From 17a18b59b2761d49026ae6051a19ac83a016bf70 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Sat, 18 Feb 2023 01:47:01 +0900 Subject: [PATCH] improve AbstractSettingsResourcePatch --- .../settings/AbstractSettingsResourcePatch.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt index 5e74bbec1..ac22e76a7 100644 --- a/src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt @@ -21,24 +21,24 @@ abstract class AbstractSettingsResourcePatch( private val isYouTube: Boolean, ) : ResourcePatch { 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 */ context.copyXmlNode(sourcehostDirectory, "values/strings.xml", "resources") /* 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")) }