remainingWarningTime fix. code comment cleanups.
This commit is contained in:
parent
16d169c46c
commit
1f377dfb51
@ -30,7 +30,7 @@
|
||||
|
||||
#pragma mark - functions to override
|
||||
|
||||
/// Can override to provide a time until the warning shows in seconds. Set to 0 if there should be no warning. Default is 0
|
||||
/// Can override to provide a time until the warning shows in seconds. Set to 0 if there should be no warning. Default is 0.
|
||||
- (NSTimeInterval)timeUntilWarning;
|
||||
|
||||
/// Can override to provide a time until the timeout happens in seconds. If there is a warning, then this value is used after the warning happens. Set to 0 if there should be no timeout. Default is 0.
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
}
|
||||
|
||||
- (BOOL)isWarningEnabled {
|
||||
return !fequal(0, self.secondsUntilWarning);
|
||||
return [self isTimeoutEnabled] && !fequal(0, self.secondsUntilWarning);
|
||||
}
|
||||
|
||||
- (BOOL)isTimeoutEnabled {
|
||||
@ -112,7 +112,7 @@
|
||||
}
|
||||
|
||||
- (NSTimeInterval)remainingTimeUntilWarning {
|
||||
if (self.timeTimerStarted < 0 || ![self isTimeoutEnabled]) {
|
||||
if (self.timeTimerStarted < 0 || ![self isWarningEnabled]) {
|
||||
return 0;
|
||||
}
|
||||
return self.secondsUntilWarning - self.timeSinceStart;
|
||||
@ -160,7 +160,7 @@
|
||||
self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:[self remainingTimeUntiTimeout] target:self selector:@selector(sessionTimeout:) userInfo:nil repeats:NO];
|
||||
MVMCoreLog(@"Session timeout will fire at: %@", self.sessionTimer.fireDate);
|
||||
|
||||
// Only setup a warning timer if there is a timout timer. Note based on scheduledTimerWithTimeInterval, if the remaining time < 0, this will fire near immediately.
|
||||
// Only setup a warning timer if there is a timeout timer. Note based on scheduledTimerWithTimeInterval, if the remaining time < 0, this will fire near immediately.
|
||||
if (self.isWarningEnabled && ![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);
|
||||
@ -211,7 +211,7 @@
|
||||
- (void)revalidateSessionTimestamp {
|
||||
if (self.sessionBeingTimed || self.sessionTimedOut) {
|
||||
if (self.isTimeoutEnabled && self.remainingTimeUntiTimeout < 0) {
|
||||
// Timeout if we are passed the warning.
|
||||
// Force a timeout if we are passed the timeout interval.
|
||||
[self sessionTimeout:YES];
|
||||
} else {
|
||||
[self resumeSessionTimer];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user