fix app lock hanging on macOS and blocking the photo picker
- Lock only when the scene really backgrounds: transient inactive states (system photo picker, app switcher) no longer swap in the lock screen and break gallery selection on iOS. - Cache biometric availability once per session off the main thread instead of calling LAContext.canEvaluatePolicy in view bodies, which froze the macOS lock screen, and auto-prompt biometrics on iOS only. - Keep UI tests as an opt-in target and guard both fixes in verify.sh.
This commit is contained in:
1 parent
8b86e33186
commit
6ed5cb3ce9
9 files changed
+86
-78
No files matched your search
@@ -112,7 +112,7 @@ struct SettingsView: View {
|
||||
}
|
||||
))
|
||||
if model.appLockIsEnabled {
|
||||
Toggle("Вход по \(biometricName)", isOn: Binding(
|
||||
Toggle("Вход по \(model.biometricUnlockName)", isOn: Binding(
|
||||
get: { model.appLockBiometricIsEnabled },
|
||||
set: { enabled in
|
||||
passcodeSheetMode = .verify(
|
||||
@@ -120,7 +120,7 @@ struct SettingsView: View {
|
||||
)
|
||||
}
|
||||
))
|
||||
.disabled(!biometricAvailable)
|
||||
.disabled(!model.biometricUnlockAvailable)
|
||||
Button("Сменить пароль") {
|
||||
passcodeSheetMode = .change
|
||||
}
|
||||
@@ -194,22 +194,6 @@ struct SettingsView: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var biometricContext: LAContext {
|
||||
LAContext()
|
||||
}
|
||||
|
||||
private var biometricAvailable: Bool {
|
||||
var error: NSError?
|
||||
return biometricContext.canEvaluatePolicy(
|
||||
.deviceOwnerAuthenticationWithBiometrics,
|
||||
error: &error
|
||||
)
|
||||
}
|
||||
|
||||
private var biometricName: String {
|
||||
biometricContext.biometryType == .faceID ? "Face ID" : "Touch ID"
|
||||
}
|
||||
|
||||
private var connectionTitle: String {
|
||||
switch model.connectionStatus {
|
||||
case .connected: return "Подключено"
|
||||
|
||||
Reference in new issue
Block a user