diff --git a/src/app/modules/startup/controller.nim b/src/app/modules/startup/controller.nim index 6cd1418c65..2f66f851c6 100644 --- a/src/app/modules/startup/controller.nim +++ b/src/app/modules/startup/controller.nim @@ -242,6 +242,7 @@ proc importMnemonic*(self: Controller): bool = return false proc setupAccount(self: Controller, accountId: string, storeToKeychain: bool, keycardUsage: bool) = + self.delegate.moveToLoadingAppState() let error = self.accountsService.setupAccount(accountId, self.tmpPassword, self.tmpDisplayName, keycardUsage) if error != "": self.delegate.setupAccountError(error) @@ -276,6 +277,7 @@ proc setupKeycardAccount*(self: Controller, storeToKeychain: bool) = # if `tmpSeedPhrase` is not empty means user has recovered keycard via seed phrase self.storeKeycardAccountAndLogin(storeToKeychain) else: + self.delegate.moveToLoadingAppState() self.accountsService.setupAccountKeycard(self.tmpKeycardEvent) if storeToKeychain: singletonInstance.localAccountSettings.setStoreToKeychainValue(LS_VALUE_STORE) @@ -316,12 +318,14 @@ proc tryToObtainDataFromKeychain*(self: Controller) = self.keychainService.tryToObtainData(selectedAccount.name) proc login*(self: Controller) = + self.delegate.moveToLoadingAppState() let selectedAccount = self.getSelectedLoginAccount() let error = self.accountsService.login(selectedAccount, self.tmpPassword) if(error.len > 0): self.delegate.emitAccountLoginError(error) proc loginAccountKeycard*(self: Controller) = + self.delegate.moveToLoadingAppState() let error = self.accountsService.loginAccountKeycard(self.tmpKeycardEvent) if(error.len > 0): self.delegate.emitAccountLoginError(error) diff --git a/src/app/modules/startup/internal/login_keycard_enter_pin_state.nim b/src/app/modules/startup/internal/login_keycard_enter_pin_state.nim index 7fa44dc58a..5857bf41e8 100644 --- a/src/app/modules/startup/internal/login_keycard_enter_pin_state.nim +++ b/src/app/modules/startup/internal/login_keycard_enter_pin_state.nim @@ -26,7 +26,7 @@ method resolveKeycardNextState*(self: LoginKeycardEnterPinState, keycardFlowType keycardEvent.error.len == 0: controller.setKeycardEvent(keycardEvent) controller.loginAccountKeycard() - return + return nil if keycardFlowType == ResponseTypeValueEnterPIN and keycardEvent.error.len > 0 and keycardEvent.error == RequestParamPIN: diff --git a/src/app/modules/startup/io_interface.nim b/src/app/modules/startup/io_interface.nim index 3eff98cb22..32ae1e2bb0 100644 --- a/src/app/modules/startup/io_interface.nim +++ b/src/app/modules/startup/io_interface.nim @@ -12,6 +12,9 @@ method delete*(self: AccessInterface) {.base.} = method load*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") +method moveToLoadingAppState*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + method moveToAppState*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/startup/module.nim b/src/app/modules/startup/module.nim index 64ed97fd82..c8f2e79432 100644 --- a/src/app/modules/startup/module.nim +++ b/src/app/modules/startup/module.nim @@ -89,6 +89,9 @@ method load*[T](self: Module[T]) = self.view.setCurrentStartupState(newLoginState(FlowType.AppLogin, nil)) self.delegate.startupDidLoad() +method moveToLoadingAppState*[T](self: Module[T]) = + self.view.setAppState(AppState.AppLoadingState) + method moveToAppState*[T](self: Module[T]) = self.view.setAppState(AppState.MainAppState) diff --git a/src/app/modules/startup/view.nim b/src/app/modules/startup/view.nim index 4173f7f278..eb4d62c7cb 100644 --- a/src/app/modules/startup/view.nim +++ b/src/app/modules/startup/view.nim @@ -10,6 +10,7 @@ import models/login_account_item as login_acc_item type AppState* {.pure.} = enum StartupState = 0 + AppLoadingState MainAppState QtObject: diff --git a/ui/app/mainui/SplashScreen.qml b/ui/app/mainui/SplashScreen.qml index b15902f778..cc1813e4c0 100644 --- a/ui/app/mainui/SplashScreen.qml +++ b/ui/app/mainui/SplashScreen.qml @@ -5,25 +5,12 @@ import utils 1.0 Item { id: root - anchors.fill: parent - visible: (opacity > 0.0001) - Behavior on opacity { NumberAnimation { duration: 250 }} - - Timer { - running: true - interval: 2000 - onTriggered: { - root.opacity = 0.0; - } - } AnimatedImage { - id: splashLogo - width: 127.88 - height: 127.88 + width: 128 + height: 128 anchors.centerIn: parent - source: Style.gif("status_splash_" + (Style.current.name)) - playing: visible + source: Style.gif("status_splash_128_" + (Style.current.name)) } // NOTE: keep it if we will decide to switch on lottie diff --git a/ui/imports/assets/gif/status_splash_128_dark.gif b/ui/imports/assets/gif/status_splash_128_dark.gif new file mode 100644 index 0000000000..70a6f9dffc Binary files /dev/null and b/ui/imports/assets/gif/status_splash_128_dark.gif differ diff --git a/ui/imports/assets/gif/status_splash_128_light.gif b/ui/imports/assets/gif/status_splash_128_light.gif new file mode 100644 index 0000000000..9387b40bd1 Binary files /dev/null and b/ui/imports/assets/gif/status_splash_128_light.gif differ diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index 063961af90..2fe33261d2 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -8,7 +8,8 @@ QtObject { readonly property QtObject appState: QtObject { readonly property int startup: 0 - readonly property int main: 1 + readonly property int appLoading: 1 + readonly property int main: 2 } readonly property QtObject startupFlow: QtObject { diff --git a/ui/main.qml b/ui/main.qml index 87fe12ce8f..50f2d5eb1b 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -130,12 +130,13 @@ StatusWindow { } function onAppStateChanged(state) { - if(state === Constants.appState.main) { + if(state === Constants.appState.appLoading) { + loader.sourceComponent = appLoadingAnimation + } + else if(state === Constants.appState.main) { // We set main module to the Global singleton once user is logged in and we move to the main app. Global.mainModuleInst = mainModule loader.sourceComponent = app - startupOnboarding.unload() - startupOnboarding.visible = false if(localAccountSensitiveSettings.recentEmojis === "") { localAccountSensitiveSettings.recentEmojis = []; @@ -150,6 +151,9 @@ StatusWindow { localAccountSensitiveSettings.hiddenCommunityBackUpBanners = []; } } + + startupOnboarding.unload() + startupOnboarding.visible = false } } @@ -263,7 +267,6 @@ StatusWindow { opacity: active ? 1.0 : 0.0 visible: (opacity > 0.0001) Behavior on opacity { NumberAnimation { duration: 120 }} - active: !splashScreen.visible } Component { @@ -273,10 +276,15 @@ StatusWindow { } } + Component { + id: appLoadingAnimation + SplashScreen { + } + } + OnboardingLayout { id: startupOnboarding anchors.fill: parent - visible: !splashScreen.visible } NotificationWindow { @@ -312,10 +320,6 @@ StatusWindow { applicationWindow.toggleFullScreen() } } - - SplashScreen { - id: splashScreen - } } /*##^##