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 0b5d03ffb0
commit 8ac2829cd0
53 changed files with 773 additions and 234 deletions

View File

@@ -37,7 +37,7 @@ class AppLockSetupPINScreenViewModelTests: XCTestCase {
}
func testCreatePIN() async throws {
viewModel = AppLockSetupPINScreenViewModel(initialMode: .create, appLockService: appLockService)
viewModel = AppLockSetupPINScreenViewModel(initialMode: .create, isMandatory: false, appLockService: appLockService)
XCTAssertEqual(context.viewState.mode, .create, "The mode should start as creation.")
let createDeferred = deferFulfillment(context.$viewState, message: "A valid PIN needs confirming.") { $0.mode == .confirm }
@@ -53,7 +53,7 @@ class AppLockSetupPINScreenViewModelTests: XCTestCase {
}
func testCreateWeakPIN() async throws {
viewModel = AppLockSetupPINScreenViewModel(initialMode: .create, appLockService: appLockService)
viewModel = AppLockSetupPINScreenViewModel(initialMode: .create, isMandatory: false, appLockService: appLockService)
XCTAssertEqual(context.viewState.mode, .create, "The mode should start as creation.")
XCTAssertNil(context.alertInfo, "There shouldn't be an alert to begin with.")
@@ -65,7 +65,7 @@ class AppLockSetupPINScreenViewModelTests: XCTestCase {
}
func testCreatePINMismatch() async throws {
viewModel = AppLockSetupPINScreenViewModel(initialMode: .create, appLockService: appLockService)
viewModel = AppLockSetupPINScreenViewModel(initialMode: .create, isMandatory: false, appLockService: appLockService)
XCTAssertEqual(context.viewState.mode, .create, "The mode should start as creation.")
XCTAssertNil(context.alertInfo, "There shouldn't be an alert to begin with.")
@@ -83,7 +83,7 @@ class AppLockSetupPINScreenViewModelTests: XCTestCase {
}
func testUnlock() async throws {
viewModel = AppLockSetupPINScreenViewModel(initialMode: .unlock, appLockService: appLockService)
viewModel = AppLockSetupPINScreenViewModel(initialMode: .unlock, isMandatory: false, appLockService: appLockService)
let pinCode = "2023"
keychainController.pinCodeReturnValue = pinCode
keychainController.containsPINCodeReturnValue = true