710e209e34
Continue the work to remove the "activeAccount" idiom. - Uses a new PachliAccount type through most of the app. This holds information that was previously accessed separately (e.g., content filters, lists) in one place. The information is loaded when the app launches or the active account switches. - Fetching data when the account is switched / loaded 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. - This opens up the possibility of "acting as one account while logged in as another". E.g., have two accounts, and be logged in to one account and boost a post you've seen from your other account. - Add a database migration to populate existing accounts with default data when the user updates the app. - Refactor code that used those list and filter repositories to get the data from the PachliAccount instead. New local and remote data sources are implemented, and the list and filter repositories mediate between those sources. - Start a ViewModel for MainActivity, which includes: - Sending user actions as UiAction objects - Providing a flow of uiState for MainActivity to react to - Remove most uses of SharedPreferencesRepository from MainActivity - Show messages about errors that occur when logging in - Refactor intent routing in MainActivity to make the logic clearer. - Add new `core.data` types to push more `core.network` types out of the UI code - `core.data.model.MastodonList` for `core.network.model.MastoList` - `core.data.model.Server` for `core.network.model.Server` - Continue the work to send the Pachli account ID to the code that uses it. - Most view models now get the account ID via assisted injection. - QueuedMedia now includes the AccountEntity so it can operate with any account. Modify the `uploadMedia` API call to include explicit authentication details. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
src/main | ||
README.md | ||
build.gradle.kts | ||
lint-baseline.xml |
README.md
:core:navigation
package app.pachli.core.navigation
Intents for starting activities to break circular dependencies.
A common approach for surfacing type-safe (ish) intents to start activities is for the activity-to-be-launched to provide a method in a companion object that returns the relevant intent, possibly taking additional parameters that will be included in the intent as extras.
E.g., if A wants to start B, B provides the method that returns the intent.
This introduces a dependency between A and B.
This is worse if B also wants to start A.
For example, if A is TimelineActivity
and B isViewThreadActivity
. The user might click a status in TimelineActivity
to view the thread, starting ViewThreadActivity
. But from the thread they might click a hashtag to view the list of statuses with that hashtag. Now TimelineActivity
and ViewThreadActivity
have a circular dependency.
Even if that doesn't happen the dependency means that any changes to B will trigger a rebuild of A, even if the changes to B are not relevant.
This package contains Intent
subclasses that should be used instead. The quadrant
plugin is used to generate constants that can be used to launch activities by name instead of by class, breaking the dependency chain.
If the activity's intent requires specific extras those are passed via the constructor, with companion object methods to extract them from the intent.
Using the intent classes from this package is enforced by a lint IntentDetector
which will warn if any intents are created using a class literal.