From dac3d4cd946cd50650703a105df775f566582ec6 Mon Sep 17 00:00:00 2001 From: Roy-wonji Date: Wed, 13 Dec 2023 23:42:34 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8[feat]:=20=20=20=EB=AA=85=EC=96=B8=20?= =?UTF-8?q?=20=EA=B4=80=EB=A0=A8=20=20=EC=88=98=EC=A0=95=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Project+Templete/Project+Templates.swift | 6 +- .../App/Sources/Application/PingPongApp.swift | 1 + .../Projects/Core/Authorization/Project.swift | 2 +- .../ViewModel/AuthorizationViewModel.swift | 24 ++-- PingPong/Projects/Core/Common/Project.swift | 2 +- .../Projects/Core/Domain/API/Project.swift | 2 +- .../Projects/Core/Domain/Model/Project.swift | 2 +- .../Core/Domain/Service/Project.swift | 2 +- PingPong/Projects/DesignSystem/Project.swift | 2 +- .../Projects/Feature/Archive/Project.swift | 2 +- PingPong/Projects/Feature/Auth/Project.swift | 2 +- PingPong/Projects/Feature/Bake/Project.swift | 2 +- .../FamousSayingBakeCardView.swift | 2 +- PingPong/Projects/Feature/Core/Project.swift | 2 +- .../Sources/UI/View/TabView/CoreView.swift | 1 + .../View/TabView/FamousSayingDetailView.swift | 4 +- PingPong/Projects/Feature/Home/Project.swift | 2 +- .../Sources/UI/View/HomeView/HomeView.swift | 111 +++++++++++++++--- .../UI/ViewModel/HomeViewViewModel.swift | 6 +- .../Projects/Feature/OnBoarding/Project.swift | 2 +- .../SelectCharacterView.swift | 4 +- .../Sources/UI/View/MainView/LoginView.swift | 5 +- .../View/MainView/OnBoardingLoginView.swift | 8 +- .../CompletOnBoardingView.swift | 2 +- .../Projects/Feature/Profile/Project.swift | 2 +- .../ChangeNickNameView.swift | 3 +- .../UI/View/MainView/ProfileView.swift | 7 +- .../NotificationQuoteView.swift | 1 - .../SelectTimeSheetView.swift | 1 + .../UI/View/WithDraw/WithDrawView.swift | 2 +- .../Projects/Feature/Search/Project.swift | 2 +- 31 files changed, 154 insertions(+), 62 deletions(-) diff --git a/PingPong/Plugins/PingPongs/ProjectDescriptionHelpers/Project+Templete/Project+Templates.swift b/PingPong/Plugins/PingPongs/ProjectDescriptionHelpers/Project+Templete/Project+Templates.swift index 8fb3a868..342b669e 100644 --- a/PingPong/Plugins/PingPongs/ProjectDescriptionHelpers/Project+Templete/Project+Templates.swift +++ b/PingPong/Plugins/PingPongs/ProjectDescriptionHelpers/Project+Templete/Project+Templates.swift @@ -12,7 +12,7 @@ public extension Project { product: Product, organizationName: String = "Wonji Suh", packages: [Package] = [], - deploymentTarget: DeploymentTarget? = .iOS(targetVersion: "16.4", devices: [.iphone]), + deploymentTarget: DeploymentTarget? = .iOS(targetVersion: "16.0", devices: [.iphone]), setting: Settings, dependencies: [TargetDependency] = [], sources: SourceFilesList = ["Sources/**"], @@ -244,14 +244,14 @@ public extension Project { } - public static func makeFramsWorkModule( + public static func makeFrameWorkModule( name: String, bundleId: String, platform: Platform = .iOS, product: Product, organizationName: String = "Wonji Suh", packages: [Package] = [], - deploymentTarget: DeploymentTarget? = .iOS(targetVersion: "16.4", devices: [.iphone]), + deploymentTarget: DeploymentTarget? = .iOS(targetVersion: "16.0", devices: [.iphone]), setting: Settings, dependencies: [TargetDependency] = [], sources: SourceFilesList = ["Sources/**"], diff --git a/PingPong/Projects/App/Sources/Application/PingPongApp.swift b/PingPong/Projects/App/Sources/Application/PingPongApp.swift index a80f895a..094a8197 100644 --- a/PingPong/Projects/App/Sources/Application/PingPongApp.swift +++ b/PingPong/Projects/App/Sources/Application/PingPongApp.swift @@ -19,6 +19,7 @@ import DesignSystem import Model import API +@available(iOS 16.4, *) @main struct PingPongProjectApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate diff --git a/PingPong/Projects/Core/Authorization/Project.swift b/PingPong/Projects/Core/Authorization/Project.swift index 4d2183f5..63f68ef3 100644 --- a/PingPong/Projects/Core/Authorization/Project.swift +++ b/PingPong/Projects/Core/Authorization/Project.swift @@ -10,7 +10,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Authorization", bundleId: .appBundleID(name: ".Authorization"), product: .staticFramework, diff --git a/PingPong/Projects/Core/Authorization/Sources/ViewModel/AuthorizationViewModel.swift b/PingPong/Projects/Core/Authorization/Sources/ViewModel/AuthorizationViewModel.swift index 90486bc4..a8b06125 100644 --- a/PingPong/Projects/Core/Authorization/Sources/ViewModel/AuthorizationViewModel.swift +++ b/PingPong/Projects/Core/Authorization/Sources/ViewModel/AuthorizationViewModel.swift @@ -58,7 +58,7 @@ public class AuthorizationViewModel: ObservableObject { var searchUserIdCancellable: AnyCancellable? var loginEmailCancellable: AnyCancellable? - @AppStorage("userId") public var userid: Int = .zero + @AppStorage("userId") public var userid: String = "" @Published public var userNickName: String = "" @Published public var userRmk: String = "" @@ -69,7 +69,7 @@ public class AuthorizationViewModel: ObservableObject { public init() { self.userSession = Auth.auth().currentUser uid = UserDefaults.standard.string(forKey: "Uid") ?? "" - userid = UserDefaults.standard.integer(forKey: "userId") + userid = UserDefaults.standard.string(forKey: "userId") ?? "" userUid = UserDefaults.standard.string(forKey: "userUid") ?? "" randomAuthNickName = UserDefaults.standard.string(forKey: "randomNickName") ?? "" @@ -273,13 +273,13 @@ public class AuthorizationViewModel: ObservableObject { }, receiveValue: { [weak self] model in if model.status == NetworkCode.success.status { self?.signupToViewModel(model) - self?.userid = model.data?.id ?? .zero + self?.userid = String(model.data?.id ?? .zero) self?.userUid = model.data?.uid ?? "" print("회원가입 성공", model) signupSuccessAction() } else { self?.signupToViewModel(model) - self?.userid = model.data?.id ?? .zero + self?.userid = String(model.data?.id ?? .zero) print("회원가입 실패", model) failSignUPAction() } @@ -291,7 +291,7 @@ public class AuthorizationViewModel: ObservableObject { } //MARK: - uid 로 회원정보 조회 - public func searchUserIdRequest(uid: String) { + public func searchUserIdRequest(uid: String, failCompletion: @escaping () -> Void) { if let cancellable = searchUserIdCancellable { cancellable.cancel() } @@ -314,12 +314,11 @@ public class AuthorizationViewModel: ObservableObject { print("아이디 조회 성공", model) self?.userNickName = model.data?.nickname ?? "" self?.userRmk = model.data?.rmk ?? "" - self?.userid = model.data?.id ?? .zero + self?.userid = String(model.data?.id ?? .zero) } else { self?.searchUserIdToViewModel(model) - print("아이디 조회 성공", model) - self?.userNickName = model.data?.nickname ?? "" - self?.userid = model.data?.id ?? .zero + print("아이디 조회 실패", model) + failCompletion() } }) } @@ -349,16 +348,15 @@ public class AuthorizationViewModel: ObservableObject { }, receiveValue: { [weak self] model in if model.status == NetworkCode.success.status { self?.signupToViewModel(model) - self?.userid = model.data?.id ?? .zero + self?.userid = String(model.data?.id ?? .zero) self?.userUid = model.data?.uid ?? "" - print("로그인 성공", model) succesCompletion(model) } else { self?.signupToViewModel(model) - self?.userid = model.data?.id ?? .zero +// self?.userid = String(model.data?.id ?? .zero) print("로그인 실패", model) - succesCompletion(model) + failLoginCompletion() } }) } diff --git a/PingPong/Projects/Core/Common/Project.swift b/PingPong/Projects/Core/Common/Project.swift index 1b310795..caab2408 100644 --- a/PingPong/Projects/Core/Common/Project.swift +++ b/PingPong/Projects/Core/Common/Project.swift @@ -10,7 +10,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Common", bundleId: .appBundleID(name: ".Common"), product: .staticFramework, diff --git a/PingPong/Projects/Core/Domain/API/Project.swift b/PingPong/Projects/Core/Domain/API/Project.swift index a2c8fe0a..bbb8703d 100644 --- a/PingPong/Projects/Core/Domain/API/Project.swift +++ b/PingPong/Projects/Core/Domain/API/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "API", bundleId: .appBundleID(name: ".API"), product: .staticFramework, diff --git a/PingPong/Projects/Core/Domain/Model/Project.swift b/PingPong/Projects/Core/Domain/Model/Project.swift index 50593f0f..1f6ce5b8 100644 --- a/PingPong/Projects/Core/Domain/Model/Project.swift +++ b/PingPong/Projects/Core/Domain/Model/Project.swift @@ -12,7 +12,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Model", bundleId: .appBundleID(name: ".Model"), product: .staticFramework, diff --git a/PingPong/Projects/Core/Domain/Service/Project.swift b/PingPong/Projects/Core/Domain/Service/Project.swift index 00f19460..5661a617 100644 --- a/PingPong/Projects/Core/Domain/Service/Project.swift +++ b/PingPong/Projects/Core/Domain/Service/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Service", bundleId: .appBundleID(name: ".Service"), product: .staticFramework, diff --git a/PingPong/Projects/DesignSystem/Project.swift b/PingPong/Projects/DesignSystem/Project.swift index 09726f62..a7f98514 100644 --- a/PingPong/Projects/DesignSystem/Project.swift +++ b/PingPong/Projects/DesignSystem/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "DesignSystem", bundleId: .appBundleID(name: "DesignSystem"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/Archive/Project.swift b/PingPong/Projects/Feature/Archive/Project.swift index afcff205..b57d1ba8 100644 --- a/PingPong/Projects/Feature/Archive/Project.swift +++ b/PingPong/Projects/Feature/Archive/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Archive", bundleId: .appBundleID(name: "Archive"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/Auth/Project.swift b/PingPong/Projects/Feature/Auth/Project.swift index 014d6b42..386f361f 100644 --- a/PingPong/Projects/Feature/Auth/Project.swift +++ b/PingPong/Projects/Feature/Auth/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Auth", bundleId: .appBundleID(name: "Auth"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/Bake/Project.swift b/PingPong/Projects/Feature/Bake/Project.swift index 0b6fa29b..0c1e7a50 100644 --- a/PingPong/Projects/Feature/Bake/Project.swift +++ b/PingPong/Projects/Feature/Bake/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Bake", bundleId: .appBundleID(name: "Bake"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/Bake/Sources/UI/HomeBakingView/FamousSayingBakeCardView.swift b/PingPong/Projects/Feature/Bake/Sources/UI/HomeBakingView/FamousSayingBakeCardView.swift index 6f3b0c5b..38783bd8 100644 --- a/PingPong/Projects/Feature/Bake/Sources/UI/HomeBakingView/FamousSayingBakeCardView.swift +++ b/PingPong/Projects/Feature/Bake/Sources/UI/HomeBakingView/FamousSayingBakeCardView.swift @@ -61,7 +61,7 @@ struct FamousSayingBakeCardView: View { self.viewModel.tmpChoicedTopping = nil } .task { - authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)") + authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)", failCompletion: {}) } .onDisappear { viewModel.tmpChoicedBread = nil diff --git a/PingPong/Projects/Feature/Core/Project.swift b/PingPong/Projects/Feature/Core/Project.swift index ae68d66b..ef5f6b9a 100644 --- a/PingPong/Projects/Feature/Core/Project.swift +++ b/PingPong/Projects/Feature/Core/Project.swift @@ -12,7 +12,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Core", bundleId: .appBundleID(name: "Core"), product: .staticFramework, 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 10a65764..bb3f3195 100644 --- a/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/CoreView.swift +++ b/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/CoreView.swift @@ -15,6 +15,7 @@ import Model import Home import Profile +@available(iOS 16.4, *) public struct CoreView: View { @EnvironmentObject var sheetManager: SheetManager @StateObject var appState: AppState = AppState() diff --git a/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/FamousSayingDetailView.swift b/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/FamousSayingDetailView.swift index 66fe1426..e780bfd4 100644 --- a/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/FamousSayingDetailView.swift +++ b/PingPong/Projects/Feature/Core/Sources/UI/View/TabView/FamousSayingDetailView.swift @@ -217,8 +217,8 @@ public struct FamousSayingDetailView: View { .onChange(of: viewModel.selectedCard.isBookrmark , perform: { newValue in if viewModel.isLoginCheck { - homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { - for quoteContent in homeViewModel.homeRandomQuoteModel?.data?.content ?? [] { + homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in + for quoteContent in model.data?.content ?? [] { let hashTags = viewModel.getHashtags(post: quoteContent) viewModel.cards.append(CardInfomation(qouteId: quoteContent.quoteID ?? .zero, hashtags: hashTags, image: "", title: quoteContent.content ?? "", sources: quoteContent.author ?? "", isBookrmark: newValue, likeId: quoteContent.likeID)) diff --git a/PingPong/Projects/Feature/Home/Project.swift b/PingPong/Projects/Feature/Home/Project.swift index 599ad927..f307df9b 100644 --- a/PingPong/Projects/Feature/Home/Project.swift +++ b/PingPong/Projects/Feature/Home/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Home", bundleId: .appBundleID(name: "Home"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/Home/Sources/UI/View/HomeView/HomeView.swift b/PingPong/Projects/Feature/Home/Sources/UI/View/HomeView/HomeView.swift index 440dec6f..44e98b55 100644 --- a/PingPong/Projects/Feature/Home/Sources/UI/View/HomeView/HomeView.swift +++ b/PingPong/Projects/Feature/Home/Sources/UI/View/HomeView/HomeView.swift @@ -48,18 +48,22 @@ public struct HomeView: View { } .navigationBarHidden(true) .task { - await authViewModel.loginWithEmail(email: authViewModel.userEmail, succesCompletion: { model in - authViewModel.userNickName = model.data?.nickname ?? "" - authViewModel.userid = model.data?.id ?? .zero - }, failLoginCompletion: {}) - authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)") +// Task { +// await authViewModel.loginWithEmail(email: authViewModel.userEmail, succesCompletion: { model in +// authViewModel.userNickName = model.data?.nickname ?? "" +// authViewModel.userid = String(model.data?.id ?? .zero) +// print("userid \(authViewModel.userid)") +// }, failLoginCompletion: { +// authViewModel.userid = "" +// }) +// authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)", failCompletion: { +// authViewModel.userid = "" +// }) +// } - } - - .onAppear { if !homeViewModel.isOn.isEmpty { - homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { - for quoteContent in homeViewModel.homeRandomQuoteModel?.data?.content ?? [] { + homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in + for quoteContent in model.data?.content ?? [] { let hashTags = viewModel.getHashtags(post: quoteContent) self.homeViewModel.isOn[quoteContent.quoteID ?? .zero].toggle() self.homeViewModel.selecteLikeYn = quoteContent.likeID != nil @@ -76,11 +80,47 @@ public struct HomeView: View { } + } + } + } else if authViewModel.userid == authViewModel.userid { + viewModel.cards = [] + homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in + for quoteContent in model.data?.content ?? [] { + let hashTags = viewModel.getHashtags(post: quoteContent) + self.homeViewModel.selecteLikeYn = quoteContent.likeID != nil + let card = CardInfomation(qouteId: quoteContent.quoteID ?? .zero, + hashtags: hashTags, image: "", + title: quoteContent.content ?? "", + sources: quoteContent.author ?? "", + isBookrmark: quoteContent.likeID != nil, + likeId: quoteContent.likeID + ) + if !viewModel.cards.contains(card) { + viewModel.cards.append(card) + } + } + } + } else if authViewModel.userid == "" || authViewModel.userid == "0" || authViewModel.userid != authViewModel.userid { + viewModel.cards = [] + homeViewModel.randomQuoteRequest(userID: "") { model in + for quoteContent in model.data?.content ?? [] { + let hashTags = viewModel.getHashtags(post: quoteContent) + self.homeViewModel.selecteLikeYn = quoteContent.likeID != nil + let card = CardInfomation(qouteId: quoteContent.quoteID ?? .zero, + hashtags: hashTags, image: "", + title: quoteContent.content ?? "", + sources: quoteContent.author ?? "", + isBookrmark: quoteContent.likeID != nil, + likeId: quoteContent.likeID + ) + if !viewModel.cards.contains(card) { + viewModel.cards.append(card) + } } } } else { - homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { - for quoteContent in homeViewModel.homeRandomQuoteModel?.data?.content ?? [] { + homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in + for quoteContent in model.data?.content ?? [] { let hashTags = viewModel.getHashtags(post: quoteContent) self.homeViewModel.selecteLikeYn = quoteContent.likeID != nil let card = CardInfomation(qouteId: quoteContent.quoteID ?? .zero, @@ -96,13 +136,56 @@ public struct HomeView: View { } } } + + } + + .onAppear { +// if !homeViewModel.isOn.isEmpty { +// homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in +// for quoteContent in model.data?.content ?? [] { +// let hashTags = viewModel.getHashtags(post: quoteContent) +// self.homeViewModel.isOn[quoteContent.quoteID ?? .zero].toggle() +// self.homeViewModel.selecteLikeYn = quoteContent.likeID != nil +// +// let card = CardInfomation(qouteId: quoteContent.quoteID ?? .zero, +// hashtags: hashTags, image: "", +// title: quoteContent.content ?? "", +// sources: quoteContent.author ?? "", +// isBookrmark: quoteContent.likeID != nil, +// likeId: quoteContent.likeID +// ) +// if !viewModel.cards.contains(card) { +// viewModel.cards.append(card) +// } +// +// +// } +// } +// } else { +// homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in +// for quoteContent in model.data?.content ?? [] { +// let hashTags = viewModel.getHashtags(post: quoteContent) +// self.homeViewModel.selecteLikeYn = quoteContent.likeID != nil +// let card = CardInfomation(qouteId: quoteContent.quoteID ?? .zero, +// hashtags: hashTags, image: "", +// title: quoteContent.content ?? "", +// sources: quoteContent.author ?? "", +// isBookrmark: quoteContent.likeID != nil, +// likeId: quoteContent.likeID +// ) +// if !viewModel.cards.contains(card) { +// viewModel.cards.append(card) +// } +// } +// } +// } } .onChange(of: viewModel.selectedCard.isBookrmark , perform: { newValue in if viewModel.isLoginCheck { - homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { + homeViewModel.randomQuoteRequest(userID: "\(authViewModel.userid)") { model in // 종아요일 때 - for quoteContent in homeViewModel.homeRandomQuoteModel?.data?.content ?? [] { + for quoteContent in model.data?.content ?? [] { let hashTags = viewModel.getHashtags(post: quoteContent) viewModel.cards.append(CardInfomation(qouteId: quoteContent.quoteID ?? .zero, hashtags: hashTags, image: "", title: quoteContent.content ?? "", sources: quoteContent.author ?? "", isBookrmark: newValue, likeId: quoteContent.likeID)) diff --git a/PingPong/Projects/Feature/Home/Sources/UI/ViewModel/HomeViewViewModel.swift b/PingPong/Projects/Feature/Home/Sources/UI/ViewModel/HomeViewViewModel.swift index 530b8541..9d35cce8 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 (HomeRandomQuoteModel) -> Void) { if let cancellable = homeRandomQuoteCancellable { cancellable.cancel() } let provider = MoyaProvider(plugins: [MoyaLoggingPlugin()]) - homeRandomQuoteCancellable = provider.requestWithProgressPublisher(.homeRandomQuote(page: currentPage, sizePerPage: 100, userId: (((userID?.isEmpty) != nil) ? "" : 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()) @@ -67,7 +67,7 @@ public class HomeViewViewModel: ObservableObject { if model.status == NetworkCode.success.status { self?.randomQuoteToViewModel(model) self?.homeViewLoading = false - completion() + completion(model) Log.network("홈 핸덤 명언 조회", model) } else { self?.randomQuoteToViewModel(model) diff --git a/PingPong/Projects/Feature/OnBoarding/Project.swift b/PingPong/Projects/Feature/OnBoarding/Project.swift index fc2ffd20..08d1dcdb 100644 --- a/PingPong/Projects/Feature/OnBoarding/Project.swift +++ b/PingPong/Projects/Feature/OnBoarding/Project.swift @@ -11,7 +11,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "OnBoarding", bundleId: .appBundleID(name: ".OnBoarding"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift index bb36b9bd..0a3083d9 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift @@ -81,7 +81,7 @@ public struct SelectCharacterView: View { .foregroundColor(.basicGray6) .onTapGesture { - viewModel.onBoardingRegisterPost(userId: authViewModel.userid, flavors: ["light", "salty", "spicy", "sweet" ,"nutty"], sources: ["greatman" , "book", "anime", "film" , "celeb"]) { + viewModel.onBoardingRegisterPost(userId: Int(authViewModel.userid) ?? .zero, flavors: ["light", "salty", "spicy", "sweet" ,"nutty"], sources: ["greatman" , "book", "anime", "film" , "celeb"]) { appState.failRegisterFlavorPOPUP.toggle() } @@ -147,7 +147,7 @@ public struct SelectCharacterView: View { .foregroundColor(viewModel.selectedCharacter.count > 0 ? .basicWhite : .basicGray5) .font(.system(size: 16)) .onTapGesture { - viewModel.onBoardingRegisterPost(userId: authViewModel.userid, flavors: [viewModel.selectedFavoriteFlavor], sources: [viewModel.selectedFavoriteCategory], failOnBoardingRegsiterAction: { + viewModel.onBoardingRegisterPost(userId: Int(authViewModel.userid) ?? .zero, flavors: [viewModel.selectedFavoriteFlavor], sources: [viewModel.selectedFavoriteCategory], failOnBoardingRegsiterAction: { appState.failRegisterFlavorPOPUP.toggle() }) commonViewViewModel.viewPath.append(ViewState.isSelectedCharacter) 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 c71d4354..130f64ac 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift @@ -18,6 +18,7 @@ import Core import Model +@available(iOS 16.4, *) public struct LoginView: View { @StateObject var appState: OnBoardingAppState = OnBoardingAppState() @StateObject var authViewModel: AuthorizationViewModel = AuthorizationViewModel() @@ -45,7 +46,7 @@ public struct LoginView: View { switch state { case .isStartLogin: - OnBoardingLoginView(viewModel: viewModel, commonViewViewModel: commonViewViewModel) + OnBoardingLoginView(viewModel: viewModel, commonViewViewModel: commonViewViewModel, authViewModel: authViewModel) .navigationBarBackButtonHidden() case .isStartEnter: OnBoardingView(viewModel: viewModel, commonViewViewModel: commonViewViewModel) @@ -209,6 +210,8 @@ public struct LoginView: View { .pretendardFont(family: .SemiBold, size: 16) } .onTapGesture { + authViewModel.userid = "" + authViewModel.userEmail = "" commonViewViewModel.isExploreApp = true // commonViewViewModel.viewPath.append(ViewState.isLoginned) } diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift index b1687d19..779733e4 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift @@ -17,7 +17,7 @@ import Model public struct OnBoardingLoginView: View { @StateObject var appState: OnBoardingAppState = OnBoardingAppState() - @StateObject var authViewModel: AuthorizationViewModel = AuthorizationViewModel() + @StateObject var authViewModel: AuthorizationViewModel @ObservedObject var viewModel: OnBoardingViewModel @StateObject var commonViewViewModel: CommonViewViewModel @StateObject var sheetManager: SheetManager = SheetManager() @@ -26,10 +26,12 @@ public struct OnBoardingLoginView: View { public init( viewModel: OnBoardingViewModel, - commonViewViewModel: CommonViewViewModel + commonViewViewModel: CommonViewViewModel, + authViewModel: AuthorizationViewModel ) { self._viewModel = ObservedObject(wrappedValue: viewModel) self._commonViewViewModel = StateObject(wrappedValue: commonViewViewModel) + self._authViewModel = StateObject(wrappedValue: authViewModel) } public var body: some View { @@ -151,7 +153,7 @@ public struct OnBoardingLoginView: View { succesCompletion: { model in commonViewViewModel.isLogin = true commonViewViewModel.isLoginCheck = true - authViewModel.userid = model.data?.id ?? .zero + authViewModel.userid = String(model.data?.id ?? .zero) authViewModel.userNickName = model.data?.nickname ?? "" commonViewViewModel.isLoginExplore = false }, failLoginCompletion: { diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift index 7f49d7f3..3dd7126b 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift @@ -39,7 +39,7 @@ public struct CompletOnBoardingView: View { .navigationBarBackButtonHidden() .task { - authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)") + authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)", failCompletion: {}) await authViewModel.randomNameRequest(commCdTpCd: .userDesc, completion: {_ in }) } } diff --git a/PingPong/Projects/Feature/Profile/Project.swift b/PingPong/Projects/Feature/Profile/Project.swift index d2247a55..9c9516c1 100644 --- a/PingPong/Projects/Feature/Profile/Project.swift +++ b/PingPong/Projects/Feature/Profile/Project.swift @@ -4,7 +4,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Profile", bundleId: .appBundleID(name: ".Profile"), product: .staticFramework, diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/ChangeNickNameView/ChangeNickNameView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/ChangeNickNameView/ChangeNickNameView.swift index 6bd8aa01..c25530eb 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/ChangeNickNameView/ChangeNickNameView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/ChangeNickNameView/ChangeNickNameView.swift @@ -43,6 +43,7 @@ struct ChangeNickNameView: View { changeNickNameButton() } + .cornerRadius(20) @@ -115,7 +116,7 @@ struct ChangeNickNameView: View { await viewModel.changeNickName( userID: "\(authViewModel.userid)", nickName: viewModel.changeNickName) { - authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)") + authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)", failCompletion: {}) } } closeSheet() diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift index 95a7add3..5e0bfa63 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift @@ -13,6 +13,7 @@ import Authorization import SwiftUI import PopupView +@available(iOS 16.4, *) public struct ProfileView: View { @StateObject private var appState: AppState @StateObject private var viewModel: CommonViewViewModel @@ -85,10 +86,10 @@ public struct ProfileView: View { await authViewModel.loginWithEmail(email: authViewModel.userEmail, succesCompletion: { model in authViewModel.userNickName = model.data?.nickname ?? "" - authViewModel.userid = model.data?.id ?? .zero + authViewModel.userid = String(model.data?.id ?? .zero) }, failLoginCompletion: {}) - authViewModel.searchUserIdRequest(uid: "\(authViewModel.userid)") + authViewModel.searchUserIdRequest(uid: authViewModel.userid, failCompletion: {}) await profileViewModel.profileUserPrefRequset(userid: "\(authViewModel.userid)", completion: { _ in for userFlavor in profileViewModel.profileUserPrefModel?.data?.flavors ?? [] { @@ -492,6 +493,8 @@ public struct ProfileView: View { viewModel.isLogin = false viewModel.isLoginCheck = false authViewModel.randomAuthNickName = "" + authViewModel.userid = "" + authViewModel.userEmail = "" } } } diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/NotificationQuoteView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/NotificationQuoteView.swift index 14329dec..ba541923 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/NotificationQuoteView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/NotificationQuoteView.swift @@ -100,7 +100,6 @@ struct NotificationQuoteView: View { }) .presentationDetents([UIScreen.main.bounds.height.native == 667 ? .height(UIScreen.screenHeight/2 + UIScreen.screenWidth*0.2) : .height(UIScreen.screenHeight/3 + UIScreen.screenWidth*0.2)]) - .presentationCornerRadius(20) } } diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/SelectTimeSheetView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/SelectTimeSheetView.swift index 332fa248..b1025fa7 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/SelectTimeSheetView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/NotificationQuoteView/SelectTimeSheetView.swift @@ -44,6 +44,7 @@ struct SelectTimeSheetView: View { } + } private var timeTextHeaderView: some View { diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift index 94f0a913..30b293bd 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift @@ -64,7 +64,7 @@ struct WithDrawView: View { profileViewModel.selectWithDrawPOPUP = false viewModel.isLoginCheck = false profileViewModel.randomNickName = "" - authViewModel.userid = .zero + authViewModel.userid = "" authViewModel.userNickName = "" presentationMode.wrappedValue.dismiss() viewModel.isFirstUserPOPUP = false diff --git a/PingPong/Projects/Feature/Search/Project.swift b/PingPong/Projects/Feature/Search/Project.swift index 926286b1..7d62620a 100644 --- a/PingPong/Projects/Feature/Search/Project.swift +++ b/PingPong/Projects/Feature/Search/Project.swift @@ -12,7 +12,7 @@ import MyPlugin let localHelper = LocalHelper(name: "MyPlugin") -let project = Project.makeFramsWorkModule( +let project = Project.makeFrameWorkModule( name: "Search", bundleId: .appBundleID(name: "Search"), product: .staticFramework,