diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/NotificationsManager.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/NotificationsManager.kt index ef3bb182f..6ff46e85d 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/NotificationsManager.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/NotificationsManager.kt @@ -13,10 +13,13 @@ import java.lang.ref.WeakReference import java.util.Date interface NotificationsManager { + val displayNotificationEvents: Flowable var apiClient: WeakReference? fun setNotifications(current: List) fun getNotifications(): Flowable> + fun getNotification(id: String): Notification? + fun dismissTaskNotification(context: Context, task: Task) } class MainNotificationsManager: NotificationsManager { @@ -28,7 +31,7 @@ class MainNotificationsManager: NotificationsManager { private var lastNotificationHandling: Date? = null - val displayNotificationEvents: Flowable + override val displayNotificationEvents: Flowable get() { return displayNotificationSubject.toFlowable(BackpressureStrategy.DROP) } @@ -48,11 +51,11 @@ class MainNotificationsManager: NotificationsManager { .toFlowable(BackpressureStrategy.LATEST) } - fun getNotification(id: String): Notification? { + override fun getNotification(id: String): Notification? { return this.notifications.value?.find { it.id == id } } - fun dismissTaskNotification(context: Context, task: Task) { + override fun dismissTaskNotification(context: Context, task: Task) { NotificationManagerCompat.from(context).cancel(task.id.hashCode()) }