|
|
@ -70,7 +70,7 @@ object WebDavHelp { |
|
|
|
return names |
|
|
|
return names |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
suspend fun showRestoreDialog(context: Context, restoreSuccess: () -> Unit): Boolean { |
|
|
|
suspend fun showRestoreDialog(context: Context): Boolean { |
|
|
|
val names = withContext(IO) { getWebDavFileNames() } |
|
|
|
val names = withContext(IO) { getWebDavFileNames() } |
|
|
|
return if (names.isNotEmpty()) { |
|
|
|
return if (names.isNotEmpty()) { |
|
|
|
withContext(Main) { |
|
|
|
withContext(Main) { |
|
|
@ -79,7 +79,7 @@ object WebDavHelp { |
|
|
|
items = names |
|
|
|
items = names |
|
|
|
) { _, index -> |
|
|
|
) { _, index -> |
|
|
|
if (index in 0 until names.size) { |
|
|
|
if (index in 0 until names.size) { |
|
|
|
restoreWebDav(names[index], restoreSuccess) |
|
|
|
restoreWebDav(names[index]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -89,7 +89,7 @@ object WebDavHelp { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun restoreWebDav(name: String, success: () -> Unit) { |
|
|
|
private fun restoreWebDav(name: String) { |
|
|
|
Coroutine.async { |
|
|
|
Coroutine.async { |
|
|
|
rootWebDavUrl.let { |
|
|
|
rootWebDavUrl.let { |
|
|
|
if (name == SyncBookProgress.fileName) { |
|
|
|
if (name == SyncBookProgress.fileName) { |
|
|
@ -103,8 +103,6 @@ object WebDavHelp { |
|
|
|
Restore.restoreConfig() |
|
|
|
Restore.restoreConfig() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}.onSuccess { |
|
|
|
|
|
|
|
success.invoke() |
|
|
|
|
|
|
|
}.onError { |
|
|
|
}.onError { |
|
|
|
App.INSTANCE.toast("WebDavError:${it.localizedMessage}") |
|
|
|
App.INSTANCE.toast("WebDavError:${it.localizedMessage}") |
|
|
|
} |
|
|
|
} |
|
|
|