Fix last update sensor intent not retrieving value (#3825)

* Fix last update sensor intent not retrieving value

* Suppress deprecation

* Move suppression
This commit is contained in:
Daniel Shokouhi 2023-08-28 14:44:10 -07:00 committed by GitHub
parent bb58a578dd
commit 3cc7bdca08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,15 +109,14 @@ abstract class SensorReceiverBase : BroadcastReceiver() {
return
}
@Suppress("DEPRECATION")
if (isSensorEnabled(LastUpdateManager.lastUpdate.id)) {
LastUpdateManager().sendLastUpdate(context, intent.action)
val allSettings = sensorDao.getSettings(LastUpdateManager.lastUpdate.id)
for (setting in allSettings) {
if (setting.value != "" && intent.action == setting.value) {
val eventData = intent.extras?.keySet()
?.associate {
it.toString() to (intent.extras?.getString(it) ?: "")
}
?.associate { it.toString() to intent.extras?.get(it).toString() }
?.plus("intent" to intent.action.toString())
?: mapOf("intent" to intent.action.toString())
Log.d(tag, "Event data: $eventData")