Fix loading selected filter on startup

pull/2807/head
Alex Baker 8 months ago
parent f33cc896dd
commit 4fb3cda173

@ -390,7 +390,7 @@ class MainActivity : AppCompatActivity() {
lifecycleScope.launch { lifecycleScope.launch {
val filter = intent.getFilter val filter = intent.getFilter
?: intent.getFilterString?.let { defaultFilterProvider.getFilterFromPreference(it) } ?: intent.getFilterString?.let { defaultFilterProvider.getFilterFromPreference(it) }
?: viewModel.state.value.filter ?: defaultFilterProvider.getStartupFilter()
val task = getTaskToLoad(filter) val task = getTaskToLoad(filter)
viewModel.setFilter(filter = filter, task = task) viewModel.setFilter(filter = filter, task = task)
} }

@ -16,7 +16,6 @@ import com.todoroo.astrid.api.GtasksFilter
import com.todoroo.astrid.api.TagFilter import com.todoroo.astrid.api.TagFilter
import com.todoroo.astrid.data.Task import com.todoroo.astrid.data.Task
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList import kotlinx.collections.immutable.toPersistentList
@ -46,7 +45,6 @@ import javax.inject.Inject
@HiltViewModel @HiltViewModel
class MainActivityViewModel @Inject constructor( class MainActivityViewModel @Inject constructor(
savedStateHandle: SavedStateHandle, savedStateHandle: SavedStateHandle,
@ApplicationContext context: Context,
private val defaultFilterProvider: DefaultFilterProvider, private val defaultFilterProvider: DefaultFilterProvider,
private val filterProvider: FilterProvider, private val filterProvider: FilterProvider,
private val taskDao: TaskDao, private val taskDao: TaskDao,

Loading…
Cancel
Save