pachli-android/core
Nik Clayton 00a2cd32d3
change: Implement more of FiltersRepository (#816)
The previous code had a number of problems, including:

- Calls to the filters API were scattered through UI and viewmodel code.
- Repeated places where the differences between the v1 and v2 Mastodon
filters API had to be handled.
- UI and viewmodel code using the network filter classes, which tied
them to the API implementation.
- Error handling was inconsistent.

Fix this.

## FiltersRepository

- All filter management now goes through `FiltersRepository`.
- `FiltersRepository` exposes the current set of filters as a
`StateFlow`, and automatically updates it when the current server
changes or any changes to filters are made. This makes
`FilterChangeEvent` obsolete.
- Other operations on filters are exposed through `FiltersRepository` as
functions for viewmodels to call.
- Within the bulk of the app a new `Filter` class is used to represent a
filter; handling the differences between the v1 and v2 APIs is
encapsulated in `FiltersRepository`.
- Represent errors when handling filters as subclasses of `PachliError`,
and use `Result<V, E>` throughout, including using `ApiResult` for all
filter API results.
- Provide different types to distinguish between new-and-unsaved
filters, new-and-unsaved keywords, and in-progress edits to filters.

## Editing filters

- Accept an optional complete filter, or filter ID, as parameters in the
intent that launches `EditFilterActivity`. Pass those to the viewmodel
using assisted injection so the viewmodel has the info immediately.
- In the viewmodel use a new `FilterViewData` type to model the data
used to display and edit the filter.
- Start using the UiSuccess/UiError model. Refrain from cutting over to
full the action implementation as that would be a much larger change.
- Use `FiltersRepository` instead of making any API calls directly.

## Listing filters

- Use `FiltersRepository` instead of making any API calls directly.

## EventHub

- Remove `FilterChangedEvent`. Update everywhere that used it to use the
flow from `FiltersRepository`.
2024-07-14 15:36:52 +02:00
..
accounts fix: Ensure logging out accounts completes (#515) 2024-03-10 12:25:12 +01:00
activity fix(l10n): Update Irish translations 2024-07-13 09:43:18 +02:00
common change: Implement more of FiltersRepository (#816) 2024-07-14 15:36:52 +02:00
data change: Implement more of FiltersRepository (#816) 2024-07-14 15:36:52 +02:00
database refactor: Remove `TabData` type (#576) 2024-03-30 23:27:25 +01:00
designsystem feat: Show author bylines on preview cards, tap to view profile (#805) 2024-07-06 00:30:24 +02:00
model refactor: Remove `TabData` type (#576) 2024-03-30 23:27:25 +01:00
navigation change: Implement more of FiltersRepository (#816) 2024-07-14 15:36:52 +02:00
network change: Implement more of FiltersRepository (#816) 2024-07-14 15:36:52 +02:00
network-test change: Move MediaUploadApi to the correct package 2024-04-30 16:23:34 +02:00
preferences feat: Show author bylines on preview cards, tap to view profile (#805) 2024-07-06 00:30:24 +02:00
testing change: Implement more of FiltersRepository (#816) 2024-07-14 15:36:52 +02:00
ui fix(l10n): Update Irish translations 2024-07-13 09:43:18 +02:00
AndroidManifest.xml refactor: Start creating core modules (#286) 2023-12-04 16:58:36 +01:00