mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-06 09:34:37 +02:00
fix(YouTube/Settings): some preferences are not linked correctly
This commit is contained in:
parent
1b271e45d7
commit
bdff8e5430
@ -167,7 +167,9 @@ object SettingsPatch : BaseResourcePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
// Set ReVanced Patches Version
|
|
||||||
|
// region set ReVanced Patches Version
|
||||||
|
|
||||||
val jarManifest = classLoader.getResources("META-INF/MANIFEST.MF")
|
val jarManifest = classLoader.getResources("META-INF/MANIFEST.MF")
|
||||||
while (jarManifest.hasMoreElements())
|
while (jarManifest.hasMoreElements())
|
||||||
contexts.updatePatchStatusSettings(
|
contexts.updatePatchStatusSettings(
|
||||||
@ -177,34 +179,20 @@ object SettingsPatch : BaseResourcePatch(
|
|||||||
.getValue("Version") + ""
|
.getValue("Version") + ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Endregion
|
// endregion
|
||||||
|
|
||||||
// Set ReVanced Integrations Version
|
// region set ReVanced Integrations Version
|
||||||
SettingsBytecodePatch.contexts.classes.forEach { classDef ->
|
|
||||||
if (classDef.sourceFile != "BuildConfig.java")
|
|
||||||
return@forEach
|
|
||||||
|
|
||||||
classDef.fields.forEach { field ->
|
val buildConfigMutableClass = SettingsBytecodePatch.contexts.findClass { it.sourceFile == "BuildConfig.java" }!!.mutableClass
|
||||||
if (field.name == "VERSION_NAME") {
|
val versionNameField = buildConfigMutableClass.fields.single { it.name == "VERSION_NAME" }
|
||||||
contexts.updatePatchStatusSettings(
|
val versionName = versionNameField.initialValue.toString().trim().replace("\"","").replace(""", "")
|
||||||
"ReVanced Integrations",
|
|
||||||
field.initialValue.toString().trim()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contexts["res/xml/revanced_prefs.xml"].apply {
|
contexts.updatePatchStatusSettings(
|
||||||
writeText(
|
"ReVanced Integrations",
|
||||||
readText()
|
versionName
|
||||||
.replace(
|
)
|
||||||
""",
|
|
||||||
""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Endregion
|
// endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user