Allow the server to specify whether to extend the session timer.

This commit is contained in:
Hedden, Kyle Matthew 2018-08-06 17:52:17 -04:00
parent 3cec2459b0
commit 20d9261cb3
3 changed files with 11 additions and 1 deletions

View File

@ -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<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate;
- (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate;

View File

@ -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

View File

@ -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 {