feat(settings): Add back up seed phrase banner in profile settings

Closes: #5743
This commit is contained in:
Boris Melnik 2022-06-03 13:48:03 +03:00 committed by Iuri Matias
parent 1870e9a0ce
commit 235046cba0
4 changed files with 47 additions and 2 deletions

View File

@ -92,6 +92,8 @@ const LSS_KEY_IS_DDMMYY_DATE_FORMAT* = "is_DDMMYY_date_format"
const DEFAULT_IS_DDMMYY_DATE_FORMAT = false const DEFAULT_IS_DDMMYY_DATE_FORMAT = false
const LSS_KEY_IS_24H_TIME_FORMAT* = "is_24h_time_format" const LSS_KEY_IS_24H_TIME_FORMAT* = "is_24h_time_format"
const DEFAULT_IS_24H_TIME_FORMAT = false const DEFAULT_IS_24H_TIME_FORMAT = false
const LSS_KEY_USER_DECLINED_BACKUP_BANNER* = "userDeclinedBackupBanner"
const DEFAULT_USER_DECLINED_BACKUP_BANNER = false
logScope: logScope:
@ -743,6 +745,18 @@ QtObject:
write = setIs24hTimeFormat write = setIs24hTimeFormat
notify = is24hTimeFormatChanged notify = is24hTimeFormatChanged
proc userDeclinedBackupBannerChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getUserDeclinedBackupBanner*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_USER_DECLINED_BACKUP_BANNER, newQVariant(DEFAULT_USER_DECLINED_BACKUP_BANNER))
proc setUserDeclinedBackupBanner*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
setSettingsProp(self, LSS_KEY_USER_DECLINED_BACKUP_BANNER, newQVariant(value)):
self.userDeclinedBackupBannerChanged()
QtProperty[bool] userDeclinedBackupBanner:
read = getUserDeclinedBackupBanner
write = setUserDeclinedBackupBanner
notify = userDeclinedBackupBannerChanged
proc removeKey*(self: LocalAccountSensitiveSettings, key: string) = proc removeKey*(self: LocalAccountSensitiveSettings, key: string) =
if(self.settings.isNil): if(self.settings.isNil):
return return
@ -796,3 +810,4 @@ QtObject:
of LSS_KEY_STICKERS_ENS_ROPSTEN: self.stickersEnsRopstenChanged() of LSS_KEY_STICKERS_ENS_ROPSTEN: self.stickersEnsRopstenChanged()
of LSS_KEY_IS_DDMMYY_DATE_FORMAT: self.isDDMMYYDateFormatChanged() of LSS_KEY_IS_DDMMYY_DATE_FORMAT: self.isDDMMYYDateFormatChanged()
of LSS_KEY_IS_24H_TIME_FORMAT: self.is24hTimeFormatChanged() of LSS_KEY_IS_24H_TIME_FORMAT: self.is24hTimeFormatChanged()
of LSS_KEY_USER_DECLINED_BACKUP_BANNER: self.userDeclinedBackupBannerChanged()

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13
import utils 1.0 import utils 1.0
import shared 1.0 import shared 1.0
import shared.panels 1.0
import "stores" import "stores"
import "popups" import "popups"
@ -27,7 +28,7 @@ StatusAppTwoPanelLayout {
QtObject { QtObject {
id: d id: d
readonly property int topMargin: 0 readonly property int topMargin: secureYourSeedPhrase.visible ? secureYourSeedPhrase.height : 0
readonly property int bottomMargin: 56 readonly property int bottomMargin: 56
readonly property int leftMargin: 48 readonly property int leftMargin: 48
readonly property int rightMargin: 48 readonly property int rightMargin: 48
@ -39,6 +40,7 @@ StatusAppTwoPanelLayout {
id: leftTab id: leftTab
store: profileView.store store: profileView.store
anchors.fill: parent anchors.fill: parent
anchors.topMargin: d.topMargin
} }
rightPanel: Item { rightPanel: Item {
@ -225,5 +227,24 @@ StatusAppTwoPanelLayout {
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
} // Item
ModuleWarning {
id: secureYourSeedPhrase
width: parent.width
visible: profileContainer.currentIndex === Constants.settingsSubsection.profile &&
!profileView.store.profileStore.userDeclinedBackupBanner
color: Style.current.red
btnWidth: 100
text: qsTr("Secure your seed phrase")
btnText: qsTr("Back up now")
onClick: function(){
Global.openBackUpSeedPopup();
}
onClosed: {
profileView.store.profileStore.userDeclinedBackupBanner = true
}
} }
} } // StatusAppTwoPanelLayout

View File

@ -13,6 +13,12 @@ QtObject {
property string ensName: userProfile.preferredName || userProfile.firstEnsName || userProfile.ensName property string ensName: userProfile.preferredName || userProfile.firstEnsName || userProfile.ensName
property string profileLargeImage: userProfile.largeImage property string profileLargeImage: userProfile.largeImage
property string icon: userProfile.icon property string icon: userProfile.icon
property bool userDeclinedBackupBanner: localAccountSensitiveSettings.userDeclinedBackupBanner
onUserDeclinedBackupBannerChanged: {
if (userDeclinedBackupBanner !== localAccountSensitiveSettings.userDeclinedBackupBanner) {
localAccountSensitiveSettings.userDeclinedBackupBanner = userDeclinedBackupBanner
}
}
function uploadImage(source, aX, aY, bX, bY) { function uploadImage(source, aX, aY, bX, bY) {
return root.profileModule.upload(source, aX, aY, bX, bY) return root.profileModule.upload(source, aX, aY, bX, bY)

View File

@ -22,6 +22,8 @@ Rectangle {
closeBtn.clicked(null) closeBtn.clicked(null)
} }
signal closed
Row { Row {
spacing: Style.current.halfPadding spacing: Style.current.halfPadding
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@ -90,6 +92,7 @@ Rectangle {
onClicked: ParallelAnimation { onClicked: ParallelAnimation {
PropertyAnimation { target: root; property: "visible"; to: false; } PropertyAnimation { target: root; property: "visible"; to: false; }
PropertyAnimation { target: root; property: "y"; to: -1 * root.height } PropertyAnimation { target: root; property: "y"; to: -1 * root.height }
onFinished: root.closed()
} }
} }
} }