diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/MyPageViewModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/MyPageViewModel.kt index 1cc08059..75a5a2cc 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/MyPageViewModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/MyPageViewModel.kt @@ -4,6 +4,7 @@ package com.teumteum.teumteum.presentation.mypage.setting.viewModel import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.teumteum.domain.entity.Friend +import com.teumteum.domain.entity.FriendMyPage import com.teumteum.domain.entity.UserInfo import com.teumteum.domain.repository.AuthRepository import com.teumteum.domain.repository.UserRepository @@ -28,8 +29,8 @@ class MyPageViewModel @Inject constructor( private val _frontCardState = MutableStateFlow(FrontCard()) val frontCardState: StateFlow = _frontCardState - private val _friendsList = MutableStateFlow>(emptyList()) - val friendsList : StateFlow> = _friendsList + private val _friendsList = MutableStateFlow>(emptyList()) + val friendsList : StateFlow> = _friendsList init { loadUserInfo() diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/RecommendDetailViewModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/RecommendDetailViewModel.kt index 8f3c78e2..3a8b94b8 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/RecommendDetailViewModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/RecommendDetailViewModel.kt @@ -3,6 +3,7 @@ package com.teumteum.teumteum.presentation.mypage.setting.viewModel import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.teumteum.domain.entity.Friend +import com.teumteum.domain.entity.FriendMyPage import com.teumteum.domain.entity.UserInfo import com.teumteum.domain.repository.SettingRepository import com.teumteum.domain.repository.UserRepository @@ -38,10 +39,10 @@ class RecommendDetailViewModel @Inject constructor( private val _isFriend = MutableStateFlow(false) val isFriend: StateFlow = _isFriend.asStateFlow() - private val _friendsList = MutableStateFlow>(emptyList()) - val friendsList : StateFlow> = _friendsList + private val _friendsList = MutableStateFlow>(emptyList()) + val friendsList : StateFlow> = _friendsList - fun checkIfUserIsFriend(friendsList: List, userId: Long) { + fun checkIfUserIsFriend(friendsList: List, userId: Long) { _isFriend.value = friendsList.any { friend -> friend.id.toLong() == userId } } diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/SettingMeetingUiModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/SettingMeetingUiModel.kt index a9979720..a4368f8e 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/SettingMeetingUiModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/viewModel/SettingMeetingUiModel.kt @@ -3,6 +3,7 @@ package com.teumteum.teumteum.presentation.mypage.setting.viewModel import android.content.Intent import androidx.annotation.DrawableRes import com.teumteum.domain.entity.Friend +import com.teumteum.domain.entity.FriendMyPage import com.teumteum.teumteum.R data class Meeting( @@ -17,7 +18,7 @@ data class Recommend( val characterId: Int, ) -fun Friend.toRecommend(): Recommend { +fun FriendMyPage.toRecommend(): Recommend { return Recommend( id = this.id, characterId = this.characterId, diff --git a/core/domain/src/main/java/com/teumteum/domain/entity/Friend.kt b/core/domain/src/main/java/com/teumteum/domain/entity/Friend.kt index f6ac68ea..7fd47703 100644 --- a/core/domain/src/main/java/com/teumteum/domain/entity/Friend.kt +++ b/core/domain/src/main/java/com/teumteum/domain/entity/Friend.kt @@ -14,9 +14,17 @@ data class Friend( val mannerTemperature: Int ) +@Serializable +data class FriendMyPage( + val id: Int, + val characterId: Int, + val name: String, + val job: JobEntity, +) + @Serializable data class Friends( - val friends: List + val friends: List )