Shift app background check to resumeSessionTimer to make isAppInSession and revalidateSessionTimestamp background safe.

This commit is contained in:
Kyle Matthew Hedden 2022-12-28 11:02:02 -05:00
parent c7bfda216a
commit 80512a0b8a

View File

@ -124,11 +124,7 @@
if (!fequal(0, self.secondsUntilTimeout)) {
self.sessionBeingTimed = YES;
[self markStartTime];
// Only start physical timer if active, otherwise will begin once entering foreground. FaceId prompt is considered UIApplicationStateInactive.
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
[self resumeSessionTimer];
}
[self resumeSessionTimer];
}
}
});
@ -137,6 +133,11 @@
/// Resume the session timers if they are stopped.
- (void)resumeSessionTimer {
dispatch_async(dispatch_get_main_queue(), ^(void) {
// Only start physical timer if active, otherwise will begin once entering foreground. FaceId prompt is considered UIApplicationStateInactive.
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
return;
}
if (!fequal(0, self.secondsUntilWarning) && ![self.sessionWarningTimer isValid]) {
self.sessionWarningTimer = [NSTimer scheduledTimerWithTimeInterval:[self remainingTimeUntilWarning] target:self selector:@selector(sessionTimeoutWarning) userInfo:nil repeats:NO];
MVMCoreLog(@"Session warning will fire at: %@", self.sessionWarningTimer.fireDate);