Use foreground service to perform restore

This commit is contained in:
Moez Bhatti
2018-08-27 20:37:16 -04:00
parent 52d73e6d57
commit 9825c6c2ee
10 changed files with 148 additions and 14 deletions
@@ -148,13 +148,13 @@ class BackupRepositoryImpl @Inject constructor(
}
.map { files -> files.sortedByDescending { file -> file.date } }
override fun performRestore(backupFile: BackupFile) {
override fun performRestore(filePath: String) {
// If a backupFile or restore is already running, don't do anything
if (isBackupOrRestoreRunning()) return
restoreProgress.onNext(BackupRepository.Progress.Running(0, "Parsing backup"))
val file = File(backupFile.path)
val file = File(filePath)
val source = Okio.buffer(Okio.source(file))
val backup = moshi.adapter(Backup::class.java).fromJson(source)