diff --git a/src/app/modules/main/profile_section/privacy/controller.nim b/src/app/modules/main/profile_section/privacy/controller.nim index 67ffb0e884..92b2327605 100644 --- a/src/app/modules/main/profile_section/privacy/controller.nim +++ b/src/app/modules/main/profile_section/privacy/controller.nim @@ -86,6 +86,9 @@ proc getMnemonic*(self: Controller): string = proc removeMnemonic*(self: Controller) = self.privacyService.removeMnemonic() +proc mnemonicWasShown*(self: Controller) = + self.settingsService.mnemonicWasShown() + proc getMnemonicWordAtIndex*(self: Controller, index: int): string = return self.privacyService.getMnemonicWordAtIndex(index) diff --git a/src/app/modules/main/profile_section/privacy/io_interface.nim b/src/app/modules/main/profile_section/privacy/io_interface.nim index e2b46247ed..9dc8362a87 100644 --- a/src/app/modules/main/profile_section/privacy/io_interface.nim +++ b/src/app/modules/main/profile_section/privacy/io_interface.nim @@ -34,6 +34,9 @@ method getMnemonic*(self: AccessInterface): string {.base.} = method removeMnemonic*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") +method mnemonicWasShown*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + method getMnemonicWordAtIndex*(self: AccessInterface, index: int): string {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/profile_section/privacy/module.nim b/src/app/modules/main/profile_section/privacy/module.nim index 3d4cf14ea1..06b338e1f8 100644 --- a/src/app/modules/main/profile_section/privacy/module.nim +++ b/src/app/modules/main/profile_section/privacy/module.nim @@ -75,6 +75,9 @@ method getMnemonic*(self: Module): string = method removeMnemonic*(self: Module) = self.controller.removeMnemonic() +method mnemonicWasShown*(self: Module) = + self.controller.mnemonicWasShown() + method getMnemonicWordAtIndex*(self: Module, index: int): string = return self.controller.getMnemonicWordAtIndex(index) diff --git a/src/app/modules/main/profile_section/privacy/view.nim b/src/app/modules/main/profile_section/privacy/view.nim index c01ea588a5..32819cc655 100644 --- a/src/app/modules/main/profile_section/privacy/view.nim +++ b/src/app/modules/main/profile_section/privacy/view.nim @@ -41,6 +41,9 @@ QtObject: proc removeMnemonic*(self: View) {.slot.} = self.delegate.removeMnemonic() + proc mnemonicWasShown*(self: View) {.slot.} = + self.delegate.mnemonicWasShown() + proc getMnemonicWordAtIndex*(self: View, index: int): string {.slot.} = return self.delegate.getMnemonicWordAtIndex(index) diff --git a/src/app_service/service/privacy/service.nim b/src/app_service/service/privacy/service.nim index 5efafdb6cc..4325e5ed2c 100644 --- a/src/app_service/service/privacy/service.nim +++ b/src/app_service/service/privacy/service.nim @@ -102,6 +102,9 @@ QtObject: data.success = false error "error: ", procName="removeMnemonic", errDesription = "an error occurred removing mnemonic" + proc mnemonicWasShown*(self: Service) = + self.settingsService.mnemonicWasShown() + proc getMnemonicWordAtIndex*(self: Service, index: int): string = let mnemonic = self.settingsService.getMnemonic() if(mnemonic.len == 0): diff --git a/src/app_service/service/settings/service.nim b/src/app_service/service/settings/service.nim index a8a809a42a..68f9207ae4 100644 --- a/src/app_service/service/settings/service.nim +++ b/src/app_service/service/settings/service.nim @@ -1000,3 +1000,9 @@ QtObject: proc getProfileMigrationNeeded*(self: Service): bool = self.settings.profileMigrationNeeded + + proc mnemonicWasShown*(self: Service) = + let response = status_settings.mnemonicWasShown() + if(not response.error.isNil): + error "error saving mnemonic was shown setting: ", errDescription = response.error.message + return diff --git a/src/backend/settings.nim b/src/backend/settings.nim index 3118cf8d15..1484d1bcd2 100644 --- a/src/backend/settings.nim +++ b/src/backend/settings.nim @@ -101,3 +101,6 @@ proc addOrReplaceSocialLinks*(value: JsonNode): RpcResponse[JsonNode] {.raises: proc getSocialLinks*(): RpcResponse[JsonNode] {.raises: [Exception].} = return core.callPrivateRPC("settings_getSocialLinks") + +proc mnemonicWasShown*(): RpcResponse[JsonNode] {.raises: [Exception].} = + return core.callPrivateRPC("settings_mnemonicWasShown") diff --git a/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml b/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml index 8031147389..a869497b2f 100644 --- a/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml +++ b/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml @@ -130,6 +130,7 @@ StatusStackModal { ConfirmSeedPhrasePanel { id: confirmSeedPhrase seedPhrase: root.privacyStore.getMnemonic().split(" ") + privacyStore: root.privacyStore }, BackupSeedStepBase { id: confirmFirstWord diff --git a/ui/app/AppLayouts/Profile/popups/backupseed/ConfirmSeedPhrasePanel.qml b/ui/app/AppLayouts/Profile/popups/backupseed/ConfirmSeedPhrasePanel.qml index 4273c64b72..da6eefc204 100644 --- a/ui/app/AppLayouts/Profile/popups/backupseed/ConfirmSeedPhrasePanel.qml +++ b/ui/app/AppLayouts/Profile/popups/backupseed/ConfirmSeedPhrasePanel.qml @@ -14,6 +14,7 @@ BackupSeedStepBase { property var seedPhrase: [] property bool hideSeed: true + property var privacyStore titleText: qsTr("Write down your 12-word seed phrase to keep offline") @@ -68,6 +69,7 @@ BackupSeedStepBase { icon.name: "view" text: qsTr("Reveal seed phrase") onClicked: { + privacyStore.mnemonicWasShown(); hideSeed = false; } } diff --git a/ui/app/AppLayouts/Profile/stores/PrivacyStore.qml b/ui/app/AppLayouts/Profile/stores/PrivacyStore.qml index f3c30735c2..b32f1911ec 100644 --- a/ui/app/AppLayouts/Profile/stores/PrivacyStore.qml +++ b/ui/app/AppLayouts/Profile/stores/PrivacyStore.qml @@ -40,4 +40,8 @@ QtObject { function backupData() { return root.privacyModule.backupData() } + + function mnemonicWasShown() { + root.privacyModule.mnemonicWasShown() + } }