Loading data/src/main/java/com/moez/QKSMS/repository/BackupRepositoryImpl.kt +11 −1 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ class BackupRepositoryImpl @Inject constructor( } val messageCount = backup?.messages?.size ?: 0 var errorCount = 0 backup?.messages?.forEachIndexed { index, message -> if (stopFlag) { Loading @@ -187,6 +188,7 @@ class BackupRepositoryImpl @Inject constructor( // Update the progress restoreProgress.onNext(BackupRepository.Progress.Running(messageCount, index)) try { context.contentResolver.insert(Telephony.Sms.CONTENT_URI, contentValuesOf( Telephony.Sms.TYPE to message.type, Telephony.Sms.ADDRESS to message.address, Loading @@ -200,6 +202,14 @@ class BackupRepositoryImpl @Inject constructor( Telephony.Sms.SERVICE_CENTER to message.serviceCenter, Telephony.Sms.LOCKED to message.locked, Telephony.Sms.SUBSCRIPTION_ID to message.subId)) } catch (e: Exception) { Timber.w(e) errorCount++ } } if (errorCount > 0) { Timber.w(Exception("Failed to backup $errorCount/$messageCount messages")) } // Sync the messages Loading Loading
data/src/main/java/com/moez/QKSMS/repository/BackupRepositoryImpl.kt +11 −1 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ class BackupRepositoryImpl @Inject constructor( } val messageCount = backup?.messages?.size ?: 0 var errorCount = 0 backup?.messages?.forEachIndexed { index, message -> if (stopFlag) { Loading @@ -187,6 +188,7 @@ class BackupRepositoryImpl @Inject constructor( // Update the progress restoreProgress.onNext(BackupRepository.Progress.Running(messageCount, index)) try { context.contentResolver.insert(Telephony.Sms.CONTENT_URI, contentValuesOf( Telephony.Sms.TYPE to message.type, Telephony.Sms.ADDRESS to message.address, Loading @@ -200,6 +202,14 @@ class BackupRepositoryImpl @Inject constructor( Telephony.Sms.SERVICE_CENTER to message.serviceCenter, Telephony.Sms.LOCKED to message.locked, Telephony.Sms.SUBSCRIPTION_ID to message.subId)) } catch (e: Exception) { Timber.w(e) errorCount++ } } if (errorCount > 0) { Timber.w(Exception("Failed to backup $errorCount/$messageCount messages")) } // Sync the messages Loading