Scheudle timer on mian
This commit is contained in:
parent
3df4bcef3c
commit
1947b326a4
|
@ -198,16 +198,18 @@ 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 {
|
||||||
Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in
|
DispatchQueue.main.async {
|
||||||
print("Refreshing context")
|
Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in
|
||||||
guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return }
|
print("Refreshing context")
|
||||||
guard refreshContext.valid else {
|
guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return }
|
||||||
timer.invalidate()
|
guard refreshContext.valid else {
|
||||||
return
|
timer.invalidate()
|
||||||
}
|
return
|
||||||
refreshContext.context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Refresh") { success, _ in
|
}
|
||||||
guard success else { return }
|
refreshContext.context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Refresh") { success, _ in
|
||||||
print("Refreshed")
|
guard success else { return }
|
||||||
|
print("Refreshed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue