feat: update MicroG patch to latest version

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX
2022-05-22 17:41:59 +02:00
parent 08aad61b61
commit 45c75cfb0e
13 changed files with 669 additions and 1216 deletions
@@ -8,32 +8,31 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.misc.manifest.annotations.FixLocaleConfigErrorCompatibility
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import org.w3c.dom.Element
@Patch
@Name("locale-config-fix")
@Description("Fix an error when building the resources by patching the manifest file.")
@FixLocaleConfigErrorCompatibility
@MicroGPatchCompatibility
@Version("0.0.1")
class FixLocaleConfigErrorPatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult {
// create an xml editor instance
val editor = data.getXmlEditor("AndroidManifest.xml")
data.getXmlEditor("AndroidManifest.xml").use {
// edit the application nodes attribute...
val applicationNode = it
.file
.getElementsByTagName("application")
.item(0) as Element
// edit the application nodes attribute...
val applicationNode = editor
.file
.getElementsByTagName("application")
.item(0) as Element
// by replacing the attributes name
val attribute = "android:localeConfig"
applicationNode.setAttribute("localeConfig", applicationNode.getAttribute(attribute))
applicationNode.removeAttribute("android:localeConfig")
// by replacing the attributes name
val attribute = "android:localeConfig"
applicationNode.setAttribute("localeConfig", applicationNode.getAttribute(attribute))
applicationNode.removeAttribute("android:localeConfig")
// close & save the modified file
editor.close()
}
return PatchResultSuccess()
}