improve notification dismiss
This commit is contained in:
parent
659473a528
commit
370b504d74
2 changed files with 7 additions and 8 deletions
|
@ -77,14 +77,14 @@ class OverviewPlugin @Inject constructor(
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({ n ->
|
.subscribe({ n ->
|
||||||
if (notificationStore.add(n.notification))
|
if (notificationStore.add(n.notification))
|
||||||
rxBus.send(EventUpdateOverviewNotification("EventNewNotification"))
|
overviewBus.send(EventUpdateOverviewNotification("EventNewNotification"))
|
||||||
}, fabricPrivacy::logException)
|
}, fabricPrivacy::logException)
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventDismissNotification::class.java)
|
.toObservable(EventDismissNotification::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({ n ->
|
.subscribe({ n ->
|
||||||
if (notificationStore.remove(n.id))
|
if (notificationStore.remove(n.id))
|
||||||
rxBus.send(EventUpdateOverviewNotification("EventDismissNotification"))
|
overviewBus.send(EventUpdateOverviewNotification("EventDismissNotification"))
|
||||||
}, fabricPrivacy::logException)
|
}, fabricPrivacy::logException)
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventIobCalculationProgress::class.java)
|
.toObservable(EventIobCalculationProgress::class.java)
|
||||||
|
|
|
@ -14,13 +14,12 @@ import androidx.core.app.NotificationCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.databinding.OverviewNotificationItemBinding
|
import info.nightscout.androidaps.databinding.OverviewNotificationItemBinding
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.IconsProvider
|
import info.nightscout.androidaps.interfaces.IconsProvider
|
||||||
import info.nightscout.androidaps.interfaces.NotificationHolder
|
import info.nightscout.androidaps.interfaces.NotificationHolder
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
|
||||||
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
@ -33,13 +32,13 @@ import javax.inject.Singleton
|
||||||
class NotificationStore @Inject constructor(
|
class NotificationStore @Inject constructor(
|
||||||
private val aapsLogger: AAPSLogger,
|
private val aapsLogger: AAPSLogger,
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val rxBus: RxBus,
|
|
||||||
private val rh: ResourceHelper,
|
private val rh: ResourceHelper,
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val iconsProvider: IconsProvider,
|
private val iconsProvider: IconsProvider,
|
||||||
private val alarmSoundServiceHelper: AlarmSoundServiceHelper,
|
private val alarmSoundServiceHelper: AlarmSoundServiceHelper,
|
||||||
private val dateUtil: DateUtil,
|
private val dateUtil: DateUtil,
|
||||||
private val notificationHolder: NotificationHolder
|
private val notificationHolder: NotificationHolder,
|
||||||
|
private val activePlugin: ActivePlugin
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var store: MutableList<Notification> = ArrayList()
|
private var store: MutableList<Notification> = ArrayList()
|
||||||
|
@ -186,7 +185,7 @@ class NotificationStore @Inject constructor(
|
||||||
val notification = it.tag as Notification
|
val notification = it.tag as Notification
|
||||||
notification.contextForAction = itemView.context
|
notification.contextForAction = itemView.context
|
||||||
notification.action?.run()
|
notification.action?.run()
|
||||||
if (remove(notification.id)) rxBus.send(EventRefreshOverview("NotificationCleared"))
|
if (remove(notification.id)) activePlugin.activeOverview.overviewBus.send(EventUpdateOverviewNotification("NotificationCleared"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue