Commit Graph

5005 Commits

Author SHA1 Message Date
Nik Clayton f71a5e1237
ci: Run ktlint workflow on forks, with write permissions (#95)
Previously the permissions were only applied to branches from this
repository, not forks. Use `pull_request_target` so the `GITHUB_TOKEN`
will have the correct permissions when this workflow is run from a PR
created from a clone.

Remove the `issues` permission, it didn't seem necessary.
2023-09-25 18:18:39 +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 ba8048a3d6 refactor: Remove unnecessary SVG metadata 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 e0e4235354
change: Deprecate the "develop" branch (#70)
The separation between the `develop` and `main` branches was inherited
from Tusky and isn't helpful, complicating the release process and
causing CI to repeatedly run the same actions on the same code.

Deprecate the `develop` branch by removing references to it in the
documentation and updating the CI configuration as necessary.

Separately, the GitHub settings will be changed to set `main` as the
default branch, and the `develop` branch will be deleted.
2023-09-19 16:40:07 +02:00
Nik Clayton 26482c4b78
ci: Support generating whatsnew and uploading to Google Play (#69)
Add additional steps which:

- Generate the whatsnew-en-US file from the Fastlane metadata
- Uploads the generated AAB file to Google Play
2023-09-19 12:05:06 +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 2c5c93e33a
ci: Start creating the build / sign / upload-to-Google-Play pipeline (#50)
This action should build the APK and AAB, sign them, and store the APK
as an asset.

Uploading to the correct Google Play release track will come later.
2023-09-15 22:15:50 +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