mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 07:34:31 +02:00
refactor: better method is used for settings-framework
This commit is contained in:
parent
ef370c82d1
commit
b3ed1c0f93
@ -11,15 +11,16 @@ internal object MicroGResourceHelper {
|
|||||||
*
|
*
|
||||||
* @param fromPackageName Original package name.
|
* @param fromPackageName Original package name.
|
||||||
* @param toPackageName The package name to accept.
|
* @param toPackageName The package name to accept.
|
||||||
* @param toName The new name of the app.
|
|
||||||
*/
|
*/
|
||||||
fun ResourceContext.patchManifest(
|
fun ResourceContext.patchManifest(
|
||||||
fromPackageName: String,
|
fromPackageName: String,
|
||||||
toPackageName: String
|
toPackageName: String
|
||||||
) {
|
) {
|
||||||
val manifest = this["AndroidManifest.xml"].readText()
|
val manifest = this["AndroidManifest.xml"]
|
||||||
this["AndroidManifest.xml"].writeText(
|
|
||||||
manifest.replace(
|
manifest.writeText(
|
||||||
|
manifest.readText()
|
||||||
|
.replace(
|
||||||
"package=\"$fromPackageName",
|
"package=\"$fromPackageName",
|
||||||
"package=\"$toPackageName"
|
"package=\"$toPackageName"
|
||||||
).replace(
|
).replace(
|
||||||
@ -40,4 +41,25 @@ internal object MicroGResourceHelper {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch the settings fragment to work with MicroG.
|
||||||
|
*
|
||||||
|
* @param fromPackageName Original package name.
|
||||||
|
* @param toPackageName The package name to accept.
|
||||||
|
*/
|
||||||
|
fun ResourceContext.patchSetting(
|
||||||
|
fromPackageName: String,
|
||||||
|
toPackageName: String
|
||||||
|
) {
|
||||||
|
val prefs = this["res/xml/settings_fragment.xml"]
|
||||||
|
|
||||||
|
prefs.writeText(
|
||||||
|
prefs.readText()
|
||||||
|
.replace(
|
||||||
|
"android:targetPackage=\"$fromPackageName",
|
||||||
|
"android:targetPackage=\"$toPackageName"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user