Commit Graph

3960 Commits

Author SHA1 Message Date
Nik Clayton 6ee41177cd
build: Install LeakCanary in debug builds (#308) 2023-12-09 18:06:01 +01:00
Kalle Kniivilä 0251801d7e fix(l10n): Update Finnish translations
Currently translated at 60.1% (389 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/fi/
2023-12-09 17:49:16 +01:00
Nik Clayton 1214cf7c8a
refactor: Break navigation dependency cycles with :core:navigation (#305)
The previous code generally started an activity by having the activity
provide a method in a companion object that returns the relevant intent,
possibly taking additional parameters that will be included in the
intent as extras.

E.g., if A wants to start B, B provides the method that returns the
intent that starts B.

This introduces a dependency between A and B.

This is worse if B also wants to start A.

For example, if A is `StatusListActivity` and B is`ViewThreadActivity`.
The user might click a status in `StatusListActivity` to view the
thread, starting `ViewThreadActivity`. But from the thread they might
click a hashtag to view the list of statuses with that hashtag. Now
`StatusListActivity` and `ViewThreadActivity` have a circular
dependency.

Even if that doesn't happen the dependency means that any changes to B
will trigger a rebuild of A, even if the changes to B are not relevant.

Break this dependency by adding a `:core:navigation` module with an
`app.pachli.core.navigation` package that contains `Intent` subclasses
that should be used instead. The `quadrant` plugin is used to generate
constants that can be used to launch activities by name instead of by
class, breaking the dependency chain.

The plugin uses the `Activity` names from the manifest, so when an
activity is moved in the future the constant will automatically update
to reflect the new package name.

If the activity's intent requires specific extras those are passed via
the constructor, with companion object methods to extract them from the
intent.

Using the intent classes from this package is enforced by a lint
`IntentDetector` which will warn if any intents are created using a
class literal.

See #291
2023-12-07 18:36:00 +01:00
Nik Clayton 2ce80c6a32
refactor: Use the correct package for TimelineKind (#303)
The package wasn't renamed when it was moved, so was still
`app.pachli.components.timeline`, instead of the new location,
`app.pachli.core.network.model`.
2023-12-06 12:20:36 +01:00
Nik Clayton e749b362ca
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.

This is unnecessarily slow.

This change starts to split the code in to multiple modules, which are:

- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules

Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.

The rough mechanics of the changes are:

- Create the modules, and move existing files in to them. This causes a
  lot of churn in import arguments.

- Convert build.gradle files to build.gradle.kts

- Separate out the data required to display a tab (`TabViewData`) from
  the data required to configure a tab (`TabData`) to avoid circular
  dependencies.

- Abstract the repeated build logic shared between the modules in to
  a set of plugins under `build-logic/`, to simplify configuration of
  the application and library builds.

- Be explicit that some nullable types are non-null at time of use.
  Nullable properties in types imported from modules generally can't be
  smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.

The changes highlight design problems with the current code, including:

- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult

Future changes will add more modules.

See #291.
2023-12-04 16:58:36 +01:00
sanao a7533b3f08
feat: Display compose button when viewing lists (#279)
Fixes #231
2023-12-04 16:42:32 +01:00
sanao fbbb6249cc
feat: Display compose button when viewing bookmarks list (#278)
Fixes #230
2023-12-04 16:29:14 +01:00
renovate[bot] 02b17f4144
fix(deps): update dependency com.android.tools.build:gradle to v8.2.0 (#257)
[![Mend Renovate logo
banner](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.build:gradle](https://developer.android.com/studio/build)
([source](https://android.googlesource.com/platform/tools/base)) |
`8.1.2` -> `8.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools.build:gradle/8.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools.build:gradle/8.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools.build:gradle/8.1.2/8.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools.build:gradle/8.1.2/8.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.android.tools.lint:lint-tests](http://tools.android.com/) |
`31.1.3` -> `31.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools.lint:lint-tests/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools.lint:lint-tests/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools.lint:lint-tests/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools.lint:lint-tests/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.android.tools.lint:lint](http://tools.android.com/) | `31.1.3` ->
`31.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools.lint:lint/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools.lint:lint/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools.lint:lint/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools.lint:lint/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.android.tools.lint:lint-checks](http://tools.android.com/) |
`31.1.3` -> `31.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools.lint:lint-checks/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools.lint:lint-checks/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools.lint:lint-checks/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools.lint:lint-checks/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.android.tools.lint:lint-api](http://tools.android.com/) |
`31.1.3` -> `31.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools.lint:lint-api/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools.lint:lint-api/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools.lint:lint-api/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools.lint:lint-api/31.1.3/31.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
---

### 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:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-12-02 14:34:34 +01:00
Nik Clayton f9fb0e87b4
fix: Prevent UnsupportedOperationException in PachliTileService (#288)
Previous code always called `startActivityAndCollapse()` with a regular
intent, which triggers an `UnsupportedOperationException` at API 34.

Use the non-deprecated variant that uses pending intents when
appropriate.

While looking at this I noticed the icon for the tile was incorrect, so
replaced that with the notification icon.
2023-12-02 14:24:29 +01:00
Jener Gomes d2ef0b0713 fix(l10n): Update English (United Kingdom) translations
Currently translated at 12.3% (80 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/en_GB/
2023-12-01 17:00:58 +01:00
sköldpadda 96d6c3bed3 fix(l10n): Update Swedish translations
Currently translated at 99.8% (646 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/sv/
2023-12-01 17:00:58 +01:00
Jener Gomes abc7a180bf fix(l10n): Update Portuguese (Brazil) translations
Currently translated at 100.0% (647 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/pt_BR/
2023-12-01 17:00:58 +01:00
Jener Gomes ad8d689165 fix(l10n): Update Spanish translations
Currently translated at 100.0% (647 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/es/
2023-12-01 17:00:58 +01:00
Jener Gomes ef6db89665 fix(l10n): Update English translations
Currently translated at 100.0% (647 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/en/
2023-12-01 17:00:58 +01:00
Jener Gomes a097b09af6 fix(l10n): Update Portuguese (Brazil) translations
Currently translated at 99.8% (646 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/pt_BR/
2023-12-01 17:00:58 +01:00
sanao bfdd8c943f fix(l10n): Update Japanese translations
Currently translated at 100.0% (647 of 647 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ja/
2023-12-01 17:00:58 +01:00
Nik Clayton 3827c09165
chore: Prepare release 2.0.0 (versionCode 8) (#277) 2023-11-23 12:53:58 +01:00
sanao 06f2fa27e2
feat: Display compose button when viewing favorites list (#276)
Display the "compose" FAB when viewing the favourite list. 

Fixes #229
2023-11-23 11:32:08 +01:00
Nik Clayton 4992aa9c52
feat: Increase the amount of information in link previews (#275)
Show up to two lines of the link's title and three lines of the link's
description in link preview cards. This provides additional useful
context to the user, especially when many links bury the important
information at the end of the title.
2023-11-21 20:06:29 +01:00
Nik Clayton 123c251fc9
feat: Warn the user about an Android animation bug (#274)
Upgrading to this version of Pachli may trigger an Android bug where
cached animation specifications are not cleared, resulting in incorrect
animations (e.g., when navigating between activities).

This is an Android bug triggered by the Android Material library,
https://github.com/material-components/material-components-android/issues/3644.

Show the user a dialog (once) when launching after an upgrade, so they
know to restart their device if necessary.
2023-11-21 16:05:42 +01:00
Nik Clayton 806991f8a8
fix: Prevent a ClassCastException when handling timeline errors (#273) 2023-11-21 13:48:41 +01:00
Nik Clayton a6a68f1384
fix: Use transparent system bar on all Android versions (#272)
Previous code use transparent system bars on v29, resulting in the wrong
colours in preferences and other activities on some devices.

Fixes #267
2023-11-21 00:02:52 +01:00
vinz e72431d15c fix(l10n): Update German translations
Currently translated at 99.6% (643 of 645 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/de/
2023-11-20 21:41:23 +01:00
renovate[bot] 8043f9fe1c
fix(deps): update material.drawer to v9 (major) (#127)
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

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

---

### Release Notes

<details>
<summary>mikepenz/MaterialDrawer
(com.mikepenz:materialdrawer-iconics)</summary>

###
[`v9.0.2`](https://togithub.com/mikepenz/MaterialDrawer/releases/tag/v9.0.2)

##### 🚀 Features

-   Update to Gradle 7.5.1
- PR:
[#&#8203;2788](https://togithub.com/mikepenz/MaterialDrawer/issues/2788)
-   Bump git from 1.11.0 to 1.13.0
- PR:
[#&#8203;2792](https://togithub.com/mikepenz/MaterialDrawer/issues/2792)
-   Upgrade all dependencies to the latest version
- PR:
[#&#8203;2798](https://togithub.com/mikepenz/MaterialDrawer/issues/2798)

##### 🐛 Fixes

-   fix getColorStateList for API22 and below
- PR:
[#&#8203;2797](https://togithub.com/mikepenz/MaterialDrawer/issues/2797)
    -   Thanks [@&#8203;bmx666](https://togithub.com/bmx666)

##### 💬 Other

-   Dependency Submission API
- PR:
[#&#8203;2782](https://togithub.com/mikepenz/MaterialDrawer/issues/2782)
-   Update CI pipeline for dependency submission API
- PR:
[#&#8203;2783](https://togithub.com/mikepenz/MaterialDrawer/issues/2783)
-   Run dependency submission action on dev branch
- PR:
[#&#8203;2784](https://togithub.com/mikepenz/MaterialDrawer/issues/2784)
-   Update Dependency submission for all modules
- PR:
[#&#8203;2787](https://togithub.com/mikepenz/MaterialDrawer/issues/2787)

###
[`v9.0.1`](https://togithub.com/mikepenz/MaterialDrawer/releases/tag/v9.0.1)

##### 🚀 Features

-   Upgrade dependencies 2022.06.24
- PR:
[#&#8203;2780](https://togithub.com/mikepenz/MaterialDrawer/issues/2780)

##### 🐛 Fixes

-   Enhance selected color selection MiniDrawerItem
- PR:
[#&#8203;2779](https://togithub.com/mikepenz/MaterialDrawer/issues/2779)
    -   Thanks [@&#8203;hamedgramzi](https://togithub.com/hamedgramzi)

###
[`v9.0.0`](https://togithub.com/mikepenz/MaterialDrawer/releases/tag/v9.0.0)

##### 🚀 Features

-   Material 3 theme
- PR:
[#&#8203;2756](https://togithub.com/mikepenz/MaterialDrawer/issues/2756)
- PR:
[#&#8203;2757](https://togithub.com/mikepenz/MaterialDrawer/issues/2757)
-   Upgrade environment | Kotlin 1.6 | Material 1.5.0-beta01
- PR:
[#&#8203;2758](https://togithub.com/mikepenz/MaterialDrawer/issues/2758)
-   Kotlin 1.6.10 | Material Components 1.5.0
- PR:
[#&#8203;2762](https://togithub.com/mikepenz/MaterialDrawer/issues/2762)
-   Upgrade to Navigation 2.4.x
- PR:
[#&#8203;2770](https://togithub.com/mikepenz/MaterialDrawer/issues/2770)
-   Upgrade dependencies | Kotlin 1.6.20
- PR:
[#&#8203;2774](https://togithub.com/mikepenz/MaterialDrawer/issues/2774)
-   Add successListener to setupWithNavController()
- PR:
[#&#8203;2773](https://togithub.com/mikepenz/MaterialDrawer/issues/2773)
- Thanks [@&#8203;shmueldabomb441](https://togithub.com/shmueldabomb441)

##### 🐛 Fixes

-   Do not set `selectOnLongClick` on `multiSelect=false`
- PR:
[#&#8203;2771](https://togithub.com/mikepenz/MaterialDrawer/issues/2771)

</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 these
updates 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:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDcuMiIsInVwZGF0ZWRJblZlciI6IjM3LjU5LjgiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-11-20 20:37:56 +01:00
sanao adb9fcf468
feat: Display compose button when viewing hashtags (#254)
Display the "compose" FAB when viewing a hashtag list. Tapping the
button will open `ComposeActivity` prepopulated with the hashtag at the
end of the post with the cursor at the start.

Fixes #228
2023-11-20 19:19:51 +01:00
vinz 1f21bd45d4 fix(l10n): Update German translations
Currently translated at 98.9% (638 of 645 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/de/
2023-11-19 16:28:52 +01:00
sanao e97ce6f303 fix(l10n): Update Japanese translations
Currently translated at 100.0% (645 of 645 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ja/
2023-11-17 14:09:04 +01:00
sanao 432e262e32 fix(l10n): Update Japanese translations
Currently translated at 100.0% (645 of 645 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ja/
2023-11-17 14:09:04 +01:00
Nik Clayton 46d81b3c68
fix: Ensure update-related data classes are retained (#269)
Prevents a crash if Proguard optimises them away in release builds.
2023-11-17 12:27:28 +01:00
Nik Clayton 34c88b0291
fix: Prevent colour related crash on API level ~ 26 (#262)
Viewing edited statuses could crash on API levels around 26 with a
ResourceNotFoundException. Using `?colorOutline` for the divider colour
instead of `?android:textColorPrimary` fixes this, and is also a better
colour to use.
2023-11-16 11:44:09 +01:00
Nik Clayton fce34cced1
fix: Update themes to correct poll/black theme issues (#255)
`Theme.Pachli` was being overriden on v29+ devices which meant that poll
options were showing with too much padding. Fix that by using `AppTheme`
as the final theme, and basing that off `Theme.Pachli`.

Black themes were using dark grey for toolbar and tab backgrounds, so
fix that too for a seamless experience with the black theme.
2023-11-15 15:59:01 +01:00
Nik Clayton 09dc830c86
fix: Collect the server capabilities in SFragment subclasses (#252)
Not all subclasses were calling `super.onViewCreated()` so collecting
the server capability wasn't happening consistently. Fix this, and add a
`@CallSuper` annotation to prevent the problem from recurring.
2023-11-13 16:44:29 +01:00
Nik Clayton 1c6c8a7455
fix: Keep network model classes, preventing crash on startup (#251)
Without this the model classes are not retained, which causes a
`ClassCastException` when parsing the new models for the instance v1 and
instance v2 API calls.

Fixes #250
2023-11-13 13:31:31 +01:00
Nik Clayton d40b87f0a0
feat: Translate statuses on cached timelines (#220)
Implement some support for server-side status translation. Do this by:

- Implement support for the `api/v1/instance` endpoint to determine if
  the remote server supports translation.

- Create new `ServerCapabilities` to allow the app to query the remote
  capabilities in a server-agnostic way. Use this to query if the
  remote server supports the Mastodon implementation of server-side
  translation

- If translation is supported then show a translate/undo translate
  option on the status "..." menu.

- Fetch translated content from the server if requested, and store it
  locally as a new Room entity.

- Update displaying a status to check if the translated version
  should be displayed; if it should then new code is used to show
  translated content, content warning, poll options, and media
  descriptions.

- Add a `TextView` to show an "in progress" message while translation
  is happening, and to show the translation provider (generally
  required by agreements with them).

Partially fixes #62

---------

Co-authored-by: sanao <naosak1006@gmail.com>
2023-11-12 19:51:46 +01:00
chaoscalm 27367d94bd fix(l10n): Update Italian translations
Currently translated at 97.6% (625 of 640 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/it/
2023-11-12 12:44:03 +01:00
Nik Clayton 9b85ae08a1
chore: Prepare release 1.4.0 (versionCode 7) (#241) 2023-11-10 13:55:32 +01:00
Nik Clayton 0816071eea
fix(l10n): Update Italian translations (#240)
Based on work originally carried out by chaoscalm in
https://github.com/pachli/pachli-android/pull/206.
2023-11-10 12:52:52 +01:00
Nik Clayton 380bc6fa1e
fix: Ensure navigation and status bar icons are visible (#239) 2023-11-09 19:12:41 +01:00
Nik Clayton e03825cc12
ci: Use correct versionCode for orange.* versions (#237)
Now that the flavour includes the store name it's not sufficient to
check for "orange" as the flavour, as that no longer matches. Now it
must start with "orange" to trigger using the git commit count as the
version code.
2023-11-08 09:59:13 +01:00
Nik Clayton dda9dde1b9
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.

Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.

On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).

The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.

A different update check method is used for each installation location.

- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version

These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".

Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.

CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
Nik Clayton 86dee94035
refactor: Convert Java to Kotlin (#235) 2023-11-06 20:16:34 +01:00
Nik Clayton cc2974cb69
fix: Show preference changes immediately (#234)
The preference change listener was being optimised out by R8, causing
rapid garbage collection, breaking the `changes` flow in release builds.

Fix this by annotating the field with `@Keep` so it is retained.

Fixes #225
2023-11-06 19:02:13 +01:00
Nik Clayton 392eb55485
fix: Honour the FAB_HIDE preference in timelines (#227) 2023-11-06 16:29:46 +01:00
Nik Clayton bd452b53a5
fix: Ensure system controls are visible on older devices (#224)
Previous code always set `navigationBarColor` and `statusBarColor` to
`transparent` irrespective of the API level.

This only works on API 29 and above; if you do it on API levels lower
than that the system navigation buttons (home, back, recents) are
typically shown on a very similar colour to the background, making them
very hard to see.

Fixes #221
2023-11-05 22:19:39 +01:00
Nik Clayton c350d17646
refactor: Remove additional unused code after migrating to Timber (#219) 2023-11-05 14:50:23 +01:00
sanao 4b7eb2419e
refactor: Use com.google.android.material.appbar.MaterialToolbar
The previous code used `androidx.appcompat.widget.Toolbar` in a several
places.

It's better to use `MaterialToolbar` as that plays better with other
Material components.

Update the usage throughout the project.

In addition, implement a lint check that will prevent any future use
from creeping back in.

Fixes #28
2023-11-05 13:51:37 +01:00
Nik Clayton f8877909ca
refactor: Log with Timber (#218)
Use Timber instead of `android.util.Log`. Removes the need for `TAG`
statics in companion objects, slightly simplifying the code. Opens the
door for some production logging in the future.
2023-11-04 22:22:44 +01:00
Nik Clayton 6aa4eab75d
fix: Remove progressbar from status timelines (#208)
Previously the middle-of-screen progress spinner and the spinner that
appears on a swipe-to-refresh could get out of sync.

Fix this by removing the middle-of-screen progress spinner from relevant
fragments, as the swipe-to-refresh spinner shows the user that an
operation is in progress, and also clues them in to the fact that a
swipe-to-refresh is possible (by using the common UX control).

Fixes #75
2023-10-30 19:26:40 +01:00
Nik Clayton c3f68ba9b8
fix: Refer to "SDK level" rather than "SDK version" (#211)
"level" is the term used throughout Android documentation.

Originally submitted by https://github.com/chaoscalm
2023-10-30 19:25:53 +01:00
Nik Clayton e5a54061aa
build: Use `updateLintBaseline` task (#209)
There's a well-hidden `updateLintBaseline` task that does what the
custom `newLintBaseline` task does. Prefer the `update...` task to
reduce the amount of custom machinery in this build.
2023-10-30 19:03:45 +01:00
Nik Clayton 9dad367f6f
fix: Restore image aspect ratio when drag ends (#207)
Previously, ending a drag on an image (that didn't result in dismissing
the fragment) animates the image back in to position restoring the X
axis scale factor.

The Y axis scale factor was not restored, potentially breaking the
image's aspect ratio. Restore the Y axis scale factor to fix this
(`ViewVideoFragment` already handles this correctly).

Fixes #202
2023-10-28 20:28:57 +02:00
Nik Clayton 523efa705c
fix: Prevent potential crash when filters are slow to load (#205)
This previous code could crash if `filterModel.kind` (marked `lateinit`)
had not been set before the filters are loaded. This could happen in
rare cases.

Fix this by rewriting `FilterModel`. Instead of creating a half-empty
object that still needs further initialisation, delay the creation until
all the necessary information is available, and pass it in the
`FilterModel` constructor.

This also forces code that uses `FilterModel` to properly handle the
case where it might be null at the point where filtering decisions have
to be made.

This means that `TimelineViewModel` (and subclasses) no longer need the
`init()` function to complete their construction, which was another
significant code smell. Pass the `TimelineKind` to the view models via
their `SavedStateHandle`.

This showed that changing filters wasn't causing the timelines to update
without a manual refresh, so fix that too. Editing filters sends change
events for the old and new contexts (in case a context is removed from a
filter), and deleting a filter sends a change event too.
2023-10-28 19:54:46 +02:00
chaoscalm 34e37f9ebb
fix(l10n): Update Italian translations (#204) 2023-10-28 13:43:41 +02:00
Nik Clayton 3705a29dd0
fix: Use the correct name for filters affecting threads (#203)
Previous code called filters that affect threads "Conversations".
Correct this to "Threads", to distinguish from "Direct Messages" which
can also be known as "conversations" (in the API in particular).
2023-10-26 23:34:04 +02:00
Nik Clayton ca8c1d9181
chore: Update copyright notice to refer to Pachli for the license (#201)
Previous copyright notice mentioned that the license should have been
distributed with Tusky. Correct that to Pachli.

This does not change the copyright assignment, only the instructions
as to where to find the license.
2023-10-26 16:41:12 +02:00
Nik Clayton 2f3851acee
refactor: Convert Java viewholders to Kotlin (#200) 2023-10-26 16:22:18 +02:00
Nik Clayton 0598c0e667
chore: Remove unused DAO functions (#199) 2023-10-26 12:23:10 +02:00
Nik Clayton 6b12ecfd7a
fix(deps): update androidx.room to v2.6.0 (#198)
Enable Kotlin code generation, and use the new room plugin to generate
schemas in a reproducible/cacheable way.
2023-10-25 18:39:31 +02:00
Nik Clayton 9c4ea13d23
chore: Prepare release 1.3.0 (versionCode 6) (#197) 2023-10-25 09:52:25 +02:00
sanao 00bde27eb3 fix(l10n): Update Japanese translations
Currently translated at 100.0% (632 of 632 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ja/
2023-10-25 09:05:27 +02:00
sanao 1f2f4d51b5
feat: Add a preference to hide "self-boosts"
A "self-boost" is someone boosting their own post. Some people are
particularly prolific at this, and it can clutter the timeline. Provide
a new preference that allows the user to show/hide these boosts from
their timeline.
2023-10-23 22:47:11 +02:00
Nik Clayton 42b09f4f1e
fix: Show full display and username in profile view (#195)
Most parts of the UI will truncate the display of long names (display
and user), but it makes sense to show them untruncated on the account's
profile screen.
2023-10-23 13:20:23 +02:00
Nik Clayton 5a41cbd40f
fix: Improve display of "obscured" links (#194)
The previous code (a) used an emoji as the prefix character when showing
the destination of an obscured link, and (b) made the destination part
of the link anchor text.

Using an emoji was a problem because the user can use different emoji
sets and it can give strange results. Making the destination part of the
link text made it difficult to distinguish at a glance where one link
ends and another starts.

Fix the emoji problem by replacing the emoji with a drawable.

Fix the destination problem by changing the string resource so it only
includes the destination part, and inserting it at the end of the link
instead of replacing the whole link. This means the disclosed
destination is not clickable, does not look like part of the link, and
stands out more.
2023-10-23 13:20:09 +02:00
Nik Clayton 566b23ed06
fix: Ensure empty timeline message is visible (#191)
Previously was showing pale text on a pale background, so effectively
invisible.

Use `colorPrimary` and `colorOnPrimary` to ensure the text can be seen.
2023-10-20 13:29:35 +02:00
Nik Clayton 514b295fe1
refactor: Use sealed interfaces for lighterweight code (#190)
Using a sealed interface (instead of a sealed class) at the root of the
hierarchy avoids the overhead of having to create and initialise the
class (visible in the generated bytecode).

It also makes the instantiation code slightly less cumbersome because
the code doesn't need to pass parameters to the root's constructor.
2023-10-20 13:00:36 +02:00
Nik Clayton d39eb3b642
refactor: Extract PreviewCard display code to `PreviewCardView` (#184) 2023-10-19 12:54:58 +02:00
Nik Clayton 3157f8d946
fix: Adjust video playback UX behaviour (#186)
Previously, playing a video would show the controls and associated
overlay for five seconds before fading them out. This obscures the video
for too long.

Fix this by:

- Only showing the media description on start, and remove after two
seconds
- Show the controls (and media description) if the user taps, removing
after two seconds
- Pausing the video (with the pause control, or tapping on the media
description) keeps the controls and description on-screen indefinitely
so they are easier to read

Fixes #144
2023-10-19 12:43:10 +02:00
Nik Clayton 0730c0190b
refactor: Use ksp instead of kapt for Hilt (#181)
This removes all use of kapt from the project.
2023-10-18 15:02:17 +02:00
Nik Clayton e59eebc5e4
fix: Use Pachli blue and orange for notification icons (#182)
Fixes #178
2023-10-17 20:35:15 +02:00
sanao 95d4fd2d74 fix(l10n): Update Japanese translations
Currently translated at 99.5% (627 of 630 strings)

Translation: Pachli/UI strings
Translate-URL: https://hosted.weblate.org/projects/pachli/ui-strings/ja/
2023-10-17 20:33:48 +02:00
Nik Clayton 2ca279a37c
fix: Update timeline when link preview setting changes (#180)
The previous code didn't include SHOW_CARDS_IN_TIMELINES in the list of
prefkeys that change `StatusDisplayOptions`, so changing the preference
wouldn't update the timeline display; you had to close/restart the app.
2023-10-16 21:49:11 +02:00
sanao 3cfb7a0d1e
feat: Show announcement dates (#35) (#151)
Display the time that an announcement was posted, as well as the
most recent update to the announcement (if there is one). Time display
honours the user's "use absolute time" preference.

Fixes #35
2023-10-16 20:04:30 +02:00
Nik Clayton db2bd3199e
refactor: Create repositories for preferences and StatusDisplayOptions (#149)
Previously, code for handling shared preferences, and how those
preferences affect `StatusDisplayOptions`, was scattered through the
code base with duplicate implementations.

Bring it together in to a `SharedPreferencesRepository` and a
`StatusDisplayOptionsRepository`.

`SharedPreferencesRepository` is a thin wrapper over`SharedPreferences`
that delegates most work to `SharedPreferences`. It configures a
listener for preference changes, and exposes those changes as a flow.

`StatusDisplayOptions` now contains explicit defaults to ensure they
are in one place.

`StatusDisplayOptionsRepository` exposes a `StatusDisplayOptions` flow
that updates whenever the active account changes or a relevant
preference changes.

The viewmodels expose `StatusDisplayOptionsRepository.flow` to the
activities and fragments so they can pass the current value to the
adapter.

This obsoletes `PreferenceChangedEvent`. An event is still fired when
filters change, `FilterChangedEvent`.

This allowed many of the mocks in tests to be replaced with either the
real type (because a fake is injected in to it, or one of its
dependencies) or a custom fake that provides a mock.
2023-10-15 22:52:47 +02:00
Nik Clayton 24fa26c126
refactor: Simplify View{Image,Media,Video}Fragment creation (#175)
Previous code had to distinguish between showing an attachment or
showing an image by URL.

Simplify this by -- in the image URL case -- creating a fake attachment
that references the image URL.

Move the code that unmarshalls the Bundle arguments to
`ViewMediaFragment` to share between `ViewImageFragment` and
`ViewVideoFragment`.
2023-10-15 22:29:18 +02:00
Nik Clayton c50f10a989
refactor: Extract Poll display code to `PollView` (#177) 2023-10-15 22:26:34 +02:00
Nik Clayton 9cb41d6353
fix: Show media when resuming ViewMediaFragment (#174)
Previous code finalised the view setup in `onViewCreated`, so if you
opened some media, switched away from the app, and switched back you'd
get a blank screen.

Fix this by doing the finalisation in `onResume()`, so the media is
displayed correctly when returning to the fragment.

Fixes #161
2023-10-15 14:45:41 +02:00
Nik Clayton 99dd15ea89
fix: Add foregroundServiceType/onTimeout() to prevent crash (#163)
Android 14 (SDK 34) requires a `foregroundServiceType` and `onTimeout()`
implementation for foreground services, otherwise creating the service
will crash.

Do this. If `SendStatusService` does timeout then any pending statuses
are marked as failed, saved to drafts, and the user is informed.

Fixes #162
2023-10-15 13:07:35 +02:00
Weblate (bot) 34c53a67e0
fix(l10n): Translations update from Weblate (#159)
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/UI
strings](https://hosted.weblate.org/projects/pachli/ui-strings/)



Current translation status:

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

---------

Co-authored-by: sanao <jinsei@sanao.dev>
Co-authored-by: Eryk Michalak <gnu.ewm@protonmail.com>
2023-10-15 11:48:52 +02:00
renovate[bot] ca06d46d32
fix(deps): update glide to v4.16.0 (#123)
[![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.github.bumptech.glide:okhttp3-integration](https://togithub.com/bumptech/glide)
| `4.15.1` -> `4.16.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.github.bumptech.glide:okhttp3-integration/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.github.bumptech.glide:okhttp3-integration/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.github.bumptech.glide:okhttp3-integration/4.15.1/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.github.bumptech.glide:okhttp3-integration/4.15.1/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.github.bumptech.glide:glide](https://togithub.com/bumptech/glide)
| `4.15.1` -> `4.16.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.github.bumptech.glide:glide/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.github.bumptech.glide:glide/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.github.bumptech.glide:glide/4.15.1/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.github.bumptech.glide:glide/4.15.1/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.github.bumptech.glide:ksp](https://togithub.com/bumptech/glide) |
`4.15.1` -> `4.16.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.github.bumptech.glide:ksp/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.github.bumptech.glide:ksp/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.github.bumptech.glide:ksp/4.15.1/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.github.bumptech.glide:ksp/4.15.1/4.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>bumptech/glide
(com.github.bumptech.glide:okhttp3-integration)</summary>

###
[`v4.16.0`](https://togithub.com/bumptech/glide/releases/tag/v4.16.0):
Glide 4.16.0

This release focuses on some build improvements and Compose. The two
major Compose improvements are adding support for Compose specific
transitions (e.g. cross fade) and supporting recomposition based on
request state using `GlideSubcomposition`. There's also been a bunch of
internal refactoring to move away from Painters to Modifier nodes based
on feedback from the Compose team. This is still an alpha release of
Compose, but barring unexpectedly negative feedback, the next release
should be beta.

This should be the last release of Glide that targets Java 7. That
probably means our next release will be a major version change.

##### Features

- Allow passing an executor into ChromiumRequestSerializer in
[https://github.com/bumptech/glide/pull/5077](https://togithub.com/bumptech/glide/pull/5077)
- Allow host app to provide a way to clear all resources onStop() by
[@&#8203;osamaaftab](https://togithub.com/osamaaftab) in
[https://github.com/bumptech/glide/pull/5145](https://togithub.com/bumptech/glide/pull/5145)

##### Compose

- Add a Transition API and a CrossFade Transition for Compose by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5235](https://togithub.com/bumptech/glide/pull/5235)

- Influence layout using intrinsics in GlideNode by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5240](https://togithub.com/bumptech/glide/pull/5240)
\* Log instead of throwing parsing manifests to fix compose previews by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5167](https://togithub.com/bumptech/glide/pull/5167)

- Launch no more than one request per onRemembered by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5062](https://togithub.com/bumptech/glide/pull/5062)

- Remove GlidePainter in favor of Modifier nodes / Flows by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5230](https://togithub.com/bumptech/glide/pull/5230)

- Replace flows in GlideSubcomposition with a listener on GlideNode by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5238](https://togithub.com/bumptech/glide/pull/5238)

##### Bugs

- Read library glide module names from Java indexes by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5052](https://togithub.com/bumptech/glide/pull/5052)
- Fix typo. anay -> any in GlideSymbolProcessor.kt. by
[@&#8203;trevorhackman](https://togithub.com/trevorhackman) in
[https://github.com/bumptech/glide/pull/5029](https://togithub.com/bumptech/glide/pull/5029)
- Include URL in error log by
[@&#8203;paulsowden](https://togithub.com/paulsowden) in
[https://github.com/bumptech/glide/pull/5164](https://togithub.com/bumptech/glide/pull/5164)
- Add `isInitialized` visible for testing method by
[@&#8203;paulsowden](https://togithub.com/paulsowden) in
[https://github.com/bumptech/glide/pull/5163](https://togithub.com/bumptech/glide/pull/5163)
- Use onIdle to avoid a race in FlowTests by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5202](https://togithub.com/bumptech/glide/pull/5202)
- Add a isEquivalentTo method to correctly check equality by
[@&#8203;mori-atsushi](https://togithub.com/mori-atsushi) in
[https://github.com/bumptech/glide/pull/5232](https://togithub.com/bumptech/glide/pull/5232)
- Add
[@&#8203;RequiresPermission](https://togithub.com/RequiresPermission) to
NotificationTarget by
[@&#8203;TWiStErRob](https://togithub.com/TWiStErRob) in
[https://github.com/bumptech/glide/pull/5220](https://togithub.com/bumptech/glide/pull/5220)

##### Deprecations

- `placeholderOf(@&#8203;Composable)` in `GlideImage` is deprecated, use
`GlideSubcomposition` instead. Keep in mind that using either forces a
recomposition each time the state of the image load changes.
Recomposition will have a significant performance penalty in scrolling
lists and should be avoided.

##### Behavior Changes

- Hard code disabling hardware bitmaps on O/OMR1. by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5115](https://togithub.com/bumptech/glide/pull/5115)
- Do not set requireOriginal on Android photo picker uris. by
[@&#8203;phoenixli](https://togithub.com/phoenixli) in
[https://github.com/bumptech/glide/pull/5162](https://togithub.com/bumptech/glide/pull/5162)

##### Breaking Changes

##### Build Changes

- Add integration tests for ksp library modules. by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5054](https://togithub.com/bumptech/glide/pull/5054)
- Update README.md to use https by
[@&#8203;simoarpe](https://togithub.com/simoarpe) in
[https://github.com/bumptech/glide/pull/5058](https://togithub.com/bumptech/glide/pull/5058)
- Use dokka to build scripts/update_javadocs.sh by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5104](https://togithub.com/bumptech/glide/pull/5104)
- avif integration: Update libavif dependency by
[@&#8203;vigneshvg](https://togithub.com/vigneshvg) in
[https://github.com/bumptech/glide/pull/5128](https://togithub.com/bumptech/glide/pull/5128)
- Disable java 7 source obsolete warning. by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5168](https://togithub.com/bumptech/glide/pull/5168)
- Update mockito version to fix j16 compilation. by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5169](https://togithub.com/bumptech/glide/pull/5169)
- Switch Glide's dependencies to a version catalog. by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5183](https://togithub.com/bumptech/glide/pull/5183)
- Remove jetifier by [@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5184](https://togithub.com/bumptech/glide/pull/5184)
- Add an updated proguard plugin to compile on Java 17. by
[@&#8203;sjudd](https://togithub.com/sjudd) in
[https://github.com/bumptech/glide/pull/5185](https://togithub.com/bumptech/glide/pull/5185)
- Configure Renovate in
[https://github.com/bumptech/glide/pull/5186](https://togithub.com/bumptech/glide/pull/5186)
- Increment ROBOLECTRIC_SDK to 19 from 18. by
[@&#8203;brettchabot](https://togithub.com/brettchabot) in
[https://github.com/bumptech/glide/pull/5208](https://togithub.com/bumptech/glide/pull/5208)
and
[https://github.com/bumptech/glide/pull/5207](https://togithub.com/bumptech/glide/pull/5207)
- AGP: Upgrade AndroidManifest.xml's package to build.gradle's
namespace. by [@&#8203;TWiStErRob](https://togithub.com/TWiStErRob) in
[https://github.com/bumptech/glide/pull/5221](https://togithub.com/bumptech/glide/pull/5221)

##### New Contributors

- [@&#8203;trevorhackman](https://togithub.com/trevorhackman) made their
first contribution in
[https://github.com/bumptech/glide/pull/5029](https://togithub.com/bumptech/glide/pull/5029)
- [@&#8203;simoarpe](https://togithub.com/simoarpe) made their first
contribution in
[https://github.com/bumptech/glide/pull/5058](https://togithub.com/bumptech/glide/pull/5058)
- [@&#8203;paulsowden](https://togithub.com/paulsowden) made their first
contribution in
[https://github.com/bumptech/glide/pull/5164](https://togithub.com/bumptech/glide/pull/5164)
- [@&#8203;phoenixli](https://togithub.com/phoenixli) made their first
contribution in
[https://github.com/bumptech/glide/pull/5162](https://togithub.com/bumptech/glide/pull/5162)
- [@&#8203;osamaaftab](https://togithub.com/osamaaftab) made their first
contribution in
[https://github.com/bumptech/glide/pull/5145](https://togithub.com/bumptech/glide/pull/5145)
- [@&#8203;brettchabot](https://togithub.com/brettchabot) made their
first contribution in
[https://github.com/bumptech/glide/pull/5207](https://togithub.com/bumptech/glide/pull/5207)
- [@&#8203;mori-atsushi](https://togithub.com/mori-atsushi) made their
first contribution in
[https://github.com/bumptech/glide/pull/5232](https://togithub.com/bumptech/glide/pull/5232)

**Full Changelog**:
https://github.com/bumptech/glide/compare/v4.15.0...v4.16.0

Note - there's been a change in the gpg key used to sign these releases.
The new public key is attached

</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 these
updates 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:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDcuMiIsInVwZGF0ZWRJblZlciI6IjM3LjguMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-10-13 14:59:45 +02:00
Nik Clayton 71df6254ef
fix: Show thread indicators and other dividers using Material colours (#157)
Use the Material colour for `conversation_thread_line` (which is
`colorOutlineVariant`) instead of a custom attribute.

Elsewhere, use the Material attribute directly (in code), or replace the
custom divider with a `MaterialDivider`.

This makes some colour definitions unused, so remove them.

Fixes #148
2023-10-13 11:36:05 +02:00
Nik Clayton ff5d7f1d27
refactor: Update ViewThreadViewModel to use FiltersRepository (#156)
Instead of calling the filters API directly use `FiltersRepository` to
handle the v1/v2 filter differences.
2023-10-12 12:47:27 +02:00
Nik Clayton 0902b0ba49
refactor: Replace test preference mocks with InMemorySharedPreferences (#155)
Previously the tests mocked shared preferences with a map and a mock
that had to be implemented for each test that needed it.

Replace this with `InMemorySharedPreferences`, which provides the normal
`SharedPreferences` interface so can be used as a drop-in replacement.
2023-10-12 11:22:41 +02:00
Nik Clayton 628b5a7db5
refactor: Inject Gson in FakeDatabaseModule (#153) 2023-10-11 21:27:28 +02:00
Nik Clayton f88599908b
refactor: Extract FakeMastodonApiModule (#152)
Extract `FakeMastodonApiModule` from `ComposeActivityTest` to make it
usable in other tests. Update `MainActivityTest` to use the extracted
code.
2023-10-11 15:39:51 +02:00
Nik Clayton 53e7842439
change: Increase compileSdk and targetSdk to 34 (#150)
Associated changes:

- Handle new null/non-null type signatures in overriden methods
- Configure Robolectric to use SDK 33 (current highest supported
version)
2023-10-11 12:28:45 +02:00
Nik Clayton 38214648dd
refactor: Migrate from Dagger to Hilt (#143)
- Remove `Injectable` interface, use `@AndroidEntryPoint`
- Remove `DispatchingAndroidInjector`
- Remove `viewModelFactory`, use `@HiltViewModel`
- Create providers for the different DAOs, and inject those instead of
  `AppDatabase`
- Create provider for a database transaction, inject that instead of
  `AppDatabase`
- Update tests
2023-10-07 19:30:11 +02:00
Nik Clayton f4c0d3525b
chore: Prepare release 1.2.2 (versionCode 5) (#140) 2023-10-03 13:21:53 +02:00
Nik Clayton 802cdd4c46
feat: Embed the privacy policy in the app (#139)
Instead of linking to the privacy policy embed it in the app as a string
of HTML.

The string is created with a new `markdown2resource` plugin, which
converts `PRIVACY.md` to HTML and generates a Java class with the HTML
content.

Create `PrivacyPolicyActivity` to display the HTML in a `WebView`, and
link to it from `AboutActivity`.
2023-10-03 12:56:30 +02:00
Nik Clayton 2cc534f22a
chore: Prepare release 1.2.1 (versionCode 4) (#138) 2023-09-30 14:33:10 +02:00
Nik Clayton 651b0efcd6
feat: Link to the privacy policy from "About" (#137)
Google requires an in-app link to the privacy policy.
2023-09-30 13:15:44 +02:00
Nik Clayton 7b4d879e80
chore: Prepare release 1.2 (versionCode 3) (#135) 2023-09-29 15:49:43 +02:00
Nik Clayton 6fedfe54ba
fix: Restore the user's reading position under all circumstances (#133)
The previous code did not always work when the user returned to the app
after a lengthy absence (e.g., overnight).

Instead of restoring by scrolling in `TimelineFragment`, restore by
working with the platform.

Determine the initial page to fetch by looking half a page ahead of the
saved saved status ID, and fetch that status and the page immediately
prior. This seems to match the view's expectations about what will be
immediately available.

Set `jumpThreshold` and `enablePlaceholders` in the `PagingConfig` so
the paging system will jump to the saved status.

Remove the restoration code in `TimelineFragment`.

Fixes #53
2023-09-29 11:10:55 +02:00
Nik Clayton d434144922
ci: Upload orangeRelease to Google Play (internal track) (#134)
Start building infrastructure to automatically build and deploy the
`orangeRelease` variant to Google Play.

The variant needs an automatically incrementing `versionCode`. That is
derived from the count of all commits.

Change the separator between the version and the build metadata in the
`versionName` from `-` to `+` to be consistent with semantic versioning.

This is still an experiment, so the workflow is triggered manually and
only uploads to the internal track
2023-09-28 13:50:02 +02:00
Nik Clayton b947c1b289
fix: Improve error handling when blocking accounts (#131)
The previous code ran the API call in a `try/catch block`, and handled
errors in the `catch`. But `NetworkResult` already catches the exception
and transforms it to a failure, so the error case was not handled.

Replace with `NetworkResult.fold`.
2023-09-27 18:32:58 +02:00
Nik Clayton 50d9aedad9
chore(deps): Update to AGP 8.1.1 (#130) 2023-09-27 18:06:14 +02:00
Nik Clayton 0b8d702960
refactor: Remove duplicate `MainCoroutineRule` (#129) 2023-09-27 17:53:24 +02:00
Nik Clayton c5a5540467
refactor: Remove rxjava3 from Mastodon API spec (#128)
Remove the rxjava3 `Single` type from the MastodonAPI definition,
replacing with `Response` or `NetworkResult` as appropriate.

Update callsites and tests as appropriate.

This removes the need for `com.squareup.retrofit2:adapter-rxjava3`
2023-09-27 11:35:55 +02:00
Nik Clayton 11fecb1914
feat: Show vertical scrollbars on scrollable lists (#96)
Display normal Android (i.e., fading) scrollbars when the user scrolls
in lists.
2023-09-26 15:57:35 +02:00
Nik Clayton 04025e99ff
fix: Show media when opening a thread, based on user preferences (#93)
A previous change dropped the check to see if media was marked as
sensitive, and so all media was hidden when viewing a thread. Reinstate
the check so only sensitive media is hidden (if the user preferences are
set that way).
2023-09-24 21:23:29 +02:00
Nik Clayton 9b21f3f9bf
refactor: Ensure `statusDisplayOptions` are created consistently (#92)
Previous code created `statusDisplayOptions` in full each time, risking
the creation of inconsistent states / defaults.

Refactor to use `StatusDisplayOptions.from()` so the user's settings
(and defaults) are always respected.
2023-09-24 21:23:07 +02:00
Nik Clayton af7b668476
fix: Enable/disable vote button when the user can/can't vote (#91)
Previously the voting button was always enabled, even if the user hadn't
made a choice.

Disable the button by default, and listen for clicks on the options.
Enable the button whenever one or more options are selected.

Fixes #90
2023-09-23 21:01:33 +02:00
Nik Clayton 2169c91281 fix: Ensure `setLifeOnScrollTargetView` is called when fragment resumes
If you do not do this and the fragment is in a pager then it can be
overridden when another fragment is swiped in to view.
2023-09-23 16:21:05 +02:00
Nik Clayton d2d6f147ea fix: Remove second `AppBarLayout` from activity_trending
Previous code `include`'d `toolbar_basic` inside an `AppBarLayout`.
But `toolbar_basic` already contains an `AppBarLayout`, which
resulted in some rendering issues.

Remove the `include` and incorporate the `MaterialToolbar` directly.
Set the toolbar to scroll out of the way when the screen scrolls, so
the behaviour is consistent with the tabs in `MainActivity` and
`AccountActivity`.
2023-09-23 16:21:05 +02:00
Nik Clayton f2cce6947e fix: Use the correct colour for the status bar
Previously, in `MainActivity` and `AccountActivity` the status bar would
be `colorPrimaryDark`.

Adjust the layouts and code so that `colorSurface` is used to match
the toolbar colour.

Fixes #79
2023-09-23 16:21:05 +02:00
Nik Clayton 0b74b073a4
fix: Ensure poll option text is visible against the background (#86)
Draw poll bars using the container colour variants to ensure that the
text drawn on top is also visible against the background.

Fixes #85
2023-09-23 11:58:00 +02:00
Nik Clayton 5fd15852fb
refactor: Use constant keys whenever preference values are fetched (#84) 2023-09-23 11:26:46 +02:00
Nik Clayton 3a274b0594
refactor: Replace .to... with .from() in most cases (#82)
The previous code generally converted between a higher and a lower type
by putting the type conversion functions on the lower type.

This introduced cycles in the code dependency graph, and made it more
difficult to follow the code flow.

Refactor the code so that types generally have a `from(...)` static
factory method that can create an instance from a lower type, and if
appropriate a `to...()` method that can also create an instance of that
lower type.

Add `docs/code-style.md` which explains the rationale for this change
in more detail so that future contributors can write code in the same
style.
2023-09-22 15:17:38 +02:00
Nik Clayton f45a3df83f refactor: Use resource strings on the hashtag toolbar menu 2023-09-20 19:05:35 +02:00
Nik Clayton 2b2d5d4bd8 refactor: Remove unnecessary tint from composeToggleVisibilityButton 2023-09-20 19:05:35 +02:00
Nik Clayton f9e5063ce6 fix: Label the header and avatar on the account screen 2023-09-20 19:05:35 +02:00
Nik Clayton 2bcb595777 fix: Label the image on the focus dialog 2023-09-20 19:05:35 +02:00
Nik Clayton 254edf5e6f refactor: Mark the image overlay is not important for accessibility 2023-09-20 19:05:35 +02:00
Nik Clayton 0fadb6f3fd fix: Set the contentDescription for avatars 2023-09-20 19:05:35 +02:00
Nik Clayton acaf2a7d89 refactor: Remove warnings about unclosed resources
In `MediaUploader` the lint warning can be ignored, as the stream is
closed elsewhere.

In the other files `.use` is used to simplify the code and remove
the need for Closeable.closeQuietly (as `.use` catches exceptions that
are thrown when closing).
2023-09-20 19:05:35 +02:00
Nik Clayton d00dc97a5f refactor: Suppress an unncessary CheckResult lint error
The result is used, lint isn't smart enough to figure that out.
2023-09-20 19:05:35 +02:00
Nik Clayton d555e2a69c refactor: Fix KDoc warnings 2023-09-20 19:05:35 +02:00
Nik Clayton 1aea1cde8b refactor: Resolve theoretical `BaseActivity` NPEs 2023-09-20 19:05:35 +02:00
Nik Clayton 4db1af5b50 refactor: Resolve theoretical `StatusBaseViewHolder` NPEs
Use `assert` to note when a nullable value is known to be non-null.

Extract a method call to a variable where necessary to do this.
2023-09-20 19:05:35 +02:00
Nik Clayton a6bad12271 refactor: Resolve theoretical Notification NPEs
Use `assert` to note when a nullable value is known to be non-null.

Extract a method call to a variable where necessary to do this.

Update `CharSequence.unicodeWrap()` to handle a null `CharSequence`.
2023-09-20 19:05:35 +02:00
Nik Clayton 7b7976c31b refactor: Rewrite `onRequestPermissionsResult` to remove a theoretical NPE 2023-09-20 19:05:35 +02:00
Nik Clayton e762008a2a refactor: Use Java enhanced switch 2023-09-20 19:05:35 +02:00
Nik Clayton 1a817d9b29 fix: Fix potential NPE in `ConversationViewHolder`
`ConversationViewHolder` calls `getDisplayName()`, which may return
null.

Replace with `getName()`, which is consistent with usage in other
classes. Mark `getDisplayName()` as deprecated to prevent future
usage.
2023-09-20 19:05:35 +02:00
Nik Clayton da808793f5 refactor: Remove unncessary `val` from constructor parameter 2023-09-20 19:05:35 +02:00
Nik Clayton 26ff8e5bad refactor: Remove unnecessary return type from `handleProfileClick` 2023-09-20 19:05:35 +02:00
Nik Clayton 8c95472d42 refactor: Remove unused `consumed` property 2023-09-20 19:05:35 +02:00
Nik Clayton 249718edf3 refactor: Remove unused `statusAsync` function 2023-09-20 19:05:35 +02:00
Nik Clayton 7b7c304f61 refactor: Remove unused `hasTab` function 2023-09-20 19:05:35 +02:00
Nik Clayton c335fa6217 refactor: Suppress lint errors for unused log TAG variables 2023-09-20 19:05:35 +02:00
Nik Clayton 986ccd0532 refactor: Remove unnecessary `?:` operator
Left hand side of the operation was always non-null.
2023-09-20 19:05:35 +02:00
Nik Clayton 20e5877a29 refactor: Convert sealed sub-objects to `data object` 2023-09-20 19:05:35 +02:00
Nik Clayton 9f81be7bb7 refactor: Replace `try/finally` with `use` 2023-09-20 19:05:35 +02:00
Nik Clayton b157791058
refactor: Convert ProgressRequestBody to Kotlin (#78) 2023-09-19 22:18:29 +02:00
Nik Clayton 9de829995b
fix: Check permissions before sending a failure notification (#77) 2023-09-19 22:18:17 +02:00
Nik Clayton 0f6975ffcc
fix: Check build version is >= T before POST_NOTIFICATIONS request (#76) 2023-09-19 22:04:42 +02:00
Nik Clayton ffa8ea615b
refactor: Convert AccountActionListener to Kotlin (#74) 2023-09-19 21:38:27 +02:00
Nik Clayton 5193f31ad8
refactor: Convert StatusActionListener to Kotlin (#73) 2023-09-19 17:57:35 +02:00
Nik Clayton 0bf459d385
refactor: Use "compat" drawables where appropriate (#72)
Use AppCompatResources.getDrawable() and app:drawableStartCompat.
Resolves existing lint issues.
2023-09-19 17:42:20 +02:00
Nik Clayton c97c3a4156
refactor: Add @NonNull and @Nullable annotations where appropriate (#71)
Adding the annotations cleans up an entire class of lint errors, and
it will be easire to convert from Java to Kotlin later.
2023-09-19 17:17:31 +02:00
Nik Clayton 4775ef85e9
chore: Prepare release 1.1 (versionCode 2) (#59) 2023-09-18 15:47:33 +02:00
Nik Clayton b739dc0a94
fix: Use correct colours for preference switches (#56)
The previous code used SwitchPreference to generate the switches, which
didn't apply the Material colours. This made it difficult to distinguish
between the on/off states, as the non-Material colours for those states
are very similar.

Fix by using SwitchPreferenceCompat which uses the correct Material
colours.
2023-09-18 12:21:49 +02:00
Nik Clayton b787f76cf6
fix: Use correct colour on "mute account" dialog (#55)
The previous code used "?attr/colorOnTertiary", which is the wrong
colour for the default background. Remove the override, so the correct
styled colour is used.
2023-09-18 12:12:35 +02:00
Nik Clayton 8ebc4e19ea
change: Fetch cached timeline when lifecycle is CREATED (#51)
Fetching data for a cached timeline can start on `onCreateView`, as soon
as the `viewLifecycle` state transitions to `CREATED`.
2023-09-16 15:32:43 +02:00
Nik Clayton f4e14dcf44
fix: Restore the user's reading position in more circumstances (#49)
The previous code only attempted to restore the user's reading position
once, after any initial refresh.

Adjust this so the position is restored after any refresh (which may
have been triggered from a menu instead of a swipe), and use
`scrollToPositionWithOffset` to ensure it's visible.
2023-09-15 16:09:18 +02:00
Nik Clayton ccb8ec06e7
fix: Fix toolbar flickering in additional activities (#48)
Testing showed additional activities with toolbar flicking issues. Fix
as before, using `setLiftOnScrollTargetView` to specify the scrolling
view the toolbar should lift above.
2023-09-14 22:19:26 +02:00
Nik Clayton 676c1eea2b
fix: Use the correct contrast colour on hashtag tab chips (#47)
The chips for adding a new hashtag to a tab specified the background
colour without setting the text colour, resulting in the colour being
too low-contrast against the background.

Use `?colorOnPrimary` to get the correct colour.
2023-09-14 22:19:10 +02:00
Nik Clayton 3577084b41
fix: Scale the monochrome icon to fit (#46)
The icon was appearing zoomed in when the user enabled theming in the
launcher.

Scale and translate the path to position it correctly.
2023-09-14 22:18:52 +02:00
Nik Clayton 7bb1e6fe17
change: Restore dividers between list items (#45)
Switching to the Material 3 themes caused the previous list dividers to
disappear.

Replace `DividerItemDecoration` with `MaterialDividerItemDecoration` to
restore them.
2023-09-14 19:10:59 +02:00
Nik Clayton fd7912e73c
fix: Restore the user's home timeline position (#44)
The previous code would always fetch the latest statuses when the app
restarts, jumping the user to the top of the home timeline. This is
because state.anchorPosition was null in this case.

Fix this by passing the saved initialKey to CachedTimelineRemoteMediator
and using it to construct a page of statuses around the requested
status.

This restores the user's reading position, and ensures that if the
user is at the top of the list their reading position is not reset
to the second item in the list.

Fixes #41, #42
2023-09-14 17:19:02 +02:00
Nik Clayton 402bcef588
fix: Ensure refreshing does not create a gap in the timeline (#43)
The previous code did not handle refreshing correctly; it retained some
of the cache, and tried merge new statuses in to the cache. This does
not work, and resulted in the app creating gaps in the timeline if more
than a page's worth of statuses had appeared since the user last
refreshed (e.g., overnight).

Fix this by treating the on-device cache as disposable, as the Paging3
library intends. On refresh the cached timeline is emptied and replaced
with a fresh page.

This causes a problem for state that is not stored on the server but is
part of a status' viewdata (has the user toggled viewing a piece of
media, expanded a CW, etc).

The previous code tried to work around that by pulling the state out of
the page cache and copying it in to the new statuses. That won't work
when the page cache is being destroyed.

So do it properly -- store the viewdata state in a separate (sparse)
table that contains only rows for statuses that have a non-default
state.

Save changes to the state when the user interacts with a status, and
use the state to ensure that the viewdata for a status in a thread
matches the viewdata for the same status if it is shown on the home
timeline (and vice-versa).

Fixes #16
2023-09-14 15:12:48 +02:00
Nik Clayton ec66942ae9
fix: Show the FAB according to the user's preferences (#29)
The previous code didn't collect the uiState, so it was fixed at the
default value, ignoring any changes that happened over the life of
the viewmodel.

Fix that, so that the FAB will hide/show on scroll according to the
user's preferences.

While I'm here simplify the show/hide logic. The previous code would
ignore the user's preference if scrolling up. There doesn't seem to
be a good reason for that, and spelunking 6+ years back through the
history didn't find a justification for that behaviour in the original
commit.

Fixes #15
2023-09-11 21:19:45 +02:00