adjust stateflow starting mode

This commit is contained in:
Stefano Sansone
2024-05-01 02:23:11 +02:00
parent ce2f0d4b6f
commit 5b58c1c23f

View File

@ -5,10 +5,8 @@ import android.widget.Toast
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.asLiveData
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import app.omnivore.omnivore.BuildConfig import app.omnivore.omnivore.BuildConfig
import app.omnivore.omnivore.R import app.omnivore.omnivore.R
@ -45,7 +43,6 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import io.intercom.android.sdk.Intercom import io.intercom.android.sdk.Intercom
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
@ -101,7 +98,7 @@ class LoginViewModel @Inject constructor(
followingTabActive followingTabActive
).stateIn( ).stateIn(
scope = viewModelScope, scope = viewModelScope,
started = SharingStarted.WhileSubscribed(), started = SharingStarted.Lazily,
initialValue = true initialValue = true
) )