2022-07-20 12:34:44 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
|
2023-01-26 11:52:01 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2022-03-03 22:50:53 +00:00
|
|
|
import utils 1.0
|
2022-08-05 13:50:54 +00:00
|
|
|
import shared.popups.keycard 1.0
|
2024-07-15 13:34:40 +00:00
|
|
|
import shared.stores 1.0
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
import "controls"
|
2022-03-03 22:50:53 +00:00
|
|
|
import "views"
|
|
|
|
import "stores"
|
2023-03-14 02:52:16 +00:00
|
|
|
import "../Profile/stores"
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
OnboardingBasePage {
|
2022-03-03 22:50:53 +00:00
|
|
|
id: root
|
2022-03-07 22:59:38 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property StartupStore startupStore: StartupStore {}
|
2024-10-21 22:01:34 +00:00
|
|
|
property UtilsStore utilsStore
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-12-13 10:45:26 +00:00
|
|
|
backButtonVisible: root.startupStore.currentStartupState ? root.startupStore.currentStartupState.displayBackButton
|
|
|
|
: false
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
onBackClicked: {
|
|
|
|
root.startupStore.backAction()
|
|
|
|
}
|
2022-05-20 17:14:39 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
function unload() {
|
|
|
|
loader.sourceComponent = undefined
|
|
|
|
}
|
2022-05-20 17:14:39 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
anchors.fill: parent
|
|
|
|
sourceComponent: {
|
2022-11-30 09:25:47 +00:00
|
|
|
switch (root.startupStore.currentStartupState.stateType) {
|
|
|
|
case Constants.startupState.allowNotifications:
|
2022-07-20 12:34:44 +00:00
|
|
|
return allowNotificationsViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.welcome:
|
2022-07-20 12:34:44 +00:00
|
|
|
return welcomeViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.welcomeNewStatusUser:
|
|
|
|
case Constants.startupState.welcomeOldStatusUser:
|
2023-01-16 09:45:33 +00:00
|
|
|
case Constants.startupState.recoverOldUser:
|
2022-11-30 09:25:47 +00:00
|
|
|
case Constants.startupState.userProfileImportSeedPhrase:
|
|
|
|
case Constants.startupState.profileFetchingAnnouncement:
|
|
|
|
case Constants.startupState.userProfileCreateSameChatKey:
|
2023-01-18 11:53:38 +00:00
|
|
|
case Constants.startupState.lostKeycardOptions:
|
2022-07-20 12:34:44 +00:00
|
|
|
return keysMainViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileCreate:
|
2022-07-20 12:34:44 +00:00
|
|
|
return insertDetailsViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
2024-04-24 16:31:22 +00:00
|
|
|
case Constants.startupState.userProfileChatKey:
|
|
|
|
return profileChatKeyViewComponent
|
|
|
|
|
2022-11-30 09:25:47 +00:00
|
|
|
case Constants.startupState.userProfileCreatePassword:
|
2022-07-20 12:34:44 +00:00
|
|
|
return createPasswordViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileConfirmPassword:
|
2022-07-20 12:34:44 +00:00
|
|
|
return confirmPasswordViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.biometrics:
|
2022-07-20 12:34:44 +00:00
|
|
|
return touchIdAuthViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileEnterSeedPhrase:
|
2022-07-20 12:34:44 +00:00
|
|
|
return seedPhraseInputViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.login:
|
2023-03-03 10:24:50 +00:00
|
|
|
case Constants.startupState.loginNoPCSCService:
|
2022-11-30 09:25:47 +00:00
|
|
|
case Constants.startupState.loginPlugin:
|
|
|
|
case Constants.startupState.loginKeycardInsertKeycard:
|
|
|
|
case Constants.startupState.loginKeycardInsertedKeycard:
|
|
|
|
case Constants.startupState.loginKeycardReadingKeycard:
|
|
|
|
case Constants.startupState.loginKeycardRecognizedKeycard:
|
|
|
|
case Constants.startupState.loginKeycardEnterPin:
|
|
|
|
case Constants.startupState.loginKeycardEnterPassword:
|
|
|
|
case Constants.startupState.loginKeycardPinVerified:
|
|
|
|
case Constants.startupState.loginKeycardWrongKeycard:
|
|
|
|
case Constants.startupState.loginKeycardWrongPin:
|
|
|
|
case Constants.startupState.loginKeycardMaxPinRetriesReached:
|
|
|
|
case Constants.startupState.loginKeycardMaxPukRetriesReached:
|
|
|
|
case Constants.startupState.loginKeycardMaxPairingSlotsReached:
|
|
|
|
case Constants.startupState.loginKeycardEmpty:
|
|
|
|
case Constants.startupState.loginNotKeycard:
|
2023-01-26 11:52:01 +00:00
|
|
|
case Constants.startupState.loginKeycardConvertedToRegularAccount:
|
2022-07-20 12:34:44 +00:00
|
|
|
return loginViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardPluginReader:
|
|
|
|
case Constants.startupState.keycardInsertKeycard:
|
|
|
|
case Constants.startupState.keycardInsertedKeycard:
|
|
|
|
case Constants.startupState.keycardReadingKeycard:
|
|
|
|
case Constants.startupState.keycardRecognizedKeycard:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardInitViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardCreatePin:
|
|
|
|
case Constants.startupState.keycardRepeatPin:
|
|
|
|
case Constants.startupState.keycardPinSet:
|
|
|
|
case Constants.startupState.keycardEnterPin:
|
|
|
|
case Constants.startupState.keycardWrongPin:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardPinViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardDisplaySeedPhrase:
|
2022-07-21 11:29:18 +00:00
|
|
|
return seedphraseViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardEnterSeedPhraseWords:
|
2022-07-21 11:29:18 +00:00
|
|
|
return seedphraseWordsInputViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
2023-03-03 10:24:50 +00:00
|
|
|
case Constants.startupState.keycardNoPCSCService:
|
2022-11-30 09:25:47 +00:00
|
|
|
case Constants.startupState.keycardNotEmpty:
|
|
|
|
case Constants.startupState.keycardNotKeycard:
|
|
|
|
case Constants.startupState.keycardEmpty:
|
|
|
|
case Constants.startupState.keycardWrongKeycard:
|
|
|
|
case Constants.startupState.keycardLocked:
|
|
|
|
case Constants.startupState.keycardRecover:
|
|
|
|
case Constants.startupState.keycardMaxPairingSlotsReached:
|
|
|
|
case Constants.startupState.keycardMaxPinRetriesReached:
|
|
|
|
case Constants.startupState.keycardMaxPukRetriesReached:
|
2023-01-26 11:52:01 +00:00
|
|
|
case Constants.startupState.userProfileWrongSeedPhrase:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardStateViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardEnterPuk:
|
|
|
|
case Constants.startupState.keycardWrongPuk:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardPukViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardWrongPuk:
|
|
|
|
return keycardPukViewComponent
|
|
|
|
|
|
|
|
case Constants.startupState.keycardWrongPuk:
|
|
|
|
return keycardPukViewComponent
|
|
|
|
|
|
|
|
case Constants.startupState.profileFetching:
|
|
|
|
case Constants.startupState.profileFetchingSuccess:
|
|
|
|
case Constants.startupState.profileFetchingTimeout:
|
|
|
|
return fetchingDataViewComponent
|
2023-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
case Constants.startupState.syncDeviceWithSyncCode:
|
|
|
|
return syncDeviceViewComponent
|
|
|
|
|
|
|
|
case Constants.startupState.syncDeviceResult:
|
|
|
|
return syncDeviceResultComponent
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
return undefined
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
2022-07-20 12:34:44 +00:00
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Connections {
|
|
|
|
target: root.startupStore.startupModuleInst
|
2023-01-18 09:25:36 +00:00
|
|
|
function onStartupError(error: string, errType: int) {
|
2023-01-26 11:52:01 +00:00
|
|
|
msgDialog.errType = errType
|
|
|
|
if (errType === Constants.startupErrorType.setupAccError) {
|
|
|
|
if (error === Constants.existingAccountError) {
|
|
|
|
msgDialog.title = qsTr("Keys for this account already exist")
|
2023-03-03 10:13:48 +00:00
|
|
|
msgDialog.text = qsTr("Keys for this account already exist and can't be added again. If you've lost \
|
2023-01-26 11:52:01 +00:00
|
|
|
your password, passcode or Keycard, uninstall the app, reinstall and access your keys by entering your seed phrase.")
|
|
|
|
} else {
|
|
|
|
msgDialog.title = qsTr("Login failed")
|
|
|
|
msgDialog.text = qsTr("Login failed. Please re-enter your password and try again.")
|
|
|
|
}
|
2022-07-20 12:34:44 +00:00
|
|
|
}
|
2023-01-26 11:52:01 +00:00
|
|
|
else if (errType === Constants.startupErrorType.importAccError) {
|
|
|
|
if (error === Constants.existingAccountError) {
|
|
|
|
msgDialog.title = qsTr("Keys for this account already exist")
|
2023-03-03 10:13:48 +00:00
|
|
|
msgDialog.text = qsTr("Keys for this account already exist and can't be added again. If you've lost \
|
|
|
|
your password, passcode or Keycard, uninstall the app, reinstall and access your keys by entering your seed phrase. In \
|
2022-07-21 11:29:18 +00:00
|
|
|
case of Keycard try recovering using PUK or reinstall the app and try login with the Keycard option.")
|
2023-01-26 11:52:01 +00:00
|
|
|
} else {
|
|
|
|
msgDialog.title = qsTr("Error importing seed")
|
|
|
|
msgDialog.text = error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (errType === Constants.startupErrorType.convertToRegularAccError) {
|
|
|
|
msgDialog.title = qsTr("Converting account")
|
|
|
|
msgDialog.text = qsTr("Really sorry about this inconvenience.\n\
|
|
|
|
Most likely that your account is damaged while converting to a regular Status account.\n\
|
2024-10-15 19:26:12 +00:00
|
|
|
First try to login after app restart, if that doesn't work, you can alway recover your account\n\
|
2023-01-26 11:52:01 +00:00
|
|
|
following the \"Add existing Status user\" flow, using your seed phrase.")
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
2023-01-26 11:52:01 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
msgDialog.open()
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
2023-01-26 11:52:01 +00:00
|
|
|
|
2023-01-18 09:25:36 +00:00
|
|
|
function onDisplayKeycardSharedModuleFlow() {
|
2023-06-27 09:29:31 +00:00
|
|
|
keycardPopup.active = true
|
2022-08-05 13:50:54 +00:00
|
|
|
}
|
2023-01-18 09:25:36 +00:00
|
|
|
function onDestroyKeycardSharedModuleFlow() {
|
2023-06-27 09:29:31 +00:00
|
|
|
keycardPopup.active = false
|
2022-08-05 13:50:54 +00:00
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
|
2023-01-26 11:52:01 +00:00
|
|
|
StatusDialog {
|
2022-07-20 12:34:44 +00:00
|
|
|
id: msgDialog
|
|
|
|
title: qsTr("Login failed")
|
2023-01-26 11:52:01 +00:00
|
|
|
|
|
|
|
property int errType: Constants.startupErrorType.unknownType
|
|
|
|
property string text: qsTr("Login failed. Please re-enter your password and try again.")
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.fill: parent
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: msgDialog.text
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
|
|
|
standardButtons: Dialog.Ok
|
2022-07-20 12:34:44 +00:00
|
|
|
onAccepted: {
|
2023-01-26 11:52:01 +00:00
|
|
|
if (msgDialog.errType == Constants.startupErrorType.convertToRegularAccError) {
|
|
|
|
Qt.quit();
|
|
|
|
}
|
2022-07-20 12:34:44 +00:00
|
|
|
console.log("TODO: restart flow...")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: allowNotificationsViewComponent
|
2022-05-20 17:14:39 +00:00
|
|
|
AllowNotificationsView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-05-20 17:14:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: welcomeViewComponent
|
2022-03-04 23:31:31 +00:00
|
|
|
WelcomeView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-03-04 23:31:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: keysMainViewComponent
|
2022-03-03 22:50:53 +00:00
|
|
|
KeysMainView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: insertDetailsViewComponent
|
|
|
|
InsertDetailsView {
|
|
|
|
startupStore: root.startupStore
|
2024-10-21 22:01:34 +00:00
|
|
|
utilsStore: root.utilsStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-24 16:31:22 +00:00
|
|
|
Component {
|
|
|
|
id: profileChatKeyViewComponent
|
|
|
|
ProfileChatKeyView {
|
|
|
|
startupStore: root.startupStore
|
2024-10-22 12:39:42 +00:00
|
|
|
utilsStore: root.utilsStore
|
2024-04-24 16:31:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: createPasswordViewComponent
|
|
|
|
CreatePasswordView {
|
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: confirmPasswordViewComponent
|
|
|
|
ConfirmPasswordView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: touchIdAuthViewComponent
|
|
|
|
TouchIDAuthView {
|
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: seedPhraseInputViewComponent
|
|
|
|
SeedPhraseInputView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loginViewComponent
|
2022-03-03 22:50:53 +00:00
|
|
|
LoginView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardInitViewComponent
|
|
|
|
KeycardInitView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardPinViewComponent
|
|
|
|
KeycardPinView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardPukViewComponent
|
|
|
|
KeycardPukView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: seedphraseViewComponent
|
|
|
|
SeedPhraseView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: seedphraseWordsInputViewComponent
|
|
|
|
SeedPhraseWordsInputView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardStateViewComponent
|
|
|
|
KeycardStateView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
|
2022-11-30 09:25:47 +00:00
|
|
|
Component {
|
|
|
|
id: fetchingDataViewComponent
|
|
|
|
ProfileFetchingView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-14 02:52:16 +00:00
|
|
|
Component {
|
|
|
|
id: syncDeviceViewComponent
|
|
|
|
SyncCodeView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: syncDeviceResultComponent
|
|
|
|
SyncDeviceResult {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-27 09:29:31 +00:00
|
|
|
Loader {
|
2022-08-05 13:50:54 +00:00
|
|
|
id: keycardPopup
|
2023-06-27 09:29:31 +00:00
|
|
|
active: false
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceComponent: KeycardPopup {
|
2022-08-05 13:50:54 +00:00
|
|
|
sharedKeycardModule: root.startupStore.startupModuleInst.keycardSharedModule
|
|
|
|
}
|
2023-06-27 09:29:31 +00:00
|
|
|
|
|
|
|
onLoaded: {
|
|
|
|
keycardPopup.item.open()
|
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|