Scheudle timer on mian

This commit is contained in:
Max Goedjen 2024-01-20 19:47:55 -08:00
parent 3df4bcef3c
commit 1947b326a4
No known key found for this signature in database
1 changed files with 12 additions and 10 deletions

View File

@ -198,6 +198,7 @@ extension SecureEnclave {
self?.persistedAuthenticationContexts[secret] = context self?.persistedAuthenticationContexts[secret] = context
// Contexts will expire within LATouchIDAuthenticationMaximumAllowableReuseDuration unless we periodically refresh them // Contexts will expire within LATouchIDAuthenticationMaximumAllowableReuseDuration unless we periodically refresh them
if duration > LATouchIDAuthenticationMaximumAllowableReuseDuration { if duration > LATouchIDAuthenticationMaximumAllowableReuseDuration {
DispatchQueue.main.async {
Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in
print("Refreshing context") print("Refreshing context")
guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return } guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return }
@ -213,6 +214,7 @@ extension SecureEnclave {
} }
} }
} }
}
public func reloadSecrets() { public func reloadSecrets() {
reloadSecretsInternal(notifyAgent: false) reloadSecretsInternal(notifyAgent: false)