updates for lock screen

This commit is contained in:
Mark Gregory
2026-11-04 15:19:49 +00:00
parent 5bebd30041
commit 66adec42e3
5 changed files with 59 additions and 16 deletions
+20
View File
@@ -198,6 +198,26 @@ final class MockProtocol: URLProtocol, @unchecked Sendable {
}
await protection.updateScene(.active)
check(!protection.locked, "Face ID success while system prompt is inactive unlocks the app")
let presentation = AppModel()
presentation.biometric = true; presentation.locked = true
check(!presentation.unlockNeedsRetry, "Fresh protected launch shows branding instead of lock fallback")
presentation.authenticate = { _ in
check(!presentation.unlockNeedsRetry, "Face ID prompt keeps lock fallback hidden")
throw LAError(.userCancel)
}
await presentation.updateScene(.active)
check(presentation.locked && presentation.unlockNeedsRetry, "Only unsuccessful authentication shows the Unlock fallback")
presentation.authenticate = { _ in
check(!presentation.unlockNeedsRetry, "Retry returns to branded authentication screen")
return true
}
await presentation.unlock()
check(!presentation.locked && !presentation.unlockNeedsRetry, "Successful authentication opens app without lock screen")
await presentation.updateScene(.background)
check(!presentation.unlockNeedsRetry, "New background lock clears previous fallback state")
presentation.authenticate = { _ in false }
await presentation.updateScene(.active)
check(presentation.locked && presentation.unlockNeedsRetry, "Incomplete authentication offers a retry instead of a permanent spinner")
another.close(); transport.close(); print("\(checks) contract checks passed.")
}
}