Clean up context parameters
This commit is contained in:
1 parent
59598094df
commit
348813109b
11 files changed
+11
-11
No files matched your search
@@ -82,7 +82,7 @@ object EhTagDatabase : CoroutineScope {
|
||||
|
||||
data class Tag(val tag: String, val hint: String?, val score: Float)
|
||||
|
||||
context(ctx: Context)
|
||||
context(_: Context)
|
||||
fun suggestion(rawKeyword: String, expectTranslate: Boolean): List<Tag> {
|
||||
val keyword = PREFIXES.fold(rawKeyword) { kwd, pfx -> kwd.removePrefix(pfx) }
|
||||
if (!initialized || keyword.isEmpty()) return emptyList()
|
||||
|
||||
@@ -114,7 +114,7 @@ suspend fun keepNoMediaFileStatus(downloadDir: Path = downloadLocation) {
|
||||
|
||||
fun getFavoriteIcon(favorited: Boolean) = if (favorited) Icons.Default.Favorite else Icons.Default.FavoriteBorder
|
||||
|
||||
context(_: DialogState, context: MainActivity)
|
||||
context(_: DialogState, _: MainActivity)
|
||||
suspend fun startDownload(forceDefault: Boolean, vararg galleryInfos: BaseGalleryInfo) {
|
||||
if (isAtLeastT) {
|
||||
requestPermission(Manifest.permission.POST_NOTIFICATIONS)
|
||||
|
||||
@@ -79,7 +79,7 @@ operator fun PaddingValues.plus(r: PaddingValues) = object : PaddingValues {
|
||||
}
|
||||
|
||||
@Composable
|
||||
context(_: CoroutineScope, ctx: Context)
|
||||
context(_: CoroutineScope, _: Context)
|
||||
fun GalleryList(
|
||||
modifier: Modifier = Modifier,
|
||||
data: LazyPagingItems<BaseGalleryInfo>,
|
||||
|
||||
@@ -377,7 +377,7 @@ fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
|
||||
}
|
||||
}
|
||||
|
||||
context(ctx: Context, state: DialogState, nav: DestinationsNavigator)
|
||||
context(_: Context, _: DialogState, nav: DestinationsNavigator)
|
||||
suspend inline fun <T> usePageLoader(args: ReaderScreenArgs, crossinline block: suspend (PageLoader) -> T) = when (args) {
|
||||
is ReaderScreenArgs.Gallery -> {
|
||||
val info = args.info
|
||||
|
||||
@@ -829,7 +829,7 @@ private fun GalleryDetail.collectPreviewItems() = rememberInVM(previewList) {
|
||||
}.flow.cachedIn(viewModelScope)
|
||||
}.collectAsLazyPagingItems()
|
||||
|
||||
context(ctx: Context)
|
||||
context(_: Context)
|
||||
private fun LazyGridScope.galleryPreview(detail: GalleryDetail, data: LazyPagingItems<GalleryPreview>, onClick: (Int) -> Unit) {
|
||||
val isV2Thumb = detail.previewList.first() is V2GalleryPreview
|
||||
items(
|
||||
|
||||
@@ -25,7 +25,7 @@ private fun urlToDestination(url: String): Direction? {
|
||||
}
|
||||
|
||||
@MainThread
|
||||
context(nav: DestinationsNavigator)
|
||||
context(_: DestinationsNavigator)
|
||||
fun navWithUrl(url: String): Boolean {
|
||||
val dest = urlToDestination(url) ?: return false
|
||||
navigate(dest)
|
||||
|
||||
@@ -182,7 +182,7 @@ suspend fun <R> awaitResult(
|
||||
)
|
||||
}
|
||||
|
||||
context(ctx: Context, state: DialogState)
|
||||
context(_: Context, _: DialogState)
|
||||
suspend fun awaitSelectTags(): List<String> = dialog { cont ->
|
||||
val selected = remember { mutableStateListOf<String>() }
|
||||
val state = rememberTextFieldState()
|
||||
|
||||
@@ -39,7 +39,7 @@ fun copyTextToClipboard(text: CharSequence?, isSensitive: Boolean) {
|
||||
)
|
||||
}
|
||||
|
||||
context(ctx: Context)
|
||||
context(_: Context)
|
||||
fun addTextToClipboard(text: CharSequence?, useToast: Boolean = false) {
|
||||
copyTextToClipboard(text, false)
|
||||
// Avoid double notify user since system have done that on Tiramisu above
|
||||
|
||||
@@ -46,7 +46,7 @@ private val lifecycle: Lifecycle
|
||||
}
|
||||
}
|
||||
|
||||
context(ctx: Context)
|
||||
context(_: Context)
|
||||
suspend fun <I, O> awaitActivityResult(contract: ActivityResultContract<I, O>, input: I): O {
|
||||
val key = "activity_rq#${atomicInteger.fetchAndIncrement()}"
|
||||
var launcher: ActivityResultLauncher<I>? = null
|
||||
|
||||
@@ -39,7 +39,7 @@ fun string(@StringRes id: Int, vararg args: Any?) = ctx.getString(id, *args)
|
||||
context(activity: MainActivity)
|
||||
fun tip(message: String, useToast: Boolean = false) = activity.showTip(message, useToast)
|
||||
|
||||
context(activity: MainActivity)
|
||||
context(_: MainActivity)
|
||||
fun tip(@StringRes id: Int, useToast: Boolean = false) = tip(string(id), useToast)
|
||||
|
||||
context(state: SnackbarHostState)
|
||||
|
||||
@@ -13,5 +13,5 @@ inline fun <R> runSuspendCatching(block: () -> R) = runCatching(block).except<R,
|
||||
|
||||
inline fun <T, R> T.runSuspendCatching(block: T.() -> R) = runCatching(block).except<R, CancellationException>()
|
||||
|
||||
context(state: SnackbarHostState, scope: CoroutineScope)
|
||||
context(_: SnackbarHostState, _: CoroutineScope)
|
||||
inline fun <R> runSwallowingWithUI(block: () -> R) = runSuspendCatching(block).onFailure { e -> launch { snackbar(e.displayString()) } }
|
||||
Reference in new issue
Block a user