Skip to content
Merged
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
1,120 changes: 572 additions & 548 deletions Keychy/Keychy.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

35 changes: 13 additions & 22 deletions Keychy/Keychy/Core/Navigation/Routes/WorkshopRoute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
//
// Created by 길지훈 on 10/16/25.
//
import UIKit
import Foundation

/// 공방 탭 라우팅
/// 공방 탭 라우팅 (마켓플레이스 + 키링 제작)
enum WorkshopRoute: Hashable {
// MARK: - 공통 프리뷰
// MARK: - 공방 마켓플레이스
case workshopPreview(item: AnyHashable)
case coinCharge
case myItems
case workshopTemplates

// MARK: - Festival 임시 라우트 (추후 정리 예정)
case showcase25BoardView
case festivalKeyringDetailView(Keyring)

// MARK: - 아크릴 포토 템플릿
case acrylicPhotoPreview
Expand All @@ -18,12 +25,9 @@ enum WorkshopRoute: Hashable {
case acrylicPhotoCustomizing
case acrylicPhotoInfoInput
case acrylicPhotoComplete
case coinCharge
case myItems
case workshopTemplates

// MARK: - 네온 사인 템플릿
case NeonSignPreView
case neonSignPreview
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이놈 슬슬 없애도 될듯...ㅋㅋㅋ

case neonSignCustomizing
case neonSignInfoInput
case neonSignComplete
Expand All @@ -33,7 +37,7 @@ enum WorkshopRoute: Hashable {
case polaroidCustomizing
case polaroidInfoInput
case polaroidComplete

// MARK: - 클리어 스케치 템플릿
case clearSketchPreview
case clearSketchDrawing
Expand All @@ -48,30 +52,20 @@ enum WorkshopRoute: Hashable {
case pixelCustomizing
case pixelInfoInput
case pixelComplete

// MARK: - 임시 페스티벌 라우트
case showcase25BoardView
case festivalKeyringDetailView(Keyring)

// MARK: - 말풍선 키링 템플릿
case speechBubblePreview
case speechBubbleCustomizing
case speechBubbleInfoInput
case speechBubbleComplete

// MARK: - 새로운 템플릿의 루트는 이렇게 추가해주면 됩니다. (예정)
// case hkPreview
// case hkCustomizing
// case hkInfoInput
// case hkComplete

/// template.id 문자열을 WorkshopRoute로 변환
static func from(string: String) -> WorkshopRoute? {
switch string {
case "AcrylicPhoto":
return .acrylicPhotoPreview
case "NeonSign":
return .NeonSignPreView
return .neonSignPreview
case "Polaroid":
return .polaroidPreview
case "ClearSketch":
Expand All @@ -80,11 +74,8 @@ enum WorkshopRoute: Hashable {
return .pixelPreview
case "SpeechBubble":
return .speechBubblePreview

// 필요한 프리뷰 케이스들 추가
default:
return nil
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Showcase25BoardViewModel {
var userKeyrings: [Keyring] = []
var selectedKeyringIndex: Int = 0

// MARK: - Festival에서 Workshop으로 갔을 때 사용
// MARK: - Festival에서 KeyringMaker로 갔을 때 사용
var isFromFestivalTab: Bool = false
var onKeyringCompleteFromFestival: ((NavigationRouter<WorkshopRoute>) -> Void)?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Photos

struct FestivalKeyringDetailView: View {
@Bindable var festivalRouter: NavigationRouter<FestivalRoute>
@Bindable var workshopRouter: NavigationRouter<WorkshopRoute>
@Bindable var viewModel: Showcase25BoardViewModel

@State var userManager = UserManager.shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ extension Showcase25BoardView {
Button {
dismissSheet()
viewModel.isFromFestivalTab = true

viewModel.onKeyringCompleteFromFestival = { workshopRouter in
workshopRouter.reset()
workshopRouter.push(.showcase25BoardView)
}

onNavigateToWorkshop?(.workshopTemplates)
} label: {
Text("+ 만들기")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import NukeUI
import FirebaseFirestore

struct Showcase25BoardView: View {

@Bindable var festivalRouter: NavigationRouter<FestivalRoute>
@Bindable var workshopRouter: NavigationRouter<WorkshopRoute>
@Bindable var viewModel: Showcase25BoardViewModel
@Environment(\.scenePhase) private var scenePhase

// 위치 기반 체크용
@State var locationManager = LocationManager()


var onNavigateToKeyringMaker: ((WorkshopRoute) -> Void)? = nil
var onNavigateToWorkshop: ((WorkshopRoute) -> Void)? = nil
var isFromFestivalTab: Bool = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct KeyringCompleteView<VM: KeyringViewModelProtocol>: View {

var userManager: UserManager = UserManager.shared
var reviewManager: ReviewManager = ReviewManager.shared

// Festival에서 왔을 때 처리용 옵셔널 콜백
var onCloseFromFestival: ((NavigationRouter<WorkshopRoute>) -> Void)?

Expand Down
16 changes: 14 additions & 2 deletions Keychy/Keychy/Presentation/Tab/ViewModels/MainTabViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ class MainTabViewModel {
/// Festival 탭에서 Workshop 탭으로 전환하고 특정 라우트로 이동
/// - Parameter route: 이동할 WorkshopRoute
func handleSwitchToWorkshop(_ route: WorkshopRoute) {
festivalViewModel.isFromFestivalTab = true

selectedTab = TabIndex.workshop.rawValue
Task { @MainActor in
try? await Task.sleep(for: .seconds(Delay.tabSwitchAnimation))
workshopRouter.push(route)
}
}

/// Festival 탭에서 KeyringMaker로 전환하고 특정 라우트로 이동
/// - Parameter route: 이동할 WorkshopRoute (키링 제작 라우트)
func handleSwitchToKeyringMaker(_ route: WorkshopRoute) {
setupFestivalReturnCallback()

selectedTab = TabIndex.workshop.rawValue
Expand All @@ -91,10 +103,10 @@ class MainTabViewModel {
}

// MARK: - Private Methods
/// Festival → Workshop 이동 시 완료 후 복귀 콜백 설정
/// Festival → KeyringMaker 이동 시 완료 후 복귀 콜백 설정
private func setupFestivalReturnCallback() {
festivalViewModel.isFromFestivalTab = true
festivalViewModel.onKeyringCompleteFromFestival = { [weak self] router in
festivalViewModel.onKeyringCompleteFromFestival = { [weak self] (router: NavigationRouter<WorkshopRoute>) in
guard let self = self else { return }
router.reset()
self.selectedTab = TabIndex.festival.rawValue
Expand Down
11 changes: 6 additions & 5 deletions Keychy/Keychy/Presentation/Tab/Views/FestivalTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import SwiftUI

struct FestivalTab: View {
@Bindable var router: NavigationRouter<FestivalRoute>
@Bindable var workshopRouter: NavigationRouter<WorkshopRoute>
@Bindable var showcaseVM: Showcase25BoardViewModel
var onSwitchToKeyringMaker: ((WorkshopRoute) -> Void)? = nil
var onSwitchToWorkshop: ((WorkshopRoute) -> Void)? = nil

var body: some View {
NavigationStack(path: $router.path) {
FestivalView(router: router)
Expand All @@ -21,19 +21,20 @@ struct FestivalTab: View {
case .showcase25BoardView:
Showcase25BoardView(
festivalRouter: router,
workshopRouter: workshopRouter,
viewModel: showcaseVM,
onNavigateToKeyringMaker: { route in
onSwitchToKeyringMaker?(route)
},
onNavigateToWorkshop: { route in
onSwitchToWorkshop?(route)
}
)

case .festivalView:
FestivalView(router: router)
case .festivalKeyringDetailView(let keyring):
FestivalKeyringDetailView(
festivalRouter: router,
workshopRouter: workshopRouter,
viewModel: showcaseVM,
keyring: keyring
)
Expand Down
4 changes: 3 additions & 1 deletion Keychy/Keychy/Presentation/Tab/Views/MainTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ extension MainTabView {
private var festivalTab: some View {
FestivalTab(
router: viewModel.festivalRouter,
workshopRouter: viewModel.workshopRouter,
showcaseVM: viewModel.festivalViewModel,
onSwitchToKeyringMaker: { route in
viewModel.handleSwitchToKeyringMaker(route)
},
onSwitchToWorkshop: { route in
viewModel.handleSwitchToWorkshop(route)
}
Expand Down
Loading