From 9803c269a02755cb0ab381154dfe7caa09686be7 Mon Sep 17 00:00:00 2001 From: "Sankari, Swathi S" Date: Fri, 3 Sep 2021 17:44:18 +0530 Subject: [PATCH 1/3] Tabslistitem molecule action --- .../Atomic/Molecules/HorizontalCombinationViews/Tabs.swift | 6 +++++- MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index 804075ff..c2df0909 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -244,7 +244,11 @@ extension Tabs: UICollectionViewDelegateFlowLayout { tabCell.setNeedsDisplay() tabCell.setNeedsLayout() tabCell.layoutIfNeeded() - delegate?.didSelectItem(indexPath, tabs: self) + if let delegate = delegate { + delegate.didSelectItem(indexPath, tabs: self) + } else if let action = tabsModel.tabs[selectedIndex].action { + MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: nil, delegateObject:delegateObject) + } } } diff --git a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift index a636b90b..6d49cdfe 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift @@ -67,6 +67,9 @@ extension TabsTableViewCell: TabsDelegate { let index = indexPath.row guard let model = tabsListItemModel, index < model.molecules.count else { return } + if let action = model.tabs.tabs[index].action { + MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: nil, delegateObject:delegateObject) + } MVMCoreActionHandler.shared()?.asyncHandleAction(with: AddMoleculesActionModel(index < previousTabIndex ? .left : .right), additionalData: [KeySourceModel: model], delegateObject: delegateObject) } } From acbb26bbd82e8093b15b985e3dc773adead977a3 Mon Sep 17 00:00:00 2001 From: "Sankari, Swathi S" Date: Fri, 3 Sep 2021 21:08:49 +0530 Subject: [PATCH 2/3] passing sourcemodel --- .../Atomic/Molecules/HorizontalCombinationViews/Tabs.swift | 2 +- MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index c2df0909..139a3d06 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -247,7 +247,7 @@ extension Tabs: UICollectionViewDelegateFlowLayout { if let delegate = delegate { delegate.didSelectItem(indexPath, tabs: self) } else if let action = tabsModel.tabs[selectedIndex].action { - MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: nil, delegateObject:delegateObject) + MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: tabsModel], delegateObject:delegateObject) } } } diff --git a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift index 6d49cdfe..7eeffb08 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift @@ -68,7 +68,7 @@ extension TabsTableViewCell: TabsDelegate { guard let model = tabsListItemModel, index < model.molecules.count else { return } if let action = model.tabs.tabs[index].action { - MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: nil, delegateObject:delegateObject) + MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: model], delegateObject:delegateObject) } MVMCoreActionHandler.shared()?.asyncHandleAction(with: AddMoleculesActionModel(index < previousTabIndex ? .left : .right), additionalData: [KeySourceModel: model], delegateObject: delegateObject) } From 5bfef340f15f4202b8709ec81c97bcc3f859a0ae Mon Sep 17 00:00:00 2001 From: "Sankari, Swathi S" Date: Fri, 3 Sep 2021 21:27:12 +0530 Subject: [PATCH 3/3] passing tabs as sourcemodel --- MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift index 7eeffb08..d3b91b11 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift @@ -68,7 +68,7 @@ extension TabsTableViewCell: TabsDelegate { guard let model = tabsListItemModel, index < model.molecules.count else { return } if let action = model.tabs.tabs[index].action { - MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: model], delegateObject:delegateObject) + MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: model.tabs], delegateObject:delegateObject) } MVMCoreActionHandler.shared()?.asyncHandleAction(with: AddMoleculesActionModel(index < previousTabIndex ? .left : .right), additionalData: [KeySourceModel: model], delegateObject: delegateObject) }