Skip to content

Commit

Permalink
[ProfileSettings]: Added biometrics in password change view
Browse files Browse the repository at this point in the history
Closes #13302
  • Loading branch information
alexandraB99 committed Feb 22, 2024
1 parent 12c24c4 commit 314f26f
Showing 1 changed file with 67 additions and 12 deletions.
79 changes: 67 additions & 12 deletions ui/app/AppLayouts/Profile/views/ChangePasswordView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,82 @@ import StatusQ.Controls 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1

import AppLayouts.Profile.popups 1.0

SettingsContentBase {
id: root

property var privacyStore

readonly property bool biometricsEnabled: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store
onBiometricsEnabledChanged: {
biometricsSwitch.checked = Qt.binding(() => { return root.biometricsEnabled });
}

property var passwordStrengthScoreFunction: function () {}

//TODO https://github.com/status-im/status-desktop/issues/13302
// titleRowComponentLoader.sourceComponent: Item {
// implicitWidth: 226
// implicitHeight: 38
// StatusSwitch {
// LayoutMirroring.enabled: true
// text: qsTr("Enable biometrics")
// onToggled: {
// //
// }
// }
// }
titleRowComponentLoader.sourceComponent: Item {
implicitWidth: 226
implicitHeight: 38
StatusSwitch {
id: biometricsSwitch
LayoutMirroring.enabled: true
LayoutMirroring.childrenInherit: true
text: qsTr("Enable biometrics")
checked: root.biometricsEnabled
onToggled: {
enableBiometricsPopup.open();
}
StatusToolTip {
x: 15
visible: (!biometricsSwitch.checked && biometricsSwitch.hovered)
text: qsTr("Biometric login and transaction authentication")
}
}
StatusModal {
id: enableBiometricsPopup
title: biometricsSwitch.checked ? qsTr("Disable biometrics") : qsTr("Enable biometrics")
height: 216
Item {
anchors.fill: parent
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
StatusBaseText {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
text: biometricsSwitch.checked ? qsTr("Are you sure you want to disable biometrics for login and transaction authentication?") :
qsTr("Do you want to enable biometrics for login and transaction authentication?")
}
}
rightButtons: [
StatusButton {
text: qsTr("Cancel")
normalColor: "transparent"
onClicked: {
enableBiometricsPopup.close();
}
},

StatusButton {
text: biometricsSwitch.checked ? qsTr("Yes, enable biometrics") : qsTr("Yes, disable biometrics")
onClicked: {
if (biometricsSwitch.checked && !biometricsSwitch.biometricsEnabled) {
root.privacyStore.tryStoreToKeyChain();
} else if (!biometricsSwitch.checked) {
root.privacyStore.tryRemoveFromKeyChain();
}
enableBiometricsPopup.close();
}
}
]
onClosed: {
biometricsSwitch.checked = Qt.binding(() => { return root.biometricsEnabled });
}
}
}


ColumnLayout {
Expand Down

0 comments on commit 314f26f

Please sign in to comment.