From 53a4e33430e810561141fb6502e856be9b204edd Mon Sep 17 00:00:00 2001 From: JongHoon Date: Sat, 9 Nov 2024 16:34:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=8F=84=EC=B0=A9=ED=95=9C=20=EB=B3=B4?= =?UTF-8?q?=ED=8B=80=20=EB=A6=AC=EC=8A=A4=ED=8A=B8,=20=EB=8F=84=EC=B0=A9?= =?UTF-8?q?=ED=95=9C=20=EB=B3=B4=ED=8B=80=20=EC=83=81=EC=84=B8=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=A1=9C=EB=94=A9=20=EC=9D=B8=EB=94=94=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/GoodFeeling/GoodFeelingFeature.swift | 8 +++++++- .../GoodFeeling/GoodFeelingFeatureInterface.swift | 7 +++++++ .../Interface/Sources/GoodFeeling/GoodFeelingView.swift | 9 ++++++++- .../SentBottleDetail/SentBottleDetailFeature.swift | 5 +++++ .../SentBottleDetailFeatureInterface.swift | 7 +++++++ .../Sources/SentBottleDetail/SentBottleDetailView.swift | 9 ++++++++- 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeature.swift b/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeature.swift index 62626ac2..937ad4c6 100644 --- a/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeature.swift +++ b/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeature.swift @@ -19,13 +19,19 @@ public struct GoodFeelingFeature { @ObservableState public struct State: Equatable { + var isLoading: Bool + public init() { - + self.isLoading = true } } public enum Action: BindableAction { case sentBottleTapped(url: String) + case webViewLoadingDidCompleted + + case configureIsLoading(_: Bool) + case delegate(Delegate) public enum Delegate { diff --git a/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeatureInterface.swift b/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeatureInterface.swift index 79e8405b..d9c3acfe 100644 --- a/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeatureInterface.swift +++ b/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingFeatureInterface.swift @@ -13,9 +13,16 @@ extension GoodFeelingFeature { public init() { let reducer = Reduce { state, action in switch action { + case .webViewLoadingDidCompleted: + return .send(.configureIsLoading(false)) + case let .sentBottleTapped(url): return .send(.delegate(.sentBottleTapped(url: url))) + case let .configureIsLoading(isLoading): + state.isLoading = isLoading + return .none + default: return .none } diff --git a/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingView.swift b/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingView.swift index a2647c83..401f0c86 100644 --- a/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingView.swift +++ b/Projects/Feature/GoodFeeling/Interface/Sources/GoodFeeling/GoodFeelingView.swift @@ -11,6 +11,8 @@ import FeatureBaseWebViewInterface import CoreLoggerInterface +import SharedDesignSystem + import ComposableArchitecture public struct GoodFeelingView: View { @@ -27,7 +29,7 @@ public struct GoodFeelingView: View { actionDidInputted: { action in switch action { case .webViewLoadingDidCompleted: - break + store.send(.webViewLoadingDidCompleted) case let .openLink(url): store.send(.sentBottleTapped(url: url)) @@ -37,6 +39,11 @@ public struct GoodFeelingView: View { } } ) + .overlay { + if store.isLoading { + LoadingIndicator() + } + } } } } diff --git a/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeature.swift b/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeature.swift index 5e2be585..8893aa67 100644 --- a/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeature.swift +++ b/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeature.swift @@ -19,16 +19,21 @@ public struct SentBottleDetailFeature { @ObservableState public struct State: Equatable { + var isLoading: Bool let sentBottleDetailURL: String public init(sentBottleDetailURL: String) { + self.isLoading = true self.sentBottleDetailURL = sentBottleDetailURL } } public enum Action: BindableAction { + case webViewLoadingDidCompleted case backButtonDidTapped case bottelDidAccepted + + case configureIsLoading(_: Bool) case showToast(message: String) case delegate(Delegate) diff --git a/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeatureInterface.swift b/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeatureInterface.swift index 3087fdd0..a34362d7 100644 --- a/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeatureInterface.swift +++ b/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailFeatureInterface.swift @@ -17,6 +17,9 @@ extension SentBottleDetailFeature { let reducer = Reduce { state, action in switch action { + case .webViewLoadingDidCompleted: + return .send(.configureIsLoading(false)) + case .backButtonDidTapped: return .send(.delegate(.backButtonDidTapped)) @@ -24,6 +27,10 @@ extension SentBottleDetailFeature { toastClient.presentToast(message: message) return .none + case let .configureIsLoading(isLoading): + state.isLoading = isLoading + return .none + case .bottelDidAccepted: return .send(.delegate(.bottelDidAccepted)) diff --git a/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailView.swift b/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailView.swift index a9966c48..49e059fd 100644 --- a/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailView.swift +++ b/Projects/Feature/GoodFeeling/Interface/Sources/SentBottleDetail/SentBottleDetailView.swift @@ -11,6 +11,8 @@ import FeatureBaseWebViewInterface import CoreLoggerInterface +import SharedDesignSystem + import ComposableArchitecture public struct SentBottleDetailView: View { @@ -27,7 +29,7 @@ public struct SentBottleDetailView: View { actionDidInputted: { action in switch action { case .webViewLoadingDidCompleted: - break + store.send(.webViewLoadingDidCompleted) case .closeWebView: store.send(.backButtonDidTapped) @@ -45,6 +47,11 @@ public struct SentBottleDetailView: View { ) .navigationBarBackButtonHidden() .ignoresSafeArea(.all, edges: [.top, .bottom]) + .overlay { + if store.isLoading { + LoadingIndicator() + } + } } } }