Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file not shown.
19 changes: 16 additions & 3 deletions OneStep/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
}
}


}
}
Expand Down
11 changes: 6 additions & 5 deletions OneStep/View/MyView/MyView.swift
Original file line number Diff line number Diff line change
@@ -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") ?? "사용자"

Expand Down Expand Up @@ -286,7 +287,7 @@ struct SettingsCardView: View {
.padding(.horizontal, 20)
}
}

#Preview {
MyView()
}
//
//#Preview {
// MyView()
//}
3 changes: 2 additions & 1 deletion OneStep/View/ShopView/ShopCategoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion OneStep/View/ShopView/ShopMainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

}
Expand Down
20 changes: 8 additions & 12 deletions OneStep/View/ShopView/ShopView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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) {
Expand Down Expand Up @@ -90,7 +86,7 @@ struct ProductItem: View {


struct PurchaseModal: View {
@EnvironmentObject var purchaseManager: PurchaseManager
@ObservedObject var purchaseManager: PurchaseManager

var body: some View {
ZStack {
Expand Down