fix: Honour the FAB_HIDE preference in timelines (#227)
This commit is contained in:
parent
c2292a565e
commit
392eb55485
|
@ -381,12 +381,12 @@ abstract class TimelineViewModel(
|
||||||
.filter { it == PrefKeys.FAB_HIDE }
|
.filter { it == PrefKeys.FAB_HIDE }
|
||||||
.map {
|
.map {
|
||||||
UiState(
|
UiState(
|
||||||
sharedPreferencesRepository.getBoolean(PrefKeys.FAB_HIDE, false),
|
showFabWhileScrolling = !sharedPreferencesRepository.getBoolean(PrefKeys.FAB_HIDE, false),
|
||||||
)
|
)
|
||||||
}.stateIn(
|
}.stateIn(
|
||||||
scope = viewModelScope,
|
scope = viewModelScope,
|
||||||
started = SharingStarted.WhileSubscribed(stopTimeoutMillis = 5000),
|
started = SharingStarted.WhileSubscribed(stopTimeoutMillis = 5000),
|
||||||
initialValue = UiState(showFabWhileScrolling = true),
|
initialValue = UiState(showFabWhileScrolling = !sharedPreferencesRepository.getBoolean(PrefKeys.FAB_HIDE, false)),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (timelineKind is TimelineKind.Home) {
|
if (timelineKind is TimelineKind.Home) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ class CachedTimelineViewModelTestUiState : CachedTimelineViewModelTestBase() {
|
||||||
|
|
||||||
// Given
|
// Given
|
||||||
sharedPreferencesRepository.edit {
|
sharedPreferencesRepository.edit {
|
||||||
putBoolean(PrefKeys.FAB_HIDE, false)
|
putBoolean(PrefKeys.FAB_HIDE, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
|
|
|
@ -52,7 +52,7 @@ class NetworkTimelineViewModelTestUiState : NetworkTimelineViewModelTestBase() {
|
||||||
|
|
||||||
// When
|
// When
|
||||||
sharedPreferencesRepository.edit {
|
sharedPreferencesRepository.edit {
|
||||||
putBoolean(PrefKeys.FAB_HIDE, false)
|
putBoolean(PrefKeys.FAB_HIDE, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
|
|
Loading…
Reference in New Issue