diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 18576ec..0ac97e4 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -845,9 +845,31 @@ } else { [MVMCoreLoggingHandler logWithDelegateLoadFinished:loadObject loadedViewController:loadedViewController error:errorObject]; } + + //make post load calls function + [MVMCoreLoadRequestOperation loadPostCallActions:loadObject]; + [loadObject.operation markAsFinished]; } + ++ (void)loadPostCallActions:(nonnull MVMCoreLoadObject *)loadObject { + NSDictionary *postCallsDict = [loadObject.pageJSON dict:@"postLoadActions"]; + if (postCallsDict) { + NSArray *actionList = [postCallsDict array:@"actionList"]; + //TODO needs to create operation queue based on concurrent flag + BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; + //Needs further enhancements based on the flags. + BOOL shouldTriggerFromCache = [postCallsDict boolForKey:@"shouldTriggerFromCache"]; + //Check if page is not from cache + if (!loadObject.pageDataFromCache || shouldTriggerFromCache) { + [actionList enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:obj additionalData:nil delegateObject:nil]; + }]; + } + } +} + #pragma mark - Presentation Delegate - (void)navigationController:(UINavigationController *)navigationController willDisplayViewController:(UIViewController *)viewController {