Kgothatso Ngako fd9137ab5a feat: a chat list clock that says only as much as it has to
The one timestamp format this app had, `toFormattedTimeAndDateString`, writes
"14:05 6 Sep 2026". That is right for a message bubble, where it is the only
clock on a line the reader has already stopped at. A chat list row is not that.
Its job is to place a message relative to now, in whatever width is left after
the room's name and the preview of what was said in it -- and a full date on
this morning's message spends all of that saying "today" the long way.

So the new format gets coarser the further back it goes, and never coarser than
the reader can still resolve:

- today, the time of day. Anything less cannot order two of today's rooms.
- yesterday, named. A date here is a small arithmetic problem to read.
- the rest of the last week, an abbreviated weekday. It stops at six days
  because the seventh is this weekday again, and "Sun" on a message from last
  Sunday reads as today.
- inside this year, day and month. Past a week the weekday has stopped saying
  anything.
- beyond it, the year as well, for the same reason one rung up: day and month
  repeat.

Reading a rung too far is the failure mode and it is silent -- nothing about
"Sun" admits which Sunday it means -- so every boundary is a test. Each one is
anchored to the local day rather than to a fixed instant, because the boundaries
are local midnights and the test would otherwise pass or fail on the machine's
zone.

A timestamp ahead of `now` deliberately falls through to a date rather than a
time. Relay clocks disagree and an event can arrive stamped in the future;
rendering that as "14:05" files it under a today it does not belong to.

`now` is a parameter defaulting to `Clock.System.now()`, which is the whole
reason any of the above is testable without a clock abstraction. It is sampled
once per composition, so a list left open across midnight goes on saying "14:05"
until something recomposes it -- acceptable for a list that recomposes on every
arriving message, and not worth a ticker to fix.

Six new tests, one per rung plus the future case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 18:20:57 +02:00
2026-07-05 23:21:02 +02:00
2026-07-28 09:10:20 +02:00
2026-03-24 04:47:19 +02:00
2026-03-23 01:41:39 +02:00
2026-03-23 01:41:39 +02:00
2026-03-23 01:41:39 +02:00

This is a Kotlin Multiplatform project targeting Android, iOS, Desktop (JVM).

  • /composeApp is for code that will be shared across your Compose Multiplatform applications. It contains several subfolders:

    • commonMain is for code thats common for all targets.
    • Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. For example, if you want to use Apples CoreCrypto for the iOS part of your Kotlin app, the iosMain folder would be the right place for such calls. Similarly, if you want to edit the Desktop (JVM) specific part, the jvmMain folder is the appropriate location.
  • /iosApp contains iOS applications. Even if youre sharing your UI with Compose Multiplatform, you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.

Build and Run Android Application

To build and run the development version of the Android app, use the run configuration from the run widget in your IDEs toolbar or build it directly from the terminal:

  • on macOS/Linux
    ./gradlew :composeApp:assembleDebug
    
  • on Windows
    .\gradlew.bat :composeApp:assembleDebug
    

Build and Run Desktop (JVM) Application

To build and run the development version of the desktop app, use the run configuration from the run widget in your IDEs toolbar or run it directly from the terminal:

  • on macOS/Linux
    ./gradlew :composeApp:run
    
  • on Windows
    .\gradlew.bat :composeApp:run
    

Build and Run iOS Application

To build and run the development version of the iOS app, use the run configuration from the run widget in your IDEs toolbar or open the /iosApp directory in Xcode and run it from there.


Learn more about Kotlin Multiplatform

Description
Mantra as a kotlin multiplatform project
https://mantra.press
Readme 8.2 MiB
Languages
Kotlin 100%