Skip to content

Commit

Permalink
[BUD-50] feat : Buddy 목록 조회 API 구현 및 적용(#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
KDW03 committed Apr 8, 2023
1 parent ba0d16b commit e22701c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.nocapstone.buddyvet.buddy.domain.usecase.BuddyUseCase
import com.nocapstone.common.domain.usecase.DataStoreUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.first
Expand All @@ -22,7 +23,6 @@ import okhttp3.RequestBody.Companion.toRequestBody
import javax.inject.Inject



@HiltViewModel
class BuddyViewModel @Inject constructor(
@ApplicationContext private val context: Context,
Expand Down Expand Up @@ -81,43 +81,15 @@ class BuddyViewModel @Inject constructor(
fun getBuddyLists() = _buddyList.value

fun readBuddyList() {
Log.d("refresh","refresh")
val buddyDummy = mutableListOf<BuddyData>().apply {
add(
BuddyData(
1,
"D",
"개주",
"W",
"https://mineme-bucket.s3.ap-northeast-2.amazonaws.com/buddyvet/static/dog.png",
"5년 2개월",
false
)
)
}.apply {
add(
BuddyData(
2,
"C",
"도t",
"M",
"https://mineme-bucket.s3.ap-northeast-2.amazonaws.com/buddyvet/static/cat.png",
"5년 1개월",
false
)
)
}
_buddyList.value = buddyDummy

/*
viewModelScope.launch {
viewModelScope.launch(Dispatchers.IO) {
try {
val jwt = dataStoreUseCase.bearerJsonWebToken.first()!!
_buddyList.value = buddyUseCase.readBuddyList(jwt)
}catch (e : Exception){
val token = dataStoreUseCase.bearerJsonWebToken.first()
if (token != null){
_buddyList.value = buddyUseCase.readBuddyList(token)
}
} catch (e: Exception) {
}
}
*/
}

fun createBuddy() {
Expand Down
1 change: 0 additions & 1 deletion home/src/main/java/com/nocapstone/home/ui/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class HomeFragment : Fragment() {
TedImagePicker.with(requireContext())
.errorListener { }
.start { uri ->
//todo eyechackViewModel
eyeViewModel.setImage(uri)
findNavController().navigate(R.id.next)
}
Expand Down

0 comments on commit e22701c

Please sign in to comment.