Remove custom extension readme/changelog URLs
This reverts commit 6d255f25ad.
This commit is contained in:
parent
9352563d53
commit
1399f15747
7 changed files with 3 additions and 103 deletions
|
|
@ -15,8 +15,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.automirrored.outlined.HelpOutline
|
||||
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
|
||||
|
|
@ -57,7 +56,6 @@ import eu.kanade.tachiyomi.util.system.copyToClipboard
|
|||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.i18n.kmk.KMR
|
||||
import tachiyomi.i18n.sy.SYMR
|
||||
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
||||
import tachiyomi.presentation.core.components.material.Scaffold
|
||||
|
|
@ -70,10 +68,6 @@ fun ExtensionDetailsScreen(
|
|||
navigateUp: () -> Unit,
|
||||
state: ExtensionDetailsScreenModel.State,
|
||||
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
||||
// KMK -->
|
||||
onClickWhatsNew: () -> Unit,
|
||||
onClickReadme: () -> Unit,
|
||||
// KMK <--
|
||||
onClickEnableAll: () -> Unit,
|
||||
onClickDisableAll: () -> Unit,
|
||||
onClickClearCookies: () -> Unit,
|
||||
|
|
@ -100,26 +94,11 @@ fun ExtensionDetailsScreen(
|
|||
AppBarActions(
|
||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
||||
.apply {
|
||||
// KMK -->
|
||||
add(
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.whats_new),
|
||||
icon = Icons.Outlined.History,
|
||||
onClick = onClickWhatsNew,
|
||||
),
|
||||
)
|
||||
add(
|
||||
AppBar.Action(
|
||||
title = stringResource(KMR.strings.action_faq_and_guides),
|
||||
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
||||
onClick = onClickReadme,
|
||||
),
|
||||
)
|
||||
// KMK <--
|
||||
if (url != null) {
|
||||
add(
|
||||
AppBar.OverflowAction(
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_open_repo),
|
||||
icon = Icons.AutoMirrored.Outlined.Launch,
|
||||
onClick = {
|
||||
uriHandler.openUri(url)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -591,8 +591,6 @@ private fun ExtensionItemContentPreview() {
|
|||
versionCode = 1,
|
||||
libVersion = 1.0,
|
||||
isNsfw = true,
|
||||
hasReadme = true,
|
||||
hasChangelog = true,
|
||||
signatureHash = "900000",
|
||||
repoName = "Repository",
|
||||
sources = emptyList(),
|
||||
|
|
@ -608,8 +606,6 @@ private fun ExtensionItemContentPreview() {
|
|||
versionCode = 1,
|
||||
libVersion = 1.0,
|
||||
isNsfw = true,
|
||||
hasReadme = true,
|
||||
hasChangelog = true,
|
||||
signatureHash = "900000",
|
||||
repoName = "Repository",
|
||||
sources = emptyList(),
|
||||
|
|
@ -629,8 +625,6 @@ private fun ExtensionItemContentPreview() {
|
|||
versionCode = 1,
|
||||
libVersion = 1.0,
|
||||
isNsfw = true,
|
||||
hasReadme = true,
|
||||
hasChangelog = true,
|
||||
signatureHash = "900000",
|
||||
repoName = "Repository",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -156,8 +156,6 @@ internal class ExtensionApi {
|
|||
libVersion = it.extractLibVersion(),
|
||||
lang = it.lang,
|
||||
isNsfw = it.nsfw == 1,
|
||||
hasReadme = it.hasReadme == 1,
|
||||
hasChangelog = it.hasChangelog == 1,
|
||||
sources = it.sources?.map(extensionSourceMapper).orEmpty(),
|
||||
apkName = it.apk,
|
||||
iconUrl = "$repoUrl/icon/${it.pkg}.png",
|
||||
|
|
@ -196,8 +194,6 @@ private data class ExtensionJsonObject(
|
|||
val code: Long,
|
||||
val version: String,
|
||||
val nsfw: Int,
|
||||
val hasReadme: Int = 0,
|
||||
val hasChangelog: Int = 0,
|
||||
val sources: List<ExtensionSourceJsonObject>?,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ sealed class Extension {
|
|||
abstract val libVersion: Double
|
||||
abstract val lang: String?
|
||||
abstract val isNsfw: Boolean
|
||||
abstract val hasReadme: Boolean
|
||||
abstract val hasChangelog: Boolean
|
||||
|
||||
// KMK -->
|
||||
abstract val signatureHash: String
|
||||
|
|
@ -29,8 +27,6 @@ sealed class Extension {
|
|||
override val libVersion: Double,
|
||||
override val lang: String,
|
||||
override val isNsfw: Boolean,
|
||||
override val hasReadme: Boolean,
|
||||
override val hasChangelog: Boolean,
|
||||
// KMK -->
|
||||
override val signatureHash: String,
|
||||
/** Guessing repo name from built-in signatures preset */
|
||||
|
|
@ -56,8 +52,6 @@ sealed class Extension {
|
|||
override val libVersion: Double,
|
||||
override val lang: String,
|
||||
override val isNsfw: Boolean,
|
||||
override val hasReadme: Boolean,
|
||||
override val hasChangelog: Boolean,
|
||||
// KMK -->
|
||||
override val signatureHash: String,
|
||||
override val repoName: String,
|
||||
|
|
@ -97,7 +91,5 @@ sealed class Extension {
|
|||
// KMK <--
|
||||
override val lang: String? = null,
|
||||
override val isNsfw: Boolean = false,
|
||||
override val hasReadme: Boolean = false,
|
||||
override val hasChangelog: Boolean = false,
|
||||
) : Extension()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ internal object ExtensionLoader {
|
|||
private const val METADATA_SOURCE_CLASS = "tachiyomi.extension.class"
|
||||
private const val METADATA_SOURCE_FACTORY = "tachiyomi.extension.factory"
|
||||
private const val METADATA_NSFW = "tachiyomi.extension.nsfw"
|
||||
private const val METADATA_HAS_README = "tachiyomi.extension.hasReadme"
|
||||
private const val METADATA_HAS_CHANGELOG = "tachiyomi.extension.hasChangelog"
|
||||
const val LIB_VERSION_MIN = 1.4
|
||||
const val LIB_VERSION_MAX = 1.5
|
||||
|
||||
|
|
@ -311,9 +309,6 @@ internal object ExtensionLoader {
|
|||
return LoadResult.Error
|
||||
}
|
||||
|
||||
val hasReadme = appInfo.metaData.getInt(METADATA_HAS_README, 0) == 1
|
||||
val hasChangelog = appInfo.metaData.getInt(METADATA_HAS_CHANGELOG, 0) == 1
|
||||
|
||||
val classLoader = try {
|
||||
ChildFirstPathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||
} catch (e: Exception) {
|
||||
|
|
@ -361,8 +356,6 @@ internal object ExtensionLoader {
|
|||
libVersion = libVersion,
|
||||
lang = lang,
|
||||
isNsfw = isNsfw,
|
||||
hasReadme = hasReadme,
|
||||
hasChangelog = hasChangelog,
|
||||
sources = sources,
|
||||
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
|
||||
icon = appInfo.loadIcon(pkgManager),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import androidx.compose.runtime.LaunchedEffect
|
|||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import cafe.adriel.voyager.core.model.rememberScreenModel
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
|
|
@ -30,18 +29,11 @@ data class ExtensionDetailsScreen(
|
|||
}
|
||||
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
// KMK -->
|
||||
val uriHandler = LocalUriHandler.current
|
||||
// KMK <--
|
||||
|
||||
ExtensionDetailsScreen(
|
||||
navigateUp = navigator::pop,
|
||||
state = state,
|
||||
onClickSourcePreferences = { navigator.push(SourcePreferencesScreen(it)) },
|
||||
// KMK -->
|
||||
onClickWhatsNew = { uriHandler.openUri(screenModel.getChangelogUrl()) },
|
||||
onClickReadme = { uriHandler.openUri(screenModel.getReadmeUrl()) },
|
||||
// KMK <--
|
||||
onClickEnableAll = { screenModel.toggleSources(true) },
|
||||
onClickDisableAll = { screenModel.toggleSources(false) },
|
||||
onClickClearCookies = screenModel::clearCookies,
|
||||
|
|
|
|||
|
|
@ -29,11 +29,6 @@ import tachiyomi.core.common.util.system.logcat
|
|||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
private const val URL_EXTENSION_COMMITS =
|
||||
"https://github.com/komikku-app/komikku-extensions/commits/master"
|
||||
private const val URL_EXTENSION_BLOB =
|
||||
"https://github.com/komikku-app/komikku-extensions/blob/master"
|
||||
|
||||
class ExtensionDetailsScreenModel(
|
||||
pkgName: String,
|
||||
context: Context,
|
||||
|
|
@ -88,31 +83,6 @@ class ExtensionDetailsScreenModel(
|
|||
}
|
||||
}
|
||||
|
||||
fun getChangelogUrl(): String {
|
||||
val extension = state.value.extension ?: return ""
|
||||
|
||||
val pkgName = extension.pkgName.substringAfter("eu.kanade.tachiyomi.extension.")
|
||||
val pkgFactory = extension.pkgFactory
|
||||
if (extension.hasChangelog) {
|
||||
return createUrl(URL_EXTENSION_BLOB, pkgName, pkgFactory, "/CHANGELOG.md")
|
||||
}
|
||||
|
||||
// Falling back on GitHub commit history because there is no explicit changelog in extension
|
||||
return createUrl(URL_EXTENSION_COMMITS, pkgName, pkgFactory)
|
||||
}
|
||||
|
||||
fun getReadmeUrl(): String {
|
||||
val extension = state.value.extension ?: return ""
|
||||
|
||||
if (!extension.hasReadme) {
|
||||
return "https://tachiyomi.org/docs/faq/browse/extensions"
|
||||
}
|
||||
|
||||
val pkgName = extension.pkgName.substringAfter("eu.kanade.tachiyomi.extension.")
|
||||
val pkgFactory = extension.pkgFactory
|
||||
return createUrl(URL_EXTENSION_BLOB, pkgName, pkgFactory, "/README.md")
|
||||
}
|
||||
|
||||
fun clearCookies() {
|
||||
val extension = state.value.extension ?: return
|
||||
|
||||
|
|
@ -148,22 +118,6 @@ class ExtensionDetailsScreenModel(
|
|||
?.let { toggleSource.await(it, enable) }
|
||||
}
|
||||
|
||||
private fun createUrl(
|
||||
url: String,
|
||||
pkgName: String,
|
||||
pkgFactory: String?,
|
||||
path: String = "",
|
||||
): String {
|
||||
return if (!pkgFactory.isNullOrEmpty()) {
|
||||
when (path.isEmpty()) {
|
||||
true -> "$url/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/$pkgFactory"
|
||||
else -> "$url/multisrc/overrides/$pkgFactory/" + (pkgName.split(".").lastOrNull() ?: "") + path
|
||||
}
|
||||
} else {
|
||||
url + "/src/" + pkgName.replace(".", "/") + path
|
||||
}
|
||||
}
|
||||
|
||||
@Immutable
|
||||
data class State(
|
||||
val extension: Extension.Installed? = null,
|
||||
|
|
|
|||
Loading…
Reference in a new issue