Initial implementation for AppLockSetupFlowCoordinator. (#1949)

Rename AppLockSettingsScreen to AppLockSetupSettingsScreen.
Implement forced logout and persist PIN entry attempts.
This commit is contained in:
Doug
2023-10-25 12:03:37 +01:00
committed by GitHub
parent 30b18031a0
commit c6e4dc2a37
53 changed files with 773 additions and 234 deletions
+11 -1
View File
@@ -22,6 +22,9 @@ final class AppSettings {
private enum UserDefaultsKeys: String {
case lastVersionLaunched
case seenInvites
case hasShownWelcomeScreen
case appLockNumberOfPINAttempts
case appLockNumberOfBiometricAttempts
case lastLoginDate
case migratedAccounts
case timelineStyle
@@ -38,7 +41,6 @@ final class AppSettings {
case shouldCollapseRoomStateEvents
case userSuggestionsEnabled
case readReceiptsEnabled
case hasShownWelcomeScreen
case swiftUITimelineEnabled
case voiceMessageEnabled
case mentionsEnabled
@@ -122,10 +124,18 @@ final class AppSettings {
// MARK: - Security
/// The app must be locked with a PIN code as part of the authentication flow.
let appLockIsMandatory = false
/// The amount of time the app can remain in the background for without requesting the PIN/TouchID/FaceID.
let appLockGracePeriod: TimeInterval = 180
/// Any codes that the user isn't allowed to use for their PIN.
let appLockPINCodeBlockList = ["0000", "1234"]
/// The number of attempts the user has made to unlock the app with a PIN code (resets when unlocked).
@UserPreference(key: UserDefaultsKeys.appLockNumberOfPINAttempts, defaultValue: 0, storageType: .userDefaults(store))
var appLockNumberOfPINAttempts: Int
/// The number of attempts the user has made to unlock the app with Touch/Face ID (resets when unlocked).
@UserPreference(key: UserDefaultsKeys.appLockNumberOfBiometricAttempts, defaultValue: 0, storageType: .userDefaults(store))
var appLockNumberOfBiometricAttempts: Int
// MARK: - Authentication