Skip to content

Commit

Permalink
show import successfully message (#3663)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdyrod authored Jun 6, 2024
1 parent 3907c5d commit 46f31c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/org/dhis2/usescases/login/LoginViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -971,4 +971,5 @@
<string name="database_export_downloaded">Database downloaded</string>
<string name="importing_database">Importing database</string>
<string name="re_open_to_edit">Re-open form to edit</string>
<string name="importing_successful">Import successful</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
}

Expand Down

0 comments on commit 46f31c3

Please sign in to comment.