-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: rewrite to remove ambient account #964
Open
nikclayton
wants to merge
81
commits into
main
Choose a base branch
from
92x-mainactivity-viewmodel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The new anti-harassment features will add several different types of filtering options through the UI. To ensure there is no confusion, rename the existing "Filters" UI and code to "Content filters" to accurately describe what they operate on, distinct from new filters which will act on account metadata. Fixes #926.
# Conflicts: # app/src/main/res/values-gl/strings.xml
Stops MainActivity referencing AccountManager.
Instead of storing the current state in memory, push changes down to the database, and expose flows of those changes. Convert consumers of AccountManager.activeAccount. The change so far is bare minimum to get things building and working, some tests don't work yet. Filters and lists also don't work properly because of races with the InstanceSwitchAuthInterceptor. That'll be fixed in the next commit, where they'll be part of the Account info and fetched when the account info is fetched during the account switch process.
…ewmodel # Conflicts: # app/lint-baseline.xml # app/src/main/java/app/pachli/components/notifications/NotificationsViewModel.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/app/pachli/fragment/SFragment.kt # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values/strings.xml # core/domain/build.gradle.kts
…ewmodel # Conflicts: # app/lint-baseline.xml # app/src/main/java/app/pachli/TimelineActivity.kt # app/src/main/java/app/pachli/adapter/FilterableStatusViewHolder.kt # app/src/main/java/app/pachli/adapter/StatusViewHolder.kt # app/src/main/java/app/pachli/components/filters/ContentFiltersActivity.kt # app/src/main/java/app/pachli/components/filters/ContentFiltersListener.kt # app/src/main/java/app/pachli/components/filters/ContentFiltersViewModel.kt # app/src/main/java/app/pachli/components/filters/EditContentFilterActivity.kt # app/src/main/java/app/pachli/components/filters/EditContentFilterViewModel.kt # app/src/main/java/app/pachli/components/filters/FiltersAdapter.kt # app/src/main/java/app/pachli/components/notifications/NotificationsFragment.kt # app/src/main/java/app/pachli/components/notifications/NotificationsPagingAdapter.kt # app/src/main/java/app/pachli/components/notifications/NotificationsViewModel.kt # app/src/main/java/app/pachli/components/preference/AccountPreferencesFragment.kt # app/src/main/java/app/pachli/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/app/pachli/components/timeline/TimelineFragment.kt # app/src/main/java/app/pachli/components/timeline/TimelinePagingAdapter.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineViewModel.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/NetworkTimelineViewModel.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/app/pachli/components/trending/viewmodel/TrendingTagsViewModel.kt # app/src/main/java/app/pachli/components/viewthread/ThreadAdapter.kt # app/src/main/java/app/pachli/components/viewthread/ViewThreadFragment.kt # app/src/main/java/app/pachli/components/viewthread/ViewThreadViewModel.kt # app/src/main/java/app/pachli/network/ContentFilterModel.kt # app/src/main/java/app/pachli/viewdata/NotificationViewData.kt # app/src/main/java/app/pachli/viewdata/StatusViewData.kt # app/src/test/java/app/pachli/ContentFilterV1Test.kt # app/src/test/java/app/pachli/components/filters/ContentContentFilterViewDataTest.kt # app/src/test/java/app/pachli/components/notifications/NotificationsViewModelTestBase.kt # app/src/test/java/app/pachli/components/timeline/CachedTimelineViewModelTestBase.kt # app/src/test/java/app/pachli/components/timeline/NetworkTimelineViewModelTestBase.kt # app/src/test/java/app/pachli/components/viewthread/ViewThreadViewModelTest.kt # core/data/src/main/kotlin/app/pachli/core/data/model/ContentFilter.kt # core/data/src/main/kotlin/app/pachli/core/data/repository/ContentFiltersRepository.kt # core/data/src/test/kotlin/app/pachli/core/data/repository/filtersRepository/BaseContentFiltersRepositoryTest.kt # core/data/src/test/kotlin/app/pachli/core/data/repository/filtersRepository/ContentFiltersRepositoryTestFlow.kt # core/data/src/test/kotlin/app/pachli/core/data/repository/filtersRepository/ContentFiltersRepositoryTestUpdate.kt # core/navigation/src/main/kotlin/app/pachli/core/navigation/Navigation.kt # core/network/src/main/kotlin/app/pachli/core/network/model/FilterAction.kt # core/network/src/main/kotlin/app/pachli/core/network/model/FilterV1.kt # core/network/src/main/kotlin/app/pachli/core/network/retrofit/MastodonApi.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/MainActivity.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/MainActivity.kt # app/src/main/java/app/pachli/components/notifications/PushNotificationHelper.kt # app/src/main/java/app/pachli/components/notifications/domain/AndroidNotificationsAreEnabledUseCase.kt # app/src/main/java/app/pachli/components/notifications/domain/EnableAllNotificationsUseCase.kt # app/src/main/java/app/pachli/components/preference/NotificationPreferencesFragment.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/MainActivity.kt # app/src/main/java/app/pachli/usecase/LogoutUseCase.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/components/search/SearchActivity.kt # core/data/src/main/kotlin/app/pachli/core/data/model/Server.kt # core/data/src/main/kotlin/app/pachli/core/data/repository/ContentFiltersRepository.kt # core/data/src/main/kotlin/app/pachli/core/data/repository/ServerRepository.kt # core/data/src/test/kotlin/app/pachli/core/data/model/ServerTest.kt # core/data/src/test/kotlin/app/pachli/core/data/repository/filtersRepository/BaseContentFiltersRepositoryTest.kt # core/model/build.gradle.kts # core/model/src/main/kotlin/app/pachli/core/model/ServerOperation.kt # core/network/src/main/kotlin/app/pachli/core/network/model/nodeinfo/NodeInfo.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/components/notifications/NotificationsViewModel.kt # app/src/main/java/app/pachli/components/notifications/PushNotificationHelper.kt # app/src/main/java/app/pachli/components/preference/NotificationPreferencesFragment.kt # app/src/main/java/app/pachli/components/search/SearchViewModel.kt # app/src/main/java/app/pachli/components/timeline/NetworkTimelineRepository.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineRemoteMediator.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/NetworkTimelineRemoteMediator.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/app/pachli/components/viewthread/ViewThreadViewModel.kt # app/src/main/java/app/pachli/util/ShareShortcutHelper.kt # app/src/test/java/app/pachli/components/timeline/CachedTimelineRemoteMediatorTest.kt # app/src/test/java/app/pachli/components/timeline/NetworkTimelineRemoteMediatorTest.kt # core/activity/build.gradle.kts # core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt # core/data/build.gradle.kts # core/data/src/main/kotlin/app/pachli/core/data/repository/AccountManager.kt # core/domain/build.gradle.kts
…ewmodel # Conflicts: # feature/suggestions/src/main/kotlin/app/pachli/feature/suggestions/SuggestionsViewModel.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/TimelineActivity.kt # app/src/main/java/app/pachli/adapter/FilterableStatusViewHolder.kt # app/src/main/java/app/pachli/components/filters/ContentFiltersActivity.kt # app/src/main/java/app/pachli/components/filters/ContentFiltersViewModel.kt # app/src/main/java/app/pachli/components/filters/EditContentFilterActivity.kt # app/src/main/java/app/pachli/components/filters/EditContentFilterViewModel.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineViewModel.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/NetworkTimelineViewModel.kt # app/src/main/java/app/pachli/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/app/pachli/components/trending/viewmodel/TrendingTagsViewModel.kt # app/src/main/java/app/pachli/network/ContentFilterModel.kt # app/src/test/java/app/pachli/ContentFilterV1Test.kt # app/src/test/java/app/pachli/components/filters/ContentContentFilterViewDataTest.kt # core/data/src/main/kotlin/app/pachli/core/data/model/ContentFilter.kt # core/data/src/main/kotlin/app/pachli/core/data/repository/ContentFiltersRepository.kt # core/data/src/test/kotlin/app/pachli/core/data/repository/filtersRepository/ContentFiltersRepositoryTestFlow.kt # core/data/src/test/kotlin/app/pachli/core/data/repository/filtersRepository/ContentFiltersRepositoryTestUpdate.kt # core/navigation/src/main/kotlin/app/pachli/core/navigation/Navigation.kt # core/network/src/main/kotlin/app/pachli/core/network/retrofit/NewContentFilterConverterFactory.kt
…activity-viewmodel
Tests that rely on stubbing the MastodonAPI may have incorrect behaviour if some of the API methods called by the system-under-test are not stubbed. This can be difficult to track down. Make this easier by adding a default answer for the MastodonAPI used in tests. Any un-stubbed methods will throw an `AssertionError` with enough information to identify the method that should be stubbed and where it was called from.
…ewmodel # Conflicts: # core/network-test/src/main/kotlin/app/pachli/core/network/di/test/FakeMastodonApiModule.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/viewmodel/EditProfileViewModel.kt
…ewmodel # Conflicts: # core/database/schemas/app.pachli.core.database.AppDatabase/6.json # core/database/src/main/kotlin/app/pachli/core/database/AppDatabase.kt
- handle error cases, provide retry or re-auth options -
- Allows MainActivity to show refresh errors with a retry option
…ewmodel # Conflicts: # app/src/main/java/app/pachli/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/app/pachli/components/viewthread/ViewThreadViewModel.kt
…ewmodel # Conflicts: # app/src/main/java/app/pachli/MainActivity.kt # app/src/main/java/app/pachli/components/compose/ComposeViewModel.kt # app/src/main/java/app/pachli/components/preference/PreferencesFragment.kt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Absolutely not ready to merge, but pushing this makes it easier to see which bits get pulled out in to the separate PRs.
This does a few things:
Uses a new PachliAccount type through most of the app. This holds information that was separate (e.g., content filters, lists) in one place. The information is loaded when the app launches or the active account switches.
By fetching data when the account is switched / loaded it simplifies error handling, as more code can now assume the data has already been loaded. If it hasn't the code path is simply unreachable.
Starts to remove the "activeAccount" idiom from the code. Instead of the active account being "ambient information" every activity/fragment/viewmodel/operation is going to work with an explicitly specified account. This does a few things: