2020-06-17 19:18:31 +00:00
import QtQuick 2.13
2022-03-04 23:31:31 +00:00
import QtQuick . Layouts 1.12
2020-06-17 19:18:31 +00:00
import QtQuick . Controls 2.13
2020-12-10 21:26:39 +00:00
import QtQuick . Controls . Universal 2.12
2021-10-12 18:26:02 +00:00
2021-10-20 12:23:58 +00:00
import StatusQ . Controls 0.1
2022-03-04 23:31:31 +00:00
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
2022-11-30 09:25:47 +00:00
import StatusQ . Components 0.1
2021-10-20 12:23:58 +00:00
2021-10-27 21:27:49 +00:00
import shared 1.0
import shared . panels 1.0
2024-07-15 13:34:40 +00:00
import shared . popups 1.0
import shared . stores 1.0
2021-10-12 18:26:02 +00:00
import "../popups"
2022-03-07 22:59:38 +00:00
import "../controls"
2022-07-20 12:34:44 +00:00
import "../stores"
2021-09-28 15:04:06 +00:00
import utils 1.0
2020-05-19 13:22:38 +00:00
2022-07-20 12:34:44 +00:00
Item {
2022-03-04 23:31:31 +00:00
id: root
2022-07-20 12:34:44 +00:00
property StartupStore startupStore
2024-07-15 13:34:40 +00:00
property MetricsStore metricsStore
2021-06-28 11:11:54 +00:00
2023-04-03 09:15:34 +00:00
Component.onCompleted: {
if ( button1 . visible ) {
button1 . forceActiveFocus ( )
}
}
2022-11-30 09:25:47 +00:00
QtObject {
id: d
readonly property int infoWidth: 292
readonly property int infoHeight: 309
readonly property int infoMargin: 24
readonly property int infoTextWidth: d . infoWidth - 2 * d . infoMargin
readonly property int imgKeysWH: 160
readonly property int imgSeedPhraseWH: 257
2024-07-15 13:34:40 +00:00
function showMetricsAndRunAction ( action ) {
if ( root . startupStore . currentStartupState . stateType === Constants . startupState . welcomeNewStatusUser ) {
metricsEnablePopup . actionOnClose = action
metricsEnablePopup . visible = true
} else {
action ( )
}
}
2022-11-30 09:25:47 +00:00
}
ColumnLayout {
2022-06-20 09:50:57 +00:00
anchors.centerIn: parent
2023-05-09 16:23:48 +00:00
height: Constants . onboarding . loginHeight
2022-11-30 09:25:47 +00:00
spacing: Style . current . bigPadding
2020-05-19 13:22:38 +00:00
2022-11-30 09:25:47 +00:00
Image {
id: keysImg
Layout.alignment: Qt . AlignHCenter
mipmap: true
2023-04-26 15:33:24 +00:00
cache: false
2020-06-15 15:20:38 +00:00
}
2020-05-19 13:22:38 +00:00
2020-06-19 18:06:58 +00:00
StyledText {
2022-03-04 23:31:31 +00:00
id: txtTitle
2022-11-30 09:25:47 +00:00
Layout.alignment: Qt . AlignHCenter
2020-06-15 15:20:38 +00:00
font.bold: true
font.letterSpacing: - 0.2
2022-11-30 09:25:47 +00:00
font.pixelSize: Constants . onboarding . fontSize1
2020-06-15 15:20:38 +00:00
}
2020-05-19 13:22:38 +00:00
2020-06-19 18:06:58 +00:00
StyledText {
2022-03-04 23:31:31 +00:00
id: txtDesc
2022-11-30 09:25:47 +00:00
Layout.alignment: Qt . AlignHCenter
2022-05-25 15:24:01 +00:00
color: Style . current . secondaryText
horizontalAlignment: Text . AlignHCenter
wrapMode: Text . WordWrap
2022-11-30 09:25:47 +00:00
font.pixelSize: Constants . onboarding . fontSize3
}
Item {
id: spacer
Layout.preferredHeight: Style . current . padding
Layout.preferredWidth: 1
2020-06-15 15:20:38 +00:00
}
2022-05-25 15:24:01 +00:00
2022-11-30 09:25:47 +00:00
Row {
id: whatYouLoseGet
visible: root . startupStore . currentStartupState . stateType === Constants . startupState . userProfileCreateSameChatKey
2022-03-04 23:31:31 +00:00
spacing: Style . current . bigPadding
2022-11-30 09:25:47 +00:00
Layout.alignment: Qt . AlignHCenter
Rectangle {
width: d . infoWidth
height: d . infoHeight
radius: Constants . onboarding . radius
color: Theme . palette . baseColor5
2020-05-19 13:22:38 +00:00
2022-11-30 09:25:47 +00:00
ColumnLayout {
2022-05-25 15:24:01 +00:00
anchors.fill: parent
2022-11-30 09:25:47 +00:00
anchors.margins: d . infoMargin
spacing: Style . current . bigPadding
RowLayout {
StyledText {
text: qsTr ( "What you lose" )
font.pixelSize: Constants . onboarding . fontSize2
font.bold: true
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: 1
}
StatusEmoji {
width: 24
height: 24
emojiId: "1f622"
}
2022-05-25 15:24:01 +00:00
}
2022-11-30 09:25:47 +00:00
ColumnLayout {
StyledText {
text: qsTr ( "Chat history" )
font.pixelSize: Constants . onboarding . fontSize3
font.bold: true
}
StyledText {
Layout.preferredWidth: d . infoTextWidth
text: qsTr ( "Past is in the past. Move on :)" )
font.pixelSize: Constants . onboarding . fontSize3
wrapMode: Text . WordWrap
}
2022-05-25 15:24:01 +00:00
}
2022-11-30 09:25:47 +00:00
ColumnLayout {
StyledText {
text: qsTr ( "Contacts" )
font.pixelSize: Constants . onboarding . fontSize3
font.bold: true
}
StyledText {
Layout.preferredWidth: d . infoTextWidth
text: qsTr ( "You can add them back to your contact list" )
font.pixelSize: Constants . onboarding . fontSize3
wrapMode: Text . WordWrap
}
}
ColumnLayout {
StyledText {
text: qsTr ( "Community memberships" )
font.pixelSize: Constants . onboarding . fontSize3
font.bold: true
}
StyledText {
Layout.preferredWidth: d . infoTextWidth
text: qsTr ( "You’ ll need to rejoin communities" )
font.pixelSize: Constants . onboarding . fontSize3
wrapMode: Text . WordWrap
}
2022-05-25 15:24:01 +00:00
}
}
}
2022-03-04 23:31:31 +00:00
2022-11-30 09:25:47 +00:00
Rectangle {
width: d . infoWidth
height: d . infoHeight
radius: Constants . onboarding . radius
color: Theme . palette . baseColor5
ColumnLayout {
2022-03-04 23:31:31 +00:00
anchors.fill: parent
2022-11-30 09:25:47 +00:00
anchors.margins: d . infoMargin
spacing: Style . current . bigPadding
RowLayout {
StyledText {
text: qsTr ( "What you keep" )
font.pixelSize: Constants . onboarding . fontSize2
font.bold: true
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: 1
}
StatusEmoji {
width: 24
height: 24
emojiId: "1f389"
}
2022-03-04 23:31:31 +00:00
}
2022-11-30 09:25:47 +00:00
ColumnLayout {
StyledText {
text: qsTr ( "Chatkey" )
font.pixelSize: Constants . onboarding . fontSize3
font.bold: true
}
StyledText {
Layout.preferredWidth: d . infoTextWidth
text: qsTr ( "Your contacts can still reach you just like before" )
font.pixelSize: Constants . onboarding . fontSize3
wrapMode: Text . WordWrap
}
2022-03-04 23:31:31 +00:00
}
2022-11-30 09:25:47 +00:00
ColumnLayout {
StyledText {
text: qsTr ( "Wallet accounts" )
font.pixelSize: Constants . onboarding . fontSize3
font.bold: true
}
StyledText {
Layout.preferredWidth: d . infoTextWidth
text: qsTr ( "All your assets and collectibles are safe in your accounts" )
font.pixelSize: Constants . onboarding . fontSize3
wrapMode: Text . WordWrap
}
2022-03-04 23:31:31 +00:00
}
}
}
2020-06-15 15:20:38 +00:00
}
2022-11-30 09:25:47 +00:00
StatusButton {
id: button1
objectName: "keysMainViewPrimaryActionButton"
Layout.alignment: Qt . AlignHCenter
visible: text !== ""
onClicked: {
2024-07-15 13:34:40 +00:00
d . showMetricsAndRunAction ( root . startupStore . doPrimaryAction )
2022-11-30 09:25:47 +00:00
}
2023-04-03 09:15:34 +00:00
Keys.onPressed: {
if ( event . key === Qt . Key_Return || event . key === Qt . Key_Enter ) {
event . accepted = true
2024-07-15 13:34:40 +00:00
d . showMetricsAndRunAction ( root . startupStore . doPrimaryAction )
2023-04-03 09:15:34 +00:00
}
}
2022-11-30 09:25:47 +00:00
}
StatusBaseText {
id: button2
2024-05-27 11:19:35 +00:00
objectName: "iDontHaveOtherDeviceButton"
2022-11-30 09:25:47 +00:00
Layout.alignment: Qt . AlignHCenter
visible: text !== ""
color: Theme . palette . primaryColor1
font.pixelSize: Constants . onboarding . fontSize3
MouseArea {
anchors.fill: parent
cursorShape: Qt . PointingHandCursor
hoverEnabled: true
onEntered: {
parent . font . underline = true
}
onExited: {
parent . font . underline = false
}
onClicked: {
2024-07-15 13:34:40 +00:00
d . showMetricsAndRunAction ( root . startupStore . doSecondaryAction )
2022-11-30 09:25:47 +00:00
}
}
}
2023-01-18 11:53:38 +00:00
Row {
2022-11-30 09:25:47 +00:00
id: button3
2023-01-18 11:53:38 +00:00
property string text: ""
property string link: ""
property bool useLinkForButton: false
2022-11-30 09:25:47 +00:00
Layout.alignment: Qt . AlignHCenter
2023-01-18 11:53:38 +00:00
visible: button3 . text !== ""
spacing: 0
padding: 0
StatusBaseText {
text: button3 . text
color: Theme . palette . primaryColor1
font.pixelSize: Constants . onboarding . fontSize3
MouseArea {
anchors.fill: parent
cursorShape: Qt . PointingHandCursor
hoverEnabled: true
onEntered: {
parent . font . underline = true
}
onExited: {
parent . font . underline = false
}
onClicked: {
if ( button3 . useLinkForButton ) {
Qt . openUrlExternally ( button3 . link )
return
}
2024-07-15 13:34:40 +00:00
d . showMetricsAndRunAction ( root . startupStore . doTertiaryAction )
2023-01-18 11:53:38 +00:00
}
2022-11-30 09:25:47 +00:00
}
2023-01-18 11:53:38 +00:00
}
StatusFlatRoundButton {
visible: button3 . link !== ""
height: 20
width: 20
icon.name: "external"
icon.width: 16
icon.height: 16
2022-11-30 09:25:47 +00:00
onClicked: {
2023-01-18 11:53:38 +00:00
Qt . openUrlExternally ( button3 . link )
2022-11-30 09:25:47 +00:00
}
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
2022-03-04 23:31:31 +00:00
}
2021-09-24 12:03:57 +00:00
2024-07-15 13:34:40 +00:00
component MetricsEnablePopupWithActionOnClose: MetricsEnablePopup {
property var actionOnClose
}
MetricsEnablePopupWithActionOnClose {
id: metricsEnablePopup
isOnboarding: true
function finalAction ( enable ) {
if ( ! ! actionOnClose )
actionOnClose ( )
root . metricsStore . toggleCentralizedMetrics ( enable )
}
onAccepted: finalAction ( true )
onRejected: finalAction ( false )
}
2024-07-10 13:58:48 +00:00
2022-03-04 23:31:31 +00:00
states: [
State {
2022-07-20 12:34:44 +00:00
name: Constants . startupState . welcomeOldStatusUser
when: root . startupStore . currentStartupState . stateType === Constants . startupState . welcomeOldStatusUser
2022-05-25 15:24:01 +00:00
PropertyChanges {
target: keysImg
2022-11-30 09:25:47 +00:00
Layout.preferredWidth: d . imgKeysWH
Layout.preferredHeight: d . imgKeysWH
source: Style . png ( "onboarding/keys" )
2022-05-25 15:24:01 +00:00
}
2023-01-16 09:45:33 +00:00
PropertyChanges {
target: txtTitle
2023-03-14 02:52:16 +00:00
text: qsTr ( "Sign in by syncing" )
2023-01-16 09:45:33 +00:00
}
PropertyChanges {
target: txtDesc
text: qsTr ( "Get your data straight from your other device." )
height: Constants . onboarding . loginInfoHeight2
}
PropertyChanges {
target: button1
2023-03-14 02:52:16 +00:00
text: qsTr ( "Scan or enter a sync code" )
2023-01-16 09:45:33 +00:00
}
PropertyChanges {
target: button2
text: qsTr ( "I don’ t have other device" )
}
PropertyChanges {
target: button3
text: ""
}
} ,
State {
name: Constants . startupState . recoverOldUser
when: root . startupStore . currentStartupState . stateType === Constants . startupState . recoverOldUser
PropertyChanges {
target: keysImg
Layout.preferredWidth: d . imgKeysWH
Layout.preferredHeight: d . imgKeysWH
source: Style . png ( "onboarding/keys" )
}
2022-03-04 23:31:31 +00:00
PropertyChanges {
target: txtTitle
text: qsTr ( "Connect your keys" )
}
PropertyChanges {
target: txtDesc
text: qsTr ( "Use your existing Status keys to login to this device." )
2022-11-30 09:25:47 +00:00
height: Constants . onboarding . loginInfoHeight2
2022-03-04 23:31:31 +00:00
}
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button1
2023-01-16 09:45:33 +00:00
text: ""
2022-03-04 23:31:31 +00:00
}
2022-10-27 09:26:34 +00:00
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button2
text: qsTr ( "Login with Keycard" )
}
2022-03-04 23:31:31 +00:00
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button3
2022-03-04 23:31:31 +00:00
text: qsTr ( "Enter a seed phrase" )
}
} ,
State {
2022-07-20 12:34:44 +00:00
name: Constants . startupState . welcomeNewStatusUser
when: root . startupStore . currentStartupState . stateType === Constants . startupState . welcomeNewStatusUser
2022-05-25 15:24:01 +00:00
PropertyChanges {
target: keysImg
2022-11-30 09:25:47 +00:00
Layout.preferredWidth: d . imgKeysWH
Layout.preferredHeight: d . imgKeysWH
source: Style . png ( "onboarding/keys" )
2022-05-25 15:24:01 +00:00
}
2022-03-04 23:31:31 +00:00
PropertyChanges {
target: txtTitle
text: qsTr ( "Get your keys" )
}
PropertyChanges {
target: txtDesc
text: qsTr ( "A set of keys controls your account. Your keys live on your\ndevice, so only you can use them." )
2022-11-30 09:25:47 +00:00
height: Constants . onboarding . loginInfoHeight2
2022-03-04 23:31:31 +00:00
}
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button1
2022-03-04 23:31:31 +00:00
text: qsTr ( "Generate new keys" )
}
2022-07-21 11:29:18 +00:00
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button2
2022-07-21 11:29:18 +00:00
text: qsTr ( "Generate keys for a new Keycard" )
}
2022-03-04 23:31:31 +00:00
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button3
2022-03-29 19:15:42 +00:00
text: qsTr ( "Import a seed phrase" )
2022-03-04 23:31:31 +00:00
}
} ,
State {
2022-07-20 12:34:44 +00:00
name: Constants . startupState . userProfileImportSeedPhrase
when: root . startupStore . currentStartupState . stateType === Constants . startupState . userProfileImportSeedPhrase
2022-03-04 23:31:31 +00:00
PropertyChanges {
target: txtTitle
2022-03-29 19:15:42 +00:00
text: qsTr ( "Import a seed phrase" )
2022-03-04 23:31:31 +00:00
}
2022-04-27 08:32:41 +00:00
PropertyChanges {
target: keysImg
2022-11-30 09:25:47 +00:00
Layout.preferredWidth: d . imgSeedPhraseWH
Layout.preferredHeight: d . imgSeedPhraseWH
2022-04-27 08:32:41 +00:00
source: Style . png ( "onboarding/seed-phrase" )
}
2022-03-04 23:31:31 +00:00
PropertyChanges {
target: txtDesc
2023-01-18 13:15:35 +00:00
text: qsTr ( "Seed phrases are used to back up and restore your keys.\nOnly use this option if you already have a seed phrase." )
2022-11-30 09:25:47 +00:00
height: Constants . onboarding . loginInfoHeight2
2022-03-04 23:31:31 +00:00
}
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button1
2022-03-29 19:15:42 +00:00
text: qsTr ( "Import a seed phrase" )
2022-03-04 23:31:31 +00:00
}
2022-07-21 11:29:18 +00:00
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button2
2022-07-21 11:29:18 +00:00
text: qsTr ( "Import a seed phrase into a new Keycard" )
}
2022-03-04 23:31:31 +00:00
PropertyChanges {
2022-11-30 09:25:47 +00:00
target: button3
2022-03-04 23:31:31 +00:00
text: ""
2022-11-30 09:25:47 +00:00
}
} ,
State {
name: Constants . startupState . profileFetchingAnnouncement
when: root . startupStore . currentStartupState . stateType === Constants . startupState . profileFetchingAnnouncement
PropertyChanges {
target: keysImg
Layout.preferredWidth: d . imgKeysWH
Layout.preferredHeight: d . imgKeysWH
source: Style . png ( "onboarding/keys" )
}
PropertyChanges {
target: txtTitle
text: qsTr ( "Unable to fetch your profile" )
}
PropertyChanges {
target: txtDesc
text: qsTr ( "We cannot retrieve your profile data. If you have another device\nwith the Status profile, make sure that Status is running on the\nother device and that both devices are online." )
height: Constants . onboarding . loginInfoHeight3
}
PropertyChanges {
target: button1
text: qsTr ( "Try to fetch profile again" )
}
PropertyChanges {
target: button2
text: qsTr ( "Create new profile with the same chatkey" )
}
PropertyChanges {
target: button3
text: ""
}
} ,
State {
name: Constants . startupState . userProfileCreateSameChatKey
when: root . startupStore . currentStartupState . stateType === Constants . startupState . userProfileCreateSameChatKey
PropertyChanges {
target: keysImg
2022-03-04 23:31:31 +00:00
visible: false
}
2022-11-30 09:25:47 +00:00
PropertyChanges {
target: txtTitle
text: qsTr ( "Create a new profile with the same chatkey" )
}
PropertyChanges {
target: txtDesc
text: qsTr ( "We cannot fetch your profile data, but you still can create a profile with a same\nchatkey, name and avatar so you contacts will be able to reach you. " )
height: Constants . onboarding . loginInfoHeight2
}
PropertyChanges {
target: button1
text: qsTr ( "Continue" )
}
PropertyChanges {
target: button2
text: ""
}
PropertyChanges {
target: button3
text: ""
}
2023-01-18 11:53:38 +00:00
} ,
State {
name: Constants . startupState . lostKeycardOptions
when: root . startupStore . currentStartupState . stateType === Constants . startupState . lostKeycardOptions
PropertyChanges {
target: keysImg
Layout.preferredWidth: Constants . keycard . general . imageWidth
Layout.preferredHeight: Constants . keycard . general . imageHeight
source: Style . png ( "keycard/keycard-new" )
}
PropertyChanges {
target: txtTitle
text: ""
}
PropertyChanges {
target: txtDesc
text: qsTr ( "Sorry to hear you’ ve lost your Keycard, you have 3 options" )
height: Constants . onboarding . loginInfoHeight2
}
PropertyChanges {
target: button1
text: qsTr ( "Create replacement Keycard with seed phrase" )
}
PropertyChanges {
target: button2
text: qsTr ( "Start using account without keycard" )
}
PropertyChanges {
target: button3
text: qsTr ( "Order new keycard" )
link: "https://get.keycard.tech"
useLinkForButton: true
}
2022-03-04 23:31:31 +00:00
}
]
2020-05-19 13:22:38 +00:00
}