mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Update badge and shortcuts after pinning
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user