Skip to content

Commit

Permalink
add test code for using account information [FoKE-Developers#73]
Browse files Browse the repository at this point in the history
- 계정 정보를 임의로 받아올 수 있도록 하드코딩했습니다.
- 추후 테스트 마치고 삭제 예정입니다.
  • Loading branch information
DokySp committed Oct 10, 2024
1 parent c88b989 commit 46493e3
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
package com.foke.together.presenter.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.foke.together.domain.interactor.web.GetCurrentUserInformationUseCase
import com.foke.together.domain.interactor.web.SignInUseCase
import com.foke.together.util.AppLog
import com.foke.together.util.di.IODispatcher
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class HomeViewModel @Inject constructor(
@IODispatcher private val ioDispatcher: CoroutineDispatcher,
private val signInUseCase: SignInUseCase,
private val getCurrentUserInformationUseCase: GetCurrentUserInformationUseCase

): ViewModel() {
// TODO: add viewmodel code here
init {
viewModelScope.launch(ioDispatcher) {
// TODO: this is test code. remove later
signInUseCase(
"[email protected]",
"1234"
)
// TODO: this is test code. remove later
getCurrentUserInformationUseCase()
.onSuccess {
AppLog.e(TAG, "init", "user name: ${it.name}")
AppLog.e(TAG, "init", "user email: ${it.email}")

}.onFailure {
AppLog.e(TAG, "init", "failure: $it")
}
}
}

companion object {
private val TAG = HomeViewModel::class.java.simpleName
}
}

0 comments on commit 46493e3

Please sign in to comment.