pachli-android/core/navigation
Nik Clayton 0fe84f1611
refactor: Use Date type for scheduled post date / times (#1032)
Previous code accepted the `scheduledAt` value as a String, and kept it
as a String (including when serialising as part of a draft). Then it was
converted to an actual Date for display.

Refactor to keep it as a Date for as long as possible. Moshi decodes
Dates correctly over the network, and the database is configured to
serialise Dates as Longs.

This necessitates two migration steps to preserve any existing
`scheduledAt` values for drafts. The first step adds a new column to
store the date as a Long and copies over existing data. The second step
replaces the old column with the new column.
2024-10-20 16:29:32 +02:00
..
src/main refactor: Use Date type for scheduled post date / times (#1032) 2024-10-20 16:29:32 +02:00
README.md refactor: Rename `StatusListActivity` to `TimelineActivity` (#577) 2024-03-30 23:48:04 +01:00
build.gradle.kts change: Implement more of FiltersRepository (#816) 2024-07-14 15:36:52 +02:00
lint-baseline.xml refactor: Break navigation dependency cycles with :core:navigation (#305) 2023-12-07 18:36:00 +01:00

README.md

: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.