Remove custom extension readme/changelog URLs
This reverts commit 6d255f25ad.
This commit is contained in:
parent
085bf8c2ae
commit
f6776df151
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.layout.size
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.HelpOutline
|
import androidx.compose.material.icons.automirrored.outlined.Launch
|
||||||
import androidx.compose.material.icons.outlined.History
|
|
||||||
import androidx.compose.material.icons.outlined.Settings
|
import androidx.compose.material.icons.outlined.Settings
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
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.ImmutableList
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.kmk.KMR
|
|
||||||
import tachiyomi.i18n.sy.SYMR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
|
|
@ -70,10 +68,6 @@ fun ExtensionDetailsScreen(
|
||||||
navigateUp: () -> Unit,
|
navigateUp: () -> Unit,
|
||||||
state: ExtensionDetailsScreenModel.State,
|
state: ExtensionDetailsScreenModel.State,
|
||||||
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
||||||
// KMK -->
|
|
||||||
onClickWhatsNew: () -> Unit,
|
|
||||||
onClickReadme: () -> Unit,
|
|
||||||
// KMK <--
|
|
||||||
onClickEnableAll: () -> Unit,
|
onClickEnableAll: () -> Unit,
|
||||||
onClickDisableAll: () -> Unit,
|
onClickDisableAll: () -> Unit,
|
||||||
onClickClearCookies: () -> Unit,
|
onClickClearCookies: () -> Unit,
|
||||||
|
|
@ -100,26 +94,11 @@ fun ExtensionDetailsScreen(
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
||||||
.apply {
|
.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) {
|
if (url != null) {
|
||||||
add(
|
add(
|
||||||
AppBar.OverflowAction(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_open_repo),
|
title = stringResource(MR.strings.action_open_repo),
|
||||||
|
icon = Icons.AutoMirrored.Outlined.Launch,
|
||||||
onClick = {
|
onClick = {
|
||||||
uriHandler.openUri(url)
|
uriHandler.openUri(url)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -591,8 +591,6 @@ private fun ExtensionItemContentPreview() {
|
||||||
versionCode = 1,
|
versionCode = 1,
|
||||||
libVersion = 1.0,
|
libVersion = 1.0,
|
||||||
isNsfw = true,
|
isNsfw = true,
|
||||||
hasReadme = true,
|
|
||||||
hasChangelog = true,
|
|
||||||
signatureHash = "900000",
|
signatureHash = "900000",
|
||||||
repoName = "Repository",
|
repoName = "Repository",
|
||||||
sources = emptyList(),
|
sources = emptyList(),
|
||||||
|
|
@ -608,8 +606,6 @@ private fun ExtensionItemContentPreview() {
|
||||||
versionCode = 1,
|
versionCode = 1,
|
||||||
libVersion = 1.0,
|
libVersion = 1.0,
|
||||||
isNsfw = true,
|
isNsfw = true,
|
||||||
hasReadme = true,
|
|
||||||
hasChangelog = true,
|
|
||||||
signatureHash = "900000",
|
signatureHash = "900000",
|
||||||
repoName = "Repository",
|
repoName = "Repository",
|
||||||
sources = emptyList(),
|
sources = emptyList(),
|
||||||
|
|
@ -629,8 +625,6 @@ private fun ExtensionItemContentPreview() {
|
||||||
versionCode = 1,
|
versionCode = 1,
|
||||||
libVersion = 1.0,
|
libVersion = 1.0,
|
||||||
isNsfw = true,
|
isNsfw = true,
|
||||||
hasReadme = true,
|
|
||||||
hasChangelog = true,
|
|
||||||
signatureHash = "900000",
|
signatureHash = "900000",
|
||||||
repoName = "Repository",
|
repoName = "Repository",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -156,8 +156,6 @@ internal class ExtensionApi {
|
||||||
libVersion = it.extractLibVersion(),
|
libVersion = it.extractLibVersion(),
|
||||||
lang = it.lang,
|
lang = it.lang,
|
||||||
isNsfw = it.nsfw == 1,
|
isNsfw = it.nsfw == 1,
|
||||||
hasReadme = it.hasReadme == 1,
|
|
||||||
hasChangelog = it.hasChangelog == 1,
|
|
||||||
sources = it.sources?.map(extensionSourceMapper).orEmpty(),
|
sources = it.sources?.map(extensionSourceMapper).orEmpty(),
|
||||||
apkName = it.apk,
|
apkName = it.apk,
|
||||||
iconUrl = "$repoUrl/icon/${it.pkg}.png",
|
iconUrl = "$repoUrl/icon/${it.pkg}.png",
|
||||||
|
|
@ -196,8 +194,6 @@ private data class ExtensionJsonObject(
|
||||||
val code: Long,
|
val code: Long,
|
||||||
val version: String,
|
val version: String,
|
||||||
val nsfw: Int,
|
val nsfw: Int,
|
||||||
val hasReadme: Int = 0,
|
|
||||||
val hasChangelog: Int = 0,
|
|
||||||
val sources: List<ExtensionSourceJsonObject>?,
|
val sources: List<ExtensionSourceJsonObject>?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ sealed class Extension {
|
||||||
abstract val libVersion: Double
|
abstract val libVersion: Double
|
||||||
abstract val lang: String?
|
abstract val lang: String?
|
||||||
abstract val isNsfw: Boolean
|
abstract val isNsfw: Boolean
|
||||||
abstract val hasReadme: Boolean
|
|
||||||
abstract val hasChangelog: Boolean
|
|
||||||
|
|
||||||
// KMK -->
|
// KMK -->
|
||||||
abstract val signatureHash: String
|
abstract val signatureHash: String
|
||||||
|
|
@ -29,8 +27,6 @@ sealed class Extension {
|
||||||
override val libVersion: Double,
|
override val libVersion: Double,
|
||||||
override val lang: String,
|
override val lang: String,
|
||||||
override val isNsfw: Boolean,
|
override val isNsfw: Boolean,
|
||||||
override val hasReadme: Boolean,
|
|
||||||
override val hasChangelog: Boolean,
|
|
||||||
// KMK -->
|
// KMK -->
|
||||||
override val signatureHash: String,
|
override val signatureHash: String,
|
||||||
/** Guessing repo name from built-in signatures preset */
|
/** Guessing repo name from built-in signatures preset */
|
||||||
|
|
@ -56,8 +52,6 @@ sealed class Extension {
|
||||||
override val libVersion: Double,
|
override val libVersion: Double,
|
||||||
override val lang: String,
|
override val lang: String,
|
||||||
override val isNsfw: Boolean,
|
override val isNsfw: Boolean,
|
||||||
override val hasReadme: Boolean,
|
|
||||||
override val hasChangelog: Boolean,
|
|
||||||
// KMK -->
|
// KMK -->
|
||||||
override val signatureHash: String,
|
override val signatureHash: String,
|
||||||
override val repoName: String,
|
override val repoName: String,
|
||||||
|
|
@ -97,7 +91,5 @@ sealed class Extension {
|
||||||
// KMK <--
|
// KMK <--
|
||||||
override val lang: String? = null,
|
override val lang: String? = null,
|
||||||
override val isNsfw: Boolean = false,
|
override val isNsfw: Boolean = false,
|
||||||
override val hasReadme: Boolean = false,
|
|
||||||
override val hasChangelog: Boolean = false,
|
|
||||||
) : Extension()
|
) : Extension()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ internal object ExtensionLoader {
|
||||||
private const val METADATA_SOURCE_CLASS = "tachiyomi.extension.class"
|
private const val METADATA_SOURCE_CLASS = "tachiyomi.extension.class"
|
||||||
private const val METADATA_SOURCE_FACTORY = "tachiyomi.extension.factory"
|
private const val METADATA_SOURCE_FACTORY = "tachiyomi.extension.factory"
|
||||||
private const val METADATA_NSFW = "tachiyomi.extension.nsfw"
|
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_MIN = 1.4
|
||||||
const val LIB_VERSION_MAX = 1.5
|
const val LIB_VERSION_MAX = 1.5
|
||||||
|
|
||||||
|
|
@ -311,9 +309,6 @@ internal object ExtensionLoader {
|
||||||
return LoadResult.Error
|
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 {
|
val classLoader = try {
|
||||||
ChildFirstPathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
ChildFirstPathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
@ -361,8 +356,6 @@ internal object ExtensionLoader {
|
||||||
libVersion = libVersion,
|
libVersion = libVersion,
|
||||||
lang = lang,
|
lang = lang,
|
||||||
isNsfw = isNsfw,
|
isNsfw = isNsfw,
|
||||||
hasReadme = hasReadme,
|
|
||||||
hasChangelog = hasChangelog,
|
|
||||||
sources = sources,
|
sources = sources,
|
||||||
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
|
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
|
||||||
icon = appInfo.loadIcon(pkgManager),
|
icon = appInfo.loadIcon(pkgManager),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
|
||||||
import cafe.adriel.voyager.core.model.rememberScreenModel
|
import cafe.adriel.voyager.core.model.rememberScreenModel
|
||||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||||
|
|
@ -30,18 +29,11 @@ data class ExtensionDetailsScreen(
|
||||||
}
|
}
|
||||||
|
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
// KMK -->
|
|
||||||
val uriHandler = LocalUriHandler.current
|
|
||||||
// KMK <--
|
|
||||||
|
|
||||||
ExtensionDetailsScreen(
|
ExtensionDetailsScreen(
|
||||||
navigateUp = navigator::pop,
|
navigateUp = navigator::pop,
|
||||||
state = state,
|
state = state,
|
||||||
onClickSourcePreferences = { navigator.push(SourcePreferencesScreen(it)) },
|
onClickSourcePreferences = { navigator.push(SourcePreferencesScreen(it)) },
|
||||||
// KMK -->
|
|
||||||
onClickWhatsNew = { uriHandler.openUri(screenModel.getChangelogUrl()) },
|
|
||||||
onClickReadme = { uriHandler.openUri(screenModel.getReadmeUrl()) },
|
|
||||||
// KMK <--
|
|
||||||
onClickEnableAll = { screenModel.toggleSources(true) },
|
onClickEnableAll = { screenModel.toggleSources(true) },
|
||||||
onClickDisableAll = { screenModel.toggleSources(false) },
|
onClickDisableAll = { screenModel.toggleSources(false) },
|
||||||
onClickClearCookies = screenModel::clearCookies,
|
onClickClearCookies = screenModel::clearCookies,
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,6 @@ import tachiyomi.core.common.util.system.logcat
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
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(
|
class ExtensionDetailsScreenModel(
|
||||||
pkgName: String,
|
pkgName: String,
|
||||||
context: Context,
|
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() {
|
fun clearCookies() {
|
||||||
val extension = state.value.extension ?: return
|
val extension = state.value.extension ?: return
|
||||||
|
|
||||||
|
|
@ -148,22 +118,6 @@ class ExtensionDetailsScreenModel(
|
||||||
?.let { toggleSource.await(it, enable) }
|
?.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
|
@Immutable
|
||||||
data class State(
|
data class State(
|
||||||
val extension: Extension.Installed? = null,
|
val extension: Extension.Installed? = null,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue