Adjust timing of session timer extension. PR resolution.

This commit is contained in:
Hedden, Kyle Matthew 2018-08-07 12:21:15 -04:00
parent 20d9261cb3
commit 5e5cb1a552
3 changed files with 10 additions and 8 deletions

View File

@ -48,8 +48,6 @@
@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<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate;
- (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate;
@ -58,4 +56,7 @@
- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON errorObject:(nullable MVMCoreErrorObject *)errorObject;
// Returns whether the load will extend the app session timer based on the response provided by the server.
- (BOOL)extendsAppSession;
@end

View File

@ -55,7 +55,7 @@
return self;
}
- (BOOL) extendsAppSession {
- (BOOL)extendsAppSession {
NSNumber *extendSessionFlag = [self.responseInfoMap objectForKey:@"appSessionExtended" ofType:[NSNumber class]];
return !extendSessionFlag || [extendSessionFlag boolValue]; // Default to YES if the key does not exist.
}

View File

@ -164,6 +164,11 @@
return;
}
// Update the session timer on a good response.
if (loadObject.extendsAppSession) {
[[MVMCoreSessionTimeHandler sharedSessionHandler] startSessionTimer];
}
if (loadObject.pageDataFromCache || loadObject.pageType) {
// Can continue loading with the page.
@ -283,12 +288,8 @@
if ([jsonObject isKindOfClass:[NSDictionary class]]) {
// Update the session timer on a good response.
if (loadObject.extendsAppSession) {
[[MVMCoreSessionTimeHandler sharedSessionHandler] startSessionTimer];
}
completionHandler(jsonObject);
} else {
// Error json not correct format.