Merge branch 'feature/label_atom' into 'develop'

Feature/label atom

See merge request BPHV_MIPS/mvm_core!1
This commit is contained in:
Pfeil, Scott Robert 2019-03-05 15:56:17 -05:00
commit 7ef0cca4c0
6 changed files with 22 additions and 11 deletions

View File

@ -40,7 +40,7 @@ NSUInteger const TopAlertDismissTime = 5;
}
// The default is yes if not sent by server (for legacy to work as is)
NSNumber *closeButton = [responseInfo objectForKey:KeyCloseButton ofType:[NSNumber class]];
NSNumber *closeButton = [responseInfo optionalNumberForKey:KeyCloseButton];
if (closeButton) {
self.useCloseButton = [closeButton boolValue];
} else {
@ -51,7 +51,7 @@ NSUInteger const TopAlertDismissTime = 5;
// Server driven dismiss time.
if (self.useNewStyle) {
NSNumber *topAlertTime = [responseInfo objectForKey:@"topAlertTime" ofType:[NSNumber class]];
NSNumber *topAlertTime = [responseInfo optionalNumberForKey:@"topAlertTime"];
if (topAlertTime) {
self.topAlertDismissTime = [topAlertTime integerValue];
}

View File

@ -23,6 +23,7 @@
- (NSInteger)integer:(nonnull id<NSCopying>)key;
- (CGFloat)floatForKey:(nonnull id<NSCopying>)key;
- (double)doubleForKey:(nonnull id<NSCopying>)key;
- (nullable NSNumber *)optionalNumberForKey:(nonnull id<NSCopying>)key;
// Not strict, can accept either string or boolean.
- (BOOL)lenientBoolForKey:(nonnull id<NSCopying>)key;

View File

@ -29,7 +29,7 @@
}
- (BOOL)boolForKey:(nonnull id<NSCopying>)key {
return [[self objectForKey:key ofType:[NSNumber class]] boolValue];
return [[self optionalNumberForKey:key] boolValue];
}
- (BOOL)lenientBoolForKey:(nonnull id<NSCopying>)key {
@ -42,15 +42,19 @@
}
- (CGFloat)floatForKey:(nonnull id<NSCopying>)key {
return [[self objectForKey:key ofType:[NSNumber class]] floatValue];
return [[self optionalNumberForKey:key] floatValue];
}
- (double)doubleForKey:(id<NSCopying>)key {
return [[self objectForKey:key ofType:[NSNumber class]] doubleValue];
return [[self optionalNumberForKey:key] doubleValue];
}
- (NSInteger)integer:(nonnull id<NSCopying>)key {
return [[self objectForKey:key ofType:[NSNumber class]] integerValue];
return [[self optionalNumberForKey:key] integerValue];
}
- (nullable NSNumber *)optionalNumberForKey:(nonnull id<NSCopying>)key {
return [self objectForKey:key ofType:[NSNumber class]];
}
- (nullable id)objectChainOfKeysOrIndexes:(nonnull NSArray *)keysOrIndexes {

View File

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

View File

@ -67,7 +67,7 @@
if (self = [self initWithPageType:[actionMap stringForKey:KeyPageType] additionalModules:[actionMap array:KeyModuleList] extraParameters:[actionMap dict:KeyExtraParameters]]) {
self.contextRoot = [actionMap string:KeyContextRoot];
self.actionMap = actionMap;
self.customTimeoutTime = [actionMap objectForKey:@"customTimeoutTime" ofType:[NSNumber class]];
self.customTimeoutTime = [actionMap optionalNumberForKey:@"customTimeoutTime"];
self.openSupportPanel = [actionMap boolForKey:KeyOpenSupport];
// Right now server is sending default.... can't uncomment this until they remove default

View File

@ -218,7 +218,10 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
}
// Adds json to cache with page type key.
[weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType];
NSNumber *shouldCache = [jsonDictionary optionalNumberForKey:@"cache"];
if (!shouldCache || shouldCache.boolValue) {
[weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType];
}
}
}
if (completionBlock) {
@ -250,9 +253,12 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
// Create the cache if necessary.
weakSelf.moduleCache = [NSMutableDictionary dictionary];
}
// Adds json to cache with page type key.
[weakSelf.moduleCache setObject:obj forKey:key];
NSNumber *shouldCache = [jsonDictionary optionalNumberForKey:@"cache"];
if (!shouldCache || shouldCache.boolValue) {
[weakSelf.moduleCache setObject:obj forKey:key];
}
}
}];
}