Skip to content

Commit 9776d02

Browse files
feat(@desktop/biometrics): Added flow for the biometrics to work on password
screen all over the app
1 parent e325568 commit 9776d02

File tree

7 files changed

+9455
-8
lines changed

7 files changed

+9455
-8
lines changed

src/app/global/user_profile.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ QtObject:
6161
read = getIsKeycardUser
6262

6363
proc getUsingBiometricLogin*(self: UserProfile): bool {.slot.} =
64-
if(not main_constants.IS_MACOS):
64+
if(not main_constants.IS_MACOS or not main_constants.IS_MOBILE):
6565
return false
6666
return self.localAccountSettings.getStoreToKeychainValue() == LS_VALUE_STORE
6767
QtProperty[bool] usingBiometricLogin:

src/app/modules/main/profile_section/privacy/controller.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ proc storeToKeychain*(self: Controller, data: string) =
123123

124124
proc removeFromKeychain*(self: Controller, key: string) =
125125
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
126-
if not main_constants.IS_MACOS or # Dealing with Keychain is the MacOS only feature
126+
if not main_constants.IS_MACOS or # Dealing with Keychain is the MacOS feature
127+
not main_constants.IS_MOBILE or # Dealing with Keychain also on mobile OS
127128
key.len == 0 or
128129
value != LS_VALUE_STORE:
129130
self.delegate.onStoreToKeychainError("", "")
@@ -135,4 +136,4 @@ proc authenticateLoggedInUser*(self: Controller) =
135136
var data = SharedKeycarModuleAuthenticationArgs(uniqueIdentifier: UNIQUE_PRIVACY_SECTION_MODULE_AUTH_IDENTIFIER)
136137
if singletonInstance.userProfile.getIsKeycardUser():
137138
data.keyUid = singletonInstance.userProfile.getKeyUid()
138-
self.events.emit(SIGNAL_SHARED_KEYCARD_MODULE_AUTHENTICATE_USER, data)
139+
self.events.emit(SIGNAL_SHARED_KEYCARD_MODULE_AUTHENTICATE_USER, data)

src/app/modules/onboarding/module.nim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ method finishOnboardingFlow*[T](self: Module[T], flowInt: int, dataJson: string)
156156
let pin = data["keycardPin"].str
157157
let keyUid = data["keyUid"].str
158158
let keycardInfo = self.view.getKeycardEvent().keycardInfo
159-
let saveBiometrics = data["enableBiometrics"].getBool
159+
var saveBiometrics: bool = data["enableBiometrics"].getBool
160160
let backupImportFileUrl = data["backupImportFileUrl"].getStr
161161
let thirdpartyServicesEnabled = data["thirdpartyServicesEnabled"].getBool
162162

@@ -199,6 +199,8 @@ method finishOnboardingFlow*[T](self: Module[T], flowInt: int, dataJson: string)
199199
thirdpartyServicesEnabled,
200200
)
201201
of OnboardingFlow.LoginWithSyncing:
202+
saveBiometrics = false
203+
singletonInstance.localAccountSettings.setStoreToKeychainValue(LS_VALUE_NOT_NOW)
202204
# The pairing was already done directly through inputConnectionStringForBootstrapping, we can login
203205
self.controller.loginLocalPairingAccount(
204206
self.localPairingStatus.account,
@@ -242,7 +244,8 @@ method finishOnboardingFlow*[T](self: Module[T], flowInt: int, dataJson: string)
242244

243245
# SaveBiometrics task should be scheduled after any other tasks
244246
if saveBiometrics:
245-
let credential = if pin.len > 0: pin else: password
247+
var credential: string = if pin.len > 0: pin else: password
248+
echo "SaveBiometrics TASK >>>> ",credential,pin,password
246249
self.postLoginTasks.add(newSaveBiometricsTask(credential))
247250
if backupImportFileUrl != "":
248251
self.postLoginTasks.add(newLocalBackupTask(backupImportFileUrl))

src/constants.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ include env_cli_vars
44
## on other platform if we just change the value here
55
const IS_MACOS* = defined(macosx)
66
const IS_INTEL* = defined(amd64)
7+
const IS_MOBILE* = defined(ios) or defined(android)
78
# For future supporting fingerprints on other platforms
8-
const SUPPORTS_FINGERPRINT* = IS_MACOS
9+
const SUPPORTS_FINGERPRINT* = IS_MACOS or IS_MOBILE
910
# This is changed during compilation by reading the VERSION file
1011
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
1112
const STATUSGO_VERSION* {.strdefine.} = "0.0.0"

0 commit comments

Comments
 (0)