Fix app not reading tachiyomix.extensionLib extension metadata (#3545)

Android was interpreting the field as a float and failing (which is nuts imo)

Also cleaned up the lib validation logic
This commit is contained in:
AntsyLich
2026-07-08 13:43:17 +06:00
committed by GitHub
parent 26abad0be0
commit 66b390c62a
2 changed files with 5 additions and 13 deletions
+1
View File
@@ -31,6 +31,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Fix crash when putting app in background ([@AntsyLich](https://github.com/AntsyLich)) ([#3523](https://github.com/mihonapp/mihon/pull/3523)) - Fix crash when putting app in background ([@AntsyLich](https://github.com/AntsyLich)) ([#3523](https://github.com/mihonapp/mihon/pull/3523))
- Fix support for non-system SAF providers ([@AntsyLich](https://github.com/AntsyLich)) ([#3530](https://github.com/mihonapp/mihon/pull/3530)) - Fix support for non-system SAF providers ([@AntsyLich](https://github.com/AntsyLich)) ([#3530](https://github.com/mihonapp/mihon/pull/3530))
- Fix chapter's `memo` field not being updated for existing chapters ([@cuong-tran](https://github.com/cuong-tran)) ([#3538](https://github.com/mihonapp/mihon/pull/3538)) - Fix chapter's `memo` field not being updated for existing chapters ([@cuong-tran](https://github.com/cuong-tran)) ([#3538](https://github.com/mihonapp/mihon/pull/3538))
- Fix app not reading `tachiyomix.extensionLib` extension metadata ([@AntsyLich](https://github.com/AntsyLich)) ([#3545](https://github.com/mihonapp/mihon/pull/3545))
## [v0.20.0] - 2026-06-27 ## [v0.20.0] - 2026-06-27
### Added ### Added
@@ -54,8 +54,7 @@ internal object ExtensionLoader {
private const val METADATA_EXTENSION_LIB = "tachiyomix.extensionLib" private const val METADATA_EXTENSION_LIB = "tachiyomix.extensionLib"
private const val METADATA_CONTENT_WARNING = "tachiyomix.contentWarning" private const val METADATA_CONTENT_WARNING = "tachiyomix.contentWarning"
const val LIB_VERSION_MIN = 1.4 private val SUPPORTED_LIB_VERSIONS = listOf(1.4, 1.6)
const val LIB_VERSION_MAX = 1.6
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
private val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or private val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or
@@ -244,22 +243,14 @@ internal object ExtensionLoader {
} }
// Validate lib version // Validate lib version
val libVersion = appInfo.metaData.getDouble(METADATA_EXTENSION_LIB).takeUnless { it == 0.0 } val libVersion = appInfo.metaData.getString(METADATA_EXTENSION_LIB)?.toDouble()
?: versionName.substringBeforeLast('.').toDoubleOrNull() ?: versionName.substringBeforeLast('.').toDoubleOrNull()
if (libVersion == null || (libVersion != LIB_VERSION_MIN && libVersion != LIB_VERSION_MAX)) { if (libVersion == null || libVersion !in SUPPORTED_LIB_VERSIONS) {
logcat(LogPriority.WARN) { logcat(LogPriority.WARN) {
"Lib version is $libVersion, while only versions " + "Lib version is $libVersion, while only version(s) ${SUPPORTED_LIB_VERSIONS.joinToString()} are supported"
"$LIB_VERSION_MIN and $LIB_VERSION_MAX is allowed"
} }
return LoadResult.Error return LoadResult.Error
} }
// if (libVersion == null || libVersion < LIB_VERSION_MIN || libVersion > LIB_VERSION_MAX) {
// logcat(LogPriority.WARN) {
// "Lib version is $libVersion, while only versions " +
// "$LIB_VERSION_MIN or $LIB_VERSION_MAX is allowed"
// }
// return LoadResult.Error
// }
val signatures = getSignatures(pkgInfo) val signatures = getSignatures(pkgInfo)
if (signatures.isNullOrEmpty()) { if (signatures.isNullOrEmpty()) {