From e32299bee49dbe5053a0fbd98e72689b49346da2 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 30 Oct 2020 14:13:01 -0400 Subject: [PATCH 1/7] logging for set-cookie --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index d9d3171..1392d93 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -320,7 +320,7 @@ NSURLSessionTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - MVMCoreLog(@"Request Time %f",[NSDate timeIntervalSinceReferenceDate] - startTime); + MVMCoreLog(@"Request Time %f", [NSDate timeIntervalSinceReferenceDate] - startTime); NSDate *startTimeDate = [NSDate dateWithTimeIntervalSinceReferenceDate:startTime]; @@ -333,6 +333,8 @@ [trackInfo setObject:error.localizedDescription forKey:@"error"]; } + MVMCoreLog(@"Set-Cookie %@ Value: %@", requestParameters.pageType, [(NSHTTPURLResponse *)response allHeaderFields][@"Set-Cookie"]); + [MVMCoreLoggingHandler logWithDelegateWithObject:nil withName:@"httpRequestStatus" withExtraInfo:trackInfo]; id jsonObject = nil; From 5466c75c5cd794d7a9f56447eda69823c3fbc875 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Mon, 2 Nov 2020 12:04:53 +0530 Subject: [PATCH 2/7] Update MVMCoreLoadRequestOperation.m added function to display alert from "Action" object in response level --- .../LoadHandling/MVMCoreLoadRequestOperation.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 7bce64d..2bf4fde 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -796,7 +796,7 @@ } //make post load calls function - [MVMCoreLoadRequestOperation loadPostCallActions:loadObject]; + [MVMCoreLoadRequestOperation loadCallActions:loadObject]; [loadObject.operation markAsFinished]; } @@ -819,6 +819,20 @@ } } ++ (void)loadCallActions:(nonnull MVMCoreLoadObject *)loadObject { + NSDictionary *actionDict = [loadObject.responseJSON dict:@"Action"]; + if (actionDict) { + //TODO needs to create operation queue based on concurrent flag + //BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; + //Needs further enhancements based on the flags. + BOOL shouldTriggerFromCache = [actionDict boolForKey:@"shouldTriggerFromCache"]; + //Check if page is not from cache + if (!loadObject.pageDataFromCache || shouldTriggerFromCache) { + [[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:actionDict additionalData:nil delegateObject:nil]; + } + } +} + + (void)removeCaches:(nullable NSDictionary *)cacheDictionary { if (cacheDictionary) { From f1871ac7d12bc73fc92084dd536823055b7701fa Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 2 Nov 2020 11:07:11 -0500 Subject: [PATCH 3/7] adding back removed import --- MVMCore/MVMCore/MVMCore.h | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCore/MVMCore/MVMCore.h b/MVMCore/MVMCore/MVMCore.h index fa613c5..ca0b8a0 100644 --- a/MVMCore/MVMCore/MVMCore.h +++ b/MVMCore/MVMCore/MVMCore.h @@ -62,6 +62,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[]; #import #import #import +#import // Action Handling #import From e6a402a5bcdac7ec3d3134266d7a4889723cfbbf Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Tue, 3 Nov 2020 15:22:21 +0530 Subject: [PATCH 4/7] change in key from "Action" to "Actions" --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 2bf4fde..31ae9ed 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -820,7 +820,7 @@ } + (void)loadCallActions:(nonnull MVMCoreLoadObject *)loadObject { - NSDictionary *actionDict = [loadObject.responseJSON dict:@"Action"]; + NSDictionary *actionDict = [loadObject.responseJSON dict:@"Actions"]; if (actionDict) { //TODO needs to create operation queue based on concurrent flag //BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; From 8bceb77422369e20455d6dc85dc3645159151f84 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Tue, 3 Nov 2020 16:07:25 +0530 Subject: [PATCH 5/7] removed comments which are not needed for this implementation --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 3 --- 1 file changed, 3 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 31ae9ed..8399310 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -822,9 +822,6 @@ + (void)loadCallActions:(nonnull MVMCoreLoadObject *)loadObject { NSDictionary *actionDict = [loadObject.responseJSON dict:@"Actions"]; if (actionDict) { - //TODO needs to create operation queue based on concurrent flag - //BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; - //Needs further enhancements based on the flags. BOOL shouldTriggerFromCache = [actionDict boolForKey:@"shouldTriggerFromCache"]; //Check if page is not from cache if (!loadObject.pageDataFromCache || shouldTriggerFromCache) { From ecbb9438bc02f5a2d67ea75c96e24ac65ce90068 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Tue, 3 Nov 2020 21:20:03 +0530 Subject: [PATCH 6/7] changes made in CoreLoadRequest passed delegate obj to PostAction removed flag and check changed Actions to PostAction --- .../MVMCoreLoadRequestOperation.m | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 8399310..4209310 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -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]; } } From edfdc8576cff6b62460415ed774d11a756e3880e Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Tue, 3 Nov 2020 22:18:08 +0530 Subject: [PATCH 7/7] Update MVMCoreLoadRequestOperation.m indentation and lifted out delegate obj --- .../LoadHandling/MVMCoreLoadRequestOperation.m | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 4209310..b66c75a 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -779,12 +779,11 @@ if ([loadObject.operation checkAndHandleForCancellation]) { return; } - DelegateObject *delegateObject = nil; + + // 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; // 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 = [loadedViewController respondsToSelector:@selector(delegateObject)] ? [loadedViewController delegateObject] : loadObject.operation.delegateObject; [MVMCoreLoadRequestOperation createAndShowAlertForLoadObject:loadObject error:loadObject.operation.errorForAlertToShow delegateObject:delegateObject]; } @@ -796,10 +795,10 @@ } //make post load calls function - [MVMCoreLoadRequestOperation loadPostCallActions:loadObject]; - [MVMCoreLoadRequestOperation loadPostAction:loadObject delegateObject:delegateObject]; + [MVMCoreLoadRequestOperation loadPostCallActions:loadObject]; + [MVMCoreLoadRequestOperation loadPostAction:loadObject delegateObject:delegateObject]; - [loadObject.operation markAsFinished]; + [loadObject.operation markAsFinished]; }