mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 23:24:28 +02:00
improve AbstractSettingsResourcePatch
This commit is contained in:
parent
490efb6476
commit
17a18b59b2
@ -21,24 +21,24 @@ abstract class AbstractSettingsResourcePatch(
|
|||||||
private val isYouTube: Boolean,
|
private val isYouTube: Boolean,
|
||||||
) : ResourcePatch {
|
) : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
/*
|
|
||||||
* used for self-restart
|
|
||||||
*/
|
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
|
||||||
editor.file.getElementsByTagName("manifest").item(0).also {
|
|
||||||
it.appendChild(it.ownerDocument.createElement("uses-permission").also { element ->
|
|
||||||
element.setAttribute("android:name", "android.permission.SCHEDULE_EXACT_ALARM")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy strings
|
* Copy strings
|
||||||
*/
|
*/
|
||||||
context.copyXmlNode(sourcehostDirectory, "values/strings.xml", "resources")
|
context.copyXmlNode(sourcehostDirectory, "values/strings.xml", "resources")
|
||||||
|
|
||||||
/* initialize ReVanced Settings */
|
/* initialize ReVanced Settings */
|
||||||
if (isYouTube == true) {
|
if (isYouTube) {
|
||||||
|
/*
|
||||||
|
* used for self-restart
|
||||||
|
*/
|
||||||
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
|
editor.file.getElementsByTagName("manifest").item(0).also {
|
||||||
|
it.appendChild(it.ownerDocument.createElement("uses-permission").also { element ->
|
||||||
|
element.setAttribute("android:name", "android.permission.SCHEDULE_EXACT_ALARM")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
context.copyResources(sourceDirectory, ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml"))
|
context.copyResources(sourceDirectory, ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user