-
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.
- Loading branch information
Showing
4 changed files
with
49 additions
and
19 deletions.
There are no files selected for viewing
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
6 changes: 6 additions & 0 deletions
6
app/src/main/java/us/kikin/android/gamingbacklog/presentation/onboarding/OnboardingEvent.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package us.kikin.android.gamingbacklog.presentation.onboarding | ||
|
||
sealed class OnboardingEvent { | ||
|
||
object SaveAppEntry: OnboardingEvent() | ||
} |
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
28 changes: 28 additions & 0 deletions
28
...c/main/java/us/kikin/android/gamingbacklog/presentation/onboarding/OnboardingViewModel.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package us.kikin.android.gamingbacklog.presentation.onboarding | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.launch | ||
import us.kikin.android.gamingbacklog.domain.usecase.AppEntryUseCases | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class OnboardingViewModel @Inject constructor( | ||
private val appEntryUseCases: AppEntryUseCases | ||
) : ViewModel() { | ||
|
||
fun onEvent(event: OnboardingEvent) { | ||
when (event) { | ||
OnboardingEvent.SaveAppEntry -> { | ||
saveAppEntry() | ||
} | ||
} | ||
} | ||
|
||
private fun saveAppEntry() { | ||
viewModelScope.launch { | ||
appEntryUseCases.saveAppEntry() | ||
} | ||
} | ||
} |