diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h index dfe6705..dbaee70 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h @@ -48,6 +48,8 @@ @property (nonatomic) BOOL pageDataFromCache; @property (nonatomic) BOOL moduleDataFromCache; +@property (nonatomic, readonly) BOOL extendsAppSession; + - (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON modulesJSON:(nullable NSDictionary *)modulesJSON requestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate; - (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index 3064012..01fd7cf 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -9,6 +9,7 @@ #import "MVMCoreLoadObject.h" #import "MVMCoreErrorObject.h" #import "MVMCoreJSONConstants.h" +#import "NSDictionary+MFConvenience.h" @implementation MVMCoreLoadObject @@ -54,4 +55,9 @@ return self; } +- (BOOL) extendsAppSession { + NSNumber *extendSessionFlag = [self.responseInfoMap objectForKey:@"appSessionExtended" ofType:[NSNumber class]]; + return !extendSessionFlag || [extendSessionFlag boolValue]; // Default to YES if the key does not exist. +} + @end diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 7c919b1..020d724 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -284,7 +284,9 @@ if ([jsonObject isKindOfClass:[NSDictionary class]]) { // Update the session timer on a good response. - [[MVMCoreSessionTimeHandler sharedSessionHandler] startSessionTimer]; + if (loadObject.extendsAppSession) { + [[MVMCoreSessionTimeHandler sharedSessionHandler] startSessionTimer]; + } completionHandler(jsonObject); } else {