pull/293/head
gedoor 5 years ago
parent 5848181f6f
commit 9c0f2ecd0b
  1. 6
      app/src/main/java/io/legado/app/help/storage/Restore.kt
  2. 5
      app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt

@ -22,6 +22,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.withContext
import org.jetbrains.anko.defaultSharedPreferences
import org.jetbrains.anko.toast
import java.io.File
object Restore {
@ -173,11 +174,12 @@ object Restore {
ReadBook.loadContent(resetPageOffset = false)
}
withContext(Main) {
App.INSTANCE.applyDayNight()
postEvent(EventBus.RECREATE, "true")
App.INSTANCE.toast(R.string.restore_success)
if (!BuildConfig.DEBUG) {
LauncherIconHelp.changeIcon(App.INSTANCE.getPrefString(PreferKey.launcherIcon))
}
App.INSTANCE.applyDayNight()
postEvent(EventBus.RECREATE, "true")
}
}

@ -87,7 +87,6 @@ object BackupRestoreUi {
val doc = DocumentFile.fromTreeUri(fragment.requireContext(), uri)
if (doc?.canWrite() == true) {
Restore.restore(fragment.requireContext(), backupPath)
fragment.toast(R.string.restore_success)
} else {
selectBackupFolder(fragment, restoreSelectRequestCode)
}
@ -135,8 +134,6 @@ object BackupRestoreUi {
AppConfig.backupPath = currentPath
Coroutine.async {
Restore.restore(App.INSTANCE, currentPath)
}.onSuccess {
App.INSTANCE.toast(R.string.restore_success)
}
}
selectFolderRequestCode -> {
@ -175,8 +172,6 @@ object BackupRestoreUi {
AppConfig.backupPath = uri.toString()
Coroutine.async {
Restore.restore(App.INSTANCE, uri.toString())
}.onSuccess {
App.INSTANCE.toast(R.string.restore_success)
}
}
}

Loading…
Cancel
Save