Skip to content

Commit

Permalink
[fix/#160] 유저 리뷰 사용자 본인에 대한 예외 케이스 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
blueme0 committed Feb 15, 2024
1 parent 8f9ea00 commit dbef3f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ class TeumMessagingService : FirebaseMessagingService() {
}
if (alertMessage.type == END_MEETING) {
alertMessage.meetingId = message.data["meetingId"]?.toLong()
// Timber.tag("teum-alerts").d("data: ${message.data}")
// Timber.tag("teum-alerts").d("participants string: ${message.data["participants"]?.split(",").toString()}")
// Timber.tag("teum-alerts").d("participants size: ${message.data["participants"]?.split(",")?.size}")
alertMessage.participants = message.data["participants"]?.split(",")?.map { it.toInt() }
val userId = userRepository.getUserInfo()?.id?.toInt()
if (alertMessage.participants?.contains(userId) == true)
if (alertMessage.participants?.contains(userId) == true && alertMessage.participants?.size!! > 1)
sendNotificationAlarm(alertMessage)
}
else if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teumteum.domain.entity.ReviewFriend
import com.teumteum.domain.repository.GroupRepository
import com.teumteum.domain.repository.UserRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
import timber.log.Timber

@HiltViewModel
class ReviewViewModel @Inject constructor(
private val repository: GroupRepository
private val repository: GroupRepository,
private val userRepository: UserRepository
) : ViewModel() {
private var _selectFriendList = listOf<ReviewFriend>()
val selectFriendList get() = _selectFriendList
Expand All @@ -37,12 +40,19 @@ class ReviewViewModel @Inject constructor(
_selectDetailFriendList.add(selectFriendDetail)
}

private fun filterReviewFriendList(list: List<ReviewFriend>): List<ReviewFriend> {
val friendList = list.toMutableList()
val myUserId = userRepository.getUserInfo()?.id
friendList.removeAll { it.id == myUserId }
return friendList
}

fun getReviewFriendList() {
meetingId?.let { id ->
viewModelScope.launch {
repository.getReviewFriendList(id)
.onSuccess {
_moimFriendList.value = it
.onSuccess { list ->
_moimFriendList.value = filterReviewFriendList(list)
}
}
}
Expand Down

0 comments on commit dbef3f7

Please sign in to comment.