#1079 - Can't send or receive new messages on HTC and Huawei devices

This commit is contained in:
Moez Bhatti
2018-06-19 03:12:44 -04:00
parent 9344882295
commit 52c99faed1
3 changed files with 33 additions and 10 deletions
@@ -103,6 +103,23 @@ class ConversationRepositoryImpl @Inject constructor(
.findFirst()
}
override fun getThreadId(recipient: String): Long? {
return getThreadId(listOf(recipient))
}
override fun getThreadId(recipients: Collection<String>): Long? {
return Realm.getDefaultInstance().use { realm ->
realm.where(Conversation::class.java)
.findAll()
.firstOrNull { conversation ->
conversation.recipients.size == recipients.size && conversation.recipients.map { it.address }.all { address ->
recipients.any { recipient -> PhoneNumberUtils.compare(recipient, address) }
}
}
?.id
}
}
override fun getOrCreateConversation(threadId: Long): Conversation? {
return getConversation(threadId) ?: getConversationFromCp(threadId)
}