Fix bookmarking scrolling to top of the page bug (#548)

pull/528/head
Manuel Vivo 2 years ago committed by GitHub
parent 71e98d8297
commit 20c29a6c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,7 +32,6 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import javax.inject.Inject import javax.inject.Inject
@ -68,7 +67,8 @@ class ForYouViewModel @Inject constructor(
} else { } else {
getSaveableNewsResources( getSaveableNewsResources(
filterTopicIds = userData.followedTopics, filterTopicIds = userData.followedTopics,
).mapToFeedState() )
.map<List<UserNewsResource>, NewsFeedUiState>(NewsFeedUiState::Success)
} }
} }
// Flatten the feed flows. // Flatten the feed flows.
@ -116,7 +116,3 @@ class ForYouViewModel @Inject constructor(
} }
} }
} }
private fun Flow<List<UserNewsResource>>.mapToFeedState(): Flow<NewsFeedUiState> =
map<List<UserNewsResource>, NewsFeedUiState>(NewsFeedUiState::Success)
.onStart { emit(NewsFeedUiState.Loading) }

Loading…
Cancel
Save