Session timeout improvement. Navigation error logging

This commit is contained in:
Pfeil, Scott Robert 2018-02-22 11:54:38 -05:00
parent 9bfd5e9138
commit f26dd47d23
4 changed files with 18 additions and 7 deletions

View File

@ -31,4 +31,8 @@
[self didChangeValueForKey:@"isVisible"]; [self didChangeValueForKey:@"isVisible"];
} }
- (NSString *)description {
return [NSString stringWithFormat:@"%@|title=%@|message=%@", [super description],self.title,self.message];
}
@end @end

View File

@ -37,5 +37,6 @@ typedef NS_ENUM(NSInteger, ErrorCode) {
ErrorCodeNoModule, ErrorCodeNoModule,
ErrorCodeInvalidSettingType, ErrorCodeInvalidSettingType,
ErrorCodeServerFailSendFaceIDHash, ErrorCodeServerFailSendFaceIDHash,
ErrorCodeSSL ErrorCodeSSL,
ErrorCodeNoViewControllerToPresentOn
}; };

View File

@ -14,6 +14,8 @@
#import "MVMCoreLoadObject.h" #import "MVMCoreLoadObject.h"
#import "MVMCoreObject.h" #import "MVMCoreObject.h"
#import "MVMCoreRequestParameters.h" #import "MVMCoreRequestParameters.h"
#import "MVMCoreErrorConstants.h"
#import "MVMCoreLoggingHandler.h"
@interface MVMCoreNavigationHandler () @interface MVMCoreNavigationHandler ()
@ -265,8 +267,9 @@
- (void)presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock { - (void)presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
if (!self.viewControllerToPresentOn) { if (!self.viewControllerToPresentOn) {
NSException *exception = [NSException exceptionWithName:@"NoViewControllerToPresentOnException" reason:@"The viewControllerToPresent on property is nil and an attempt was made to present." userInfo:nil]; // Log if we are attempting to add an alert to nothing.
@throw exception; MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:nil message:@"The viewControllerToPresent on property is nil and an attempt was made to present." code:ErrorCodeNoViewControllerToPresentOn domain:ErrorDomainNative location:[NSString stringWithFormat:@"ViewController:%@|Delegate:%@",viewController.description,delegate]];
[MVMCoreLoggingHandler addErrorToLog:error];
} else { } else {
MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:self.viewControllerToPresentOn presentedViewController:viewController animated:animated]; MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:self.viewControllerToPresentOn presentedViewController:viewController animated:animated];
operation.delegate = delegate; operation.delegate = delegate;

View File

@ -107,12 +107,15 @@
self.timeTimerStarted = [NSDate timeIntervalSinceReferenceDate]; self.timeTimerStarted = [NSDate timeIntervalSinceReferenceDate];
} }
// Only start physical timer if active, otherwise will begin once entering foreground.
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
if (!fequal(0, self.secondsUntilWarning)) { if (!fequal(0, self.secondsUntilWarning)) {
self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilWarning target:self selector:@selector(sessionTimeoutWarning) userInfo:nil repeats:NO]; self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilWarning target:self selector:@selector(sessionTimeoutWarning) userInfo:nil repeats:NO];
} else if (!fequal(0, self.secondsUntilTimeout)) { } else if (!fequal(0, self.secondsUntilTimeout)) {
self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilTimeout target:self selector:@selector(sessionTimeout:) userInfo:nil repeats:NO]; self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilTimeout target:self selector:@selector(sessionTimeout:) userInfo:nil repeats:NO];
} }
} }
}
}); });
} }