mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-27 22:34:51 +00:00
android, desktop: show alert when import database is failed or succeeded (#5402)
This commit is contained in:
+4
-3
@@ -60,8 +60,7 @@ fun DatabaseView() {
|
||||
if (to != null) {
|
||||
importArchiveAlert {
|
||||
stopChatRunBlockStartChat(stopped, chatLastStart, progressIndicator) {
|
||||
importArchive(to, appFilesCountAndSize, progressIndicator)
|
||||
true
|
||||
importArchive(to, appFilesCountAndSize, progressIndicator, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -645,6 +644,7 @@ suspend fun importArchive(
|
||||
importedArchiveURI: URI,
|
||||
appFilesCountAndSize: MutableState<Pair<Int, Long>>,
|
||||
progressIndicator: MutableState<Boolean>,
|
||||
migration: Boolean
|
||||
): Boolean {
|
||||
val m = chatModel
|
||||
progressIndicator.value = true
|
||||
@@ -666,12 +666,13 @@ suspend fun importArchive(
|
||||
if (chatModel.localUserCreated.value == false) {
|
||||
chatModel.chatRunning.value = false
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
operationEnded(m, progressIndicator) {
|
||||
showArchiveImportedWithErrorsAlert(archiveErrors)
|
||||
}
|
||||
return migration
|
||||
}
|
||||
return true
|
||||
} catch (e: Error) {
|
||||
operationEnded(m, progressIndicator) {
|
||||
AlertManager.shared.showAlertMsg(generalGetString(MR.strings.error_importing_database), e.toString())
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ private fun ArchiveImportView(progressIndicator: MutableState<Boolean>, close: (
|
||||
val importArchiveLauncher = rememberFileChooserLauncher(true) { to: URI? ->
|
||||
if (to != null) {
|
||||
withLongRunningApi {
|
||||
val success = importArchive(to, mutableStateOf(0 to 0), progressIndicator)
|
||||
val success = importArchive(to, mutableStateOf(0 to 0), progressIndicator, true)
|
||||
if (success) {
|
||||
startChat(
|
||||
chatModel,
|
||||
|
||||
Reference in New Issue
Block a user