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

마이페이지 스코어 리스트 & 홈 뷰 #86

Merged
merged 7 commits into from
Sep 3, 2023

Conversation

enebin
Copy link
Member

@enebin enebin commented Aug 31, 2023

@enebin enebin requested review from k906506 and 0inn August 31, 2023 01:09
import Domain
import Network

struct KeymeTestsHomeFeature: Reducer {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디코에서 설명했듯이 이 feature는

  • 테스트 시작, 테스트 결과 뷰 중 어떤 뷰를 보여줄지 분기처리하는 로직을 담당하게끔 계획함.

Comment on lines +50 to +52
case .showTestStartView(let testData):
state.view.dailyTestId = testData.testId
state.testStartViewState = .init(nickname: state.view.nickname, testData: testData)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showTestStartViewtestStartViewState를 생성하면 View에 선언한 IfLetStore에 의해서 KeymeTestsStartView가 보여질 거야

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잠깐 설명한 적 있듯이 nicknameRootViewFeature에서 사용자 정보를 업데이트 한 다음 '무조건' 전달해 줄거야. 원래 Optional로 처리하던 번거로움을 줄일 수 있었음.

  • 만약 전달이 안 된다면 아예 이 화면에 진입할 수 없음.

.padding(.horizontal, 16)

// 테스트 뷰
testView
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

임시라 분기처리 따로 해 놓지는 않음

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오키 이건 제가 개발하면서 다시 볼게요 !

// Filler
Spacer().frame(height: 75)

welcomeText(nickname: viewStore.nickname)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestStartView에 있던 걸 밖으로 뺐어. 결과 뷰에서도 재사용되는 것 같더라고!

} else: {
Circle()
.strokeBorder(.white.opacity(0.3), lineWidth: 1)
.background(Circle().foregroundColor(.white.opacity(0.3)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기는 ProgressView 같은 거 띄우려고 했는데ㅋㅋㅋ 현재로선 아무 의미 없는 코드니까 삭제해도 ㄱㅊ

Comment on lines -44 to -49
await send(.fetchDailyTests(
TaskResult {
try await self.keymeTestsClient.fetchDailyTests()
}
))
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 파트가 이제 HomeViewFeature로 빠졌다고 보시면 됨

Comment on lines +23 to +26
public enum Action {
case logout
case changeNickname(String)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아직 쓸 일은 없는데 나중에 설정에서 로그아웃이나 닉변같이 전역적으로 영향을 미치는 액션에 대해서는 MainPageFeature에서 처리하면 어떨까 싶었음. 이건 의견 주십셔ㅎㅎ

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조아요 근데 해당 액션을 어디서 받는 거지 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 마이페이지 -> 세팅에서 받을 것 같음. 요쪽은 마이페이지라 제가 핸들링하겠읍니다.

var view: View
var scoreListState: ScoreListFeature.State = .init()

struct View: Equatable {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

간간히 View로 감싼 StateAction이 보이는데 이건 뷰에서 모든 액션이나 상태에 접근하지 못하게 하려고 했던게 의도임. private처리가 사실상 불가능하다보니까 이런 식으로라도 접근성을 제한하려는 의도!
컨벤션으로 박을 생각은 없고 쓰시는 분께서 판단 하에 사용해주시면 좋겟읍니다.

}

public var body: some View {
WithViewStore(store, observe: { $0 }) { viewStore in
WithViewStore(store, observe: \.view, send: MyPageFeature.Action.view) { viewStore in
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위처럼 View로 감사면 이런 식으로 쓸 수 잇찌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

서버에서 내려주는 형식이 좀 바뀌었더라고. 그래서 맞게 좀 바꿧읍니다.
지금 보니까 이름에 DTO 빠졌네..ㅎㅎ ㅈㅅ

@enebin
Copy link
Member Author

enebin commented Aug 31, 2023

@enebin enebin self-assigned this Sep 2, 2023
Copy link
Contributor

@0inn 0inn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳 고생하셨습니다 ~ 리뷰 늦어져서 죄송 🥺

.padding(.horizontal, 16)

// 테스트 뷰
testView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오키 이건 제가 개발하면서 다시 볼게요 !

Comment on lines +23 to +26
public enum Action {
case logout
case changeNickname(String)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조아요 근데 해당 액션을 어디서 받는 거지 ?

@enebin enebin merged commit 9a8c18a into refactor/network-manager Sep 3, 2023
@enebin enebin deleted the refactor/mypage-score-list(#84) branch September 3, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants