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/#199] 핑퐁 문답 화면 pull to refresh 구현 #202

Merged
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
6 changes: 0 additions & 6 deletions Projects/Feature/BottleStorage/Example/Sources/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
))
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ extension QuestionAndAnswerFeature {
}
}

case .stopTalkButtonTapped:
case .stopTalkButtonDidTapped:
state.destination = .alert(.init(
title: { TextState("중단하기") },
actions: {
Expand All @@ -94,6 +94,9 @@ extension QuestionAndAnswerFeature {
message: { TextState("중단 시 모든 핑퐁 내용이 사라져요. 정말 중단하시겠어요?") }
))
return .none

case .refreshDidPulled:
return .send(.delegate(.refreshPingPong))

case let .destination(.presented(.alert(alert))):
switch alert {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ public struct QuestionAndAnswerFeature {
case finalSelectButtonDidTapped(willMatch: Bool)
case refreshPingPongDidRequired
case configureShowLoadingIndicatorRequired(isShow: Bool)
case stopTalkButtonTapped
case stopTalkButtonDidTapped
case refreshDidPulled

// ETC.
case binding(BindingAction<State>)
Expand All @@ -220,6 +221,7 @@ public struct QuestionAndAnswerFeature {
public enum Delegate {
case reloadPingPongRequired
case popToRootDidRequired
case refreshPingPong
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -122,6 +122,10 @@ public struct QuestionAndAnswerView: View {
isTextFieldFocused = textFieldState == .active || textFieldState == .enabled ? false : true
}
}
.refreshable {
try? await Task.sleep(nanoseconds: 300_000_000)
await store.send(.refreshDidPulled).finish()
}
.scrollIndicators(.hidden)
.overlay {
if store.isShowLoadingIndicator {
Expand Down