Commit Graph

5207 Commits

Author SHA1 Message Date
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 75f75a7fc6
fix: Use string resource instead of hardcoded "About" (#421) 2024-02-06 12:57:50 +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
Kalle Kniivilä 29538576d6 fix(l10n): Update Finnish translations
Currently translated at 100.0% (4 of 4 strings)

Translation: Pachli/Core/Activity : Main
Translate-URL: https://hosted.weblate.org/projects/pachli/coreactivity-main/fi/
2024-02-05 14:18:34 +01:00
renovate[bot] 664730df8b
fix(deps): update dependency org.junit.jupiter:junit-jupiter-params to v5.10.2 (#418)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.junit.jupiter:junit-jupiter-params](https://junit.org/junit5/)
([source](https://togithub.com/junit-team/junit5)) | `5.10.1` ->
`5.10.2` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.junit.jupiter:junit-jupiter-params/5.10.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.junit.jupiter:junit-jupiter-params/5.10.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.junit.jupiter:junit-jupiter-params/5.10.1/5.10.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.junit.jupiter:junit-jupiter-params/5.10.1/5.10.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/pachli/pachli-android).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-04 22:54:05 +01:00
renovate[bot] b88fe9a59e
fix(deps): update dependency com.android.tools:desugar_jdk_libs to v2.0.4 (#417)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[com.android.tools:desugar_jdk_libs](https://togithub.com/google/desugar_jdk_libs)
| `2.0.3` -> `2.0.4` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools:desugar_jdk_libs/2.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools:desugar_jdk_libs/2.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools:desugar_jdk_libs/2.0.3/2.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools:desugar_jdk_libs/2.0.3/2.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>google/desugar_jdk_libs
(com.android.tools:desugar_jdk_libs)</summary>

###
[`v2.0.4`](https://togithub.com/google/desugar_jdk_libs/blob/HEAD/CHANGELOG.md#Version-204--2023-11-01-)

-   Better support for "stand-alone" month names ("LLLL" format).
    See ([issue 160113376](https://issuetracker.google.com/160113376))
    for details.
-   Added support for `java.util.Base64` introduced in API level 26
-   Workaround for some non ASCII characters
    ([issue 293388944](https://issuetracker.google.com/293388944))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/pachli/pachli-android).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-04 21:44:56 +01:00
Nik Clayton 4283161f2a
ci: Allow gradle to set the number of workers (#416) 2024-02-04 21:13:04 +01:00
renovate[bot] 34cbf1c6c1
chore(deps): update dependency com.gaelmarhic.quadrant to v1.9.1 (#395)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| com.gaelmarhic.quadrant | `1.9` -> `1.9.1` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.gaelmarhic.quadrant/1.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.gaelmarhic.quadrant/1.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.gaelmarhic.quadrant/1.9/1.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.gaelmarhic.quadrant/1.9/1.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/pachli/pachli-android).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE3MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-04 21:09:45 +01:00
Nik Clayton 37a016576b
ci: Make secrets available in CI workflow (#415)
Previous code used `pull_request:` which meant
`secrets.GRADLE_ENCRYPTION_KEY` was not available, so the configuration
cache was not restored.

Use `pull_request_target` to give the workflow access to `secrets`, and
explicitly downscope the permissions of `GITHUB_TOKEN` to read only.
2024-02-04 20:45:00 +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
renovate[bot] 36646b2e38
fix(deps): update dependency com.google.truth:truth to v1.4.0 (#412)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.truth:truth](https://togithub.com/google/truth) | `1.3.0`
-> `1.4.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.truth:truth/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.truth:truth/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.truth:truth/1.3.0/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.truth:truth/1.3.0/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>google/truth (com.google.truth:truth)</summary>

### [`v1.4.0`](https://togithub.com/google/truth/releases/tag/v1.4.0):
1.4.0

[Compare
Source](https://togithub.com/google/truth/compare/v1.3.0...v1.4.0)

In this release, our assertions on Java 8 types continue to move from
the `Truth8` class to the main `Truth` class. This change should not
break compatibility for any supported JDK or Android version, even users
who test under old versions of Android without [API
desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring).
Additionally, we will never break binary compatibility, though some
users will have to make changes to their source code in order for it to
compile against newer versions.

This release is likely to lead to more **build failures** than
[1.3.0](https://togithub.com/google/truth/releases/tag/v1.3.0) did.
However, those failures should be **straightforward to fix**.

#### Example build failure

    Foo.java:152: error: reference to assertThat is ambiguous
        assertThat(repo.findFileWithName("foo")).isNull();
        ^
both method assertThat(@&#8203;org.jspecify.nullness.Nullable Path) in
Truth8 and method assertThat(@&#8203;org.jspecify.nullness.Nullable
Path) in Truth match

#### Simplest upgrade strategy (if you can update all your code
atomically in the same commit as the Truth upgrade)

In the same commit:

1.  Upgrade Truth to 1.4.0.
2. Replace `import static com.google.common.truth.Truth8.assertThat;`
with `import static com.google.common.truth.Truth.assertThat;`.
- If you use Kotlin, replace `import
com.google.common.truth.Truth8.assertThat` with `import
com.google.common.truth.Truth.assertThat`.
3. Replace `import com.google.common.truth.Truth8;` with `import
com.google.common.truth.Truth;`.
    -   again, similarly for Kotlin if needed
4.  Replace remaining references to `Truth8` with references to `Truth`.
- For example, replace `Truth8.assertThat(optional).isPresent()` with
`Truth.assertThat(optional).isPresent()`.

If you're feeling lucky, you can try this one-liner for the code
updates:

```sh
git grep -l Truth8 | xargs perl -pi -e 's/import static com.google.common.truth.Truth8.assertThat;/import static com.google.common.truth.Truth.assertThat;/g; s/import com.google.common.truth.Truth8.assertThat/import com.google.common.truth.Truth.assertThat/g; s/import com.google.common.truth.Truth8/import com.google.common.truth.Truth/g; s/\bTruth8[.]/Truth./g;'
```

After that process, it is possible that you'll still see build errors
from ambiguous usages of `assertThat` static imports. If so, you can
find a workaround in the section about overload ambiguity in the release
notes for
[1.3.0](https://togithub.com/google/truth/releases/tag/v1.3.0).
Alternatively, you can wait to upgrade until after a future Truth
release, which will eliminate the ambiguity by changing the signatures
of some `Truth.assertThat` overloads.

#### Incremental upgrade strategy

If you have a very large repo or you have other reasons to prefer to
upgrade incrementally, you can use the approach that we used inside
Google. Roughly, that approach was:

1. Make the optional changes discussed in the release notes for
[1.3.0](https://togithub.com/google/truth/releases/tag/v1.3.0).
2. For any remaining calls to `Truth8.assertThat`, change them to
*avoid* static import.
- That is, replace `assertThat(optional).isPresent()` with
`Truth8.assertThat(optional).isPresent()`.
3.  Upgrade Truth to 1.4.0.
4. Optionally replace references to `Truth8` with references to `Truth`
(including restoring static imports if desired), as discussed in section
about the simple upgrade strategy above.

#### Optional additional changes

- If you use `assertWithMessage(...).about(intStreams()).that(...)`,
`expect.about(optionalLongs()).that(...)`, or similar, you can remove
your call to `about`. This change will never be necessary; it is just a
simplification.
- This is similar to a previous optional change from
[1.3.0](https://togithub.com/google/truth/releases/tag/v1.3.0), except
that 1.3.0 solved this problem for `streams` and `optionals`, whereas
1.4.0 solves it for the other `Truth8` types.

#### For help

Please feel welcome to [open an
issue](https://togithub.com/google/truth/issues/new) to report problems
or request help.

#### Changelog

- Added the remaining `Truth8.assertThat` overloads to the main `Truth`
class. ([`9be8e77`](https://togithub.com/google/truth/commit/9be8e774c),
[`1f81827`](https://togithub.com/google/truth/commit/1f81827f1))
- Added more `that` overloads to make it possible to write type-specific
assertions when using the remaining Java 8 types.
([`7c65fc6`](https://togithub.com/google/truth/commit/7c65fc611))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/pachli/pachli-android).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-03 15:27:59 +01:00
ButterflyOfFire 93595a04d3 fix(l10n): Update Arabic translations
Currently translated at 66.6% (2 of 3 strings)

Translation: Pachli/Core/Activity : Orange
Translate-URL: https://hosted.weblate.org/projects/pachli/coreactivity-orange/ar/
2024-02-03 15:26:43 +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
Reza Almanda 99aa6c42e2 fix(l10n): Update Indonesian translations
Currently translated at 14.2% (2 of 14 strings)

Translation: Pachli/Fastlane Metadata
Translate-URL: https://hosted.weblate.org/projects/pachli/fastlane-metadata/id/
2024-02-03 15:26:43 +01:00
Languages add-on c0303fb76c feat(l10n): Added Chinese (Simplified) (zh_MO) translation 2024-02-03 15:26:43 +01:00
Languages add-on 91a615e767 feat(l10n): Added Chinese (Simplified, Singapore) translation 2024-02-03 15:26:43 +01:00
Languages add-on a27787422b feat(l10n): Added Berber translation 2024-02-03 15:26:43 +01:00
Languages add-on 1a239d22c7 feat(l10n): Added Norwegian Bokmål translation 2024-02-03 15:26:43 +01:00
Languages add-on 4f19ec0e22 feat(l10n): Added Bengali (Bangladesh) translation 2024-02-03 15:26:43 +01:00
Languages add-on fcefb700ad feat(l10n): Added Sanskrit translation 2024-02-03 15:26:43 +01:00
Languages add-on 82248a86d8 feat(l10n): Added Kabyle translation 2024-02-03 15:26:43 +01:00
Languages add-on 66a96256c8 feat(l10n): Added Chinese (Simplified) translation 2024-02-03 15:26:43 +01:00
Languages add-on 8d5ee0056c feat(l10n): Added Chinese (Traditional) translation 2024-02-03 15:26:43 +01:00
Languages add-on e318c47887 feat(l10n): Added Kurdish (Central) translation 2024-02-03 15:26:43 +01:00
Languages add-on 248df881da feat(l10n): Added Portuguese (Portugal) translation 2024-02-03 15:26:43 +01:00
Languages add-on dbddd0a1c3 feat(l10n): Added Slovenian translation 2024-02-03 15:26:43 +01:00
Languages add-on 5aba014fce feat(l10n): Added Sinhala translation 2024-02-03 15:26:43 +01:00
Languages add-on ddaa2ef853 feat(l10n): Added Slovak translation 2024-02-03 15:26:43 +01:00
Languages add-on 1f9471afdd feat(l10n): Added Korean translation 2024-02-03 15:26:43 +01:00
Languages add-on a96e050314 feat(l10n): Added Persian translation 2024-02-03 15:26:43 +01:00
Languages add-on 11874d157b feat(l10n): Added Frisian translation 2024-02-03 15:26:43 +01:00
Languages add-on 2badc4bfaf feat(l10n): Added French translation 2024-02-03 15:26:43 +01:00
Languages add-on 66f1f6e7c9 feat(l10n): Added Spanish translation 2024-02-03 15:26:43 +01:00
Languages add-on 20c102df33 feat(l10n): Added Bengali (India) translation 2024-02-03 15:26:43 +01:00
Languages add-on 5bdbfba751 feat(l10n): Added Indonesian translation 2024-02-03 15:26:43 +01:00
Languages add-on 6a3540cead feat(l10n): Added Italian translation 2024-02-03 15:26:43 +01:00
Languages add-on 4a5a8c3075 feat(l10n): Added Polish translation 2024-02-03 15:26:43 +01:00
Languages add-on 43814b2b29 feat(l10n): Added Malayalam translation 2024-02-03 15:26:43 +01:00
Languages add-on e8a6066328 feat(l10n): Added Hebrew translation 2024-02-03 15:26:43 +01:00
Languages add-on eaafe2e40e feat(l10n): Added Hindi translation 2024-02-03 15:26:43 +01:00
Languages add-on db0fc5f5a3 feat(l10n): Added Hungarian translation 2024-02-03 15:26:43 +01:00
Languages add-on b7e1f3d504 feat(l10n): Added English (United Kingdom) translation 2024-02-03 15:26:43 +01:00
Languages add-on 0581fd0dae feat(l10n): Added Icelandic translation 2024-02-03 15:26:43 +01:00
Languages add-on 81bcde2609 feat(l10n): Added Vietnamese translation 2024-02-03 15:26:43 +01:00