diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index 4771309..89352a4 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -31,4 +31,8 @@ [self didChangeValueForKey:@"isVisible"]; } +- (NSString *)description { + return [NSString stringWithFormat:@"%@|title=%@|message=%@", [super description],self.title,self.message]; +} + @end diff --git a/MVMCore/MVMCore/Constants/MVMCoreErrorConstants.h b/MVMCore/MVMCore/Constants/MVMCoreErrorConstants.h index 014fa3b..0109cb9 100644 --- a/MVMCore/MVMCore/Constants/MVMCoreErrorConstants.h +++ b/MVMCore/MVMCore/Constants/MVMCoreErrorConstants.h @@ -37,5 +37,6 @@ typedef NS_ENUM(NSInteger, ErrorCode) { ErrorCodeNoModule, ErrorCodeInvalidSettingType, ErrorCodeServerFailSendFaceIDHash, - ErrorCodeSSL + ErrorCodeSSL, + ErrorCodeNoViewControllerToPresentOn }; diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m index 47a4481..727d97b 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m @@ -14,6 +14,8 @@ #import "MVMCoreLoadObject.h" #import "MVMCoreObject.h" #import "MVMCoreRequestParameters.h" +#import "MVMCoreErrorConstants.h" +#import "MVMCoreLoggingHandler.h" @interface MVMCoreNavigationHandler () @@ -265,8 +267,9 @@ - (void)presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject*)delegate completionHandler:(nullable void (^)(void))completionBlock { if (!self.viewControllerToPresentOn) { - NSException *exception = [NSException exceptionWithName:@"NoViewControllerToPresentOnException" reason:@"The viewControllerToPresent on property is nil and an attempt was made to present." userInfo:nil]; - @throw exception; + // Log if we are attempting to add an alert to nothing. + 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 { MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:self.viewControllerToPresentOn presentedViewController:viewController animated:animated]; operation.delegate = delegate; diff --git a/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m b/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m index 748ad76..f0f632d 100644 --- a/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m +++ b/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m @@ -107,10 +107,13 @@ self.timeTimerStarted = [NSDate timeIntervalSinceReferenceDate]; } - if (!fequal(0, self.secondsUntilWarning)) { - self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilWarning target:self selector:@selector(sessionTimeoutWarning) userInfo:nil repeats:NO]; - } else if (!fequal(0, self.secondsUntilTimeout)) { - self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilTimeout target:self selector:@selector(sessionTimeout:) userInfo:nil repeats:NO]; + // Only start physical timer if active, otherwise will begin once entering foreground. + if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) { + if (!fequal(0, self.secondsUntilWarning)) { + self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilWarning target:self selector:@selector(sessionTimeoutWarning) userInfo:nil repeats:NO]; + } else if (!fequal(0, self.secondsUntilTimeout)) { + self.sessionTimer = [NSTimer scheduledTimerWithTimeInterval:self.secondsUntilTimeout target:self selector:@selector(sessionTimeout:) userInfo:nil repeats:NO]; + } } } });