From ec70621ea088f3a89e20a47a9f814f04163f25d1 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 28 Sep 2022 10:15:57 +0530 Subject: [PATCH] Changed to read and set requestUrl in restart action. --- MVMCore/MVMCore/ActionHandling/ActionRestartHandler.swift | 2 +- MVMCore/MVMCore/ActionHandling/ActionRestartModel.swift | 4 +++- MVMCore/MVMCore/Session/MVMCoreSessionObject.h | 2 +- MVMCore/MVMCore/Session/MVMCoreSessionObject.m | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/ActionRestartHandler.swift b/MVMCore/MVMCore/ActionHandling/ActionRestartHandler.swift index 20e7a90..8e1e56f 100644 --- a/MVMCore/MVMCore/ActionHandling/ActionRestartHandler.swift +++ b/MVMCore/MVMCore/ActionHandling/ActionRestartHandler.swift @@ -26,7 +26,7 @@ open class ActionRestartHandler: MVMCoreActionHandlerProtocol { continuation.resume(throwing: MVMCoreError.errorObject(error)) } else { // Restarts the app (forcing any passed in page types). - MVMCoreSessionObject.sharedGlobal()?.restartSession(withPageType: model.pageType, parameters: model.extraParameters.toJSON(), clearAllVariables: true) + MVMCoreSessionObject.sharedGlobal()?.restartSession(withPageType: model.pageType, requestUrl: model.requestUrl, parameters: model.extraParameters?.toJSON(), clearAllVariables: true) continuation.resume() } }) diff --git a/MVMCore/MVMCore/ActionHandling/ActionRestartModel.swift b/MVMCore/MVMCore/ActionHandling/ActionRestartModel.swift index 7cc2d26..fee5496 100644 --- a/MVMCore/MVMCore/ActionHandling/ActionRestartModel.swift +++ b/MVMCore/MVMCore/ActionHandling/ActionRestartModel.swift @@ -14,6 +14,7 @@ public struct ActionRestartModel: ActionModelProtocol { public static var identifier: String = "restart" public var actionType: String = ActionRestartModel.identifier + public var requestUrl: String? public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? @@ -24,8 +25,9 @@ public struct ActionRestartModel: ActionModelProtocol { // MARK: - Initializer //-------------------------------------------------- - public init(_ pageType: String? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) { + public init(_ pageType: String? = nil, _ requestUrl: String? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) { self.pageType = pageType + self.requestUrl = requestUrl self.extraParameters = extraParameters self.analyticsData = analyticsData } diff --git a/MVMCore/MVMCore/Session/MVMCoreSessionObject.h b/MVMCore/MVMCore/Session/MVMCoreSessionObject.h index 8c86697..e82fa04 100644 --- a/MVMCore/MVMCore/Session/MVMCoreSessionObject.h +++ b/MVMCore/MVMCore/Session/MVMCoreSessionObject.h @@ -36,7 +36,7 @@ - (nullable NSDictionary *)getInitialParametersExcludingSections:(nullable NSSet *)excludeSections; /// Restarts the application session state. Can clear variables and pass a page type if needed. -- (void)restartSessionWithPageType:(nullable NSString *)pageType parameters:(nullable NSDictionary *)parameters clearAllVariables:(BOOL)clearAllVariables; +- (void)restartSessionWithPageType:(nullable NSString *)pageType requestUrl:(nullable NSString *)requestUrl parameters:(nullable NSDictionary *)parameters clearAllVariables:(BOOL)clearAllVariables; /// Redirect, leaving the current app experience. - (void)redirectWithInfo:(nullable NSDictionary *)dictionary; diff --git a/MVMCore/MVMCore/Session/MVMCoreSessionObject.m b/MVMCore/MVMCore/Session/MVMCoreSessionObject.m index bcdf390..c52913d 100644 --- a/MVMCore/MVMCore/Session/MVMCoreSessionObject.m +++ b/MVMCore/MVMCore/Session/MVMCoreSessionObject.m @@ -36,7 +36,7 @@ return nil; } -- (void)restartSessionWithPageType:(nullable NSString *)pageType parameters:(nullable NSDictionary *)parameters clearAllVariables:(BOOL)clearAllVariables { +- (void)restartSessionWithPageType:(nullable NSString *)pageType requestUrl:(nullable NSString*)requestUrl parameters:(nullable NSDictionary *)parameters clearAllVariables:(BOOL)clearAllVariables { // Clears the singletons of any session related data. if (clearAllVariables) { [self clearSessionObject];