diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt index b4af94514..44ba8167c 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt @@ -71,7 +71,7 @@ fun ExtensionScreen( searchQuery: String?, onLongClickItem: (Extension) -> Unit, onClickItemCancel: (Extension) -> Unit, - onClickItemWebView: (Extension.Available) -> Unit, + onOpenWebView: (Extension.Available) -> Unit, onInstallExtension: (Extension.Available) -> Unit, onUninstallExtension: (Extension) -> Unit, onUpdateExtension: (Extension.Installed) -> Unit, @@ -104,7 +104,7 @@ fun ExtensionScreen( contentPadding = contentPadding, onLongClickItem = onLongClickItem, onClickItemCancel = onClickItemCancel, - onClickItemWebView = onClickItemWebView, + onOpenWebView = onOpenWebView, onInstallExtension = onInstallExtension, onUninstallExtension = onUninstallExtension, onUpdateExtension = onUpdateExtension, @@ -122,8 +122,8 @@ private fun ExtensionContent( state: ExtensionsScreenModel.State, contentPadding: PaddingValues, onLongClickItem: (Extension) -> Unit, - onClickItemWebView: (Extension.Available) -> Unit, onClickItemCancel: (Extension) -> Unit, + onOpenWebView: (Extension.Available) -> Unit, onInstallExtension: (Extension.Available) -> Unit, onUninstallExtension: (Extension) -> Unit, onUpdateExtension: (Extension.Installed) -> Unit, @@ -202,7 +202,13 @@ private fun ExtensionContent( } }, onLongClickItem = onLongClickItem, - onClickItemWebView = onClickItemWebView, + onClickItemSecondaryAction = { + when (it) { + is Extension.Available -> onOpenWebView(it) + is Extension.Installed -> onOpenExtension(it) + else -> {} + } + }, onClickItemCancel = onClickItemCancel, onClickItemAction = { when (it) { @@ -243,9 +249,9 @@ private fun ExtensionItem( item: ExtensionUiModel.Item, onClickItem: (Extension) -> Unit, onLongClickItem: (Extension) -> Unit, - onClickItemWebView: (Extension.Available) -> Unit, onClickItemCancel: (Extension) -> Unit, onClickItemAction: (Extension) -> Unit, + onClickItemSecondaryAction: (Extension) -> Unit, modifier: Modifier = Modifier, ) { val (extension, installStep) = item @@ -287,9 +293,9 @@ private fun ExtensionItem( ExtensionItemActions( extension = extension, installStep = installStep, - onClickItemWebView = onClickItemWebView, onClickItemCancel = onClickItemCancel, onClickItemAction = onClickItemAction, + onClickItemSecondaryAction = onClickItemSecondaryAction, ) }, ) { @@ -371,9 +377,9 @@ private fun ExtensionItemActions( extension: Extension, installStep: InstallStep, modifier: Modifier = Modifier, - onClickItemWebView: (Extension.Available) -> Unit = {}, onClickItemCancel: (Extension) -> Unit = {}, onClickItemAction: (Extension) -> Unit = {}, + onClickItemSecondaryAction: (Extension) -> Unit = {}, ) { val isIdle = installStep.isCompleted() @@ -401,7 +407,7 @@ private fun ExtensionItemActions( installStep == InstallStep.Idle -> { when (extension) { is Extension.Installed -> { - IconButton(onClick = { onClickItemAction(extension) }) { + IconButton(onClick = { onClickItemSecondaryAction(extension) }) { Icon( imageVector = Icons.Outlined.Settings, contentDescription = stringResource(MR.strings.action_settings), @@ -428,7 +434,7 @@ private fun ExtensionItemActions( is Extension.Available -> { if (extension.sources.isNotEmpty()) { IconButton( - onClick = { onClickItemWebView(extension) }, + onClick = { onClickItemSecondaryAction(extension) }, ) { Icon( imageVector = Icons.Outlined.Public, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt index 9a73307a7..a5b390a89 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt @@ -48,7 +48,7 @@ fun extensionsTab( }, onClickItemCancel = extensionsScreenModel::cancelInstallUpdateExtension, onClickUpdateAll = extensionsScreenModel::updateAllExtensions, - onClickItemWebView = { extension -> + onOpenWebView = { extension -> extension.sources.getOrNull(0)?.let { navigator.push( WebViewScreen(