From 976c3a3e7a6179227bb0ce8c57025099b4e175c3 Mon Sep 17 00:00:00 2001 From: Ramya Subramaniam Date: Thu, 6 Jun 2019 18:38:50 +0530 Subject: [PATCH] Post call actions added --- .../MVMCoreLoadRequestOperation.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 18576ec..22be088 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -845,9 +845,28 @@ } 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 dictionaryForKey:@"postLoadActions"]; + if (postCallsDict.count > 0) { + NSArray *actionList = [postCallsDict arrayForKey:@"actionList"]; + BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; + //Needs further enhancements based on the flags. + if (isConcurrent) { + [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 {