chore(@desktop/onboarding): splash screen used as app loading animation

Fixes #5753
This commit is contained in:
Sale Djenic 2022-08-01 16:39:05 +02:00 committed by saledjenic
parent db44bc25d3
commit 70a1381e86
10 changed files with 30 additions and 27 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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")

View File

@ -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)

View File

@ -10,6 +10,7 @@ import models/login_account_item as login_acc_item
type
AppState* {.pure.} = enum
StartupState = 0
AppLoadingState
MainAppState
QtObject:

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -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 {

View File

@ -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
}
}
/*##^##