Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Near/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
applicationId = "com.alarmy.near"
minSdk = 27
targetSdk = 35
versionCode = 2
versionCode = 3
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ data class MemberInfoEntity(
val username: String,
val nickname: String,
val imageUrl: String?,
val notificationAgreedAt: String?,
val notificationAgreedAt: String? = "", // TODO #Issue: 52 Default 값 추후 제거 필요

Choose a reason for hiding this comment

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

medium

notificationAgreedAt 속성은 nullable(String?)이므로, null이 값의 부재를 나타내는 유효한 상태임을 시사합니다. 기본값으로 빈 문자열 ""을 사용하는 것은 혼란을 줄 수 있습니다. nullable 타입에는 null을 기본값으로 사용하는 것이 더 관용적입니다. 이렇게 하면 API 응답에서 필드가 누락되었을 때의 의도를 더 명확하게 코드에 나타낼 수 있습니다.

만약 이후의 코드에서 non-null 문자열이 필요하다면, null인 경우를 그쪽에서 처리하거나(예: ?: ""), null이 절대로 예상되는 상태가 아니라면 타입을 String으로 변경하는 것을 고려해 보세요.

Suggested change
val notificationAgreedAt: String? = "", // TODO #Issue: 52 Default 값 추후 제거 필요
val notificationAgreedAt: String? = null, // TODO #Issue: 52 Default 값 추후 제거 필요

val providerType: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ data class FriendSummaryEntity(
val name: String,
val imageUrl: String? = null,
val fileName: String? = null,
val checkRate: Int,
val checkRate: Int = 0, // TODO #Issue: 52 Default 값 추후 제거 필요
val lastContactAt: String? = null,
)
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

Choose a reason for hiding this comment

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

medium

이 import는 파일 내에서 사용되지 않습니다. 불필요한 import는 제거하는 것이 좋습니다.

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.alarmy.near.data.repository.FriendRepository
Expand Down Expand Up @@ -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(
Expand All @@ -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>> =
Expand All @@ -70,5 +74,5 @@ class HomeViewModel
viewModelScope.launch {
deletedFriendIdsFlow.emit(deletedFriendIdsFlow.value + friendId)
}
}
}
}