diff --git a/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupActivity.kt b/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupActivity.kt index 23ccdfb2..ae6426e9 100644 --- a/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupActivity.kt +++ b/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupActivity.kt @@ -43,7 +43,7 @@ class ImportBackupActivity : BaseActivityPresenter( } } - override fun showResultToast(text: String) = toastLong(text) + override fun showResultToast(text: Int) = toastLong(text) override fun toolbarBackClicks() = viewBinding.toolbar.navigationClicksThrottled() @@ -71,11 +71,11 @@ class ImportBackupActivity : BaseActivityPresenter( } } - override fun showError(msg: String) { + override fun showError(msg: Int) { viewBinding.progress.makeGone() viewBinding.content.makeGone() viewBinding.error.makeVisible() - viewBinding.descriptionError.text = msg + viewBinding.descriptionError.text = getString(msg) } override fun showProgress() { diff --git a/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupContract.kt b/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupContract.kt index a1e3d08f..a9c49b77 100644 --- a/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupContract.kt +++ b/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupContract.kt @@ -1,7 +1,6 @@ package com.twofasapp.features.backup.import import android.net.Uri -import com.twofasapp.base.BasePresenter import io.reactivex.Flowable interface ImportBackupContract { @@ -13,9 +12,9 @@ interface ImportBackupContract { fun cancelErrorClicks(): Flowable fun chooseAnotherFileClicks(): Flowable fun showFilePicker() - fun showResultToast(text: String) + fun showResultToast(text: Int) fun showContent(numberOfServices: Int, isPasswordProtected: Boolean) - fun showError(msg: String) + fun showError(msg: Int) fun showProgress() fun showPasswordDialog(onConfirmed: (String) -> Unit) fun showWrongPasswordDialog(onConfirmed: (String) -> Unit) diff --git a/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupPresenter.kt b/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupPresenter.kt index a626166c..29c0322a 100644 --- a/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupPresenter.kt +++ b/app/src/main/java/com/twofasapp/features/backup/import/ImportBackupPresenter.kt @@ -1,8 +1,8 @@ package com.twofasapp.features.backup.import import android.net.Uri -import com.twofasapp.backup.domain.SyncBackupWorkDispatcher import com.twofasapp.backup.domain.SyncBackupTrigger +import com.twofasapp.backup.domain.SyncBackupWorkDispatcher import com.twofasapp.prefs.ScopedNavigator import com.twofasapp.services.domain.ShowBackupNotice @@ -72,7 +72,7 @@ class ImportBackupPresenter( ImportBackup.Result.Success -> { showBackupNotice.save(false) syncBackupDispatcher.dispatch(SyncBackupTrigger.FIRST_CONNECT) - view.showResultToast("Services successfully imported!") + view.showResultToast(com.twofasapp.resources.R.string.import_ga_success) if (isFromDeeplink) { navigator.openMain() @@ -80,13 +80,15 @@ class ImportBackupPresenter( navigator.finishResultOk() } } + ImportBackup.Result.WrongPasswordError -> { view.showContent(content?.numberOfServices ?: 0, password.isNullOrBlank().not()) view.showWrongPasswordDialog { newPass -> import(password = newPass) } } + ImportBackup.Result.UnknownError -> { view.showContent(content?.numberOfServices ?: 0, password.isNullOrBlank().not()) - view.showResultToast("Unknown error occurred! Try again!") + view.showResultToast(com.twofasapp.resources.R.string.commons__unknown_error) } } }, @@ -100,8 +102,8 @@ class ImportBackupPresenter( private fun handleError(exception: Throwable) { val msg = when (exception) { - is FileTooBigException -> "The file you are trying to import is too big. Size limit is 10 MB." - else -> "The file you are trying to import is invalid or damaged. Please choose another file." + is FileTooBigException -> com.twofasapp.resources.R.string.backup__import_error_file_size + else -> com.twofasapp.resources.R.string.backup__import_error_file_invalid } view.showError(msg) } diff --git a/core/locale/src/main/res/values-de/strings.xml b/core/locale/src/main/res/values-de/strings.xml index 08d9d7ca..4edc3170 100644 --- a/core/locale/src/main/res/values-de/strings.xml +++ b/core/locale/src/main/res/values-de/strings.xml @@ -5,7 +5,7 @@ Release: Working copy Locale: de-DE, German (Germany) Exported by: rafakob - Exported at: Thu, 16 Feb 2023 09:40:23 -0800 + Exported at: Tue, 21 Feb 2023 02:46:51 -0800 -->