Merge pull request #38 in BPHVB/mvm_core from feature/trial_user to release/6_9

* commit '6bad0e1b344e9868e42560976688a10163ede817':
  fix to use key
  clean load object change
  panel protocol available
  lenient bool.... web view clean up
  button map read only property
  changes to the custom time and button map removal
  button map
  buttonMap
  customTimeoutTime
  customTimeoutTime
This commit is contained in:
Pfeil, Scott Robert 2018-11-08 15:53:08 -05:00
commit 85cc9a81c6
6 changed files with 24 additions and 0 deletions

View File

@ -24,6 +24,9 @@
- (CGFloat)floatForKey:(nonnull id<NSCopying>)key;
- (double)doubleForKey:(nonnull id<NSCopying>)key;
// Not strict, can accept either string or boolean.
- (BOOL)lenientBoolForKey:(nonnull id<NSCopying>)key;
// Gets an object that is nested using a series of keys or indexes to reach it.
// All keys should be of type NSString and is used for nested dictionaries.
// All indexes should be of type NSNumber and is used for nested arrays.

View File

@ -32,6 +32,15 @@
return [[self objectForKey:key ofType:[NSNumber class]] boolValue];
}
- (BOOL)lenientBoolForKey:(nonnull id<NSCopying>)key {
NSObject *object = [self objectForKey:key];
if ([object isKindOfClass:[NSString class]]) {
return [((NSString *)object) isEqualToString:@"true"];
} else {
return [((NSNumber *)([object isKindOfClass:[NSNumber class]] ? object : nil)) boolValue];
}
}
- (CGFloat)floatForKey:(nonnull id<NSCopying>)key {
return [[self objectForKey:key ofType:[NSNumber class]] floatValue];
}

View File

@ -23,6 +23,9 @@
// The data for hte page that was loaded
@property (nullable, strong, nonatomic) NSDictionary *pageJSON;
// Contains the button map
@property (nullable, nonatomic, strong, readonly) NSDictionary *buttonMap;
// the modules that are needed
@property (nullable, strong, nonatomic) NSDictionary *modulesJSON;

View File

@ -22,6 +22,10 @@
return self;
}
- (NSDictionary *)buttonMap {
return [self.pageJSON dict:KeyButtonMap];
}
- (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
if (self = [self initWithDelegate:delegate]) {
self.requestParameters = requestParameters;

View File

@ -67,6 +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.openSupportPanel = [actionMap boolForKey:KeyOpenSupport];
// Right now server is sending default.... can't uncomment this until they remove default
@ -132,6 +133,7 @@
copyObject.alternateBaseURL = self.alternateBaseURL;
copyObject.openSupportPanel = self.openSupportPanel;
copyObject.imageData = self.imageData;
copyObject.customTimeoutTime = self.customTimeoutTime;
return copyObject;
}

View File

@ -14,6 +14,9 @@
@optional
// The panel can return if it should be available or not.
- (BOOL)panelAvailable;
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewWillAppear:(BOOL)animated;
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewDidAppear:(BOOL)animated;
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewWillDisappear:(BOOL)animated;