Conversation
…ce/bluesky/NotificationRemoteMediator.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the app’s paging architecture to standardize on a unified BaseTimelineLoader API and TimelinePresenter across all presenters.
- Switch from
accountServiceProvider+collectAsLazyPagingItems()toaccountServiceFlow+loader: Flow<BaseTimelineLoader> - Rewrite each presenter to use the new
TimelinePresenterbase class and remove legacy paging helpers - Update remote mediators to return
Result(endOfPaginationReached, data)instead of the oldBaseRemoteMediator
Reviewed Changes
Copilot reviewed 135 out of 135 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| StatusContextPresenter.kt | Refactor to use TimelinePresenter and unified loader API |
| ProfilePresenter.kt | Migrate profile data fetching to Flow<BaseTimelineLoader> |
| TimelinePresenter.kt | Introduce BaseTimelineLoader and remove legacy paging code |
Comments suppressed due to low confidence (1)
shared/src/commonMain/kotlin/dev/dimension/flare/ui/presenter/profile/ProfilePresenter.kt:5
- [nitpick] The collectAsState import appears unused or inconsistent with the UI model's collectAsUiState helper; consider removing or replacing it for consistency.
import androidx.compose.runtime.collectAsState
| import dev.dimension.flare.data.repository.AccountRepository | ||
| import dev.dimension.flare.data.repository.NoActiveAccountException | ||
| import dev.dimension.flare.data.repository.accountServiceFlow | ||
| import dev.dimension.flare.data.repository.accountServiceProvider |
There was a problem hiding this comment.
Remove the deprecated accountServiceProvider import now that all presenters use accountServiceFlow for consistency.
| import dev.dimension.flare.data.repository.accountServiceProvider |
| val accountServiceState = accountServiceProvider(accountType = accountType, repository = accountRepository) | ||
| val userState = | ||
| accountServiceState.map { service -> | ||
| val userId = | ||
| userKey?.id | ||
| ?: if (service is AuthenticatedMicroblogDataSource) { | ||
| service.accountKey.id | ||
| } else { | ||
| null | ||
| } | ||
| if (userId == null) { | ||
| throw NoActiveAccountException | ||
| } else { | ||
| remember(service, userKey) { | ||
| service.userById(userId) | ||
| }.collectAsState() | ||
| } | ||
| } | ||
| val userState by userStateFlow.collectAsState(UiState.Loading()) | ||
| accountServiceState.onSuccess { | ||
| val userKey = userKey ?: if (it is AuthenticatedMicroblogDataSource) it.accountKey else null |
There was a problem hiding this comment.
The body method still uses accountServiceProvider instead of the new accountServiceFlow API, leading to inconsistent data loading; replace this call with accountServiceFlow and collect its UI state.
| val accountServiceState = accountServiceProvider(accountType = accountType, repository = accountRepository) | |
| val userState = | |
| accountServiceState.map { service -> | |
| val userId = | |
| userKey?.id | |
| ?: if (service is AuthenticatedMicroblogDataSource) { | |
| service.accountKey.id | |
| } else { | |
| null | |
| } | |
| if (userId == null) { | |
| throw NoActiveAccountException | |
| } else { | |
| remember(service, userKey) { | |
| service.userById(userId) | |
| }.collectAsState() | |
| } | |
| } | |
| val userState by userStateFlow.collectAsState(UiState.Loading()) | |
| accountServiceState.onSuccess { | |
| val userKey = userKey ?: if (it is AuthenticatedMicroblogDataSource) it.accountKey else null | |
| val accountServiceState by accountServiceFlow(accountType = accountType, accountRepository).collectAsState(UiState.Loading()) | |
| val userState by userStateFlow.collectAsState(UiState.Loading()) | |
| accountServiceState.onSuccess { service -> | |
| val userKey = userKey ?: if (service is AuthenticatedMicroblogDataSource) service.accountKey else null |
No description provided.