From 425459fe791e3044f2174c08a67eb3c61b6bb5f9 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 4 Sep 2020 13:36:32 -0300 Subject: [PATCH] When restoring, set token from RestoreSet as new token --- .../com/stevesoltys/seedvault/restore/RestoreViewModel.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt index 9ca7e645..6a2f3732 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt @@ -166,6 +166,12 @@ internal class RestoreViewModel( private suspend fun startRestore(token: Long) { Log.d(TAG, "Starting new restore session to restore backup $token") + // if we had no token before (i.e. restore from setup wizard), + // use the token of the current restore set from now on + if (settingsManager.getToken() == null) { + settingsManager.setNewToken(token) + } + // we need to start a new session and retrieve the restore sets before starting the restore val restoreSetResult = getAvailableRestoreSets() if (restoreSetResult.hasError()) {