mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Add KDoc to six small library API modules
Cover the remaining interfaces of libraries/troubleshoot, libraries/matrixmedia, libraries/dateformatter, libraries/featureflag, libraries/workmanager and libraries/mediaviewer, along with their members and parameters. Behaviours worth recording: NotificationTroubleshootTest reports its outcome through its state flow rather than by returning, and its quickFix throws unless the test offers one; DateFormatter.format turns a null timestamp into an empty string so callers need no null check; ImageLoaderHolder keeps one loader per session because decrypting room media needs that session's client. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
@@ -8,7 +8,17 @@
|
||||
|
||||
package io.element.android.libraries.dateformatter.api
|
||||
|
||||
/**
|
||||
* Formats timestamps for display, in the user's locale and time zone.
|
||||
*/
|
||||
interface DateFormatter {
|
||||
/**
|
||||
* Formats a timestamp according to [mode].
|
||||
*
|
||||
* @param timestamp milliseconds since the epoch; a `null` value yields an empty string, so callers need no null check of their own.
|
||||
* @param mode how much of the date and time to include; see [DateFormatterMode] for examples of each.
|
||||
* @param useRelative true to prefer wording relative to today, such as "Today" or "This month", where the mode allows it.
|
||||
*/
|
||||
fun format(
|
||||
timestamp: Long?,
|
||||
mode: DateFormatterMode = DateFormatterMode.Full,
|
||||
|
||||
+5
@@ -21,6 +21,11 @@ import kotlin.time.Duration
|
||||
* - 30 seconds → "30 seconds"
|
||||
*/
|
||||
interface DurationFormatter {
|
||||
/**
|
||||
* Formats the duration using its largest appropriate unit, rounding rather than listing several units.
|
||||
*
|
||||
* @param duration the duration to describe.
|
||||
*/
|
||||
fun format(duration: Duration): String
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user