added backgroundRequest check & addressed reviewcomments
This commit is contained in:
parent
01b14b02e4
commit
e3cbc7a7cd
@ -43,6 +43,10 @@ open class ActionOpenPageHandler: MVMCoreJSONActionHandlerProtocol {
|
|||||||
|
|
||||||
/// Adds client parameters and makes calls performRequest()
|
/// Adds client parameters and makes calls performRequest()
|
||||||
open func performRequestAddingClientParameters(with requestParameters: MVMCoreRequestParameters, model: ActionOpenPageModel, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws -> MVMCoreLoadRequestOperation? {
|
open func performRequestAddingClientParameters(with requestParameters: MVMCoreRequestParameters, model: ActionOpenPageModel, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws -> MVMCoreLoadRequestOperation? {
|
||||||
|
let actionUUID = MVMCoreActionHandler.getUUID(additionalData: additionalData) ?? UUID().uuidString
|
||||||
|
if !requestParameters.backgroundRequest, let pageType = requestParameters.pageType {
|
||||||
|
MVMCoreLoggingHandler.shared()?.logCoreEvent(.pageStarted(pageType: pageType, requestUUID: actionUUID))
|
||||||
|
}
|
||||||
// Adds any client parameters to the request parameters.
|
// Adds any client parameters to the request parameters.
|
||||||
if let parametersToFetch = model.clientParameters,
|
if let parametersToFetch = model.clientParameters,
|
||||||
let fetchedParameters = try await ClientParameterHandler().getClientParameters(
|
let fetchedParameters = try await ClientParameterHandler().getClientParameters(
|
||||||
@ -54,9 +58,7 @@ open class ActionOpenPageHandler: MVMCoreJSONActionHandlerProtocol {
|
|||||||
}
|
}
|
||||||
try Task.checkCancellation()
|
try Task.checkCancellation()
|
||||||
let coreLoadRequestOperation = MVMCoreLoadHandler.sharedGlobal()?.loadRequest(requestParameters, dataForPage: additionalData, delegateObject: delegateObject)
|
let coreLoadRequestOperation = MVMCoreLoadHandler.sharedGlobal()?.loadRequest(requestParameters, dataForPage: additionalData, delegateObject: delegateObject)
|
||||||
if let pageType = requestParameters.pageType, let identifier = coreLoadRequestOperation?.identifier {
|
coreLoadRequestOperation?.identifier = actionUUID
|
||||||
MVMCoreLoggingHandler.shared()?.logCoreEvent(.pageStarted(pageType: pageType, requestUUID: identifier))
|
|
||||||
}
|
|
||||||
return coreLoadRequestOperation
|
return coreLoadRequestOperation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
@property (nullable, strong, nonatomic) NSDictionary *responseJSON;
|
@property (nullable, strong, nonatomic) NSDictionary *responseJSON;
|
||||||
|
|
||||||
//Unique Identifier for event tracking
|
//Unique Identifier for event tracking
|
||||||
@property (nonatomic, nonatomic, nonnull) NSString *identifier;
|
@property (nullable, strong, nonatomic) NSString *identifier;
|
||||||
|
|
||||||
- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON modulesJSON:(nullable NSDictionary *)modulesJSON requestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject;
|
- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON modulesJSON:(nullable NSDictionary *)modulesJSON requestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject;
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
@property (nullable, nonatomic, readonly) NSString *finalLoadSource;
|
@property (nullable, nonatomic, readonly) NSString *finalLoadSource;
|
||||||
@property (nonatomic) BOOL backgroundLoad;
|
@property (nonatomic) BOOL backgroundLoad;
|
||||||
@property (nonatomic, getter=areDependenciesAdded) BOOL dependenciesAdded;
|
@property (nonatomic, getter=areDependenciesAdded) BOOL dependenciesAdded;
|
||||||
@property (nonnull, nonatomic, readonly) NSString *identifier;
|
@property (nonnull, nonatomic, strong) NSString *identifier;
|
||||||
|
|
||||||
/// Legacy flag for if this operation will have an alert to show when finished.
|
/// Legacy flag for if this operation will have an alert to show when finished.
|
||||||
@property (nonatomic, readonly) BOOL alertToShow;
|
@property (nonatomic, readonly) BOOL alertToShow;
|
||||||
|
|||||||
@ -35,7 +35,6 @@
|
|||||||
// For temporarily storing any alert to show until we determine it's delegate.
|
// For temporarily storing any alert to show until we determine it's delegate.
|
||||||
@property (nonatomic, readwrite) BOOL alertToShow;
|
@property (nonatomic, readwrite) BOOL alertToShow;
|
||||||
@property (strong, nonatomic, nullable) MVMCoreErrorObject *errorForAlertToShow;
|
@property (strong, nonatomic, nullable) MVMCoreErrorObject *errorForAlertToShow;
|
||||||
@property (nullable, nonatomic, readwrite) NSString *identifier;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -159,7 +158,7 @@
|
|||||||
[MVMCoreLoadRequestOperation handleLoadObject:loadObject error:nil];
|
[MVMCoreLoadRequestOperation handleLoadObject:loadObject error:nil];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(loadObject.requestParameters.pageType) {
|
if(!loadObject.requestParameters.backgroundRequest && loadObject.requestParameters.pageType) {
|
||||||
[[MVMCoreLoggingHandler sharedLoggingHandler] logPageLoadStartedFor:loadObject.requestParameters.pageType requestUUID:loadObject.identifier requestURL:@"requestURL"];
|
[[MVMCoreLoggingHandler sharedLoggingHandler] logPageLoadStartedFor:loadObject.requestParameters.pageType requestUUID:loadObject.identifier requestURL:@"requestURL"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +167,7 @@
|
|||||||
|
|
||||||
NSString *serverProcessTime = [(NSDictionary *)json objectChainOfKeysOrIndexes:@[@"ResponseInfo", @"timeStamp"]] ?: @"0";
|
NSString *serverProcessTime = [(NSDictionary *)json objectChainOfKeysOrIndexes:@[@"ResponseInfo", @"timeStamp"]] ?: @"0";
|
||||||
|
|
||||||
if(loadObject.requestParameters.pageType && serverProcessTime) {
|
if(!loadObject.requestParameters.backgroundRequest && loadObject.requestParameters.pageType && serverProcessTime) {
|
||||||
[[MVMCoreLoggingHandler sharedLoggingHandler] logPageLoadCompleteFor:loadObject.requestParameters.pageType serverProcessingTime:serverProcessTime requestURL:@"requestURL" requestUUID:loadObject.identifier isFromCache:loadObject.pageDataFromCache];
|
[[MVMCoreLoggingHandler sharedLoggingHandler] logPageLoadCompleteFor:loadObject.requestParameters.pageType serverProcessingTime:serverProcessTime requestURL:@"requestURL" requestUUID:loadObject.identifier isFromCache:loadObject.pageDataFromCache];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -162,6 +162,10 @@ extension MVMCoreLoggingHandler {
|
|||||||
|
|
||||||
@objc public extension MVMCoreLoggingHandler {
|
@objc public extension MVMCoreLoggingHandler {
|
||||||
|
|
||||||
|
@objc func pageStarted(for pageType: String, requestUUID: String) {
|
||||||
|
logCoreEvent(.pageStarted(pageType: pageType, requestUUID: requestUUID))
|
||||||
|
}
|
||||||
|
|
||||||
@objc func logPageLoadStarted(for pageType: String, requestUUID: String, requestURL: String) {
|
@objc func logPageLoadStarted(for pageType: String, requestUUID: String, requestURL: String) {
|
||||||
logCoreEvent(.pageLoadStarted(pageType: pageType, requestUUID: requestUUID, requestURL: requestURL))
|
logCoreEvent(.pageLoadStarted(pageType: pageType, requestUUID: requestUUID, requestURL: requestURL))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user