Loading domain/src/main/java/com/moez/QKSMS/interactor/MarkPinned.kt +9 −2 Original line number Diff line number Diff line Loading @@ -18,15 +18,22 @@ */ package com.moez.QKSMS.interactor import com.moez.QKSMS.manager.ShortcutManager import com.moez.QKSMS.repository.ConversationRepository import io.reactivex.Flowable import javax.inject.Inject class MarkPinned @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() { class MarkPinned @Inject constructor( private val conversationRepo: ConversationRepository, private val updateBadge: UpdateBadge, private val shortcutManager: ShortcutManager ) : Interactor<List<Long>>() { override fun buildObservable(params: List<Long>): Flowable<*> { return Flowable.just(params.toLongArray()) .doOnNext { threadIds -> conversationRepo.markPinned(*threadIds) } .doOnNext { shortcutManager.updateShortcuts() } // Update shortcuts .flatMap { updateBadge.buildObservable(Unit) } // Update the badge and widget } } domain/src/main/java/com/moez/QKSMS/interactor/MarkUnpinned.kt +9 −2 Original line number Diff line number Diff line Loading @@ -18,15 +18,22 @@ */ package com.moez.QKSMS.interactor import com.moez.QKSMS.manager.ShortcutManager import com.moez.QKSMS.repository.ConversationRepository import io.reactivex.Flowable import javax.inject.Inject class MarkUnpinned @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() { class MarkUnpinned @Inject constructor( private val conversationRepo: ConversationRepository, private val updateBadge: UpdateBadge, private val shortcutManager: ShortcutManager ) : Interactor<List<Long>>() { override fun buildObservable(params: List<Long>): Flowable<*> { return Flowable.just(params.toLongArray()) .doOnNext { threadIds -> conversationRepo.markUnpinned(*threadIds) } .doOnNext { shortcutManager.updateShortcuts() } // Update shortcuts .flatMap { updateBadge.buildObservable(Unit) } // Update the badge and widget } } domain/src/main/java/com/moez/QKSMS/interactor/ReceiveSms.kt +2 −2 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ class ReceiveSms @Inject constructor( .map { conversation -> conversation.id } // Map to the id because [delay] will put us on the wrong thread .doOnNext { threadId -> notificationManager.update(threadId) } // Update the notification .doOnNext { shortcutManager.updateShortcuts() } // Update shortcuts .flatMap { updateBadge.buildObservable(Unit) } // Update the badge .flatMap { updateBadge.buildObservable(Unit) } // Update the badge and widget } } Loading
domain/src/main/java/com/moez/QKSMS/interactor/MarkPinned.kt +9 −2 Original line number Diff line number Diff line Loading @@ -18,15 +18,22 @@ */ package com.moez.QKSMS.interactor import com.moez.QKSMS.manager.ShortcutManager import com.moez.QKSMS.repository.ConversationRepository import io.reactivex.Flowable import javax.inject.Inject class MarkPinned @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() { class MarkPinned @Inject constructor( private val conversationRepo: ConversationRepository, private val updateBadge: UpdateBadge, private val shortcutManager: ShortcutManager ) : Interactor<List<Long>>() { override fun buildObservable(params: List<Long>): Flowable<*> { return Flowable.just(params.toLongArray()) .doOnNext { threadIds -> conversationRepo.markPinned(*threadIds) } .doOnNext { shortcutManager.updateShortcuts() } // Update shortcuts .flatMap { updateBadge.buildObservable(Unit) } // Update the badge and widget } }
domain/src/main/java/com/moez/QKSMS/interactor/MarkUnpinned.kt +9 −2 Original line number Diff line number Diff line Loading @@ -18,15 +18,22 @@ */ package com.moez.QKSMS.interactor import com.moez.QKSMS.manager.ShortcutManager import com.moez.QKSMS.repository.ConversationRepository import io.reactivex.Flowable import javax.inject.Inject class MarkUnpinned @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() { class MarkUnpinned @Inject constructor( private val conversationRepo: ConversationRepository, private val updateBadge: UpdateBadge, private val shortcutManager: ShortcutManager ) : Interactor<List<Long>>() { override fun buildObservable(params: List<Long>): Flowable<*> { return Flowable.just(params.toLongArray()) .doOnNext { threadIds -> conversationRepo.markUnpinned(*threadIds) } .doOnNext { shortcutManager.updateShortcuts() } // Update shortcuts .flatMap { updateBadge.buildObservable(Unit) } // Update the badge and widget } }
domain/src/main/java/com/moez/QKSMS/interactor/ReceiveSms.kt +2 −2 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ class ReceiveSms @Inject constructor( .map { conversation -> conversation.id } // Map to the id because [delay] will put us on the wrong thread .doOnNext { threadId -> notificationManager.update(threadId) } // Update the notification .doOnNext { shortcutManager.updateShortcuts() } // Update shortcuts .flatMap { updateBadge.buildObservable(Unit) } // Update the badge .flatMap { updateBadge.buildObservable(Unit) } // Update the badge and widget } }