-
Notifications
You must be signed in to change notification settings - Fork 0
[FIX] response가 다른 컬럼 default 값 설정 #55
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| package com.alarmy.near.presentation.feature.home | ||
|
|
||
| import android.util.Log | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| import androidx.lifecycle.ViewModel | ||
| import androidx.lifecycle.viewModelScope | ||
| import com.alarmy.near.data.repository.FriendRepository | ||
|
|
@@ -32,11 +33,15 @@ class HomeViewModel | |
|
|
||
| val errorEvent = _errorEvent.receiveAsFlow() | ||
| val memberInfoFlow: StateFlow<MemberInfo?> = | ||
| memberRepository.getMyInfo().stateIn( | ||
| viewModelScope, | ||
| SharingStarted.WhileSubscribed(5_000), | ||
| null, | ||
| ) | ||
| memberRepository | ||
| .getMyInfo() | ||
| .catch { | ||
| _errorEvent.send(it) | ||
| }.stateIn( | ||
| viewModelScope, | ||
| SharingStarted.WhileSubscribed(5_000), | ||
| null, | ||
| ) | ||
|
|
||
| val friendsFlow: StateFlow<List<FriendSummary>> = | ||
| combine( | ||
|
|
@@ -45,14 +50,13 @@ class HomeViewModel | |
| deletedFriendIdsFlow, | ||
| ) { friends, deletedIds -> | ||
| friends.filter { it.id !in deletedIds } | ||
| } | ||
| .catch { | ||
| _errorEvent.send(it) | ||
| }.stateIn( | ||
| scope = viewModelScope, | ||
| started = SharingStarted.WhileSubscribed(5_000), | ||
| initialValue = emptyList(), | ||
| ) | ||
| }.catch { | ||
| _errorEvent.send(it) | ||
| }.stateIn( | ||
| scope = viewModelScope, | ||
| started = SharingStarted.WhileSubscribed(5_000), | ||
| initialValue = emptyList(), | ||
| ) | ||
|
|
||
| val monthlyFriendFlow: | ||
| StateFlow<List<MonthlyFriend>> = | ||
|
|
@@ -70,5 +74,5 @@ class HomeViewModel | |
| viewModelScope.launch { | ||
| deletedFriendIdsFlow.emit(deletedFriendIdsFlow.value + friendId) | ||
| } | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
notificationAgreedAt속성은 nullable(String?)이므로,null이 값의 부재를 나타내는 유효한 상태임을 시사합니다. 기본값으로 빈 문자열""을 사용하는 것은 혼란을 줄 수 있습니다. nullable 타입에는null을 기본값으로 사용하는 것이 더 관용적입니다. 이렇게 하면 API 응답에서 필드가 누락되었을 때의 의도를 더 명확하게 코드에 나타낼 수 있습니다.만약 이후의 코드에서 non-null 문자열이 필요하다면,
null인 경우를 그쪽에서 처리하거나(예:?: ""),null이 절대로 예상되는 상태가 아니라면 타입을String으로 변경하는 것을 고려해 보세요.