From 13a7a6f2726ae657816da4b6f66d18a5f15fe402 Mon Sep 17 00:00:00 2001 From: Roy-wonji Date: Sun, 10 Dec 2023 18:46:03 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8[feat]:=20=20=20=EB=91=98=EB=9F=AC?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PingPong/Projects/App/Project.swift | 5 +++-- .../App/Sources/Application/PingPongApp.swift | 20 ++++++++++++++++--- .../Sources/UI/View/TabView/CoreView.swift | 1 - .../UI/ViewModel/HomeViewViewModel.swift | 4 ++-- .../Sources/UI/View/MainView/LoginView.swift | 2 +- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/PingPong/Projects/App/Project.swift b/PingPong/Projects/App/Project.swift index 49887922..652e55f6 100644 --- a/PingPong/Projects/App/Project.swift +++ b/PingPong/Projects/App/Project.swift @@ -18,12 +18,13 @@ let project = Project.makeAppModule( platform: .iOS, product: .app, packages: [ // packages를 추가하여 Amplify 라이브러리 추가 - + .package(url: "https://github.com/firebase/firebase-ios-sdk.git", .upToNextMajor(from: "10.0.0")) ], setting: .appMainSetting, dependencies: [ + // .package(product: "FirebaseMessaging"), -// .package(product: "FirebaseMessaging", type: .plugin), + .package(product: "FirebaseMessaging", type: .plugin), .SPM.FirebaseMessaging, .feature(implements: .OnBoarding) diff --git a/PingPong/Projects/App/Sources/Application/PingPongApp.swift b/PingPong/Projects/App/Sources/Application/PingPongApp.swift index 54590a5e..a80f895a 100644 --- a/PingPong/Projects/App/Sources/Application/PingPongApp.swift +++ b/PingPong/Projects/App/Sources/Application/PingPongApp.swift @@ -17,6 +17,7 @@ import Search import Profile import DesignSystem import Model +import API @main struct PingPongProjectApp: App { @@ -36,7 +37,11 @@ struct PingPongProjectApp: App { .environmentObject(sheetManager) .navigationBarHidden(true) .onAppear { - authViewModel.getRefreshToken() + if commonViewViewModel.isLoginCheck { + authViewModel.getRefreshToken() + } else { + APIHeaderManger.shared.firebaseUid = "" + } } } else if commonViewViewModel.isExploreApp { @@ -45,7 +50,12 @@ struct PingPongProjectApp: App { .environmentObject(sheetManager) .navigationBarHidden(true) .onAppear { - authViewModel.getRefreshToken() + if commonViewViewModel.isLoginCheck { + + authViewModel.getRefreshToken() + } else { + APIHeaderManger.shared.firebaseUid = "" + } } } @@ -53,7 +63,11 @@ struct PingPongProjectApp: App { else { LoginView(viewModel: self.viewModel, commonViewViewModel: commonViewViewModel) .onAppear { - authViewModel.getRefreshToken() + if commonViewViewModel.isLoginCheck { + authViewModel.getRefreshToken() + } else { + APIHeaderManger.shared.firebaseUid = "" + } } } diff --git a/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/CoreView.swift b/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/CoreView.swift index 93c8f94a..182cd478 100644 --- a/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/CoreView.swift +++ b/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/CoreView.swift @@ -84,7 +84,6 @@ public struct CoreView: View { } } .onAppear { - authViewModel.getRefreshToken() self.viewModel.setupCustomTabs() } } diff --git a/PingPong/Projects/Feature/Home/Sources/UI/ViewModel/HomeViewViewModel.swift b/PingPong/Projects/Feature/Home/Sources/UI/ViewModel/HomeViewViewModel.swift index addc0a2f..530b8541 100644 --- a/PingPong/Projects/Feature/Home/Sources/UI/ViewModel/HomeViewViewModel.swift +++ b/PingPong/Projects/Feature/Home/Sources/UI/ViewModel/HomeViewViewModel.swift @@ -42,13 +42,13 @@ public class HomeViewViewModel: ObservableObject { self.homeRandomQuoteModel = list } - public func randomQuoteRequest(userID: String, completion: @escaping () -> Void) { + public func randomQuoteRequest(userID: String?, completion: @escaping () -> Void) { if let cancellable = homeRandomQuoteCancellable { cancellable.cancel() } let provider = MoyaProvider(plugins: [MoyaLoggingPlugin()]) - homeRandomQuoteCancellable = provider.requestWithProgressPublisher(.homeRandomQuote(page: currentPage, sizePerPage: 100, userId: userID)) + homeRandomQuoteCancellable = provider.requestWithProgressPublisher(.homeRandomQuote(page: currentPage, sizePerPage: 100, userId: (((userID?.isEmpty) != nil) ? "" : userID) ?? "")) .compactMap { $0.response?.data } .receive(on: DispatchQueue.main) .decode(type: HomeRandomQuoteModel.self, decoder: JSONDecoder()) diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift index 799c296b..c71d4354 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift @@ -204,7 +204,7 @@ public struct LoginView: View { .stroke(Color.primaryOrange, style: .init(lineWidth: 2)) .frame(height: 56) .overlay { - Text("둘라보기") + Text("둘러보기") .foregroundStyle(Color.primaryOrangeText) .pretendardFont(family: .SemiBold, size: 16) }