Commit Graph

4113 Commits

Author SHA1 Message Date
Angelo Suzuki 5be93acf6b
feat: Improve Image Viewer toolbar auto-hide (#521)
Cancel the auto-hide behavior in case the toolbar menu items are
interacted with.

Improves https://github.com/pachli/pachli-android/issues/505,
https://github.com/pachli/pachli-android/issues/507

---------

Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2024-03-13 20:19:46 +01:00
Nik Clayton d9fc664a63
refactor: Remove obsolete emoji-related resources (#526) 2024-03-13 11:29:45 +01:00
Nik Clayton cfc15c8f64
refactor: Use LinearProgressIndicator with delayed show/hide (#525)
Previous code used a normal ProgressBar and a coroutine to delay
hiding/showing the bar for a snappier UI perception.

This is built-in functionality in LinearProgressIndicator, so switch to
that.

While I'm here, implement the "Select list" dialog's layout as a layout
resource.
2024-03-13 10:03:10 +01:00
Nik Clayton 006c358053 fix: Sort lists by title wherever they occur 2024-03-12 19:52:45 +01:00
Nik Clayton 7da4bc090b fix: Update tabs when lists are renamed or deleted
If the user has tabs containing one or more lists, and any of those
lists are renamed or deleted then the change should be reflected in the
tabs.

To do that:

`MainActivity`:

- Re-create tabs whenever lists are loaded and there's a list in a tab
- Compare lists-in-tabs by the ID of the list when restoring the user's
  tab, so that a list rename doesn't lose their position.

`NetworkListsRepository`:

- Update the user's tab preferences whenever lists are loaded, removing
  tabs that contain lists that have been deleted, and updating the
  list's title for lists that have been renamed.

Fixes #192
2024-03-12 19:52:45 +01:00
Nik Clayton a973f67ac8 refactor: Store tab preferences as polymorphic JSON 2024-03-12 19:52:45 +01:00
Nik Clayton 805a2a9b1d feat: Show "Followed hashtags" menu item in left-nav 2024-03-11 21:31:34 +01:00
Nik Clayton 65a0fb19d9 feat: Tapping followed hashtag names in lists opens relevant timeline 2024-03-11 21:31:34 +01:00
Nik Clayton 4762411147
refactor: Replace custom worker factory with HiltWorkerFactory (#517)
Removes the need for a separate `WorkerModule` and factory methods in
each worker.
2024-03-11 10:49:58 +01:00
Nik Clayton 442f3bc80c
feat: Show user's lists in the left-side navigation menu (#514)
Previously to view a list the user either had to add it to a tab, or tap
through "Lists" in the navigation menu to their list of lists, and then
tap the list they want.

Fix that, and show all their lists in a dedicated section in the menu,
with a new "Manage lists" entry that's functionality identical to the
old "Lists" entry (i.e., it shows their lists and allows them to create,
delete, and edit list settings).

To do that:

- Implement a proper `ListsRepository` as the single source of truth for
list implementation throughout the app. Expose the current list of lists
as a flow, with methods to perform operations on the lists.

- Collect the `ListsRepository` flow in `MainActivity` and use that to
populate the menu and update it whenever the user's lists change.

- Rewrite the activities and fragments that manipulate lists to use
`ListRepository`.

- Always show error snackbars when list operations fail. In particular,
the HTTP code and error are always shown.

- Delete the custom `Either` implementation, it's no longer used.

- Add types for modelling API responses and errors, `ApiResponse` and
`ApiError` respectively. The response includes the headers as well as
the body, so it can replace the use of `NetworkResult` and `Response`.
The actual result of the operation is expected to be carried in a
`com.github.michaelbull.result.Result` type. Implement a Retrofit call
adapter for these types.

Unit tests for these borrow heavily from
https://github.com/connyduck/networkresult-calladapter

Additional user-visible changes:

- Add an accessible "Refresh" menu item to `ListsActivity`.

- Adding a list to a tab has a dialog with a "Manage lists" option.
Previously that would close the dialog when clicked, so the user had to
re-open it on returning from list management. Now the dialog stays open.

- The soft keyboard automatically opens when creating or editing a list.
2024-03-10 23:14:21 +01:00
Nik Clayton a4dc3b85bd
fix: Show sized placeholder for hidden account media (#516)
Previous code showed a small icon for account media that the user has
hidden.

Now determine the correct size / aspect ratio for the media and use that
to compute the placeholder (either a blurhash, or the link colour for
consistency with the view on a timeline).

Fixes #513
2024-03-10 23:13:58 +01:00
Angelo Suzuki bdf2d9329e
feat: Auto-hide Image Viewer toolbar (#507)
Previous code showed the toolbar and caption when displaying the image,
and the user has to tap the screen to dismiss it.

New code is consistent with the video viewer; the toolbar and caption
is displayed for two seconds, and then auto-hides.

- Tapping after the hide displays the toolbar and caption, which will
  not auto-hide and requires a second tap to dismiss.

- Tapping the caption before it's hidden cancels the auto-hide

Fixes #505
2024-03-10 23:13:40 +01:00
Nik Clayton 0445e187df
fix: Ensure logging out accounts completes (#515)
The account logout process could fail due to API exceptions; network
errors for example, or if the user had already revoked the app's token
for that account. This would prevent the rest of the logout process
(cleaning database, etc) from completing.

Fix this by ignoring network errors during the logout process, and
always cleaning up account content in the database.

Fix a related issue where a deleted account might be recreated in a
partial state if the account's visible position was saved after it was
deleted. The recreated account couldn't do anything as it had no tokens,
but is very confusing.
2024-03-10 12:25:12 +01:00
Nik Clayton 32a6d3465b
feat: Include "Notifications" in the left-side navigation menu (#504)
Previously the only way to access notifications was to dedicate a tab to
them. Now notifications are available from the left-side navigation menu
so they're always accessible.

Add them to the top of the list, and swap the order of bookmarks and
favourites, assuming that users are more likely to want to see their
bookmarks than their favourites.

Move "Edit profile" to the bottom with the other settings options,
assuming that editing their profile does not happen very often, so
should not be at the top of the list.
2024-03-05 14:45:28 +01:00
Juan M Sevilla 92eb9f32b7 fix(l10n): Update Spanish translations
Currently translated at 100.0% (623 of 623 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/es/
2024-03-04 20:33:08 +01:00
Nik Clayton dc23ea23d1
refactor: Remove last vestiges of rxJava (#492) 2024-03-03 17:38:32 +01:00
Nik Clayton da6e026cc6
refactor: Implement updateShortcut as a suspending function (#491)
Previously a regular function that created and subscribed to an rxJava
callable, now it's a suspending function that enforces Dispatchers.IO as
the context, launched in its own coroutine.
2024-03-03 17:21:04 +01:00
Nik Clayton 900b1728bf
refactor: Implement deleteStaleCachedMedia as a suspending function (#490)
Previously a regular function launched with an rxJava scheduler, now
it's a suspending function that enforces Dispatchers.IO as the context,
launched in its own coroutine.
2024-03-03 17:02:23 +01:00
Nik Clayton 1026fccc40
refactor: Restructure ViewMediaActivity and related fragments (#489)
Highlights:

- Implement fragment transitions for video to improve the UX, video
won't start playing until the transition completes
- Remove rxJava
- Move duplicate code in to base classes

Details:

`MediaActionsListener`:

- Move to `ViewMediaFragment` as it's used by both subclasses
- Remove need for separate `VideoActionsListener`
- Rename methods to better reflect their purpose and improve readability

`ViewMediaFragment`:

- Move duplicated code from `ViewImageFragment` and `ViewVideoFragment`
- Rewrite code that handles fragment transitions to use a
`CompleteableDeferred` instead of `BehaviorSubject` (removes rxJava).
- Rename methods and properties to better reflect their purpose and
improve readability
- Add extra comments

`ViewImageFragment`:
- Rewrite code that handles fragment transitions to use a
`CompleteableDeferred` instead of `BehaviorSubject` (removes rxJava).

`ViewVideoFragment`:

- Implement fragment transitions for video to improve the UX, video
won't start playing until the transition completes
- Manage toolbar visibility with a coroutine instead of a handler
- Add extra comments

`ViewMediaActivity`:
- Rename properties to better reflect their purpose and improve
readability
- Add extra comments

`ImagePagerAdapter`:
- Rename properties to better reflect their purpose and improve
readability
- Add extra comments
2024-03-03 16:07:39 +01:00
Nik Clayton 72e5ca887d
fix(deps): update agp to v8.3.0, lint to 31.3.0 (#483)
New lint rules highlighted a potential crash; the use of named match
groups (used here when extracting server versions) requires API >= 26 or
throws an exception.

Use the group numbers instead of names when extracting the value, but
keep the group names in the regular expressions for readability.
2024-03-01 23:07:14 +01:00
Nik Clayton b9512e49b4
fix: Ensure files are fully downloaded before sharing (#482)
The previous code would share media by either:

a. If it was an image, downloading the image using Glide in to a bitmap,
then recompressing as a PNG, saving, and sharing the resulting file.

b. Otherwise, create a temporary file, enqueue a DownloadManager request
to download the media in to the file, and immediately start sharing,
hoping that the download had completed in time.

Both approaches have problems:

In the "image" case the image was being downloaded (or retrieved from
the Glide cache), decompressed to a bitmap, then recompressed as a PNG.
This uses more memory, and doesn't share the original contents of the
file. E.g., if the original file was a JPEG that's lost (and the PNG
might well be larger than the source image).

In the second case the DownloadManager download is not guaranteed to
have completed (or even started) before the user chooses the share
destination. The destination could receive a partial or even empty file.

Fix both of those cases by always fully downloading the file before
sending the share intent. This guarantees the file is available to
share, and in its original format. Since this uses the same OkHttpClient
as the rest of the app the content is highly likely to be in the OkHttp
cache, so there will no extra network traffic because of this.
2024-03-01 21:54:30 +01:00
Nik Clayton fcae44110b
refactor: Remove synchronous search functions (#481)
The previous code used synchronous (i.e., non-suspending) functions to
call the /api/v2/search and /api/v2/accounts/search endpoints.

This is not necessary as the search was always performed in a separate
thread.

Remove, and replace their usage with the equivalent functions that
suspend.
2024-03-01 18:55:59 +01:00
Nik Clayton fb66293713
refactor: Remove duplicate strings from Filter.Action (#479)
Simplify code that users `Filter.Action` by deserialising directly into
the type instead of storing / using strings throughout the API.
2024-02-29 09:49:17 +01:00
Nik Clayton af58de5a8f
refactor: Enable core library desugaring as build convention logic (#480)
Once desugaring is enabled it needs to be enabled for up/down the
dependency chain, so enable it in the shared configuration defined by
the build convention code.

Highlighted a failing test that wasn't being run, so fix that too.
2024-02-29 09:43:44 +01:00
Nik Clayton 9a23439d04
refactor: Remove duplicate strings from Filter contexts (#478)
A filter's context (previously referred to as its `kind`) controls where
the filter is applied.

This was implemented as an enum with a specific property to control how
it would serialise when @FormUrlEncoded, and with a @Json annotation for
Moshi.

In addition, the model objects kept the filter context in its string
form throughout Pachli, requiring periodic conversion to/from the enum
type, making the code more complicated.

Fix this, by:

1. Converting the incoming JSON value to the enum type immediately, so
the rest of the code uses the enum constants exclusively.

2. Implement a Retrofit converter that serialises the enum value when
@FormUrlEncoded to the same string used in JSON serialisation
2024-02-28 19:09:54 +01:00
Nik Clayton 2aa01fba8c
chore: Prepare release 2.3.0 (versionCode 12) (#477) 2024-02-28 09:54:52 +01:00
Nik Clayton d943fa1aca
fix: Update InstanceV1/V2 related types based on real-world usage (#476)
Many servers that claim to be Mastodon-API compatible are not, as
evidenced by the content they include in the responses to
`/api/v1/instance` and `/api/v2/instance` requests.

Work around the worst of the breakage by providing defaults or marking
some fields as nullable (with a default null).

Bugs have been reported against the relevant projects.
2024-02-28 00:02:03 +01:00
Kalle Kniivilä 58a6f75728 fix(l10n): Update Finnish translations
Currently translated at 100.0% (622 of 622 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/fi/
2024-02-27 10:37:41 +01:00
Martijn de Boer 44365f445f fix(l10n): Update Dutch translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Google
Translate-URL: https://hosted.weblate.org/projects/pachli/app-google/nl/
2024-02-25 15:53:32 +01:00
Martijn de Boer c75c143825 fix(l10n): Update Dutch translations
Currently translated at 100.0% (622 of 622 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/nl/
2024-02-25 15:53:32 +01:00
Martijn de Boer edcf6f13ab fix(l10n): Update Dutch translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Fdroid
Translate-URL: https://hosted.weblate.org/projects/pachli/app-fdroid/nl/
2024-02-25 15:53:32 +01:00
Nik Clayton 51c64a74dc
fix: Parse roles without a `highlighted` property (#467)
The `highlighted` property on a role may be absent. If it is this breaks
account parsing, including accounts in an /api/v2/instance response.
This, in turn, breaks determining server capabilities, including whether
or not translation is supported.

Set the default to `true`, which matches observed Mastodon behaviour.
2024-02-22 21:17:34 +01:00
Nik Clayton 415b182405
change: Log the trigger for a refresh/reload (#466)
A user is reporting that a refresh is happening in the middle of loading
content, borne out by the existing logs.

Those logs don't say what has triggered the refresh attempt, so add
additional logging whenever a refresh can occur to record what triggered
it.
2024-02-22 17:41:56 +01:00
Nik Clayton 9071a89e48
feat: Display uncropped media on account media pages (#464)
Previously media on the "Media" tab was displayed scaled and cropped to
a square aspect ratio, effectively forcing the user to tap every image
to see it.

Now, display the images scaled but not cropped, layed out with
`StaggeredGridLayoutManager`. This shows each image in full (still
scaled) providing a better experience when scrolling down.

Scrolling up can occasionally introduce gaps in the grid as images are
re-placed as viewholders are reused. When this happens images animate to
a better position when scrolling stops.
2024-02-22 14:33:44 +01:00
Nik Clayton 203784d718
fix: Don't crash when displaying update check dialog (#463)
Previous code injected `ApplicationContext`, which is not themed, and
caused a crash if the "update" dialog was shown.

Fix by passing the necesssary context in explicitly when the check is
performed.
2024-02-22 14:16:05 +01:00
Nik Clayton 2162e03e1f
fix: Handle JSON enums with unknown values (#462)
Previous code expected all incoming enums values to map directly to
Kotlin enum constants.

This is a problem for servers with additional features -- e.g.,
"reaction" as a notification type.

Fix this with a new Moshi adapter that will set the incoming value to a
given constant if it's not recognised.

Apply this to the enum constants in core.network to ensure they are
handled.

Clean up enum handling in Converters.kt, ComposeViewModel.kt, and
Status.kt by using the existing `.ordinal` property and some extension
functions for idiomatic code.

Fixes #461
2024-02-21 23:36:24 +01:00
Nik Clayton 941f4677eb
fix: Show previews for playable audio media from accounts (#460)
Previous code showed a generic placeholder for audio media on the
account's "Media" tab.

Fix this so the preview image is shown (if it's available).

- Move the "is this attachment previewable?" code to `Attachment` so it
can be reused here.

- Restructure the logic in `AccountMediaGridAdapter` to use the new
`isPreviewable()` method when deciding whether to show a preview.

- Attachments have dedicated placeholder drawables, use those when the
preview is not available.
2024-02-20 16:20:34 +01:00
Nik Clayton 8293e90b73
feat: Allow the user to trigger update checks (#458)
Add an additional preference entry that triggers an update when tapped.
It also displays the earliest time of the next automatic update check as
the preference summary.

Move the code that performs the update check (and the logic for whether
to perform the check) out of `MainActivity` and in to `UpdateCheck` so
it's available from `PreferencesFragment`.
2024-02-20 14:50:59 +01:00
Nik Clayton 8fdb15893a
fix: Improve legibility of stats labels for large font sizes (#457)
If the user increases the font size the labels for post statistics
(number of replies, etc) can crash in to each other.

To give more space for the text:

- Shrink the label font size
- Move the labels slightly left / tighter to the icon
- Allow the "bookmark" icon to move next to the "more" icon. There's
still 48dp of space for them, and this gives a little more space to the
other icons that have labels
2024-02-19 22:59:04 +01:00
Nik Clayton 73c947edfa
fix: Prevent crash when Friendica returns a null `voted_on` property (#456)
Friendica can return a null `voted_on` property, in violation of the API
spec.

Introduce a `BooleanIfNull` annotation that will convert the `null` to
`false` if encountered.

While I'm here update the other adapters as classes on their relevant
annotations instead of standalone classes to keep the code consistent.

Fixes #455
2024-02-19 19:04:29 +01:00
Nik Clayton 23e3cf1035
feat: Show information about notification fetches on "About" screen (#454)
Some users report that Pachli is not retrieving/displaying notifications
in a timely fashion.

To assist in diagnosing these errors, provide an additional set of tabs
on the "About" screen that contain information about how Pachli is
fetching notifications, and if not, why not.

Allow the user to save notification related logs and other details to a
file that can be attached to an e-mail or bug report.

Recording data:

- Provide a `NotificationConfig` singleton with properties to record
different aspects of the notification configuration. Update these
properties as different notification actions occur.

- Store logs in a `LogEntryEntity` table. Log events of interest with a
new `Timber` `LogEntryTree` that is planted in all cases.

- Add `PruneLogEntryEntityWorker` to trim saved logs to the last 48
hours.

Display:

- Add a `NotificationFragment` to `AboutActivity`. It hosts two other
fragments in tabs to show details from `NotificationConfig` and the
relevant logs, as well as controls for interacting with them.

Bug fixes:

- Filter out notifications with a null tag when processing active
notifications, prevents an NPE crash

Other changes:

- Log more details when errors occur so the bug reports are more helpful
2024-02-17 15:57:32 +01:00
Hosted Weblate 3fb6994429 Update translation files
Updated by "Remove blank strings" hook in Weblate.

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/
2024-02-17 10:01:04 +01:00
JuanM b676d705bf fix(l10n): Update Spanish translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Google
Translate-URL: https://hosted.weblate.org/projects/pachli/app-google/es/
2024-02-17 10:01:04 +01:00
JuanM a5dc1106f0 fix(l10n): Update Spanish translations
Currently translated at 100.0% (619 of 619 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/es/
2024-02-17 10:01:04 +01:00
JuanM 90414f606b fix(l10n): Update Spanish translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Fdroid
Translate-URL: https://hosted.weblate.org/projects/pachli/app-fdroid/es/
2024-02-17 10:01:04 +01:00
Nik Clayton 59a7673149
fix: Use the correct font when showing inserted text (#453)
The previous code was using a bold version of the default font for
inserted text. So if the user had set a custom font it was being
ignored.

Fix this by creating a bold version of the user's typeface.

Fixes #435
2024-02-16 21:52:05 +01:00
Nik Clayton b3978c4af7
change: Move CustomFragmentStateAdapter to core.activity (#452) 2024-02-16 20:56:00 +01:00
Nik Clayton 4dbf6065fd
change: Move RefreshableFragment to core.activity (#450) 2024-02-16 19:58:11 +01:00
Nik Clayton 11bf47e3b3
fix: Handle null properties in `Attachment.Focus` (#449)
The `x` and `y` properties in `Attachment.Focus` may be null (not
documented as such, but observed in the wild).

Provide a `DefaultIfNull` adapter that can be applied to these to
replace null values with a sensible default.
2024-02-15 20:32:22 +01:00
Nik Clayton c7895cf2db
fix: Show diffs for content that doesn't start with a block element (#446)
Content that doesn't start with a block element generates a parse error.
This isn't normally seen from Mastodon servers but is seen from content
from other servers (e.g,. Akkoma), which can generate:

```
<a href="..."> some text
```

instead of:

```
<p><a href="..."> some text</p>
```

Work around this by ensuring that content-to-be-diffed is wrapped in a
`div`.
2024-02-15 14:16:50 +01:00
Nik Clayton b8ac1f3944
fix: Show correct account/timeline when composing from notifications (#445)
The previous code didn't clear the task stack or recreate `MainActivity`
when the active user was changed.

So if the user was logged in with account A and used "Compose" from a
notification sent to account B, the active account was switched to B but
the UI chrome wasn't. After exiting `ComposeActivity` they would be
looking at the timeline for account B but with a toolbar that showed
account A.

Fix this by clearing the task stack and explicitly recreating
`MainActivity` when forwarding intents to `ComposeActivity`.
2024-02-15 13:10:00 +01:00
Nik Clayton 2cf7c072ca
fix: Prevent memory leak when updating shortcuts (#443)
Shortcuts were being updated using `MainActivity.this` as the `Context`
and leaking in `ShortcutManagerCompat`. Use the application context to
fix this.
2024-02-15 00:25:37 +01:00
Nik Clayton 0d826bc2d6
fix: Don't crash when deserializing notification types (#442)
When the `Notification.Type` enum was moved to a separate module it
resulted in exceptions trying to deserialize the enum:

```
java.lang.RuntimeException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = app.pachli.core.network.model.Notification$Type)
```

This happened in debug builds without Proguard, so not a minification or
renaming issue.

Fix this by providing `putEnum`/`getEnum` extension functions on
`Bundle` that store the enum's ordinal value and restore it from that.
2024-02-14 23:55:46 +01:00
Nik Clayton 913f366a41
fix: Expedite notification fetches via UnifiedPush (#440)
UnifiedPush broadcasts are used to trigger fetching new notifications.
Previously this was a normal one-time work request. Mark it as expedited
to increase the likelihood it will run soon.
2024-02-14 12:01:06 +01:00
Nik Clayton e71e0df324
fix: Allow HIDE_TOP_TOOLBAR preference text to wrap (#439)
Previously it was constrained to a single line, and would clip on narrow
devices.

Fixes #436
2024-02-14 11:31:21 +01:00
Nik Clayton 2d03e6cf7b
change: Move AlertDialogExtensions to core.ui (#438) 2024-02-14 11:26:28 +01:00
Nik Clayton 96474a9ac3
change: Improve logging calls to Timber (#430)
- Use format strings so any overhead of building the string is only
incurred if the message is actually logged

- Pass throwables as the first parameter so they are logged with the
stacktrace
2024-02-09 17:33:01 +01:00
Nik Clayton 9b0f1118f9
fix: Add missing import for MoshiConverterFactory (#431)
Add run CI on the PR not the base.
2024-02-09 17:18:50 +01:00
Nik Clayton a3d45ca9ec
refactor: Convert from Gson to Moshi (#428)
Moshi is faster to decode JSON at runtime, is actively maintained, has a
smaller memory and method footprint, and a slightly smaller APK size.
Moshi also correctly creates default constructor arguments instead of
leaving them null, which was a source of `NullPointerExceptions` when
using Gson.

The conversion broadly consisted of:

- Adding `@JsonClass(generateAdapter = true)` to data classes that
marshall to/from JSON.

- Replacing `@SerializedName(value = ...)` with `@Json(name = ...)`.

- Replacing Gson instances with Moshi in Retrofit, Hilt, and tests.

- Using Moshi adapters to marshall to/from JSON instead of Gson `toJson`
/ `fromJson`.

- Deleting `Rfc3339DateJsonAdapter` and related code, and using the
equivalent adapter bundled with Moshi.

- Rewriting `GuardedBooleanAdapter` as a more generic `GuardedAdapter`.

- Deleting unused ProGuard rules; Moshi generates adapters using code
generation, not runtime reflection.

The conversion surfaced some bugs which have been fixed.

- Not all audio attachments have attachment size metadata. Don't show
the attachment preview if the metadata is missing.

- Some `throwable` were not being logged correctly.

- The wrong type was being used when parsing the response when sending a
scheduled status.

- Exceptions other than `HttpException` or `IoException` would also
cause a status to be resent. If there's a JSON error parsing a response
the status would be repeatedly sent.

- In tests strings containing error responses were not valid JSON.

- Workaround Mastodon a bug and ensure `filter.keywords` is populated,
https://github.com/mastodon/mastodon/issues/29142
2024-02-09 12:41:13 +01:00
Nik Clayton d01c72b7d7
change: Disable SyntheticAccessor lint rule (#424)
Does not appear to be adding value, and R8 optimises the code to remove
the generated accessors.
2024-02-06 19:51:37 +01:00
Nik Clayton 5a51310af8
feat: Show a preview for playable audio attachments (#426) 2024-02-06 19:38:50 +01:00
Nik Clayton 7fc8a5fb1e
change: Update lint baseline (#427) 2024-02-06 19:23:34 +01:00
Nik Clayton 9a47e306ea
fix: Keep the screen on while media is playing (#422)
Fixes #335
2024-02-06 14:13:09 +01:00
Nik Clayton 41c702fc1b
change: Display "About" information in tabs (#420)
Previously, `AboutActivity` had buttons and links to show the privacy
policy and licenses of dependencies.

Change this to a selection of fragments in tabs, one tab each for:

- General "About" information
- Licenses
- Privacy Policy

The information shown hasn't changed, but this lays the groundwork for
including additional tabs in the future for information like server
rules, detected capabilities, or troubleshooting information.
2024-02-06 00:43:26 +01:00
Kalle Kniivilä 7c5181d5c2 fix(l10n): Update Finnish translations
Currently translated at 100.0% (619 of 619 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/fi/
2024-02-05 14:18:34 +01:00
Kalle Kniivilä ab01bbfed8 fix(l10n): Update Finnish translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Fdroid
Translate-URL: https://hosted.weblate.org/projects/pachli/app-fdroid/fi/
2024-02-05 14:18:34 +01:00
Nik Clayton 54d7888316
feat: Include extra logs in error reports from orange release builds (#414)
Release builds normally strip out all logging to reduce the number of
disk writes and reduce UI jank.

These logs would still be useful in user error reports from orange
builds. To preseve them:

- Implement a simple `RingBuffer`.

- Create `TreeRing`, a `Timber` `Tree` logger that logs to a
`RingBuffer` instance in orange release builds.

- Create `TreeRingCollector`, called when ACRA reports are generated,
which includes the contents of the ring buffer in the report.

- Enable desugaring to allow the use of java.time libraries on older
Android versions.

- Disable ProGuard obfuscation of class names as the obfuscation adds
additional de-obfuscation steps when handling error reports from users.
2024-02-04 15:17:46 +01:00
Reza Almanda dcf781aa21 fix(l10n): Update Indonesian translations
Currently translated at 45.8% (284 of 619 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/id/
2024-02-03 15:26:43 +01:00
ButterflyOfFire 7cb48a6673 fix(l10n): Update French translations
Currently translated at 97.4% (603 of 619 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/fr/
2024-02-03 15:26:43 +01:00
ButterflyOfFire 409db3019f fix(l10n): Update French translations
Currently translated at 92.7% (574 of 619 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/fr/
2024-02-03 15:26:43 +01:00
bittin1ddc447d824349b2 e5bbb71661 fix(l10n): Update Swedish translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Google
Translate-URL: https://hosted.weblate.org/projects/pachli/app-google/sv/
2024-02-03 15:26:43 +01:00
bittin1ddc447d824349b2 53ce9d90e6 fix(l10n): Update Swedish translations
Currently translated at 100.0% (2 of 2 strings)

Translation: Pachli/App : Fdroid
Translate-URL: https://hosted.weblate.org/projects/pachli/app-fdroid/sv/
2024-02-03 15:26:43 +01:00
Nik Clayton 1488c13c42
feat: Allow the user to send an error report without a crash (#406)
Getting error reports with logs of strange behaviour is useful even if
the app doesn't crash.

Move crash reporting in to `core.activity`, and provide a menu option
(in orange builds) to trigger a non-fatal crash report that is handled
the same way (i.e., sent by e-mail) as a regular crash report.

`BaseActivity` has to be able to create and handle menus, so adjust
subclasses to call the superclass when necessary.

Update `tools/mvstring` to be able to move strings between different
flavour directories, not just `main`.
2024-02-02 15:34:31 +01:00
Nik Clayton 86d800b1c8
refactor: Modularise "about" activities (#405)
Continue modularisation by moving activities in the "About" feature to a
new `feature.about` module.

Implement `feature.about:
- Move `AboutActivity`, `LicenseActivity`, and `PrivacyPolicyActivity`
here.
- Update `markdown2resource` plugin to work with libraries

Implement `core.data`:
- Types and repositories used through the app
- Move `InstanceInfo` and `InstanceInfoRepository` here so they are
available to `feature.about`.

Implement `core.ui`:
- App-specific views, spans, and other UI content
- Move `ClickableSpanTextView` and `NoUnderlineURLSpan` here so they are
available to `feature.about`.
2024-02-02 15:14:31 +01:00
Nik Clayton 7116c8e0c3
test: Mock searchSync to prevent crash in ComposeActivityTest (#404)
Without the mock the code-under-test was getting a null value where none
should have been possible, and crashing.
2024-02-01 15:50:40 +01:00
ButterflyOfFire ce21b3b9f8 fix(l10n): Update Arabic translations
Currently translated at 94.8% (604 of 637 strings)

Translation: Pachli/App : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/app-main/ar/
2024-01-31 20:19:19 +01:00
Weblate (bot) 1925860731
fix(l10n): Translations update from Hosted Weblate (#397)
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](https://hosted.weblate.org/projects/pachli/ui-strings/)

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

* [Pachli/F-Droid](https://hosted.weblate.org/projects/pachli/f-droid/)

* [Pachli/Core -
Network](https://hosted.weblate.org/projects/pachli/core-network/)

* [Pachli/Core - Design
System](https://hosted.weblate.org/projects/pachli/core-design-system/)

* [Pachli/Core -
Activity](https://hosted.weblate.org/projects/pachli/core-activity/)

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

* [Pachli/GitHub](https://hosted.weblate.org/projects/pachli/github/)



Current translation status:

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

---------

Co-authored-by: Languages add-on <noreply-addon-languages@weblate.org>
2024-01-30 16:39:45 +01:00
Nik Clayton 358af13dfb
chore: Remove obsolete LicenseCard code (#399)
Unnecessary since the use of `aboutlibraries`
2024-01-30 16:39:19 +01:00
Nik Clayton f0fc0fd530
refactor: Modularise core activity classes, (#393)
Continue modularisation by moving core activity classes that almost all
activities depende on to a `core.activity` module. This includes
core "helper" classes as well.

Implement core.activity:
- Contains BaseActivity, BottomSheetActivity
- Contains LinkHelper and other utility classes used by activities

Implement core.common.extensions:
- Move ViewBindingExtensions and ViewExtensions here

Implement core.common.util:
- Move BlurHashDecoder and VersionName here

Implement core.designsystem:
- Holds common resources (animations, colours, drawables, etc) used
  through the app
- Import "core.designsystem.R as DR" through the app to distinguish
  from the module's own resources

Implement feature.login:
- Move the LoginActivity and related code/resources to its own module

Implement tools/mvstring
- Moves string resources (and all translations) from one module to
  another
2024-01-30 11:37:00 +01:00
Nik Clayton 741bf56f38
chore: Prepare release 2.2.0 (versionCode 11) (#392) 2024-01-29 10:09:57 +01:00
Nik Clayton b454fdceb9
fix: Allow users to retry errors when fetching server info (#391)
Previous code would show errors when fetching server info but with no
mechanism to retry the operation, so it would "stick" until the user
restarted the app.

Fix this with a retry action.

While I'm here use styles to ensure that all snackbars are 5 lines max
length and remove code that sets the length.
2024-01-28 20:13:39 +01:00
Nik Clayton 355244a8e2
refactor: Destructure maps for more idiomatic code (#388) 2024-01-26 12:32:45 +01:00
Nik Clayton fc81e8bad7
fix: Ensure actions happen against the correct status (#373)
Previously when the user interacted with a status the operation (reblog,
favourite, etc) travels through multiple layers of code, carrying with
it the position of the item in the list that the user operated on.

At some point the status is retrieved from the list using its position
so that the correct status ID can be used in the network operation.

If this happens while the list is also refreshing there's a possible
race condition, and the original status' position may have changed in
the list. Looking up the status by position to determine which status to
perform the action on may cause the action to happen on the wrong
status.

Fix this by passing the status' viewdata to any actions instead of its
position. This includes all the information necessary to make the API
call, so there is no chance of a race.

This is quite an involved change because there are three types of
viewdata:

- `StatusViewData`, used for regular timelines
- `NotificationViewData`, used for notifications, may wrap a status that
can be operated on
- `ConversationViewData`, used for conversations, does wrap a status

The previous code treated them all differently, which is probably why it
operated by position instead of type.

The high level fix is to:

1. Create an interface, `IStatusViewData`, that contains the data
exposed by any viewdata that contains a status.

2. Implement the interface in `StatusViewData`, `NotificationViewData`,
and `ConversationViewData`.

3. Change the code that operates on viewdata (`SFragment`,
`StatusActionListener`, etc) to be generic over anything that implements
`IStatusViewData`.

4. Change the code that handles actions to pass the viewdata instead of
the position.

Fixes #370
2024-01-26 12:15:27 +01:00
Nik Clayton c48b8bf545
fix: Don't leak MainActivity in DrawerImageLoader (#382)
Previous code created the drawer image loader as an anonymous inner
class that kept a reference to `glide`, which had a reference to `this`
and could leak.

Fix that by create a separate class that takes these as constructor
parameters.
2024-01-25 17:45:20 +01:00
bittin1ddc447d824349b2 928955e886 fix(l10n): Update Swedish translations
Currently translated at 100.0% (658 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/sv/
2024-01-25 11:28:08 +01:00
bittin1ddc447d824349b2 8dc56be8b6 fix(l10n): Update Swedish translations
Currently translated at 100.0% (658 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/sv/
2024-01-25 11:28:08 +01:00
Reza Almanda 1fc306d890 fix(l10n): Update Indonesian translations
Currently translated at 44.2% (291 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/id/
2024-01-25 11:28:08 +01:00
Anonymous 092a91312a fix(l10n): Update Chinese (Simplified) (zh_MO) translations
Currently translated at 51.5% (339 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/zh_MO/
2024-01-25 11:28:08 +01:00
Anonymous 1e638af89e fix(l10n): Update Chinese (Simplified) translations
Currently translated at 92.0% (606 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/zh_Hans/
2024-01-25 11:28:08 +01:00
Anonymous 28b34aee64 fix(l10n): Update Vietnamese translations
Currently translated at 92.0% (606 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/vi/
2024-01-25 11:28:08 +01:00
Anonymous ec8666edc5 fix(l10n): Update Ukrainian translations
Currently translated at 91.6% (603 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/uk/
2024-01-25 11:28:08 +01:00
Anonymous 0857f3d61d fix(l10n): Update Turkish translations
Currently translated at 91.7% (604 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/tr/
2024-01-25 11:28:08 +01:00
Anonymous 7fb2cd9af1 fix(l10n): Update Thai translations
Currently translated at 66.4% (437 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/th/
2024-01-25 11:28:08 +01:00
Anonymous 6ef6ac15df fix(l10n): Update Slovenian translations
Currently translated at 58.0% (382 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/sl/
2024-01-25 11:28:08 +01:00
Anonymous 92c94ae2b9 fix(l10n): Update Sinhala translations
Currently translated at 36.4% (240 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/si/
2024-01-25 11:28:08 +01:00
Anonymous 9a17096f8d fix(l10n): Update Sanskrit translations
Currently translated at 78.1% (514 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/sa/
2024-01-25 11:28:08 +01:00
Anonymous 11a8429327 fix(l10n): Update Portuguese (Portugal) translations
Currently translated at 78.5% (517 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/pt_PT/
2024-01-25 11:28:08 +01:00
Anonymous b36eba9092 fix(l10n): Update Occitan translations
Currently translated at 91.1% (600 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/oc/
2024-01-25 11:28:08 +01:00
Anonymous b3427f823e fix(l10n): Update Norwegian Bokmål translations
Currently translated at 90.5% (596 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/nb_NO/
2024-01-25 11:28:08 +01:00
Anonymous 73c80825f1 fix(l10n): Update Latvian translations
Currently translated at 83.2% (548 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/lv/
2024-01-25 11:28:08 +01:00
Anonymous 3829e8bd31 fix(l10n): Update Korean translations
Currently translated at 57.2% (377 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ko/
2024-01-25 11:28:08 +01:00
Anonymous 9a68df58f6 fix(l10n): Update Kabyle translations
Currently translated at 37.3% (246 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/kab/
2024-01-25 11:28:08 +01:00
Anonymous 978f1fccee fix(l10n): Update Icelandic translations
Currently translated at 90.5% (596 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/is/
2024-01-25 11:28:08 +01:00
Anonymous 612043d3fe fix(l10n): Update Hungarian translations
Currently translated at 90.5% (596 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/hu/
2024-01-25 11:28:08 +01:00
Anonymous 4d8e8fa020 fix(l10n): Update Hindi translations
Currently translated at 55.9% (368 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/hi/
2024-01-25 11:28:08 +01:00
Anonymous 9e1b6f9d02 fix(l10n): Update Galician translations
Currently translated at 91.9% (605 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/gl/
2024-01-25 11:28:08 +01:00
Anonymous c1c99db75b fix(l10n): Update Gaelic translations
Currently translated at 91.6% (603 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/gd/
2024-01-25 11:28:08 +01:00
Anonymous 79648170d1 fix(l10n): Update Irish translations
Currently translated at 64.5% (425 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ga/
2024-01-25 11:28:08 +01:00
Anonymous 53c1485dbf fix(l10n): Update French translations
Currently translated at 89.3% (588 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fr/
2024-01-25 11:28:08 +01:00
Anonymous ab7003efc4 fix(l10n): Update Persian translations
Currently translated at 92.0% (606 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fa/
2024-01-25 11:28:08 +01:00
Anonymous 9ddb965d6b fix(l10n): Update Basque translations
Currently translated at 71.5% (471 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/eu/
2024-01-25 11:28:08 +01:00
Anonymous 4b4a736db0 fix(l10n): Update Esperanto translations
Currently translated at 74.0% (487 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/eo/
2024-01-25 11:28:08 +01:00
Anonymous 181b8198be fix(l10n): Update German translations
Currently translated at 97.7% (643 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/de/
2024-01-25 11:28:08 +01:00
Anonymous 2fd6f96706 fix(l10n): Update Welsh translations
Currently translated at 92.0% (606 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/cy/
2024-01-25 11:28:08 +01:00
Anonymous b36cf1dbc0 fix(l10n): Update Czech translations
Currently translated at 74.9% (493 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/cs/
2024-01-25 11:28:08 +01:00
Anonymous 2979959e87 fix(l10n): Update Kurdish (Central) translations
Currently translated at 63.3% (417 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ckb/
2024-01-25 11:28:08 +01:00
Anonymous d0e77b4a5c fix(l10n): Update Catalan translations
Currently translated at 84.8% (558 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ca/
2024-01-25 11:28:08 +01:00
Anonymous cc5a535730 fix(l10n): Update Bengali (India) translations
Currently translated at 62.4% (411 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/bn_IN/
2024-01-25 11:28:08 +01:00
Anonymous 8919650cc7 fix(l10n): Update Bengali (Bangladesh) translations
Currently translated at 66.7% (439 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/bn_BD/
2024-01-25 11:28:08 +01:00
Anonymous 50f4df1693 fix(l10n): Update Belarusian translations
Currently translated at 88.1% (580 of 658 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/be/
2024-01-25 11:28:08 +01:00
Reza Almanda d501d7d35d fix(l10n): Update Indonesian translations
Currently translated at 42.6% (277 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/id/
2024-01-25 11:28:08 +01:00
Reza Almanda 1e13a040b4 fix(l10n): Update Indonesian translations
Currently translated at 40.3% (262 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/id/
2024-01-25 11:28:08 +01:00
Nik Clayton dcc2954148
fix: Show correct trending tag values at the end of the chart lines (#380)
The previous code incorrectly showed the trending tag usage data twice
next to the end of the trending tag lines, instead of one entry for the
usage data and one entry for the account data.

Fix that.

As part of this fix change how the data is displayed. Instead of using
two distinct `TextView`, fixed to the bottom end of the chart, draw the
text directly on the chart. The text is accurately position so that it
is next to the end of the relevant line. If both lines overlap the label
positions are adjusted appropriately.

The chart now uses Pachli blue and orange for the line colours.

While doing this I discovered that the mechanism used to fall back to
particular chart colours if none were specified was incorrect, so fix
that too.
2024-01-25 00:50:50 +01:00
Nik Clayton bdb3a61523
feat: Disable tag mute feature if server can't filter (#378)
If the server doesn't support filtering then it's impossible to mute a
hashtag (which works by creating a filter). In this case hide the UI.
2024-01-23 23:29:10 +01:00
Nik Clayton 88066302ab
build: Disable lint warnings about old versions of AGP (#379)
They're caught via GH Actions, and block builds unnecessarily.
2024-01-23 23:18:27 +01:00
Nik Clayton 5cfe6d055b
fix: Improve parsing of Friendica (and other server) version formats (#376)
Previous code could return an error on Friendica version strings like
`2024.03-dev-1547`.

Fix this:

- Extend the list of explicitly supported servers to include Fedibird,
Friendica, Glitch, Hometown, Iceshrimp, Pixelfed, and Sharkey.

- Add version parsing routines for these servers.

- Test the version parsing routines fetching every server and version
seen by Fediverse Observer (~ 2,000 servers) and ensuring that the
server and version information can be parsed.

Improve the error message:

- Show the hostname with a `ServerRepository` error

Clean up the code:

- Remove the custom `resultOf` and `mapResult` functions, they have
equivalents in newer versions of the library (like `runSuspendCatching`)

Fixes #372
2024-01-23 20:27:25 +01:00
Nik Clayton 7e3cde4c65
refactor: Remove unused logging tags (#374) 2024-01-23 16:59:56 +01:00
Nik Clayton a588c702fb
fix: Prevent crash by keeping network.model.** classes (#369)
Previous rule didn't consider a deeper package hierarchy, so the new
NodeInfo classes were being removed by ProGuard.
2024-01-19 09:39:44 +01:00
Martijn de Boer 875bb9c2a5 fix(l10n): Update Dutch translations
Currently translated at 100.0% (650 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/nl/
2024-01-18 22:02:47 +01:00
Jener Gomes ee0fdf86b3 fix(l10n): Update Portuguese (Brazil) translations
Currently translated at 100.0% (650 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/pt_BR/
2024-01-18 22:02:47 +01:00
Kalle Kniivilä 1bbe32d6c0 fix(l10n): Update Finnish translations
Currently translated at 100.0% (650 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fi/
2024-01-18 22:02:47 +01:00
Kalle Kniivilä 37a6826df7 fix(l10n): Update Finnish translations
Currently translated at 86.6% (563 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fi/
2024-01-18 22:02:47 +01:00
Martijn de Boer c50bbf86ca fix(l10n): Update Dutch translations
Currently translated at 99.6% (648 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/nl/
2024-01-18 22:02:47 +01:00
ButterflyOfFire 970a7574a7 fix(l10n): Update Arabic translations
Currently translated at 94.6% (615 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ar/
2024-01-18 22:02:47 +01:00
Nik Clayton 42219875e9
fix: Disable filter functionality if unsupported by the server (#366)
The previous code unilaterally enabled filter functionality. Some
Mastodon-like servers -- like GoToSocial -- do not support filters, and
this resulted in user visible error messages when connecting to those
servers.

To fix this:

- Extend the set of supported server capabilities to include client and
server side filtering.

- Disable the filter preferences if the server does not support filters
and show a message explaining why it's disabled.

Extend the capabilities model to support this:

- Fetch server software name and version from the nodeinfo endpoints
(implementing the nodeinfo API and schema)

- Extend the use of kotlin-result to provide hierarchies of Error
classes and demonstrate how to chain errors and display more informative
messages without using exceptions.

Fixes #343
2024-01-18 21:44:30 +01:00
Nik Clayton aaf8cf57f3
refactor: Provide TestScope as ApplicationScope in tests (#364)
Previously some tests had to manually create dependencies (instead of
injecting them) because the dependency required the `TestScope`
`CoroutineScope` as one of its dependencies.

Resolve this with a `FakeCoroutineScopeModule` that provides `TestScope`
as `@ApplicationScope`. The tests can now inject their dependencies,
which will use `TestScope`.

To inject `AccountPreferenceDataStore` it has been updated to use the
current active account when reading or writing preferences.
2024-01-17 16:41:41 +01:00
Nik Clayton 993b74691a
chore(deps): update plugin ktlint to v12.1.0 (#358) 2024-01-09 17:50:20 +01:00
Nik Clayton d8be70a465
chore(deps): update plugin ktlint to v12 (#357) 2024-01-08 23:26:46 +01:00
Nik Clayton 51c2ef0607
chore: Prepare release 2.1.1 (versionCode 10) (#331) 2023-12-17 07:15:46 +01:00
Nik Clayton 88466373b3
chore: Prepare release 2.1.0 (versionCode 9) (#327) 2023-12-15 15:50:20 +01:00
bittin1ddc447d824349b2 49a31dd80b fix(l10n): Update Swedish translations
Currently translated at 100.0% (650 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/sv/
2023-12-15 11:38:09 +01:00
Kalle Kniivilä 4db3b35023 fix(l10n): Update Finnish translations
Currently translated at 72.3% (470 of 650 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fi/
2023-12-15 11:38:09 +01:00
Nik Clayton b294a3bace
fix: Correctly show if an account is a bot or not (#322)
e35fa1db inadvertently contained some left over debug code that treats
non-bot accounts as bots (for displaying the bot badge) and vice versa.

Fixes #321
2023-12-14 11:27:49 +01:00
Nik Clayton 29f9273c01
fix: Show translated content when viewing a thread (#320)
If a status was part of a thread, and it was not the "detailed" status,
and it had been translated, then the view data was marked as "show the
translation". But the translation was not loaded, so the status content
appeared as empty.

Fix that by loading the translated content of all statuses in the thead
and ensure that the translated content is rendered.

Throw an `IllegalStateException` in debug builds to catch any future
occurrences of this.

Fixes #281
2023-12-13 17:18:07 +01:00
Nik Clayton bf36837b04
feat: Allow the user to report crashes in orange builds (#317)
Add a dependency on ACRA (in orange builds only), and catch crashes.

The user is given the option to e-mail the crash report data to the
support address, and can view and edit/redact the data before doing so.
2023-12-12 23:25:09 +01:00
Nik Clayton 098983f401
fix: Calculate length of posts and polls with emojis correctly (#315)
Mastodon counts post lengths by considering emojis to be single
characters, no matter how many unicode code points they are composed of.
So "😜" has length 1.

Pachli was using `String.length`, which considers "😜" as length 2.

Correct the calculation by using a BreakIterator to count the characters
in the string, which treats multi-character emojis as a length 1.

Poll options had a similar problem, exacerbated by the Mastodon web UI
also having the same problem, see
https://github.com/mastodon/mastodon/issues/28336.

Fix that by creating `MastodonLengthFilter`, an `InputFilter` that does
the right thing for regular text that may contain emojis.

See also https://github.com/tuskyapp/Tusky/pull/4152, which has the fix
for status length but not polls.

---------

Co-authored-by: Konrad Pozniak <opensource@connyduck.at>
2023-12-12 16:53:09 +01:00
Kalle Kniivilä 07e1d4c760 fix(l10n): Update Finnish translations
Currently translated at 60.2% (390 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fi/
2023-12-12 14:09:35 +01:00
Nik Clayton cbecfa3117
feat: Show roles on profiles (#312)
Roles for the logged in user appeared in Mastodon 4.0.0 and can be
displayed on the user's profile screen.

Show them as chips, adjusting the display of the existing "Follows you"
and "Bot" indicators to make allowances for this.

Roles can have a custom colour assigned by the server admin. This is
blended with the app colour so it is not too jarring in the display.

See also https://github.com/tuskyapp/Tusky/pull/4029

Co-authored-by: Konrad Pozniak <opensource@connyduck.at>
2023-12-11 20:57:11 +01:00
Nik Clayton 60cfa99f17
refactor: Use AppTheme enum exclusively (#311)
Previous code treated the app theme as a mix of strings and enums.
Convert to exclusively use the `AppTheme` enum to improve type safety.
2023-12-11 14:41:36 +01:00
Nik Clayton 2a7eda667b fix: Prevent crash if a preview card does not have an author 2023-12-09 22:49:21 +01:00