From 4254e63993aea373ad5e06ad2072f81697126f1e Mon Sep 17 00:00:00 2001 From: Damodaram Date: Thu, 17 Sep 2020 19:52:33 +0530 Subject: [PATCH] sending model json --- MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift | 6 +++++- MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift | 2 +- MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift | 2 +- MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift index fc6607b1..6e52e735 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift @@ -24,6 +24,10 @@ import MVMCore var groupName: String? var delegateObject: MVMCoreUIDelegateObject? + public var checkboxModel: CheckboxModel? { + return model as? CheckboxModel + } + public static let defaultHeightWidth: CGFloat = 18.0 /// If true the border of this checkbox will be circular. @@ -393,7 +397,7 @@ import MVMCore private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { if let actionMap = actionModel.toJSON() { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: checkboxModel?.toJSON(), delegateObject: delegateObject) } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift index 7b8b5703..793348c9 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift @@ -139,7 +139,7 @@ open class RadioBox: Control, MFButtonProtocol { isSelected = true radioBoxModel?.selected = isSelected if let actionModel = radioBoxModel?.action { - Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: nil) + Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: radioBoxModel?.toJSON()) } layer.setNeedsDisplay() } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift index e1f3ab93..30cc4bb8 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift @@ -100,7 +100,7 @@ import UIKit isSelected = !isSelected } if let actionModel = radioModel?.action, isSelected { - Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: nil) + Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: radioModel?.toJSON()) } _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) setNeedsDisplay() diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift index 3184feb4..f921616f 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift @@ -121,7 +121,7 @@ open class RadioSwatch: Control, MFButtonProtocol { isSelected = true radioSwatchModel?.selected = isSelected if let actionModel = radioSwatchModel?.action { - Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: nil) + Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: radioSwatchModel?.toJSON()) } layer.setNeedsDisplay() }