Add a lot of code documentation (#1145)

## Description
A brain dump documenting many classes and functions throughout the app.
Definitely does not document everything, but covers most of the major
components. This should be useful for new contributors.

There is a small amount of code clean up too.

There are no user facing changes.

### Related issues
N/A

### Testing
N/A

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Ray 2026-03-29 10:52:25 -04:00 • committed by GitHub
parent 2485d2c644
commit 66f060dccb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
92 changed files with 719 additions and 222 deletions

View file

@ -3,12 +3,24 @@ package com.github.damontecres.wholphin.util
import java.util.function.IntFunction
import java.util.function.Predicate
/**
* A [List] which has function that will wait for a result
*/
interface BlockingList<T> : List<T> {
/**
* Get the specified index, possibly blocking until it is available
*/
suspend fun getBlocking(index: Int): T
/**
* Get first index that matches the given predicate, possibly blocking while searching
*/
suspend fun indexOfBlocking(predicate: Predicate<T>): Int
companion object {
/**
* Create a [BlockingList] over a regular [List]
*/
fun <T> of(list: List<T>): BlockingList<T> = BlockingListWrapper(list)
}
}

View file

@ -20,6 +20,9 @@ import org.json.JSONObject
import timber.log.Timber
import java.util.Date
/**
* Sends a crash report to the current server
*/
@AutoService(ReportSenderFactory::class)
class CrashReportSenderFactory : ReportSenderFactory {
override fun create(

View file

@ -4,6 +4,9 @@ import android.util.Log
import com.github.damontecres.wholphin.BuildConfig
import timber.log.Timber
/**
* Enable debug logging via [Timber] if enabled in the app settings
*/
class DebugLogTree private constructor() : Timber.Tree() {
// Only add logging for below INFO, production logger in WholphinApplication logs >=INFO
override fun isLoggable(

View file

@ -1,9 +0,0 @@
package com.github.damontecres.wholphin.util
import androidx.compose.ui.focus.FocusRequester
data class FocusPair(
val row: Int,
val column: Int,
val focusRequester: FocusRequester,
)

View file

@ -3,6 +3,9 @@ package com.github.damontecres.wholphin.util
import com.github.damontecres.wholphin.preferences.UserPreferences
import java.util.UUID
/**
* Functions to remember tabs choices for a library
*/
interface RememberTabManager {
/**
* If enabled, get the remembered tab index for the given item

View file

@ -1,5 +1,8 @@
package com.github.damontecres.wholphin.util
/**
* A utility class to lazily transforms items from the source list
*/
class TransformList<S, T>(
private val source: List<S>,
private val transform: (S) -> T,

View file

@ -2,6 +2,9 @@ package com.github.damontecres.wholphin.util
import kotlinx.serialization.Serializable
/**
* Represents a version in the format of `<major>.<minor>.<patch>-<numCommits>-g<gitSha>` as output by `git describe`
*/
@Serializable
data class Version(
val major: Int,