make unread conversations float to the top of conversation lists and widgets. satisifies https://github.com/octoshrimpy/quik/issues/41 and largely satisfies https://github.com/octoshrimpy/quik/issues/99

This commit is contained in:
gavine99
2025-01-14 18:41:24 +11:00
parent 61293ce035
commit 05b9fcceef
15 changed files with 132 additions and 25 deletions
@@ -31,7 +31,7 @@ class UpdateBadge @Inject constructor(
override fun buildObservable(params: Unit): Flowable<*> {
return Flowable.just(params)
.doOnNext { shortcutManager.updateBadge() }
.doOnNext { widgetManager.updateUnreadCount() }
.doOnNext { widgetManager.sendDatasetChanged() }
}
}
@@ -24,7 +24,7 @@ interface WidgetManager {
const val ACTION_NOTIFY_DATASET_CHANGED = "dev.octoshrimpy.quik.intent.action.ACTION_NOTIFY_DATASET_CHANGED"
}
fun updateUnreadCount()
fun sendDatasetChanged()
fun updateTheme()
@@ -27,9 +27,9 @@ import io.realm.RealmResults
interface ConversationRepository {
fun getConversations(archived: Boolean = false): RealmResults<Conversation>
fun getConversations(unreadAtTop: Boolean, archived: Boolean = false): RealmResults<Conversation>
fun getConversationsSnapshot(): List<Conversation>
fun getConversationsSnapshot(unreadAtTop: Boolean): List<Conversation>
/**
* Returns the top conversations that were active in the last week
@@ -123,6 +123,7 @@ class Preferences @Inject constructor(
val longAsMms = rxPrefs.getBoolean("longAsMms", false)
val mmsSize = rxPrefs.getInteger("mmsSize", 300)
val logging = rxPrefs.getBoolean("logging", false)
val unreadAtTop = rxPrefs.getBoolean("unreadAtTop", false)
init {
// Migrate from old night mode preference to new one, now that we support android Q night mode