mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-11-06 02:40:58 +01:00
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:
parent
2485d2c644
commit
66f060dccb
92 changed files with 719 additions and 222 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue