Remove unused functions

This commit is contained in:
Dude so hot authored and renovate[bot] committed 2025-01-16 20:22:34 +08:00
1 parent b0ab1f0f2d
commit 623c4c3e39
2 files changed
-43

No files matched your search

@@ -35,7 +35,6 @@ import arrow.atomic.Atomic
import com.hippo.ehviewer.ui.openBrowser
import com.hippo.ehviewer.ui.settings.PreferenceTokens.PreferenceTextPadding
import com.hippo.ehviewer.util.ProgressDialog
import com.jamal.composeprefs3.ui.prefs.DropDownPref
import com.jamal.composeprefs3.ui.prefs.DropDownPrefInt
import com.jamal.composeprefs3.ui.prefs.SliderPref
import com.jamal.composeprefs3.ui.prefs.SpannedTextPref
@@ -135,20 +134,6 @@ fun SimpleMenuPreferenceInt(title: String, summary: String? = null, @ArrayRes en
DropDownPrefInt(title = title, summary = summary, defaultValue = v, onValueChange = ::set, useSelectedAsSummary = summary.isNullOrBlank(), entries = map)
}
@Composable
fun SimpleMenuPreference(title: String, @ArrayRes entry: Int, @ArrayRes entryValueRes: Int, value: KMutableProperty0<String>) {
val entryArray = stringArrayResource(id = entry)
val valuesArray = stringArrayResource(id = entryValueRes)
val map = remember {
val iter = entryArray.iterator()
valuesArray.associateWith { iter.next() }
}
var v by remember { mutableStateOf(value.get()) }
fun set(new: String) = value.set(new.also { v = it })
check(entryArray.size == valuesArray.size)
DropDownPref(title = title, defaultValue = v, onValueChange = ::set, useSelectedAsSummary = true, entries = map)
}
@Composable
fun WorkPreference(title: String, summary: String? = null, work: suspend CoroutineScope.() -> Unit) {
val coroutineScope = rememberCoroutineScope { Dispatchers.IO }
@@ -81,34 +81,6 @@ fun launchInVM(
viewModelScope.launch(context, start, block)
}
@Composable
fun launchInVM(
key: Any?,
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> Unit,
) = rememberUpdatedStateInVM(key).let { key ->
val f by rememberUpdatedStateInVM(block)
rememberInVM {
nonNullState {
viewModelScope.launch(start = CoroutineStart.UNDISPATCHED) {
snapshotFlow { key.value }.mapLatest {
coroutineScope { value = launch(context, start, f) }
}.collect()
}
}
}
}
@Composable
fun <R> asyncInVM(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> R,
) = rememberInVM {
viewModelScope.async(context, start, block)
}
@Composable
fun <R> asyncInVM(
key: Any?,