forked from upstream-mirrors/quik
#848 - App shortcuts support
This commit is contained in:
@@ -21,14 +21,11 @@ package com.moez.QKSMS.manager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.klinker.android.send_message.BroadcastUtils
|
||||
import me.leolin.shortcutbadger.ShortcutBadger
|
||||
import javax.inject.Inject
|
||||
|
||||
class WidgetManagerImpl @Inject constructor(private val context: Context) : WidgetManager {
|
||||
|
||||
override fun updateUnreadCount(count: Int) {
|
||||
ShortcutBadger.applyCount(context, count)
|
||||
|
||||
override fun updateUnreadCount() {
|
||||
BroadcastUtils.sendExplicitBroadcast(context, Intent(), WidgetManager.ACTION_NOTIFY_DATASET_CHANGED)
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import io.realm.Case
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmResults
|
||||
import io.realm.Sort
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
class ConversationRepositoryImpl @Inject constructor(
|
||||
@@ -70,6 +71,19 @@ class ConversationRepositoryImpl @Inject constructor(
|
||||
.findAll())
|
||||
}
|
||||
|
||||
override fun getTopConversations(): List<Conversation> {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
return realm.copyFromRealm(realm.where(Conversation::class.java)
|
||||
.notEqualTo("id", 0L)
|
||||
.greaterThan("count", 0)
|
||||
.greaterThan("date", System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7))
|
||||
.equalTo("archived", false)
|
||||
.equalTo("blocked", false)
|
||||
.isNotEmpty("recipients")
|
||||
.sort("pinned", Sort.DESCENDING, "count", Sort.DESCENDING)
|
||||
.findAll())
|
||||
}
|
||||
|
||||
override fun setConversationName(id: Long, name: String) {
|
||||
Realm.getDefaultInstance().use { realm ->
|
||||
realm.executeTransaction {
|
||||
|
||||
Reference in New Issue
Block a user