From f53e79a6f6008c1117494047a78c63f37a88e0b3 Mon Sep 17 00:00:00 2001 From: FerdyRod Date: Mon, 3 Jun 2024 12:26:20 +0200 Subject: [PATCH] show import successfully message --- app/src/main/java/org/dhis2/usescases/login/LoginViewModel.kt | 2 ++ app/src/main/res/values/strings.xml | 1 + .../test/java/org/dhis2/usescases/login/LoginViewModelTest.kt | 2 ++ 3 files changed, 5 insertions(+) diff --git a/app/src/main/java/org/dhis2/usescases/login/LoginViewModel.kt b/app/src/main/java/org/dhis2/usescases/login/LoginViewModel.kt index 1e4f1710a9..e50a123ff2 100644 --- a/app/src/main/java/org/dhis2/usescases/login/LoginViewModel.kt +++ b/app/src/main/java/org/dhis2/usescases/login/LoginViewModel.kt @@ -11,6 +11,7 @@ import io.reactivex.Observable import io.reactivex.disposables.CompositeDisposable import kotlinx.coroutines.async import kotlinx.coroutines.launch +import org.dhis2.R import org.dhis2.commons.Constants.PREFS_URLS import org.dhis2.commons.Constants.PREFS_USERS import org.dhis2.commons.Constants.USER_TEST_ANDROID @@ -584,6 +585,7 @@ class LoginViewModel( view.setUrl(it.serverUrl) view.setUser(it.username) displayManageAccount() + view.displayMessage(resourceManager.getString(R.string.importing_successful)) }, onFailure = { view.displayMessage(resourceManager.parseD2Error(it)) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 63608905d2..99bb27844c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -971,4 +971,5 @@ Database downloaded Importing database Re-open form to edit + Import successful diff --git a/app/src/test/java/org/dhis2/usescases/login/LoginViewModelTest.kt b/app/src/test/java/org/dhis2/usescases/login/LoginViewModelTest.kt index 8e2b7019bb..33dcdb70c0 100644 --- a/app/src/test/java/org/dhis2/usescases/login/LoginViewModelTest.kt +++ b/app/src/test/java/org/dhis2/usescases/login/LoginViewModelTest.kt @@ -455,6 +455,7 @@ class LoginViewModelTest { val mockedDatabase: File = mock() instantiateLoginViewModel() + whenever(resourceManager.getString(any())) doReturn "Import successful" whenever( userManager.d2.maintenanceModule().databaseImportExport() .importDatabase(mockedDatabase), @@ -470,6 +471,7 @@ class LoginViewModelTest { testingDispatcher.scheduler.advanceUntilIdle() verify(view).setUrl("serverUrl") verify(view).setUser("userName") + verify(view).displayMessage("Import successful") verify(view).onDbImportFinished(true) }