Nik Clayton 54e1978626
feat: Always show the post beng replied to when replying (#1263)
Previous code showed the post being replied to, but in a tiny font and
hidden behind a disclosure triangle that was difficult to spot.

Fix that. Show the post, including the author and their avatar. The text
of the post is selectable for copy/paste in to the reply if necessary
(links and hashtags are deliberately not clickable so they can't be
clicked by accident).

To do this:

Update `ComposeOptions`. Instead of three different properties that
were set if the post was a reply, use a new `InReplyTo` sealed class
that covers two situations; either the caller has the full content of
the status being replied to, in which case it's included, or they only
have the ID of the status being replied to.

Update `ComposeViewModel` with a state flow of `inReplyTo` results to
represent either (a) Not a reply, (b) is a reply, data is loading, (c)
is a reply, data is loaded, or (d) is a reply, error occurred loading
data.

In `ComposeActivity` use this flow to drive updates to a new part of
the UI showing the status being replied to (or hiding that part of the
UI if this is not a reply).
2025-02-06 21:11:07 +01:00
..

:core:navigation

package app.pachli.core.navigation

Intents for starting activities to break circular dependencies.

A common approach for surfacing type-safe (ish) intents to start activities is for the activity-to-be-launched to 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.

This introduces a dependency between A and B.

This is worse if B also wants to start A.

For example, if A is TimelineActivity and B isViewThreadActivity. The user might click a status in TimelineActivity 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 TimelineActivity 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.

This package 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.

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.