forked from FoKE-Developers/FourCutTogether
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test code for using account information [FoKE-Developers#73]
- 계정 정보를 임의로 받아올 수 있도록 하드코딩했습니다. - 추후 테스트 마치고 삭제 예정입니다.
- Loading branch information
Showing
1 changed file
with
33 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 33 additions & 1 deletion
34
presenter/src/main/java/com/foke/together/presenter/viewmodel/HomeViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |