diff --git a/src/app/modules/onboarding/module.nim b/src/app/modules/onboarding/module.nim index e486f8191ee..34fa87f28b6 100644 --- a/src/app/modules/onboarding/module.nim +++ b/src/app/modules/onboarding/module.nim @@ -1,4 +1,5 @@ import NimQml, chronicles, json +import logging import io_interface import view, controller @@ -26,7 +27,8 @@ type SecondaryFlow* {.pure} = enum CreateProfileWithKeycardExistingSeedphrase, LoginWithSeedphrase, LoginWithSyncing, - LoginWithKeycard + LoginWithKeycard, + ActualLogin, # TODO get the real name and value for this when it's implemented on the front-end type Module*[T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface @@ -35,6 +37,7 @@ type viewVariant: QVariant controller: Controller localPairingStatus: LocalPairingStatus + currentFlow: SecondaryFlow proc newModule*[T]( delegate: T, @@ -99,7 +102,7 @@ method inputConnectionStringForBootstrapping*[T](self: Module[T], connectionStri method finishOnboardingFlow*[T](self: Module[T], flowInt: int, dataJson: string): string = try: - let flow = SecondaryFlow(flowInt) + self.currentFlow = SecondaryFlow(flowInt) let data = parseJson(dataJson) let password = data["password"].str @@ -107,7 +110,7 @@ method finishOnboardingFlow*[T](self: Module[T], flowInt: int, dataJson: string) var err = "" - case flow: + case self.currentFlow: # CREATE PROFILE FLOWS of SecondaryFlow.CreateProfileWithPassword: err = self.controller.createAccountAndLogin(password) @@ -147,7 +150,7 @@ method finishOnboardingFlow*[T](self: Module[T], flowInt: int, dataJson: string) # TODO implement keycard function discard else: - raise newException(ValueError, "Unknown flow: " & $flow) + raise newException(ValueError, "Unknown flow: " & $self.currentFlow) return err except Exception as e: @@ -158,13 +161,11 @@ proc finishAppLoading2[T](self: Module[T]) = self.delegate.appReady() # TODO get the flow to send the right metric - # let currStateObj = self.view.currentStartupStateObj() - # if not currStateObj.isNil: - # var eventType = "user-logged-in" - # if currStateObj.flowType() != FlowType.AppLogin: - # eventType = "onboarding-completed" - # singletonInstance.globalEvents.addCentralizedMetricIfEnabled(eventType, - # $(%*{"flowType": currStateObj.flowType()})) + var eventType = "user-logged-in" + if self.currentFlow != SecondaryFlow.ActualLogin: + eventType = "onboarding-completed" + singletonInstance.globalEvents.addCentralizedMetricIfEnabled(eventType, + $(%*{"flowType": repr(self.currentFlow)})) self.delegate.finishAppLoading() diff --git a/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml b/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml index c1d3b4a1105..d9aba550381 100644 --- a/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml +++ b/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml @@ -31,6 +31,7 @@ Page { readonly property alias stack: stack signal shareUsageDataRequested(bool enabled) + signal pageNavigated(string pageName) // flow: Onboarding.SecondaryFlow signal finished(int flow, var data) @@ -108,6 +109,13 @@ Page { readonly property bool backAvailable: stack.currentItem ? (stack.currentItem.backAvailableHint ?? true) : false + + + onCurrentItemChanged: { + if (!!stack.currentItem && !!stack.currentItem.pageName) { + root.pageNavigated(stack.currentItem.pageName) + } + } } // needs to be on top of the stack diff --git a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseAcks.qml b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseAcks.qml index 90a9c114a70..3ceccf03e01 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseAcks.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseAcks.qml @@ -10,6 +10,8 @@ import StatusQ.Core.Theme 0.1 OnboardingPage { id: root + pageName: "BackupSeedphraseAcks" + signal backupSeedphraseContinue() contentItem: Item { diff --git a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseIntro.qml b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseIntro.qml index 101e953e1d7..53360d64678 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseIntro.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseIntro.qml @@ -10,6 +10,8 @@ import StatusQ.Core.Theme 0.1 OnboardingPage { id: root + pageName: "BackupSeedphraseIntro" + signal backupSeedphraseRequested() contentItem: Item { diff --git a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseOutro.qml b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseOutro.qml index db59a73786b..bb7f76e41c7 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseOutro.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseOutro.qml @@ -12,6 +12,8 @@ import AppLayouts.Onboarding2.components 1.0 OnboardingPage { id: root + pageName: "BackupSeedphraseOutro" + signal backupSeedphraseRemovalConfirmed() contentItem: Item { diff --git a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseReveal.qml b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseReveal.qml index 175ffbeac20..61b4980e61f 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseReveal.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseReveal.qml @@ -15,6 +15,8 @@ OnboardingPage { required property var seedWords + pageName: "BackupSeedphraseReveal" + signal mnemonicWasShown() signal backupSeedphraseConfirmed() diff --git a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseVerify.qml b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseVerify.qml index f9485ea84fa..267c7e76bc6 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseVerify.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/BackupSeedphraseVerify.qml @@ -19,6 +19,8 @@ OnboardingPage { required property var seedWordsToVerify // [{seedWordNumber:int, seedWord:string}, ...] + pageName: "BackupSeedphraseVerify" + signal backupSeedphraseVerified() QtObject { diff --git a/ui/app/AppLayouts/Onboarding2/pages/CreateKeycardProfilePage.qml b/ui/app/AppLayouts/Onboarding2/pages/CreateKeycardProfilePage.qml index dc900da57b8..48d6214d1a9 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/CreateKeycardProfilePage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/CreateKeycardProfilePage.qml @@ -16,6 +16,8 @@ OnboardingPage { title: qsTr("Create profile on empty Keycard") + pageName: "CreateKeycardProfilePage" + signal createKeycardProfileWithNewSeedphrase() signal createKeycardProfileWithExistingSeedphrase() diff --git a/ui/app/AppLayouts/Onboarding2/pages/CreatePasswordPage.qml b/ui/app/AppLayouts/Onboarding2/pages/CreatePasswordPage.qml index 36126f73766..50a41178111 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/CreatePasswordPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/CreatePasswordPage.qml @@ -15,6 +15,8 @@ OnboardingPage { property var passwordStrengthScoreFunction: (password) => { console.error("passwordStrengthScoreFunction: IMPLEMENT ME") } + pageName: "CreatePasswordPage" + signal setPasswordRequested(string password) title: qsTr("Create profile password") diff --git a/ui/app/AppLayouts/Onboarding2/pages/CreateProfilePage.qml b/ui/app/AppLayouts/Onboarding2/pages/CreateProfilePage.qml index 7d3fffd91db..96281edb46e 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/CreateProfilePage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/CreateProfilePage.qml @@ -17,6 +17,8 @@ OnboardingPage { title: qsTr("Create profile") + pageName: "CreateProfilePage" + signal createProfileWithPasswordRequested() signal createProfileWithSeedphraseRequested() signal createProfileWithEmptyKeycardRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/EnableBiometricsPage.qml b/ui/app/AppLayouts/Onboarding2/pages/EnableBiometricsPage.qml index ab9b0672c91..bb47b7bf7cf 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/EnableBiometricsPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/EnableBiometricsPage.qml @@ -12,6 +12,8 @@ OnboardingPage { title: qsTr("Enable biometrics") + pageName: "EnableBiometricsPage" + property string subtitle: qsTr("Would you like to enable biometrics to fill in your password? You will use biometrics for signing in to Status and for signing transactions.") signal enableBiometricsRequested(bool enable) diff --git a/ui/app/AppLayouts/Onboarding2/pages/HelpUsImproveStatusPage.qml b/ui/app/AppLayouts/Onboarding2/pages/HelpUsImproveStatusPage.qml index 651178c7f0a..0c7a1cb43c6 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/HelpUsImproveStatusPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/HelpUsImproveStatusPage.qml @@ -17,6 +17,8 @@ OnboardingPage { title: qsTr("Help us improve Status") + pageName: "HelpUsImproveStatusPage" + signal shareUsageDataRequested(bool enabled) signal privacyPolicyRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardAddKeyPairPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardAddKeyPairPage.qml index 5413e0ecb81..f8e0d7e71a1 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardAddKeyPairPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardAddKeyPairPage.qml @@ -20,6 +20,8 @@ OnboardingPage { signal reloadKeycardRequested() signal createProfilePageRequested() + pageName: "KeycardAddKeyPairPage" + states: [ State { name: "inprogress" diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardBasePage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardBasePage.qml index 2ffd2b72b08..21cf63f85e5 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardBasePage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardBasePage.qml @@ -16,6 +16,8 @@ OnboardingPage { property alias infoText: infoText property alias buttons: buttonsWrapper.children + pageName: "KeycardBasePage" + contentItem: Item { ColumnLayout { anchors.centerIn: parent diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml index 028f518e73a..c5bd990744f 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml @@ -17,6 +17,8 @@ KeycardBasePage { signal keycardPinCreated(string pin) + pageName: "KeycardCreatePinPage" + image.source: Theme.png("onboarding/keycard/reading") QtObject { diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardEmptyPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardEmptyPage.qml index 67ca1affe2d..60682e7226b 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardEmptyPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardEmptyPage.qml @@ -7,6 +7,8 @@ import AppLayouts.Onboarding2.controls 1.0 KeycardBasePage { id: root + pageName: "KeycardEmptyPage" + signal createProfileWithEmptyKeycardRequested() signal reloadKeycardRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml index 601661068f5..63582eb6e22 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml @@ -19,6 +19,8 @@ KeycardBasePage { required property int remainingAttempts property bool unlockUsingSeedphrase + pageName: "KeycardEnterPinPage" + signal keycardPinEntered(string pin) signal reloadKeycardRequested() signal unlockWithSeedphraseRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardIntroPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardIntroPage.qml index 31e7d46f419..9a7b79d5d1c 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardIntroPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardIntroPage.qml @@ -19,6 +19,8 @@ KeycardBasePage { property bool displayPromoBanner property bool unlockUsingSeedphrase + pageName: "KeycardIntroPage" + signal keycardFactoryResetRequested() signal unlockWithSeedphraseRequested() signal reloadKeycardRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardNotEmptyPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardNotEmptyPage.qml index ac7762357b0..25a543f94d2 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardNotEmptyPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardNotEmptyPage.qml @@ -7,6 +7,8 @@ import AppLayouts.Onboarding2.controls 1.0 KeycardBasePage { id: root + pageName: "KeycardNotEmptyPage" + signal reloadKeycardRequested() signal loginWithThisKeycardRequested() signal keycardFactoryResetRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/LoginBySyncingPage.qml b/ui/app/AppLayouts/Onboarding2/pages/LoginBySyncingPage.qml index a6bb2677b42..ff866b429de 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/LoginBySyncingPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/LoginBySyncingPage.qml @@ -15,6 +15,8 @@ OnboardingPage { property var validateConnectionString: (stringValue) => { console.error("validateConnectionString IMPLEMENT ME"); return false } + pageName: "LoginBySyncingPage" + signal syncProceedWithConnectionString(string connectionString) title: qsTr("Log in by syncing") diff --git a/ui/app/AppLayouts/Onboarding2/pages/NewAccountLoginPage.qml b/ui/app/AppLayouts/Onboarding2/pages/NewAccountLoginPage.qml index 2e914532ebf..a40ab90fe96 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/NewAccountLoginPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/NewAccountLoginPage.qml @@ -22,6 +22,8 @@ OnboardingPage { title: qsTr("Log in") + pageName: "LoginPage" + signal loginWithSeedphraseRequested() signal loginWithSyncingRequested() signal loginWithKeycardRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/OnboardingPage.qml b/ui/app/AppLayouts/Onboarding2/pages/OnboardingPage.qml index 5a6a81f04f3..afc085c00a8 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/OnboardingPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/OnboardingPage.qml @@ -7,6 +7,8 @@ Page { signal openLink(string link) signal openLinkWithConfirmation(string link, string domain) + required property string pageName + implicitWidth: 1200 implicitHeight: 700 diff --git a/ui/app/AppLayouts/Onboarding2/pages/SeedphrasePage.qml b/ui/app/AppLayouts/Onboarding2/pages/SeedphrasePage.qml index 507be21f784..646737a0900 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/SeedphrasePage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/SeedphrasePage.qml @@ -18,6 +18,8 @@ OnboardingPage { property var isSeedPhraseValid: (mnemonic) => { console.error("isSeedPhraseValid IMPLEMENT ME"); return false } + pageName: "SeedphrasePage" + signal seedphraseSubmitted(string seedphrase) contentItem: Item { diff --git a/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml b/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml index 6afe9971b7f..a687ba3b889 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml @@ -13,6 +13,7 @@ OnboardingPage { id: root required property int syncState // Onboarding.SyncState.xxx + pageName: "SyncProgressPage" signal loginToAppRequested() signal restartSyncRequested() diff --git a/ui/app/AppLayouts/Onboarding2/pages/WelcomePage.qml b/ui/app/AppLayouts/Onboarding2/pages/WelcomePage.qml index cfe813c21a0..c871b428762 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/WelcomePage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/WelcomePage.qml @@ -16,6 +16,7 @@ OnboardingPage { id: root title: qsTr("Welcome to Status") + pageName: "WelcomePage" signal createProfileRequested() signal loginRequested() diff --git a/ui/main.qml b/ui/main.qml index 96857bdd5b7..5affe99422d 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -465,6 +465,16 @@ StatusWindow { stack.clear() stack.push(splashScreenV2, { runningProgressAnimation: true }) } + + onShareUsageDataRequested: { + applicationWindow.metricsStore.toggleCentralizedMetrics(enabled) + if (enabled) { + Global.addCentralizedMetricIfEnabled("usage_data_shared", {placement: Constants.metricsEnablePlacement.onboarding}) + } + } + onPageNavigated: (pageName) => { + Global.addCentralizedMetricIfEnabled("navigation", {viewId: pageName}) + } } }