refactor: cleanup MicroGResourcePatch.kt
This commit is contained in:
parent
125bfd294c
commit
e58b96a6f4
|
@ -34,32 +34,34 @@ class MicroGResourcePatch : ResourcePatch() {
|
||||||
it.file.firstChild.appendChild(settingsElement)
|
it.file.firstChild.appendChild(settingsElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
val settings_fragment = data.get("res/xml/settings_fragment.xml")
|
val settingsFragment = data["res/xml/settings_fragment.xml"]
|
||||||
val text = settings_fragment.readText()
|
settingsFragment.writeText(
|
||||||
settings_fragment.writeText(
|
settingsFragment.readText().replace(
|
||||||
text.replace("android:targetPackage=\"com.google.android.youtube", "android:targetPackage=\"$REVANCED_PACKAGE_NAME")
|
"android:targetPackage=\"com.google.android.youtube",
|
||||||
|
"android:targetPackage=\"$REVANCED_PACKAGE_NAME"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val manifest = data.get("AndroidManifest.xml").readText()
|
val manifest = data["AndroidManifest.xml"]
|
||||||
|
manifest.writeText(
|
||||||
data.get("AndroidManifest.xml").writeText(
|
manifest.readText()
|
||||||
manifest.replace(
|
.replace(
|
||||||
"package=\"com.google.android.youtube", "package=\"$REVANCED_PACKAGE_NAME"
|
"package=\"com.google.android.youtube", "package=\"$REVANCED_PACKAGE_NAME"
|
||||||
).replace(
|
).replace(
|
||||||
"android:label=\"@string/application_name", "android:label=\"$REVANCED_APP_NAME"
|
"android:label=\"@string/application_name", "android:label=\"$REVANCED_APP_NAME"
|
||||||
).replace(
|
).replace(
|
||||||
"android:authorities=\"com.google.android.youtube", "android:authorities=\"$REVANCED_PACKAGE_NAME"
|
"android:authorities=\"com.google.android.youtube", "android:authorities=\"$REVANCED_PACKAGE_NAME"
|
||||||
).replace(
|
).replace(
|
||||||
"com.google.android.youtube.permission.C2D_MESSAGE", "$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE"
|
"com.google.android.youtube.permission.C2D_MESSAGE", "$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE"
|
||||||
).replace( // TODO: might not be needed
|
).replace( // TODO: might not be needed
|
||||||
"com.google.android.youtube.lifecycle-trojan", "$REVANCED_PACKAGE_NAME.lifecycle-trojan"
|
"com.google.android.youtube.lifecycle-trojan", "$REVANCED_PACKAGE_NAME.lifecycle-trojan"
|
||||||
).replace( // TODO: might not be needed
|
).replace( // TODO: might not be needed
|
||||||
"com.google.android.youtube.photopicker_images", "$REVANCED_PACKAGE_NAME.photopicker_images"
|
"com.google.android.youtube.photopicker_images", "$REVANCED_PACKAGE_NAME.photopicker_images"
|
||||||
).replace(
|
).replace(
|
||||||
"com.google.android.c2dm", "$BASE_MICROG_PACKAGE_NAME.android.c2dm"
|
"com.google.android.c2dm", "$BASE_MICROG_PACKAGE_NAME.android.c2dm"
|
||||||
).replace(
|
).replace(
|
||||||
"</queries>", "<package android:name=\"$BASE_MICROG_PACKAGE_NAME.android.gms\"/></queries>"
|
"</queries>", "<package android:name=\"$BASE_MICROG_PACKAGE_NAME.android.gms\"/></queries>"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|
Loading…
Reference in a new issue