-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 throw된 exception은 어디서 핸들링 되나요?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: 아마 요건 필요없을거에요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNewUser만 말한겁니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
02d73e1
삭제 했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿~
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3 : key 빼도 되지 않나여?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key 를 통해서 값을 저장하고 객체를 구성하는 것으로 알고있어서 중요한 부분으로 알고있습니다!
✅ 𝗖𝗵𝗲𝗰𝗸-𝗟𝗶𝘀𝘁
📌 𝗜𝘀𝘀𝘂𝗲𝘀
📎𝗪𝗼𝗿𝗸 𝗗𝗲𝘀𝗰𝗿𝗶𝗽𝘁𝗶𝗼𝗻
📷 𝗦𝗰𝗿𝗲𝗲𝗻𝘀𝗵𝗼𝘁
KakaoTalk_20240817_032146733.mp4
💬 𝗧𝗼 𝗥𝗲𝘃𝗶𝗲𝘄𝗲𝗿𝘀
datastore는 flow를 저장해야해서
collect 혹은 collectlatest를 통해 값을 가져 오시면 됩니다!