Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test code for using account information [#73] #79

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}