From 6068bb752faf004f699a5ceaede1d16bcaac8b20 Mon Sep 17 00:00:00 2001 From: JongHoon Date: Fri, 23 Aug 2024 20:41:47 +0900 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20stopTalkButtonTapped=20->=20stopTa?= =?UTF-8?q?lkButtonDidTapped=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuestionAndAnswer/QuestionAndAnswerFeature.swift | 2 +- .../QuestionAndAnswerFeatureInterface.swift | 2 +- .../SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift index a2aa05db..6bf1ad2f 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift @@ -82,7 +82,7 @@ extension QuestionAndAnswerFeature { } } - case .stopTalkButtonTapped: + case .stopTalkButtonDidTapped: state.destination = .alert(.init( title: { TextState("중단하기") }, actions: { diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift index 325aa352..ba8c43aa 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift @@ -204,7 +204,7 @@ public struct QuestionAndAnswerFeature { case finalSelectButtonDidTapped(willMatch: Bool) case refreshPingPongDidRequired case configureShowLoadingIndicatorRequired(isShow: Bool) - case stopTalkButtonTapped + case stopTalkButtonDidTapped // ETC. case binding(BindingAction) diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift index 8123ba2f..ff314190 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift @@ -103,7 +103,7 @@ public struct QuestionAndAnswerView: View { color: .enableSecondary ) .asThrottleButton { - store.send(.stopTalkButtonTapped) + store.send(.stopTalkButtonDidTapped) } .padding(.top, 12.0) .disabled(store.isStopped == true) @@ -121,6 +121,9 @@ public struct QuestionAndAnswerView: View { .onChange(of: store.textFieldState) { textFieldState in isTextFieldFocused = textFieldState == .active || textFieldState == .enabled ? false : true } + } + .refreshable { + } .scrollIndicators(.hidden) .overlay { From 1fcdafc1da69fcf4a0e47935d5ec405b4c239f52 Mon Sep 17 00:00:00 2001 From: JongHoon Date: Fri, 23 Aug 2024 22:46:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=ED=95=91=ED=90=81=20=EB=AC=B8?= =?UTF-8?q?=EB=8B=B5=20pull=20to=20refresh=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Feature/BottleStorage/Example/Sources/AppView.swift | 6 ------ .../View/PingPongDetail/PingPongDetailFeature.swift | 2 ++ .../QuestionAndAnswer/QuestionAndAnswerFeature.swift | 3 +++ .../QuestionAndAnswerFeatureInterface.swift | 2 ++ .../SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Projects/Feature/BottleStorage/Example/Sources/AppView.swift b/Projects/Feature/BottleStorage/Example/Sources/AppView.swift index ef784883..e05e0e8c 100644 --- a/Projects/Feature/BottleStorage/Example/Sources/AppView.swift +++ b/Projects/Feature/BottleStorage/Example/Sources/AppView.swift @@ -21,12 +21,6 @@ struct AppView: App { initialState: BottleStorageFeature.State(), reducer: { BottleStorageFeature() } )) - .onAppear { - AuthClient.liveValue.saveToken(token: .init( - accessToken: "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzIzMTE3ODk1LCJleHAiOjE3MjMxNTM4OTV9.HjjnS1onaAUA6nJGOV-f6FE55eAihUGTFNYGmmyETQc", - refershToken: "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzIzMTE3ODk1LCJleHAiOjE3Mzc2MzMwOTV9.Af-L2h_5pBQWrZCc1OQI3tm1DGwowqCAId-rK5vAPaQ" - )) - } } } } diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/PingPongDetail/PingPongDetailFeature.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/PingPongDetail/PingPongDetailFeature.swift index cc01fbd4..d1ee40f0 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/PingPongDetail/PingPongDetailFeature.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/PingPongDetail/PingPongDetailFeature.swift @@ -54,6 +54,8 @@ extension PingPongDetailFeature { return fetchPingPong(state: &state) case .popToRootDidRequired: return .send(.delegate(.popToRootDidRequired)) + case .refreshPingPong: + return fetchPingPong(state: &state) } case let .matching(.delegate(delegate)): diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift index 6bf1ad2f..5a4dc213 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeature.swift @@ -94,6 +94,9 @@ extension QuestionAndAnswerFeature { message: { TextState("중단 시 모든 핑퐁 내용이 사라져요. 정말 중단하시겠어요?") } )) return .none + + case .refreshDidPulled: + return .send(.delegate(.refreshPingPong)) case let .destination(.presented(.alert(alert))): switch alert { diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift index ba8c43aa..4353b898 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerFeatureInterface.swift @@ -205,6 +205,7 @@ public struct QuestionAndAnswerFeature { case refreshPingPongDidRequired case configureShowLoadingIndicatorRequired(isShow: Bool) case stopTalkButtonDidTapped + case refreshDidPulled // ETC. case binding(BindingAction) @@ -220,6 +221,7 @@ public struct QuestionAndAnswerFeature { public enum Delegate { case reloadPingPongRequired case popToRootDidRequired + case refreshPingPong } } diff --git a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift index ff314190..b8208f68 100644 --- a/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift +++ b/Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/SubViews/QuestionAndAnswer/QuestionAndAnswerView.swift @@ -123,7 +123,8 @@ public struct QuestionAndAnswerView: View { } } .refreshable { - + try? await Task.sleep(nanoseconds: 300_000_000) + await store.send(.refreshDidPulled).finish() } .scrollIndicators(.hidden) .overlay {