70 Commits

Author SHA1 Message Date
Russssty
04c12a2505 fix(l10n): Update Slovak translations
Currently translated at 100.0% (11 of 11 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/sk/
2025-02-05 22:14:35 +01:00
Nik Clayton
91d577c128
refactor: Replace the different network response types with ApiResult (#1261)
Previous code used five (!) different types for the network response.

Some used Retrofit's `Response`. This provides access to the headers.

Some used `NetworkResult`. This did not provide access to the headers,
but did provide some higher-order functions (e.g., `fold`) for operating
on the results.

One used a raw `Map`.

One used a raw `Call`.

The rest had been converted to `ApiResult`, a `Result<V, ApiError>`.
This provides the higher-order functions, provides the headers, and
is exception-free, so is the correct type to use.

This PR completes the work of cutting over to `ApiResult`. The return
values are changed and the calling code is adjusted to use the new
functions as appropriate.
2025-02-05 13:37:59 +01:00
Nik Clayton
ccb9628b77
refactor: Simplify page fetching code (#1257)
Previous code complicated the logic to retrieve and fetch a jumbo page
of results around a given status/notification ID. Simplify it to make it
easier to follow.
2025-02-03 20:14:16 +01:00
Nik Clayton
1611e488f6
refactor: Update status storage, fragments (#1249)
# Status storage

Re-work how statuses are stored and managed to separate the cached home
timeline from the cached notification timeline.

Previously, the home timeline pulled all statuses in `StatusEntity`.
Since that table also includes statuses that are referenced from
`NotificationEntity` this could show the wrong data. It also makes it
difficult to cache other timelines in the future.

To fix this:

- Introduce `TimelineStatus` which associates a given timeline with the
statuses on that timeline.

- Use the the `StatusEntity` table as a general cache of statuses.
wherever they're used. 

- Create the home timeline by joining `TimelineStatus` (where the
timeline's kind is `Home`) with the statuses in `StatusEntity`.

This has a number of knock-on effects.

- Deleting from the home timeline now deletes the association from
`TimelineStatus`. The cached status is unaffected, so if it is
referenced from another cached timeline (currently, notifications)
there is no change.

- Modifying a status on one timeline (translating, expanding,
collapsing, etc) modifies it on all timelines that reference that
status.

- `cleanup()` and related functions no longer need to take `limit` or
`keep` parameter, as it's known whether a status is referenced from a
timeline.

Rewriting one of the queries exposed an issue where `TimelineDaoTest`
run locally could return different (incorrect) results to the same test
run on a device (https://issuetracker.google.com/issues/393685887).

So re-implement `TimelineDaoTest` as an `androidTest`, and update the CI
workflow to include a step to run these tests on an API 31 emulator.

# Repositories

- Allow `null` as an initial key.

# Fragments

- Remove unnecessary `refreshAdapterAndScrollToVisibleId`.
2025-02-02 21:29:27 +01:00
Nik Clayton
ecb0f7cc84
refactor: Use a single transaction for all remote mediator operations (#1256)
Previous code used a transaction for updates to the database, but didn't
do the earlier reads in the same transaction. Theoretically this could
race.

Guard against this by using a single transaction for a complete remote
mediator operation (refresh, prepend, append).
2025-02-01 19:59:07 +01:00
Nik Clayton
c6b5f949dc
refactor: Create StatusDao for operations that act on individual statuses (#1252)
TimelineDao contained operations on timelines and statuses which made it
large and confusing.

Factor out the status-specific operations in to the new StatusDao class
to make things more understandable.
2025-02-01 12:11:30 +01:00
Nik Clayton
d42eba90bb
refactor: Rename TimelineStatusEntity to StatusEntity (#1251)
TimelineStatusEntity is going to be repurposed for the table that maps
between a timeline (not just the home timeline) and the statuses on that
timeline.
2025-02-01 11:54:42 +01:00
Weblate (bot)
d851319305
fix(l10n): Translations update from Hosted Weblate (#1246)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pachli/Fastlane
Metadata](https://hosted.weblate.org/projects/pachli/fastlane-metadata/).


It also includes following components:

* [Pachli/App :
Fdroid](https://hosted.weblate.org/projects/pachli/app-fdroid/)

* [Pachli/App :
Main](https://hosted.weblate.org/projects/pachli/app-main/)

* [Pachli/Core/Activity :
Orange](https://hosted.weblate.org/projects/pachli/coreactivity-orange/)

* [Pachli/Feature/About :
Main](https://hosted.weblate.org/projects/pachli/featureabout-main/)

* [Pachli/Feature/Suggestions :
Main](https://hosted.weblate.org/projects/pachli/featuresuggestions-main/)

* [Pachli/Core/Ui :
Main](https://hosted.weblate.org/projects/pachli/coreui-main/)

* [Pachli/App :
Google](https://hosted.weblate.org/projects/pachli/app-google/)

* [Pachli/Core/Data :
Main](https://hosted.weblate.org/projects/pachli/coredata-main/)

*
[Pachli/Feature/Login](https://hosted.weblate.org/projects/pachli/featurelogin/)

* [Pachli/Core/Designsystem :
Main](https://hosted.weblate.org/projects/pachli/coredesignsystem-main/)

* [Pachli/Feature/Lists :
Main](https://hosted.weblate.org/projects/pachli/featurelists-main/)

* [Pachli/Core/Preferences :
Main](https://hosted.weblate.org/projects/pachli/corepreferences-main/)

* [Pachli/Core/Network :
Main](https://hosted.weblate.org/projects/pachli/corenetwork-main/)

* [Pachli/Core/Activity :
Main](https://hosted.weblate.org/projects/pachli/coreactivity-main/)



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pachli/fastlane-metadata/horizontal-auto.svg)

---------

Co-authored-by: Kalle Kniivilä <kalle.kniivila@gmail.com>
2025-01-30 12:05:02 +01:00
Aindriú Mac Giolla Eoin
a14c947592 fix(l10n): Update Irish translations
Currently translated at 100.0% (11 of 11 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/ga/
2025-01-28 19:40:32 +01:00
தமிழ்நேரம்
06130bc397 fix(l10n): Update Tamil translations
Currently translated at 100.0% (11 of 11 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/ta/
2025-01-28 13:52:10 +01:00
Juan M Sevilla
bae5c5031b fix(l10n): Update Spanish translations
Currently translated at 100.0% (11 of 11 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/es/
2025-01-28 13:52:10 +01:00
தமிழ்நேரம்
91cfbf677f fix(l10n): Update Tamil translations
Currently translated at 100.0% (10 of 10 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/ta/
2025-01-28 13:52:10 +01:00
Nik Clayton
0a42ab0b37
fix: Scroll and restore position correctly in Home and Notifications (#1240)
These are cached timelines, backed by Room. Room **requires** the
`PagingConfig` to have `enablePlaceholders = true`. Otherwise the list
is corrupted when scrolling down the list and paging in new items.

To restore the user's reading position correctly in the UI, wait for the
adapter to emit the very first page. Combine this with the user's
refresh key, and the number of placeholders in the page, to scroll the
user to the correct place in the list.

To make all this work, ensure that Room loads a large enough page of
data around the refresh key (in the `initialKey` calculation).
2025-01-28 10:57:18 +01:00
Nik Clayton
ebdd5862cb
fix: Update server capabilities as Akkoma has v1 filter support (#1238) 2025-01-28 10:44:40 +01:00
Nik Clayton
353f123b5d
fix: Show an error message if a Dao error occurs during login (#1235)
Previous code would crash on an SQLiteException. Catch it and convert to
a specific error.
2025-01-25 16:06:04 +01:00
Nik Clayton
5f67f9938c
fix: Ensure coroutine cancellations propograte, rethrow CancellationException (#1231)
Previous code had legacy `try ... catch` blocks that could catch all
exceptions, including `CancellationException`, thrown if the job of a
suspending function is cancelled.

Indiscriminately catching those can interfere with cancellation, so use
`currentCoroutineContext().ensureActive()` to rethrow the exception if
the job has been cancelled.
2025-01-24 18:04:46 +01:00
Nik Clayton
7bf322c4f3
refactor: Use same patterns as Notifications* implementation (#1222)
The modifications to the Notifications* classes highlighted different
(and better) ways of writing the code that manages status timelines.
Follow those practices here.

Changes include:

- Move `pachliAccountId` in to `IStatusViewData` so the adapter does not
need to be initialised with the information. This allows the parameter
to be removed from functions that operate on `IStatusViewData`, and the
adapter does not need to be marked `lateinit`.

- Convert Fragment/ViewModel communication to use the `uiResult`
pattern instead of separate `uiSuccess` and `uiError`.

- Show a `LinearProgressIndicator` when refreshing the list.

- Restore the reading position more smoothly by responding when the
first page of results is loaded.

- Save the reading position to `RemoteKeyEntity` instead of a dedicated
property in `AccountEntity`.

- Fixed queries for returning the row number of a notification or
status in the database.

Fixes #238, #872, #928, #1190
2025-01-23 13:23:17 +01:00
Nik Clayton
e8e84a1538
feat: Persist notification filtering decisions locally (#1196)
Persist the user's notification filtering decisions (i.e., the decision
to show a filtered notification) by caching all notification data,
including the filtering decision, in the database.

## Structure changes

This means re-writing the notification management system to use Room and
the Paging library to manage the notification data.

Implement a repository and remote mediator for notifications that does
this, with knock on effects for the viewmodel and the fragment. Take the
opportunity to rewrite these to reflect (current understanding of) best
practice for state management.

Active account information is included in the viewdata for each
notification when sent to the adapter. This allows the adapter to be
created before the fragment knows the active account from the view
model.

`RemoteKeyDao` is extended to support sorting the "refresh" key for
a timeline. This is used to persist the notifications refresh key
instead of the `lastNotificationId` property in the account (which has
been removed).

## UX changes

A linear progress bar is used to show progress when notifications are
refreshed, as part of the ongoing effort to migrate the UI.
2025-01-19 22:24:30 +01:00
Nik Clayton
40370e607e
fix: Show lists sorted by title (#1218)
Some parts of the UI already showed lists sorted by title, but not all.

The areas fixed are:

- The list of lists in the main drawer (left side navitation)
- The list of lists when adding/removing an account from a list

Fixes #1168
2025-01-18 18:02:29 +01:00
Nik Clayton
df5e65bb47
refactor: Delete account data using foreign key constraints (#1205)
Previous code managed account deletions by having specific functions to
call when an account was deleted that would delete all related data.

Replace this with proper foreign key references back to the account ID,
and cascade account deletes to the related data.

Add tests to ensure the deletes happen as expected. Update existing
tests to create an account where necessary so the new foreign key
constraints are kept.
2025-01-16 18:14:06 +01:00
Nik Clayton
59ab24a0a6
refactor: Move StatusViewData to core.data.model (#1195)
Makes it available to code in other modules, which will be necessary
when implementing cached notifications.
2025-01-06 15:20:08 +01:00
jens persson
ffe4a73d38 fix(l10n): Update Swedish translations
Currently translated at 100.0% (10 of 10 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/sv/
2024-12-23 12:33:00 +01:00
Nik Clayton
16f6330a9e
fix: Include URL when constructing nodeinfo error string (#1160)
Previous code crashed because of a missing format argument.
2024-12-08 14:30:29 +01:00
Nik Clayton
57be148fbf
feat: Show posts that mention a trending link (#1153)
Mastodon 4.3 introduced a new API to fetch a timeline of posts that
mention a trending link.

Use that to display a "See <n> posts about ths link" message in a
trending link's preview card (if supported by the server).

Define a new timeline type with associated API call to fetch the
timeline.

Add an accessibilty action to support this.

While I'm here also support author's in preview cards that don't have a
related Fediverse account; show their name in this case.

Fixes #1123
2024-12-03 23:00:31 +01:00
Nik Clayton
e009c00a76
feat: Initial support for filtering notifications by sending account (#1127)
Allow the user to define filtering rules for notifications by sending
account:

- Not followed
- Younger than 30d
- Limited by moderators

and a policy for each of either show, warn, or hide.

To do this:

## Manage followers

- Create a new `FollowingAccountEntity`, to record accounts the logged
in account is following.
- Fetch the account's followers when an account is made active, and
persist to this table.
- Provide the followers as a property on `PachliAccount`
- Update this table if the user follows/unfollows accounts during normal
operation.

## Track account creation time

- Record account creation time in `TimelineAccount`.

## Track notification creation time

- Record notification creation time in `Notification`.

## API

- Always fetch all notifications, including those the server is
filtering.

## UX and storage for account filters

- Show a new Account preference to edit account notification filters.
- Display a dialog to manage account notification filters.
- Persist the user's choice to new properties in `AccountEntity`.
- New `AccountManager` methods to update the properties

## Filtering notifications

- New `NotificationFilter.filterNotificationByAccount()` method to make
the filtering decision based on the user's preferences.
- Use this in `NotificationFetcher` to filter notifications before
creating Android notifications.
- Use this in `NotificationsViewModel` to filter notifications before
display in `NotificationsFragment`.

## UX for filtered notifications

- Display filtered (with warning) notifications inline with other
notifications, with UI to disclose the notification or edit the filters.
2024-11-25 11:35:05 +01:00
Nik Clayton
4c7107c910
feat: Support Pleroma returning dates with no timezone (#1120)
Pleroma (and possibly other servers) can return dates that have no
timezone. Previous code would fail to deserialise JSON in this state and
show an error.

Patch around this by assuming anything with a missing timezone is in UTC
(timezone suffix "Z").

Fixes #562
2024-11-21 16:20:27 +01:00
Nik Clayton
632282d0e2
fix: Prevent crash when showing account chooser (#1117)
Chooser dialog could start before any accounts have loaded. Fix by
collecting the account flow and waiting for the first emission (convert
the flow to shared instead of state so there's no initial empty list).

Guard against the potential for a similar issue when fetching
notifications.

Order the list of accounts with active account first so that code that
skips it by ignoring the first item works correctly.
2024-11-20 19:28:29 +01:00
Juan M Sevilla
d36aa18e0a fix(l10n): Update Spanish translations
Currently translated at 100.0% (10 of 10 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/es/
2024-11-16 08:13:15 +01:00
Languages add-on
61f6a5ed96 feat(l10n): Added Norwegian Nynorsk translation 2024-11-15 08:54:53 +01:00
Weblate (bot)
d7a683e6ea
fix(l10n): Translations update from Hosted Weblate (#1097)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pachli/Fastlane
Metadata](https://hosted.weblate.org/projects/pachli/fastlane-metadata/).


It also includes following components:

* [Pachli/App :
Main](https://hosted.weblate.org/projects/pachli/app-main/)

* [Pachli/Core/Data :
Main](https://hosted.weblate.org/projects/pachli/coredata-main/)

* [Pachli/App :
Fdroid](https://hosted.weblate.org/projects/pachli/app-fdroid/)

* [Pachli/App :
Google](https://hosted.weblate.org/projects/pachli/app-google/)

* [Pachli/Feature/About :
Main](https://hosted.weblate.org/projects/pachli/featureabout-main/)

* [Pachli/Core/Activity :
Main](https://hosted.weblate.org/projects/pachli/coreactivity-main/)

* [Pachli/Core/Preferences :
Main](https://hosted.weblate.org/projects/pachli/corepreferences-main/)

*
[Pachli/Feature/Login](https://hosted.weblate.org/projects/pachli/featurelogin/)

* [Pachli/Feature/Suggestions :
Main](https://hosted.weblate.org/projects/pachli/featuresuggestions-main/)

* [Pachli/Core/Activity :
Orange](https://hosted.weblate.org/projects/pachli/coreactivity-orange/)

* [Pachli/Core/Designsystem :
Main](https://hosted.weblate.org/projects/pachli/coredesignsystem-main/)

* [Pachli/Core/Network :
Main](https://hosted.weblate.org/projects/pachli/corenetwork-main/)

* [Pachli/Core/Ui :
Main](https://hosted.weblate.org/projects/pachli/coreui-main/)

* [Pachli/Feature/Lists :
Main](https://hosted.weblate.org/projects/pachli/featurelists-main/)



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pachli/fastlane-metadata/horizontal-auto.svg)

---------

Co-authored-by: Nik Clayton <nik@ngo.org.uk>
Co-authored-by: Weblate Translation Memory <noreply-mt-weblate-translation-memory@weblate.org>
2024-11-14 01:36:43 +01:00
Nik Clayton
710e209e34
refactor: Ongoing work to remove the activeAccount idiom (#964)
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>
2024-11-13 11:45:16 +01:00
Weblate (bot)
04d98ae616
fix(l10n): Translations update from Hosted Weblate (#1056)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pachli/Fastlane
Metadata](https://hosted.weblate.org/projects/pachli/fastlane-metadata/).


It also includes following components:

* [Pachli/App :
Main](https://hosted.weblate.org/projects/pachli/app-main/)

* [Pachli/App :
Fdroid](https://hosted.weblate.org/projects/pachli/app-fdroid/)

* [Pachli/Core/Activity :
Main](https://hosted.weblate.org/projects/pachli/coreactivity-main/)

* [Pachli/Core/Data :
Main](https://hosted.weblate.org/projects/pachli/coredata-main/)

* [Pachli/App :
Google](https://hosted.weblate.org/projects/pachli/app-google/)

* [Pachli/Core/Ui :
Main](https://hosted.weblate.org/projects/pachli/coreui-main/)

* [Pachli/Core/Network :
Main](https://hosted.weblate.org/projects/pachli/corenetwork-main/)

* [Pachli/Feature/About :
Main](https://hosted.weblate.org/projects/pachli/featureabout-main/)

* [Pachli/Core/Preferences :
Main](https://hosted.weblate.org/projects/pachli/corepreferences-main/)

* [Pachli/Core/Activity :
Orange](https://hosted.weblate.org/projects/pachli/coreactivity-orange/)

* [Pachli/Feature/Suggestions :
Main](https://hosted.weblate.org/projects/pachli/featuresuggestions-main/)

*
[Pachli/Feature/Login](https://hosted.weblate.org/projects/pachli/featurelogin/)

* [Pachli/Feature/Lists :
Main](https://hosted.weblate.org/projects/pachli/featurelists-main/)

* [Pachli/Core/Designsystem :
Main](https://hosted.weblate.org/projects/pachli/coredesignsystem-main/)



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pachli/fastlane-metadata/horizontal-auto.svg)

---------

Co-authored-by: Vaclovas Intas <Gateway_31@protonmail.com>
2024-10-29 15:43:23 +01:00
Nik Clayton
5a35009e35
change: Remove unused code (#1044) 2024-10-23 15:16:07 +02:00
Nik Clayton
e68ab54f95
feat: Ignore suggested accounts that haven't posted in 28 days (#1031)
The "Suggested accounts" API returns dormant accounts. See this bug
report: https://github.com/mastodon/mastodon/issues/30674.

That's bad UX, so filter out any account that hasn't posted in the last
28 days.

Fixes #1029
2024-10-19 14:38:00 +02:00
Weblate (bot)
0cf50524f2
fix(l10n): Translations update from Hosted Weblate (#995)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pachli/Fastlane
Metadata](https://hosted.weblate.org/projects/pachli/fastlane-metadata/).


It also includes following components:

* [Pachli/App :
Main](https://hosted.weblate.org/projects/pachli/app-main/)

* [Pachli/App :
Fdroid](https://hosted.weblate.org/projects/pachli/app-fdroid/)

*
[Pachli/Feature/Login](https://hosted.weblate.org/projects/pachli/featurelogin/)

* [Pachli/Feature/Suggestions :
Main](https://hosted.weblate.org/projects/pachli/featuresuggestions-main/)

* [Pachli/Feature/Lists :
Main](https://hosted.weblate.org/projects/pachli/featurelists-main/)

* [Pachli/Core/Ui :
Main](https://hosted.weblate.org/projects/pachli/coreui-main/)

* [Pachli/App :
Google](https://hosted.weblate.org/projects/pachli/app-google/)

* [Pachli/Core/Designsystem :
Main](https://hosted.weblate.org/projects/pachli/coredesignsystem-main/)

* [Pachli/Core/Data :
Main](https://hosted.weblate.org/projects/pachli/coredata-main/)

* [Pachli/Core/Activity :
Main](https://hosted.weblate.org/projects/pachli/coreactivity-main/)

* [Pachli/Feature/About :
Main](https://hosted.weblate.org/projects/pachli/featureabout-main/)

* [Pachli/Core/Preferences :
Main](https://hosted.weblate.org/projects/pachli/corepreferences-main/)

* [Pachli/Core/Activity :
Orange](https://hosted.weblate.org/projects/pachli/coreactivity-orange/)

* [Pachli/Core/Network :
Main](https://hosted.weblate.org/projects/pachli/corenetwork-main/)



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pachli/fastlane-metadata/horizontal-auto.svg)

---------

Co-authored-by: Vaclovas Intas <vaclovas1999@gmail.com>
Co-authored-by: Languages add-on <noreply-addon-languages@weblate.org>
Co-authored-by: Weblate Translation Memory <noreply-mt-weblate-translation-memory@weblate.org>
Co-authored-by: LibreTranslate <noreply-mt-libretranslate@weblate.org>
2024-10-10 21:42:59 +02:00
Nik Clayton
23121459ab
refactor: Implement SharedPreferencesRepository.showSelfUsername property (#996) 2024-10-10 20:15:46 +02:00
Nik Clayton
e307796251
refactor: Provide properties for more shared preferences (#992)
Continues the work of providing properties with accessors for specific
shared preferences.
2024-10-10 13:12:56 +02:00
Nik Clayton
59a0e3087c
refactor: Pass the active account ID to activities, fragments, etc (#982)
Previous code assumed the active account could always be determined from
the account manager.

This causes a few problems.

1. The account manager has to handle the case where there is no active
account (e.g., the user is logging out of the last account). This meant
the `activeAccount` property had to be nullable, so every consumer of
that property either used it with a `let` or `!!` expression.

2. The active account can change over the life of the UI component, for
example, when the user is switching accounts. There's a theoretical race
condition where the UI component has started an operation for one
account, then the account changes and the network authentication code
uses the new account.

3. All operations assume they operate on whatever the active account is,
making it difficult to provide any features that allow the user to
temporarily operate as another account ("Boost as...", etc).

This "ambient account" was effectively global mutable state, with all
the problems that can cause.

Start to fix this. The changes in this commit do not fix the problem
completely, but they are some progress.

Each activity (except LoginActivity) is expected to be launched with an
intent that includes the ID of the Pachli account it defaults to
operating with. This is `pachliAccountId`, and is the *database ID*
(not the server ID) of the account. This is non-null, which removes one
class of bugs.

This account is passed to each fragment and any piece of code that has
to perform an operation on behalf of this account. It's not used in
most of those places yet, that will be done over a number of followup
PRs as part of modernising each module.
2024-10-07 15:56:37 +02:00
Nik Clayton
668c073822
refactor: Assorted code inspection cleanups (#985)
Code inspection found some mechanical code cleanups.
2024-10-07 12:38:35 +02:00
Languages add-on
0b8f36431f feat(l10n): Added Burmese translation 2024-10-06 19:08:25 +02:00
Nik Clayton
65c73625f6
refactor: Create V2 filters with one API call (#979)
Previous code didn't encode v2 filter keywords, so created v2 filters by
first creating the filter with no keywords (one API call) then making
1-N API calls to add each keyword to the filter.

Fix this by adding a dedicated converter for the `NewContentFilter` type
that encodes it correctly so the filter can be created with a single API
call.

This necessitates moving some types around,
2024-10-05 14:53:23 +02:00
Nik Clayton
0d5d118267
refactor: Move AccountManager to core.data.repository (#976) 2024-10-03 21:28:01 +02:00
Nik Clayton
fe1c586dae
refactor: Move ServerOperation and related types to core.model (#969) 2024-10-03 13:41:46 +02:00
Nik Clayton
510717d46a
refactor: Rename "Filters" to "Content filters" (#927)
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.
2024-10-02 22:57:00 +02:00
Weblate (bot)
5505180868
fix(l10n): Translations update from Hosted Weblate (#933)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pachli/Fastlane
Metadata](https://hosted.weblate.org/projects/pachli/fastlane-metadata/).


It also includes following components:

* [Pachli/Core/Activity :
Main](https://hosted.weblate.org/projects/pachli/coreactivity-main/)

* [Pachli/App :
Google](https://hosted.weblate.org/projects/pachli/app-google/)

* [Pachli/Feature/Suggestions :
Main](https://hosted.weblate.org/projects/pachli/featuresuggestions-main/)

* [Pachli/Core/Designsystem :
Main](https://hosted.weblate.org/projects/pachli/coredesignsystem-main/)

* [Pachli/Core/Network :
Main](https://hosted.weblate.org/projects/pachli/corenetwork-main/)

*
[Pachli/Feature/Login](https://hosted.weblate.org/projects/pachli/featurelogin/)

* [Pachli/Core/Ui :
Main](https://hosted.weblate.org/projects/pachli/coreui-main/)

* [Pachli/Core/Activity :
Orange](https://hosted.weblate.org/projects/pachli/coreactivity-orange/)

* [Pachli/Feature/About :
Main](https://hosted.weblate.org/projects/pachli/featureabout-main/)

* [Pachli/Core/Data :
Main](https://hosted.weblate.org/projects/pachli/coredata-main/)

* [Pachli/App :
Main](https://hosted.weblate.org/projects/pachli/app-main/)

* [Pachli/App :
Fdroid](https://hosted.weblate.org/projects/pachli/app-fdroid/)

* [Pachli/Feature/Lists :
Main](https://hosted.weblate.org/projects/pachli/featurelists-main/)



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pachli/fastlane-metadata/horizontal-auto.svg)

---------

Co-authored-by: sunniva <schildkroteskoldpadda@gmail.com>
Co-authored-by: LibreTranslate <noreply-mt-libretranslate@weblate.org>
Co-authored-by: ButterflyOfFire <boffire@users.noreply.hosted.weblate.org>
2024-09-20 15:53:28 +02:00
josé m
09b4a08b59 fix(l10n): Update Galician translations
Currently translated at 100.0% (7 of 7 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/gl/
2024-08-26 14:28:42 +02:00
Juan M Sevilla
7c32a077ac fix(l10n): Update Spanish translations
Currently translated at 100.0% (7 of 7 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/es/
2024-08-05 13:47:29 +02:00
Kalle Kniivilä
8888a46fb1 fix(l10n): Update Finnish translations
Currently translated at 100.0% (7 of 7 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/fi/
2024-07-27 19:17:30 +02:00
Aindriú Mac Giolla Eoin
60fc806e12 fix(l10n): Update Irish translations
Currently translated at 100.0% (7 of 7 strings)

Translation: Pachli/Core/Data : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coredata-main/ga/
2024-07-27 19:17:30 +02:00
Nik Clayton
b1d5cb548f
fix: Don't crash due to Filters/ServerRepository race condition (#837)
The `canFilter()` implementation could crash if `server` (marked
`lateinit`) hadn't been initialised at the point of use.

Fix this by removing it and adjusting the two callers to use the
`filters` flow and take appropriate action on error.
2024-07-25 18:43:34 +02:00