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

[Setting/#22] datastore 모듈 세팅 #23

Merged
merged 13 commits into from
Aug 17, 2024
Merged

Conversation

chanubc
Copy link
Collaborator

@chanubc chanubc commented Aug 16, 2024

✅ 𝗖𝗵𝗲𝗰𝗸-𝗟𝗶𝘀𝘁

  • merge할 브랜치의 위치를 확인해 주세요(main❌/develop⭕)
  • 리뷰가 필요한 경우 리뷰어를 지정해 주세요
  • P1 단계의 리뷰는 필수로 반영합니다.
  • Approve된 PR은 assigner가 머지하고, 수정 요청이 온 경우 수정 후 다시 push를 합니다.

📌 𝗜𝘀𝘀𝘂𝗲𝘀

📎𝗪𝗼𝗿𝗸 𝗗𝗲𝘀𝗰𝗿𝗶𝗽𝘁𝗶𝗼𝗻

  • datastore 모듈 생성
  • 약식 자동로그인 구현

📷 𝗦𝗰𝗿𝗲𝗲𝗻𝘀𝗵𝗼𝘁

image

KakaoTalk_20240817_032146733.mp4

💬 𝗧𝗼 𝗥𝗲𝘃𝗶𝗲𝘄𝗲𝗿𝘀

datastore는 flow를 저장해야해서
collect 혹은 collectlatest를 통해 값을 가져 오시면 됩니다!

@chanubc chanubc requested a review from a team August 16, 2024 18:22
@chanubc chanubc self-assigned this Aug 16, 2024
@chanubc chanubc requested review from Eonji-sw and sohyun127 and removed request for a team August 16, 2024 18:22
@chanubc chanubc changed the base branch from develop to setting/#15-compose-designsystem August 16, 2024 18:22
Copy link
Collaborator

@sohyun127 sohyun127 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!


private suspend fun FlowCollector<Preferences>.handleError(it: Throwable) {
if (it is IOException) emit(emptyPreferences())
else throw it
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 throw된 exception은 어디서 핸들링 되나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

공식문서 복붙 해온거라 그 생각은 못해봤네요!
이 예외는 상위에서 에러핸들링 하라는 의도인것 같습니다.

해당 flow를 viewmodel이나 activity에서 collect하기전 catch문을 통해서 error를 로깅을 찍거나 할수는 있을 것 같아요!
모든 datastore.data에 각 타입별로 default값을 할당 해놓아서 실패시에도 값이 map이 되긴 합니다!


fun getMemberProfileUrl(): Flow<String>

fun getIsNewUser(): Flow<Boolean>
Copy link
Collaborator

Choose a reason for hiding this comment

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

P2: 아마 요건 필요없을거에요!

Copy link
Collaborator

Choose a reason for hiding this comment

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

isNewUser만 말한겁니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

02d73e1
삭제 했습니다!

Copy link
Member

@Eonji-sw Eonji-sw left a comment

Choose a reason for hiding this comment

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

굿~

Comment on lines 21 to 28
val AccessToken = stringPreferencesKey("accessToken")
val RefreshToken = stringPreferencesKey("refreshToken")
val Nickname = stringPreferencesKey("nickname")
val AutoLogin = booleanPreferencesKey("autoLogin")
val MemberId = intPreferencesKey("memberId")
val MemberProfileUrl = stringPreferencesKey("memberProfileUrl")
val IsNewUser = booleanPreferencesKey("isNewUser")
val IsPushAlarmAllowed = booleanPreferencesKey("isPushAlarmAllowed")
Copy link
Member

Choose a reason for hiding this comment

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

P3 : key 빼도 되지 않나여?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

key 를 통해서 값을 저장하고 객체를 구성하는 것으로 알고있어서 중요한 부분으로 알고있습니다!

Base automatically changed from setting/#15-compose-designsystem to develop August 17, 2024 12:39
@chanubc chanubc merged commit 4ae5c13 into develop Aug 17, 2024
1 check passed
@chanubc chanubc deleted the setting/#22-datastore branch August 17, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SETTING] : datastore 모듈 생성
3 participants