Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mikescamell committed Sep 12, 2024
1 parent 77c276d commit 4525020
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() {

private fun observeViewModel() {
viewModel.viewState
.flowWithLifecycle(lifecycle, Lifecycle.State.RESUMED)
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
.onEach { viewState ->
when (viewState.selectedOption) {
LastOpenedTab -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import timber.log.Timber

@ContributesViewModel(ActivityScope::class)
class ShowOnAppLaunchViewModel @Inject constructor(
@AppCoroutineScope private val appScope: CoroutineScope,
private val dispatcherProvider: DispatcherProvider,
private val showOnAppLaunchOptionDataStore: ShowOnAppLaunchOptionDataStore,
) : ViewModel() {
Expand Down Expand Up @@ -66,14 +65,14 @@ class ShowOnAppLaunchViewModel @Inject constructor(

fun onShowOnAppLaunchOptionChanged(option: ShowOnAppLaunchOption) {
Timber.i("User changed show on app launch option to $option")
viewModelScope.launch {
viewModelScope.launch(dispatcherProvider.io()) {
showOnAppLaunchOptionDataStore.setShowOnAppLaunchOption(option)
}
}

fun setSpecificPageUrl(url: String) {
Timber.i("Setting specific page url to $url")
appScope.launch {
viewModelScope.launch(dispatcherProvider.io()) {
showOnAppLaunchOptionDataStore.setSpecificPageUrl(url)
}
}
Expand Down

0 comments on commit 4525020

Please sign in to comment.