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:
@@ -54,8 +54,7 @@ internal object ExtensionLoader {
|
||||
private const val METADATA_EXTENSION_LIB = "tachiyomix.extensionLib"
|
||||
private const val METADATA_CONTENT_WARNING = "tachiyomix.contentWarning"
|
||||
|
||||
const val LIB_VERSION_MIN = 1.4
|
||||
const val LIB_VERSION_MAX = 1.6
|
||||
private val SUPPORTED_LIB_VERSIONS = listOf(1.4, 1.6)
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or
|
||||
@@ -244,22 +243,14 @@ internal object ExtensionLoader {
|
||||
}
|
||||
|
||||
// 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()
|
||||
if (libVersion == null || (libVersion != LIB_VERSION_MIN && libVersion != LIB_VERSION_MAX)) {
|
||||
if (libVersion == null || libVersion !in SUPPORTED_LIB_VERSIONS) {
|
||||
logcat(LogPriority.WARN) {
|
||||
"Lib version is $libVersion, while only versions " +
|
||||
"$LIB_VERSION_MIN and $LIB_VERSION_MAX is allowed"
|
||||
"Lib version is $libVersion, while only version(s) ${SUPPORTED_LIB_VERSIONS.joinToString()} are supported"
|
||||
}
|
||||
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)
|
||||
if (signatures.isNullOrEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user