File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,11 @@ extension PointOfSaleAggregateModel {
106106 func loadNextItems( base: ItemListBaseItem ) async {
107107 await itemsController. loadNextItems ( base: base)
108108 }
109+
110+ func switchToItemType( _ type: ItemType ) {
111+ // TODO: Switch between controllers controller: products or coupons
112+ debugPrint ( " 🍍 Switching to \( type) " )
113+ }
109114}
110115
111116// MARK: - Cart
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ struct ItemListView: View {
2020 private var shouldShowCoupons : Bool {
2121 ServiceLocator . featureFlagService. isFeatureFlagEnabled ( . enableCouponsInPointOfSale)
2222 }
23+
24+ @State private var selectedItemType : ItemType = . products
2325
2426 var body : some View {
2527 if #available( iOS 18 . 0 , * ) {
@@ -41,12 +43,12 @@ struct ItemListView: View {
4143
4244 HStack {
4345 Button ( action: {
44- toggleItemType ( )
46+ displayItemType ( . products )
4547 } , label: {
4648 Text ( " Products " )
4749 } )
4850 Button ( action: {
49- toggleItemType ( )
51+ displayItemType ( . coupons )
5052 } , label: {
5153 Text ( " Coupons " )
5254 } )
@@ -160,8 +162,9 @@ private extension ItemListView {
160162 itemListState. eligibleToShowSimpleProductsBanner && !isHeaderBannerDismissed
161163 }
162164
163- func toggleItemType( ) {
164- debugPrint ( " 🍍 Toggle ItemType tapped " )
165+ func displayItemType( _ itemType: ItemType ) {
166+ selectedItemType = itemType
167+ posModel. switchToItemType ( itemType)
165168 }
166169}
167170
You can’t perform that action at this time.
0 commit comments