mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 23:24:28 +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 toPackageName The package name to accept.
|
||||
* @param toName The new name of the app.
|
||||
*/
|
||||
fun ResourceContext.patchManifest(
|
||||
fromPackageName: String,
|
||||
toPackageName: String
|
||||
) {
|
||||
val manifest = this["AndroidManifest.xml"].readText()
|
||||
this["AndroidManifest.xml"].writeText(
|
||||
manifest.replace(
|
||||
val manifest = this["AndroidManifest.xml"]
|
||||
|
||||
manifest.writeText(
|
||||
manifest.readText()
|
||||
.replace(
|
||||
"package=\"$fromPackageName",
|
||||
"package=\"$toPackageName"
|
||||
).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