Skip to content

Commit

Permalink
Merge pull request #202 from Nexters/feature/#199-핑퐁-문답-화면-pull-to-re…
Browse files Browse the repository at this point in the history
…fresh-구현

[Feature/#199] 핑퐁 문답 화면 pull to refresh 구현
  • Loading branch information
JongHoooon authored Aug 23, 2024
2 parents 73c5fe7 + 1fcdafc commit 980e892
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
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

0 comments on commit 980e892

Please sign in to comment.