adding some crashfixes
This commit is contained in:
parent
6c9d25d16f
commit
0e07117b3a
|
@ -56,7 +56,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:5.34.21'
|
implementation 'com.simplemobiletools:commons:5.34.22'
|
||||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||||
implementation 'com.klinkerapps:android-smsmms:5.2.6'
|
implementation 'com.klinkerapps:android-smsmms:5.2.6'
|
||||||
implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a'
|
implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a'
|
||||||
|
|
|
@ -156,7 +156,12 @@ class ThreadActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupCachedMessages(callback: () -> Unit) {
|
private fun setupCachedMessages(callback: () -> Unit) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
messages = messagesDB.getThreadMessages(threadId).toMutableList() as ArrayList<Message>
|
messages = try {
|
||||||
|
messagesDB.getThreadMessages(threadId).toMutableList() as ArrayList<Message>
|
||||||
|
} catch (e: Exception) {
|
||||||
|
ArrayList()
|
||||||
|
}
|
||||||
|
|
||||||
setupParticipants()
|
setupParticipants()
|
||||||
setupAdapter()
|
setupAdapter()
|
||||||
|
|
||||||
|
@ -176,9 +181,9 @@ class ThreadActivity : SimpleActivity() {
|
||||||
private fun setupThread() {
|
private fun setupThread() {
|
||||||
val privateCursor = getMyContactsCursor()?.loadInBackground()
|
val privateCursor = getMyContactsCursor()?.loadInBackground()
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val cachedMessagesCode = messages.hashCode()
|
val cachedMessagesCode = messages.clone().hashCode()
|
||||||
messages = getMessages(threadId)
|
messages = getMessages(threadId)
|
||||||
if (messages.hashCode() == cachedMessagesCode && participants.isNotEmpty()) {
|
if (participants.isNotEmpty() && messages.hashCode() == cachedMessagesCode) {
|
||||||
return@ensureBackgroundThread
|
return@ensureBackgroundThread
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -507,8 +507,12 @@ fun Context.insertNewSMS(address: String, subject: String, body: String, date: L
|
||||||
put(Sms.SUBSCRIPTION_ID, subscriptionId)
|
put(Sms.SUBSCRIPTION_ID, subscriptionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return try {
|
||||||
val newUri = contentResolver.insert(uri, contentValues)
|
val newUri = contentResolver.insert(uri, contentValues)
|
||||||
return newUri?.lastPathSegment?.toLong() ?: 0L
|
newUri?.lastPathSegment?.toLong() ?: 0L
|
||||||
|
} catch (e: Exception) {
|
||||||
|
0L
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.deleteConversation(threadId: Long) {
|
fun Context.deleteConversation(threadId: Long) {
|
||||||
|
|
Loading…
Reference in New Issue