From 767ca5c58ad6131c80630a5c41f0c68b5ff8a29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csubrra7=E2=80=9D?= <“ramya.subramaniam@verizon.com”> Date: Tue, 14 Jul 2020 21:05:35 +0530 Subject: [PATCH] updating handle action when server send response --- .../Templates/ModalMoleculeListTemplate.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift b/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift index 63140e6e..bfae5168 100644 --- a/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift @@ -7,15 +7,12 @@ // import UIKit - - open class ModalMoleculeListTemplate: MoleculeListTemplate { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- public var closeButton: Button? - //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- @@ -23,8 +20,14 @@ open class ModalMoleculeListTemplate: MoleculeListTemplate { override open func handleNewData() { super.handleNewData() - closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in - MVMCoreNavigationHandler.shared()?.removeCurrentViewController() + closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { [weak self] _ in + if let self = self { + guard let actionMap = self.loadObject?.pageJSON?.optionalDictionaryWithChainOfKeysOrIndexes([KeyButtonMap,"CloseButton"]) else { + MVMCoreNavigationHandler.shared()?.removeCurrentViewController() + return + } + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: self.delegateObjectIVar) + } }) }