add webview to Extension detail screen
This commit is contained in:
parent
1399f15747
commit
37ac0757c1
2 changed files with 33 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.outlined.Launch
|
||||
import androidx.compose.material.icons.outlined.Public
|
||||
import androidx.compose.material.icons.outlined.Settings
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
|
|
@ -68,6 +69,9 @@ fun ExtensionDetailsScreen(
|
|||
navigateUp: () -> Unit,
|
||||
state: ExtensionDetailsScreenModel.State,
|
||||
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
||||
// KMK -->
|
||||
onOpenWebView: (() -> Unit)?,
|
||||
// KMK <--
|
||||
onClickEnableAll: () -> Unit,
|
||||
onClickDisableAll: () -> Unit,
|
||||
onClickClearCookies: () -> Unit,
|
||||
|
|
@ -94,6 +98,15 @@ fun ExtensionDetailsScreen(
|
|||
AppBarActions(
|
||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
||||
.apply {
|
||||
if (onOpenWebView != null) {
|
||||
add(
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_open_in_web_view),
|
||||
icon = Icons.Outlined.Public,
|
||||
onClick = onOpenWebView,
|
||||
),
|
||||
)
|
||||
}
|
||||
if (url != null) {
|
||||
add(
|
||||
AppBar.Action(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import cafe.adriel.voyager.navigator.LocalNavigator
|
|||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import eu.kanade.presentation.browse.ExtensionDetailsScreen
|
||||
import eu.kanade.presentation.util.Screen
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.ui.webview.WebViewScreen
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import tachiyomi.presentation.core.screens.LoadingScreen
|
||||
|
||||
|
|
@ -29,11 +31,29 @@ data class ExtensionDetailsScreen(
|
|||
}
|
||||
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
// KMK -->
|
||||
val source = state.extension?.sources?.getOrNull(0)
|
||||
// KMK <--
|
||||
|
||||
ExtensionDetailsScreen(
|
||||
navigateUp = navigator::pop,
|
||||
state = state,
|
||||
onClickSourcePreferences = { navigator.push(SourcePreferencesScreen(it)) },
|
||||
// KMK -->
|
||||
onOpenWebView = if (source != null && source is HttpSource) {
|
||||
{
|
||||
navigator.push(
|
||||
WebViewScreen(
|
||||
url = source.baseUrl,
|
||||
initialTitle = source.name,
|
||||
sourceId = source.id,
|
||||
),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
},
|
||||
// KMK <--
|
||||
onClickEnableAll = { screenModel.toggleSources(true) },
|
||||
onClickDisableAll = { screenModel.toggleSources(false) },
|
||||
onClickClearCookies = screenModel::clearCookies,
|
||||
|
|
|
|||
Loading…
Reference in a new issue