Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Signal/util/ScreenLockUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ class ScreenLockUI {
name: NSNotification.Name.OWSApplicationDidEnterBackground,
object: nil,
)
NotificationCenter.default.addObserver(
self,
selector: #selector(protectedDataDidBecomeAvailable),
name: UIApplication.protectedDataDidBecomeAvailableNotification,
object: nil,
)
NotificationCenter.default.addObserver(
self,
selector: #selector(screenLockDidChange),
Expand Down Expand Up @@ -295,6 +301,11 @@ class ScreenLockUI {
return
}

guard UIApplication.shared.isProtectedDataAvailable else {
// Never show the auth UI while the device is locked.
return
}

Logger.info("try to unlock screen lock")

isShowingScreenLockUI = true
Expand Down Expand Up @@ -446,6 +457,11 @@ class ScreenLockUI {
private func applicationDidEnterBackground(_ notification: Notification) {
appIsInBackground = true
}

@objc
private func protectedDataDidBecomeAvailable(_ notification: Notification) {
ensureUI()
}
}

extension ScreenLockUI: ScreenLockViewDelegate {
Expand Down