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
@@ -18,16 +18,15 @@
*/
package com.moez.QKSMS.interactor
import com.moez.QKSMS.model.BackupFile
import com.moez.QKSMS.repository.BackupRepository
import io.reactivex.Flowable
import javax.inject.Inject
class PerformRestore @Inject constructor(
private val backupRepo: BackupRepository
) : Interactor<BackupFile>() {
) : Interactor<String>() {
override fun buildObservable(params: BackupFile): Flowable<*> {
override fun buildObservable(params: String): Flowable<*> {
return Flowable.just(params)
.doOnNext(backupRepo::performRestore)
}
@@ -18,6 +18,8 @@
*/
package com.moez.QKSMS.manager
import androidx.core.app.NotificationCompat
interface NotificationManager {
fun update(threadId: Long)
@@ -28,4 +30,6 @@ interface NotificationManager {
fun buildNotificationChannelId(threadId: Long): String
fun getNotificationForBackup(): NotificationCompat.Builder
}
@@ -37,7 +37,7 @@ interface BackupRepository {
*/
fun getBackups(): Observable<List<BackupFile>>
fun performRestore(backupFile: BackupFile)
fun performRestore(filePath: String)
fun getRestoreProgress(): Observable<Progress>