-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New implementation of Passcode related features
- Loading branch information
Showing
56 changed files
with
2,025 additions
and
848 deletions.
There are no files selected for viewing
441 changes: 279 additions & 162 deletions
441
UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...oppableWallet/UnstoppableWallet/Assets.xcassets/Icons/backspace_24.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+723 Bytes
.../UnstoppableWallet/Assets.xcassets/Icons/backspace_24.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1 KB
.../UnstoppableWallet/Assets.xcassets/Icons/backspace_24.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
UnstoppableWallet/UnstoppableWallet/Core/Managers/BiometryManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Combine | ||
import HsExtensions | ||
import LocalAuthentication | ||
import StorageKit | ||
|
||
class BiometryManager { | ||
private let biometricOnKey = "biometric_on_key" | ||
|
||
private let localStorage: ILocalStorage | ||
private var tasks = Set<AnyTask>() | ||
|
||
@PostPublished var biometryType: BiometryType? | ||
@PostPublished var biometryEnabled: Bool { | ||
didSet { | ||
localStorage.set(value: biometryEnabled, for: biometricOnKey) | ||
} | ||
} | ||
|
||
init(localStorage: ILocalStorage) { | ||
self.localStorage = localStorage | ||
|
||
biometryEnabled = localStorage.value(for: biometricOnKey) ?? false | ||
|
||
refreshBiometry() | ||
} | ||
|
||
private func refreshBiometry() { | ||
Task { [weak self] in | ||
var authError: NSError? | ||
let localAuthenticationContext = LAContext() | ||
|
||
if localAuthenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) { | ||
switch localAuthenticationContext.biometryType { | ||
case .faceID: self?.biometryType = .faceId | ||
case .touchID: self?.biometryType = .touchId | ||
default: self?.biometryType = .none | ||
} | ||
} else { | ||
self?.biometryType = .none | ||
} | ||
}.store(in: &tasks) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.