Skip to content

Commit

Permalink
✨ Feat: 친구 초대 화면 친구 조회 API 호출
Browse files Browse the repository at this point in the history
- GetFriendsUseCase 활용

Related to: #347
  • Loading branch information
nahy-512 committed Jan 8, 2025
1 parent 8649648 commit 146b48f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import com.mongmong.namo.R
import com.mongmong.namo.databinding.ActivityFriendInviteBinding
import com.mongmong.namo.presentation.config.BaseActivity
import com.mongmong.namo.presentation.ui.community.moim.schedule.adapter.FriendInviteRVAdapter
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class FriendInviteActivity : BaseActivity<ActivityFriendInviteBinding>(R.layout.activity_friend_invite) {

private val viewModel: FriendInviteViewModel by viewModels()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,28 @@ package com.mongmong.namo.presentation.ui.community.moim.schedule
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mongmong.namo.domain.model.Friend
import com.mongmong.namo.domain.usecases.friend.GetFriendsUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

class FriendInviteViewModel: ViewModel() {
//TODO: 임시 데이터
@HiltViewModel
class FriendInviteViewModel @Inject constructor(
private val getFriendsUseCase: GetFriendsUseCase,
): ViewModel() {
private val _friendList = MutableLiveData<List<Friend>>()
val friendList: LiveData<List<Friend>> = _friendList

init {
_friendList.value = emptyList()
getFriends()
}

/** 친구 목록 조회 */
private fun getFriends() {
viewModelScope.launch {
_friendList.value = getFriendsUseCase.execute()
}
}
}

0 comments on commit 146b48f

Please sign in to comment.