diff --git a/.DS_Store b/.DS_Store index ebca8ab..42413ef 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/OneStep.xcodeproj/project.xcworkspace/xcuserdata/kimkyengdong.xcuserdatad/UserInterfaceState.xcuserstate b/OneStep.xcodeproj/project.xcworkspace/xcuserdata/kimkyengdong.xcuserdatad/UserInterfaceState.xcuserstate index f574491..f27a0d7 100644 Binary files a/OneStep.xcodeproj/project.xcworkspace/xcuserdata/kimkyengdong.xcuserdatad/UserInterfaceState.xcuserstate and b/OneStep.xcodeproj/project.xcworkspace/xcuserdata/kimkyengdong.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/OneStep/ContentView.swift b/OneStep/ContentView.swift index f8610ee..f3863b6 100644 --- a/OneStep/ContentView.swift +++ b/OneStep/ContentView.swift @@ -38,9 +38,9 @@ struct ContentView: View { case .mission: MissionView(missionPath: $missionPath, isOnCamera: $isOnCamera, isShowAnalysis: $isShowAnalysis, capturedImage: $capturedImage) case .store: - ShopView(purchaseManager: purchaseManager) + ShopView(path: $missionPath, purchaseManager: purchaseManager) case .my: - MyView(manager:manager, infoManager:infoManager) + MyView(path: $missionPath, manager:manager, infoManager:infoManager) } CustomTabView(tabSelection: $tabSelection) @@ -54,7 +54,9 @@ struct ContentView: View { InfoModal(manager: infoManager) } if purchaseManager.isShowingPurchase { - PurchaseModal() + PurchaseModal(purchaseManager: purchaseManager) + .ignoresSafeArea() + .zIndex(2) // 항상 최상단 } } .navigationDestination(for: String.self) { value in @@ -70,6 +72,17 @@ struct ContentView: View { .fullScreenCover(isPresented: $showTutorial) { TutorialView(missionPath: $missionPath, showTutorial: $showTutorial, page: $page) } + .fullScreenCover(isPresented: $purchaseManager.isShowingPurchase) { + PurchaseModal(purchaseManager: purchaseManager) + .background(Color.clear) + } + .fullScreenCover(isPresented: $manager.showModal) { + if let selected = manager.selectedCoupon { + CouponModal(coupon: selected, manager: manager) + .background(Color.clear) + } + } + } } diff --git a/OneStep/View/MyView/MyView.swift b/OneStep/View/MyView/MyView.swift index 4c302a6..5ca1d31 100644 --- a/OneStep/View/MyView/MyView.swift +++ b/OneStep/View/MyView/MyView.swift @@ -1,11 +1,12 @@ import SwiftUI struct MyView: View { + @Binding var path:NavigationPath + @ObservedObject var manager = CouponManager() @ObservedObject var infoManager = InfoManager() @StateObject private var viewModel = MyViewModel() - @State private var path = NavigationPath() let appleToken = UserDefaults.standard.string(forKey: "appleToken") ?? "" let name = UserDefaults.standard.string(forKey: "appleUserName") ?? "사용자" @@ -286,7 +287,7 @@ struct SettingsCardView: View { .padding(.horizontal, 20) } } - -#Preview { - MyView() -} +// +//#Preview { +// MyView() +//} diff --git a/OneStep/View/ShopView/ShopCategoryView.swift b/OneStep/View/ShopView/ShopCategoryView.swift index 032019c..b08ded5 100644 --- a/OneStep/View/ShopView/ShopCategoryView.swift +++ b/OneStep/View/ShopView/ShopCategoryView.swift @@ -9,6 +9,7 @@ import SwiftUI struct ShopCategoryView: View { @Binding var path: NavigationPath + @ObservedObject var purchaseManager: PurchaseManager let myCoin:Int = 22000 let productList: [Product] = mockProducts var categoryName: String @@ -22,7 +23,7 @@ struct ShopCategoryView: View { ScrollView { VStack(spacing: 12) { ForEach(productList, id: \.self) { product in - ProductItem(product: product) + ProductItem(product: product, purchaseManager: purchaseManager) } } } diff --git a/OneStep/View/ShopView/ShopMainView.swift b/OneStep/View/ShopView/ShopMainView.swift index 534abb6..10f424e 100644 --- a/OneStep/View/ShopView/ShopMainView.swift +++ b/OneStep/View/ShopView/ShopMainView.swift @@ -10,6 +10,8 @@ import SwiftUI struct ShopMainView: View { @Binding var path : NavigationPath + @ObservedObject var purchaseManager: PurchaseManager + var myCoin: Int = 2200 let Categorys: [String: String] = ["식사":"Meal", "영화":"Film", "생필품":"Live", "과자":"Snack", "카페":"Cafe", "화장품":"Beauty"] let productList: [Product] = mockProducts @@ -72,7 +74,7 @@ struct ShopMainView: View { .font(.system(size:20)) .foregroundColor(SwiftUI.Color.black) ForEach(productList, id: \.self){ product in - ProductItem(product:product) + ProductItem(product:product, purchaseManager: purchaseManager) } } diff --git a/OneStep/View/ShopView/ShopView.swift b/OneStep/View/ShopView/ShopView.swift index 9d08870..a68137b 100644 --- a/OneStep/View/ShopView/ShopView.swift +++ b/OneStep/View/ShopView/ShopView.swift @@ -10,20 +10,16 @@ import SwiftUI struct ShopView: View { - @State private var path = NavigationPath() + @Binding var path:NavigationPath @ObservedObject var purchaseManager: PurchaseManager + var body: some View { ZStack{ - NavigationStack(path:$path){ - ShopMainView(path:$path) - .navigationDestination(for: String.self) { item in - ShopCategoryView(path:$path, categoryName: item) - } - } - - + ShopMainView(path:$path, purchaseManager: purchaseManager ) + .navigationDestination(for: String.self) { item in + ShopCategoryView(path:$path, purchaseManager: purchaseManager, categoryName: item) + } } - .environmentObject(purchaseManager) } } @@ -32,7 +28,7 @@ struct ShopView: View { struct ProductItem: View { var product: Product - @EnvironmentObject var purchaseManager: PurchaseManager + @ObservedObject var purchaseManager: PurchaseManager var body: some View { HStack(spacing: 15) { @@ -90,7 +86,7 @@ struct ProductItem: View { struct PurchaseModal: View { - @EnvironmentObject var purchaseManager: PurchaseManager + @ObservedObject var purchaseManager: PurchaseManager var body: some View { ZStack {