mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 13:48:52 +01:00
Refresh realm before updating badge count
This commit is contained in:
@@ -91,12 +91,14 @@ class MessageRepositoryImpl @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getUnreadCount(): Long {
|
override fun getUnreadCount(): Long {
|
||||||
return Realm.getDefaultInstance()
|
return Realm.getDefaultInstance().use { realm ->
|
||||||
.where(Conversation::class.java)
|
realm.refresh()
|
||||||
.equalTo("archived", false)
|
realm.where(Conversation::class.java)
|
||||||
.equalTo("blocked", false)
|
.equalTo("archived", false)
|
||||||
.equalTo("read", false)
|
.equalTo("blocked", false)
|
||||||
.count()
|
.equalTo("read", false)
|
||||||
|
.count()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPart(id: Long): MmsPart? {
|
override fun getPart(id: Long): MmsPart? {
|
||||||
@@ -351,13 +353,13 @@ class MessageRepositoryImpl @Inject constructor(
|
|||||||
|
|
||||||
// Insert the message to the native content provider
|
// Insert the message to the native content provider
|
||||||
val values = contentValuesOf(
|
val values = contentValuesOf(
|
||||||
Telephony.Sms.ADDRESS to address,
|
Telephony.Sms.ADDRESS to address,
|
||||||
Telephony.Sms.BODY to body,
|
Telephony.Sms.BODY to body,
|
||||||
Telephony.Sms.DATE to System.currentTimeMillis(),
|
Telephony.Sms.DATE to System.currentTimeMillis(),
|
||||||
Telephony.Sms.READ to true,
|
Telephony.Sms.READ to true,
|
||||||
Telephony.Sms.SEEN to true,
|
Telephony.Sms.SEEN to true,
|
||||||
Telephony.Sms.TYPE to Telephony.Sms.MESSAGE_TYPE_OUTBOX,
|
Telephony.Sms.TYPE to Telephony.Sms.MESSAGE_TYPE_OUTBOX,
|
||||||
Telephony.Sms.THREAD_ID to threadId
|
Telephony.Sms.THREAD_ID to threadId
|
||||||
)
|
)
|
||||||
|
|
||||||
if (prefs.canUseSubId.get()) {
|
if (prefs.canUseSubId.get()) {
|
||||||
@@ -406,9 +408,9 @@ class MessageRepositoryImpl @Inject constructor(
|
|||||||
|
|
||||||
// Insert the message to the native content provider
|
// Insert the message to the native content provider
|
||||||
val values = contentValuesOf(
|
val values = contentValuesOf(
|
||||||
Telephony.Sms.ADDRESS to address,
|
Telephony.Sms.ADDRESS to address,
|
||||||
Telephony.Sms.BODY to body,
|
Telephony.Sms.BODY to body,
|
||||||
Telephony.Sms.DATE_SENT to sentTime
|
Telephony.Sms.DATE_SENT to sentTime
|
||||||
)
|
)
|
||||||
|
|
||||||
if (prefs.canUseSubId.get()) {
|
if (prefs.canUseSubId.get()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user