|
@@ -16,7 +16,7 @@ import androidx.compose.foundation.layout.padding
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
import androidx.compose.foundation.lazy.items
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
-import androidx.compose.material.icons.outlined.History
|
|
|
+import androidx.compose.material.icons.automirrored.outlined.Launch
|
|
|
import androidx.compose.material.icons.outlined.Settings
|
|
|
import androidx.compose.material3.AlertDialog
|
|
|
import androidx.compose.material3.Button
|
|
@@ -67,13 +67,23 @@ fun ExtensionDetailsScreen(
|
|
|
navigateUp: () -> Unit,
|
|
|
state: ExtensionDetailsScreenModel.State,
|
|
|
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
|
|
- onClickWhatsNew: () -> Unit,
|
|
|
onClickEnableAll: () -> Unit,
|
|
|
onClickDisableAll: () -> Unit,
|
|
|
onClickClearCookies: () -> Unit,
|
|
|
onClickUninstall: () -> Unit,
|
|
|
onClickSource: (sourceId: Long) -> Unit,
|
|
|
) {
|
|
|
+ val uriHandler = LocalUriHandler.current
|
|
|
+ val url = remember(state.extension) {
|
|
|
+ val regex = """https://raw.githubusercontent.com/(.+?)/(.+?)/.+""".toRegex()
|
|
|
+ regex.find(state.extension?.repoUrl.orEmpty())
|
|
|
+ ?.let {
|
|
|
+ val (user, repo) = it.destructured
|
|
|
+ "https://github.com/$user/$repo"
|
|
|
+ }
|
|
|
+ ?: state.extension?.repoUrl
|
|
|
+ }
|
|
|
+
|
|
|
Scaffold(
|
|
|
topBar = { scrollBehavior ->
|
|
|
AppBar(
|
|
@@ -83,12 +93,14 @@ fun ExtensionDetailsScreen(
|
|
|
AppBarActions(
|
|
|
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
|
|
.apply {
|
|
|
- if (state.extension?.isUnofficial == false) {
|
|
|
+ if (url != null) {
|
|
|
add(
|
|
|
AppBar.Action(
|
|
|
- title = stringResource(MR.strings.whats_new),
|
|
|
- icon = Icons.Outlined.History,
|
|
|
- onClick = onClickWhatsNew,
|
|
|
+ title = stringResource(MR.strings.action_open_repo),
|
|
|
+ icon = Icons.AutoMirrored.Outlined.Launch,
|
|
|
+ onClick = {
|
|
|
+ uriHandler.openUri(url)
|
|
|
+ },
|
|
|
),
|
|
|
)
|
|
|
}
|
|
@@ -150,36 +162,10 @@ private fun ExtensionDetails(
|
|
|
ScrollbarLazyColumn(
|
|
|
contentPadding = contentPadding,
|
|
|
) {
|
|
|
- when {
|
|
|
- extension.isFromExternalRepo ->
|
|
|
- item {
|
|
|
- val uriHandler = LocalUriHandler.current
|
|
|
- val url = remember(extension) {
|
|
|
- val regex = """https://raw.githubusercontent.com/(.+?)/(.+?)/.+""".toRegex()
|
|
|
- regex.find(extension.repoUrl.orEmpty())
|
|
|
- ?.let {
|
|
|
- val (user, repo) = it.destructured
|
|
|
- "https://github.com/$user/$repo"
|
|
|
- }
|
|
|
- ?: extension.repoUrl
|
|
|
- }
|
|
|
-
|
|
|
- WarningBanner(
|
|
|
- MR.strings.repo_extension_message,
|
|
|
- modifier = Modifier.clickable {
|
|
|
- url ?: return@clickable
|
|
|
- uriHandler.openUri(url)
|
|
|
- },
|
|
|
- )
|
|
|
- }
|
|
|
- extension.isUnofficial ->
|
|
|
- item {
|
|
|
- WarningBanner(MR.strings.unofficial_extension_message)
|
|
|
- }
|
|
|
- extension.isObsolete ->
|
|
|
- item {
|
|
|
- WarningBanner(MR.strings.obsolete_extension_message)
|
|
|
- }
|
|
|
+ if (extension.isObsolete) {
|
|
|
+ item {
|
|
|
+ WarningBanner(MR.strings.obsolete_extension_message)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
item {
|