From 31169e318ed33ee4a6dc5e74273411096b6fe2a6 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Thu, 11 Aug 2022 22:34:37 -0400 Subject: [PATCH] bug fixes --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 2 +- MVMCoreUI/BaseControllers/ViewController.swift | 2 +- MVMCoreUI/Managers/SubNav/SubNavManagerController.swift | 2 +- MVMCoreUI/OtherHandlers/MVMCoreUIActionHandler.swift | 5 +++++ MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift | 3 +++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index 4f4801c6..8818107b 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -210,7 +210,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style){ self.style = style setFacade(by: style) - } else if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style { ///Reading the style param from context which is set is molecules, ex: TwoButtonView + } else if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style { ///Reading the style param from context which is set is molecules, ex: TwoButtonView self.style = style setFacade(by: style) } else { ///Default style diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index e0de37f1..09ae06c8 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -460,7 +460,7 @@ import MVMCore do { if let behavior = behaviors?.compactMap({ $0 as? PageCustomActionHandlerBehavior }).first(where: { $0.canHandleAction(with: model, additionalData: additionalData) }) { - delegateObject?.actionDelegate?.logAction?(withActionInformation: model.toJSON(), additionalData: additionalData) + logAction(withActionInformation: model.toJSON(), additionalData: additionalData) try await behavior.handleAction(with: model, additionalData: additionalData) } else { try await MVMCoreUIActionHandler.shared()?.handleAction(with: model, additionalData: additionalData, delegateObject: delegateObject) diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index 6ef2b8d0..e8660a51 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -155,7 +155,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, /// Logs the action for the selected tab. open func trackSelectTab() { guard let action = tabs.tabsModel?.tabs[tabs.selectedIndex].action else { return } - MVMCoreUIActionHandler.shared()?.logAction(with: action, additionalData: getAdditionalDataForNewTabLoad(indexPath: IndexPath(row: tabs.selectedIndex, section: 0)), delegateObject: delegateObjectIVar) + MVMCoreUIActionHandler.shared()?.logAction(with: action.toJSON(), additionalData: getAdditionalDataForNewTabLoad(indexPath: IndexPath(row: tabs.selectedIndex, section: 0)), delegateObject: delegateObjectIVar) } /// Allow override of additioonal data for tab press action diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIActionHandler.swift b/MVMCoreUI/OtherHandlers/MVMCoreUIActionHandler.swift index 230e7978..f4f0461a 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIActionHandler.swift +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIActionHandler.swift @@ -25,6 +25,11 @@ import SafariServices } } + open override func logAction(with JSON: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) { + // Legacy logging. + delegateObject?.actionDelegate?.logAction?(withActionInformation: JSON, additionalData: additionalData) ?? MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: nil, actionInformation: JSON, additionalData: additionalData) + } + @objc(openURLInSafariWebView:) @MainActor open func openURL(inSafariWebView url: URL) { diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift index d7747383..0ae1e879 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift @@ -7,6 +7,7 @@ // import Foundation +import MVMCore /// Allows top alerts to determine the status bar color and style. protocol StatusBarUI { @@ -138,3 +139,5 @@ public extension MVMCoreUITopAlertView { } } } + +extension MVMCoreUITopAlertView: ActionDelegateProtocol {}