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:
Benoit Marty
2026-08-14 11:43:40 +02:00
parent d80aaf6be4
commit 2284cff25a
13 changed files with 118 additions and 0 deletions
@@ -8,6 +8,10 @@
package io.element.android.libraries.troubleshoot.api.test
/**
* Lets a troubleshooting test's quick fix send the user to another screen, without the test itself knowing about navigation.
*/
interface NotificationTroubleshootNavigator {
/** Opens the blocked users screen, so the user can unblock someone whose messages were being filtered out. */
fun navigateToBlockedUsers()
}
@@ -20,11 +20,36 @@ import kotlinx.coroutines.flow.StateFlow
* the component they're injected into is bound to [SessionScope] and so should these (https://github.com/ZacSweers/metro/issues/1932).
*/
interface NotificationTroubleshootTest {
/** Position of this test in the list shown to the user; tests run in ascending order. */
val order: Int
/** The current state of this test, which the UI observes to show it as idle, running, successful or failed. */
val state: StateFlow<NotificationTroubleshootTestState>
/**
* Whether this test applies to the current setup, so that irrelevant tests are hidden rather than shown as failing.
*
* @param data the current push provider and distributor, used to decide relevance.
*/
fun isRelevant(data: TestFilterData): Boolean = true
/**
* Runs the test, reporting its outcome through [state] rather than by returning or throwing.
*
* @param coroutineScope the scope to launch any work that must outlive the call itself.
*/
suspend fun run(coroutineScope: CoroutineScope)
/** Returns the test to its idle state so it can be run again. */
suspend fun reset()
/**
* Attempts to fix what this test detected, for the tests that can offer it. Throws by default, so check the state's quick fix
* flag before calling.
*
* @param coroutineScope the scope to launch any work that must outlive the call itself.
* @param navigator used by the fixes that have to send the user to another screen.
*/
suspend fun quickFix(
coroutineScope: CoroutineScope,
navigator: NotificationTroubleshootNavigator,