minor code cleanup

This commit is contained in:
Tibor Kaputa 2021-09-22 22:55:31 +02:00 committed by GitHub
parent 3cd84e42bc
commit de57cc3085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,9 @@
package com.simplemobiletools.smsmessenger.helpers package com.simplemobiletools.smsmessenger.helpers
import android.content.Context import android.content.Context
import android.net.Uri
import android.provider.Telephony.* import android.provider.Telephony.*
import android.util.Log
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.simplemobiletools.commons.extensions.queryCursor
import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.smsmessenger.extensions.* import com.simplemobiletools.smsmessenger.extensions.*
@ -44,6 +41,7 @@ class MessagesImporter(private val context: Context) {
callback.invoke(IMPORT_NOTHING_NEW) callback.invoke(IMPORT_NOTHING_NEW)
return@ensureBackgroundThread return@ensureBackgroundThread
} }
onProgress.invoke(totalMessages, messagesImported) onProgress.invoke(totalMessages, messagesImported)
for (message in messages) { for (message in messages) {
if (config.importSms) { if (config.importSms) {
@ -70,9 +68,7 @@ class MessagesImporter(private val context: Context) {
callback.invoke( callback.invoke(
when { when {
messagesImported == 0 -> { messagesImported == 0 -> IMPORT_FAIL
IMPORT_FAIL
}
messagesFailed > 0 -> IMPORT_PARTIAL messagesFailed > 0 -> IMPORT_PARTIAL
else -> IMPORT_OK else -> IMPORT_OK
} }