mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 02:01:56 +00:00
fix
This commit is contained in:
parent
d0ad2ccc1c
commit
96b1e30092
1 changed files with 6 additions and 3 deletions
|
|
@ -13,10 +13,13 @@ import java.lang.ref.WeakReference
|
|||
import java.util.Date
|
||||
|
||||
interface NotificationsManager {
|
||||
val displayNotificationEvents: Flowable<Notification>
|
||||
var apiClient: WeakReference<ApiClient>?
|
||||
|
||||
fun setNotifications(current: List<Notification>)
|
||||
fun getNotifications(): Flowable<List<Notification>>
|
||||
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<Notification>
|
||||
override val displayNotificationEvents: Flowable<Notification>
|
||||
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())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue