changes made in CoreLoadRequest

passed delegate obj to PostAction
removed flag and check
changed Actions to PostAction
This commit is contained in:
Nishanth T 2020-11-03 21:20:03 +05:30
parent 8bceb77422
commit ecbb9438bc

View File

@ -779,12 +779,12 @@
if ([loadObject.operation checkAndHandleForCancellation]) {
return;
}
DelegateObject *delegateObject = nil;
// Show any alerts that we have been saving.
if (loadObject.operation.alertToShow) {
// If we have an alert to show and a loaded view controller, allow the loaded view controller to be the delegate.
DelegateObject *delegateObject = [loadedViewController respondsToSelector:@selector(delegateObject)] ? [loadedViewController delegateObject] : loadObject.operation.delegateObject;
delegateObject = [loadedViewController respondsToSelector:@selector(delegateObject)] ? [loadedViewController delegateObject] : loadObject.operation.delegateObject;
[MVMCoreLoadRequestOperation createAndShowAlertForLoadObject:loadObject error:loadObject.operation.errorForAlertToShow delegateObject:delegateObject];
}
@ -796,9 +796,10 @@
}
//make post load calls function
[MVMCoreLoadRequestOperation loadCallActions:loadObject];
[MVMCoreLoadRequestOperation loadPostCallActions:loadObject];
[MVMCoreLoadRequestOperation loadPostAction:loadObject delegateObject:delegateObject];
[loadObject.operation markAsFinished];
[loadObject.operation markAsFinished];
}
@ -819,14 +820,10 @@
}
}
+ (void)loadCallActions:(nonnull MVMCoreLoadObject *)loadObject {
NSDictionary *actionDict = [loadObject.responseJSON dict:@"Actions"];
+ (void)loadPostAction:(nonnull MVMCoreLoadObject *)loadObject delegateObject:(nullable DelegateObject *)delegateObject {
NSDictionary *actionDict = [loadObject.responseJSON dict:@"PostAction"];
if (actionDict) {
BOOL shouldTriggerFromCache = [actionDict boolForKey:@"shouldTriggerFromCache"];
//Check if page is not from cache
if (!loadObject.pageDataFromCache || shouldTriggerFromCache) {
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:actionDict additionalData:nil delegateObject:nil];
}
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:actionDict additionalData:nil delegateObject:delegateObject];
}
}