3771 Commits

Author SHA1 Message Date
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