From 9d14fd60af7664d603d18cf970c83313643ba8c6 Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Tue, 13 Jun 2023 23:26:55 +0300 Subject: [PATCH] chore: Integrate DB re-encryption process due to page size changes Changes: 1. Bump status go to include DB migration 2. Integrate the new DB re-encryption signals to show the re-encryption loading screen --- src/app/core/signals/remote_signals/signal_type.nim | 2 ++ src/app/modules/startup/controller.nim | 6 +++++- src/app/modules/startup/io_interface.nim | 3 +++ src/app/modules/startup/module.nim | 3 +++ src/app/modules/startup/view.nim | 3 +++ src/app_service/service/accounts/service.nim | 4 ---- ui/main.qml | 1 + 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/core/signals/remote_signals/signal_type.nim b/src/app/core/signals/remote_signals/signal_type.nim index b0c016ca49..b3136373ca 100644 --- a/src/app/core/signals/remote_signals/signal_type.nim +++ b/src/app/core/signals/remote_signals/signal_type.nim @@ -53,6 +53,8 @@ type SignalType* {.pure.} = enum WakuBackedUpKeycards = "waku.backedup.keycards" WakuBackedUpWatchOnlyAccount = "waku.backedup.watch-only-account" LocalPairing = "localPairing" + DBReEncryptionStarted = "db.reEncryption.started" + DBReEncryptionFinished = "db.reEncryption.finished" Unknown proc event*(self:SignalType):string = diff --git a/src/app/modules/startup/controller.nim b/src/app/modules/startup/controller.nim index 23fcc81d8a..13a11d073d 100644 --- a/src/app/modules/startup/controller.nim +++ b/src/app/modules/startup/controller.nim @@ -172,10 +172,14 @@ proc init*(self: Controller) = self.delegate.onLocalPairingStatusUpdate(self.localPairingStatus) self.connectionIds.add(handlerId) - handlerId = self.events.onWithUUID(SIGNAL_REENCRYPTION_PROCESS_STARTED) do(e: Args): + handlerId = self.events.onWithUUID(SignalType.DBReEncryptionStarted.event) do(e: Args): self.delegate.onReencryptionProcessStarted() self.connectionIds.add(handlerId) + handlerId = self.events.onWithUUID(SignalType.DBReEncryptionFinished.event) do(e: Args): + self.delegate.onReencryptionProcessFinished() + self.connectionIds.add(handlerId) + handlerId = self.events.onWithUUID(SIGNAL_LOGIN_ERROR) do(e: Args): let args = LoginErrorArgs(e) self.delegate.emitAccountLoginError(args.error) diff --git a/src/app/modules/startup/io_interface.nim b/src/app/modules/startup/io_interface.nim index e331867b6f..213bdac38d 100644 --- a/src/app/modules/startup/io_interface.nim +++ b/src/app/modules/startup/io_interface.nim @@ -186,6 +186,9 @@ method onLocalPairingStatusUpdate*(self: AccessInterface, status: LocalPairingSt method onReencryptionProcessStarted*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") +method onReencryptionProcessFinished*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + # This way (using concepts) is used only for the modules managed by AppController type DelegateInterface* = concept c diff --git a/src/app/modules/startup/module.nim b/src/app/modules/startup/module.nim index d04e2b5322..e47ca13d31 100644 --- a/src/app/modules/startup/module.nim +++ b/src/app/modules/startup/module.nim @@ -531,3 +531,6 @@ method onLocalPairingStatusUpdate*[T](self: Module[T], status: LocalPairingStatu method onReencryptionProcessStarted*[T](self: Module[T]) = self.view.onReencryptionProcessStarted() + +method onReencryptionProcessFinished*[T](self: Module[T]) = + self.view.onReencryptionProcessFinished() diff --git a/src/app/modules/startup/view.nim b/src/app/modules/startup/view.nim index 03ee25141d..cf3b8d8b1a 100644 --- a/src/app/modules/startup/view.nim +++ b/src/app/modules/startup/view.nim @@ -376,3 +376,6 @@ QtObject: proc onReencryptionProcessStarted*(self: View) = self.setAppState(AppState.AppEncryptionProcessState) + + proc onReencryptionProcessFinished*(self: View) = + self.setAppState(AppState.AppLoadingState) diff --git a/src/app_service/service/accounts/service.nim b/src/app_service/service/accounts/service.nim index f5798f53f0..572bad59d1 100644 --- a/src/app_service/service/accounts/service.nim +++ b/src/app_service/service/accounts/service.nim @@ -37,7 +37,6 @@ let TEST_PEER_ENR = getEnv("TEST_PEER_ENR").string const SIGNAL_CONVERTING_PROFILE_KEYPAIR* = "convertingProfileKeypair" const SIGNAL_DERIVED_ADDRESSES_FROM_NOT_IMPORTED_MNEMONIC_FETCHED* = "derivedAddressesFromNotImportedMnemonicFetched" -const SIGNAL_REENCRYPTION_PROCESS_STARTED* = "reencryptionProcessStarted" const SIGNAL_LOGIN_ERROR* = "errorWhileLogin" type ResultArgs* = ref object of Args @@ -692,9 +691,6 @@ QtObject: let isOldHashPassword = self.verifyDatabasePassword(account.keyUid, hashedPasswordToUpperCase(hashedPassword)) if isOldHashPassword: - # Start loading screen with warning - self.events.emit(SIGNAL_REENCRYPTION_PROCESS_STARTED, Args()) - # Save tmp properties so that we can login after the timer self.tmpAccount = account self.tmpHashedPassword = hashedPassword diff --git a/ui/main.qml b/ui/main.qml index ae8c5567dc..16e867bce2 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -158,6 +158,7 @@ StatusWindow { } else if(state === Constants.appState.appLoading) { loader.sourceComponent = undefined + appLoadingAnimation.active = false appLoadingAnimation.active = true startupOnboarding.visible = false }