Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/#318] 도착한 보틀 리스트, 도착한 보틀 상세 화면 로딩 인디케이터 적용 #359

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
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ extension GoodFeelingFeature {
public init() {
let reducer = Reduce<State, Action> { 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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import FeatureBaseWebViewInterface

import CoreLoggerInterface

import SharedDesignSystem

import ComposableArchitecture

public struct GoodFeelingView: View {
Expand All @@ -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))
Expand All @@ -37,6 +39,11 @@ public struct GoodFeelingView: View {
}
}
)
.overlay {
if store.isLoading {
LoadingIndicator()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ extension SentBottleDetailFeature {

let reducer = Reduce<State, Action> { state, action in
switch action {
case .webViewLoadingDidCompleted:
return .send(.configureIsLoading(false))

case .backButtonDidTapped:
return .send(.delegate(.backButtonDidTapped))

case let .showToast(message):
toastClient.presentToast(message: message)
return .none

case let .configureIsLoading(isLoading):
state.isLoading = isLoading
return .none

case .bottelDidAccepted:
return .send(.delegate(.bottelDidAccepted))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import FeatureBaseWebViewInterface

import CoreLoggerInterface

import SharedDesignSystem

import ComposableArchitecture

public struct SentBottleDetailView: View {
Expand All @@ -27,7 +29,7 @@ public struct SentBottleDetailView: View {
actionDidInputted: { action in
switch action {
case .webViewLoadingDidCompleted:
break
store.send(.webViewLoadingDidCompleted)

case .closeWebView:
store.send(.backButtonDidTapped)
Expand All @@ -45,6 +47,11 @@ public struct SentBottleDetailView: View {
)
.navigationBarBackButtonHidden()
.ignoresSafeArea(.all, edges: [.top, .bottom])
.overlay {
if store.isLoading {
LoadingIndicator()
}
}
}
}
}