From c1fdc85c9e1483cc1c95b1ff528b40c0f0d03a46 Mon Sep 17 00:00:00 2001 From: manatails Date: Thu, 2 Feb 2023 05:49:10 +0900 Subject: [PATCH] refactor: remove unnecessary `locale-config-fix` patch (#1578) Signed-off-by: oSumAtrIX Co-authored-by: oSumAtrIX --- .../spotify/layout/theme/patch/ThemePatch.kt | 3 -- .../resource/patch/GeneralAdsResourcePatch.kt | 2 -- .../patch/CopyVideoUrlResourcePatch.kt | 3 +- .../resource/patch/DownloadsResourcePatch.kt | 3 +- .../header/patch/PremiumHeadingPatch.kt | 3 -- .../icon/patch/CustomBrandingPatch.kt | 3 -- .../patch/PlayerButtonBackgroundPatch.kt | 5 +-- .../ReturnYouTubeDislikeResourcePatch.kt | 3 +- .../patch/SponsorBlockResourcePatch.kt | 3 +- .../youtube/layout/theme/patch/ThemePatch.kt | 3 +- .../FixLocaleConfigErrorCompatibility.kt | 9 ----- .../patch/FixLocaleConfigErrorPatch.kt | 36 ------------------- .../patch/resource/MicroGResourcePatch.kt | 7 ++-- .../patch/BottomControlsResourcePatch.kt | 3 -- 14 files changed, 9 insertions(+), 77 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/manifest/patch/FixLocaleConfigErrorPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/spotify/layout/theme/patch/ThemePatch.kt b/src/main/kotlin/app/revanced/patches/spotify/layout/theme/patch/ThemePatch.kt index dfbc7fd17..731f1b3d1 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/layout/theme/patch/ThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/layout/theme/patch/ThemePatch.kt @@ -5,14 +5,11 @@ import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.* -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.spotify.layout.theme.annotations.ThemeCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import org.w3c.dom.Element @Patch -@DependsOn([FixLocaleConfigErrorPatch::class]) @Name("spotify-theme") @Description("Applies a custom theme.") @ThemeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt index bfbf411b0..734869dcf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt @@ -10,13 +10,11 @@ import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.settings.preference.impl.* import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen @DependsOn( dependencies = [ - FixLocaleConfigErrorPatch::class, LithoFilterPatch::class, SettingsPatch::class, ResourceMappingPatch::class diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt index de4a3c522..6e60282cd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt @@ -12,7 +12,6 @@ import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.SwitchPreference import app.revanced.patches.youtube.interaction.copyvideourl.annotation.CopyVideoUrlCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils @@ -20,7 +19,7 @@ import app.revanced.util.resources.ResourceUtils.copyResources @Name("copy-video-url-resource") @Description("Makes necessary changes to resources for copy video link buttons.") -@DependsOn([BottomControlsResourcePatch::class, FixLocaleConfigErrorPatch::class, SettingsPatch::class]) +@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class]) @CopyVideoUrlCompatibility @Version("0.0.1") class CopyVideoUrlResourcePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt index 9589c4c74..f628f4d0c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt @@ -10,7 +10,6 @@ import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.settings.preference.impl.* import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils @@ -18,7 +17,7 @@ import app.revanced.util.resources.ResourceUtils.copyResources import app.revanced.util.resources.ResourceUtils.mergeStrings @Name("downloads-resource-patch") -@DependsOn([BottomControlsResourcePatch::class, FixLocaleConfigErrorPatch::class, SettingsPatch::class]) +@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class]) @Description("Makes necessary changes to resources for the download button.") @DownloadsCompatibility @Version("0.0.1") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/patch/PremiumHeadingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/patch/PremiumHeadingPatch.kt index 83eca468f..2d358f79c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/patch/PremiumHeadingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/patch/PremiumHeadingPatch.kt @@ -8,16 +8,13 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import java.nio.file.Files import java.nio.file.StandardCopyOption import kotlin.io.path.exists @Patch -@DependsOn([FixLocaleConfigErrorPatch::class]) @Name("premium-heading") @Description("Shows premium branding on the home screen.") @PremiumHeadingCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt index f373fd6c0..f9d93d4cd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt @@ -5,17 +5,14 @@ import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.* -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources import java.io.File import java.nio.file.Files @Patch -@DependsOn([FixLocaleConfigErrorPatch::class]) @Name("custom-branding") @Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).") @CustomBrandingCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbackground/patch/PlayerButtonBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbackground/patch/PlayerButtonBackgroundPatch.kt index c99615d93..32a7baa3d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbackground/patch/PlayerButtonBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbackground/patch/PlayerButtonBackgroundPatch.kt @@ -7,15 +7,12 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.layout.playerbuttonbackground.annotations.PlayerButtonBackgroundCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import org.w3c.dom.Element @Patch -@DependsOn([FixLocaleConfigErrorPatch::class]) @Name("remove-player-button-background") @Description("Removes the background from the video player buttons.") @PlayerButtonBackgroundCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt index 35dd0af7c..16eaf3a26 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt @@ -11,11 +11,10 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.settings.preference.impl.Preference import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils.mergeStrings -@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class]) +@DependsOn([SettingsPatch::class]) @Name("return-youtube-dislike-resource-patch") @Description("Adds the preferences for Return YouTube Dislike.") @ReturnYouTubeDislikeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt index 4f85e378a..fb6f903cd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt @@ -11,7 +11,6 @@ import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.settings.preference.impl.Preference import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources @@ -20,7 +19,7 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings @Name("sponsorblock-resource-patch") @SponsorBlockCompatibility -@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class SponsorBlockResourcePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt index 7b50a3609..8bc9c1c1c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt @@ -8,13 +8,12 @@ import app.revanced.patcher.patch.* import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources import org.w3c.dom.Element @Patch -@DependsOn([LithoThemePatch::class, FixLocaleConfigErrorPatch::class]) +@DependsOn([LithoThemePatch::class]) @Name("theme") @Description("Applies a custom theme.") @ThemeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt deleted file mode 100644 index a304b71f0..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/annotations/FixLocaleConfigErrorCompatibility.kt +++ /dev/null @@ -1,9 +0,0 @@ -package app.revanced.patches.youtube.misc.manifest.annotations - -import app.revanced.patcher.annotation.Compatibility -import app.revanced.patcher.annotation.Package - -@Compatibility([Package("com.google.android.youtube")]) -@Target(AnnotationTarget.CLASS) -@Retention(AnnotationRetention.RUNTIME) -internal annotation class FixLocaleConfigErrorCompatibility \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/patch/FixLocaleConfigErrorPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/patch/FixLocaleConfigErrorPatch.kt deleted file mode 100644 index 801e444d3..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/manifest/patch/FixLocaleConfigErrorPatch.kt +++ /dev/null @@ -1,36 +0,0 @@ -package app.revanced.patches.youtube.misc.manifest.patch - -import app.revanced.patcher.annotation.Description -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.misc.manifest.annotations.FixLocaleConfigErrorCompatibility -import org.w3c.dom.Element - -@Name("locale-config-fix") -@Description("Fixes an error when building the resources by patching the manifest file.") -@FixLocaleConfigErrorCompatibility -@Version("0.0.1") -class FixLocaleConfigErrorPatch : ResourcePatch { - override fun execute(context: ResourceContext): PatchResult { - // create an xml editor instance - context.xmlEditor["AndroidManifest.xml"].use { - // edit the application nodes attribute... - val applicationNode = it - .file - .getElementsByTagName("application") - .item(0) as Element - - - // by replacing the attributes name - val attribute = "android:localeConfig" - applicationNode.setAttribute("localeConfig", applicationNode.getAttribute(attribute)) - applicationNode.removeAttribute(attribute) - } - - return PatchResultSuccess() - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt index 1cdc47f49..257f779e2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt @@ -8,7 +8,8 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch +import app.revanced.patches.shared.settings.preference.impl.Preference +import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_APP_NAME @@ -16,15 +17,13 @@ import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAG import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.shared.settings.preference.impl.Preference -import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch import app.revanced.util.microg.Constants.MICROG_VENDOR import app.revanced.util.microg.MicroGManifestHelper import app.revanced.util.microg.MicroGResourceHelper @Name("microg-resource-patch") -@DependsOn([FixLocaleConfigErrorPatch::class, SettingsResourcePatch::class]) +@DependsOn([SettingsResourcePatch::class]) @Description("Resource patch to allow YouTube ReVanced to run without root and under a different package name.") @MicroGPatchCompatibility @Version("0.0.1") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/resource/patch/BottomControlsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/resource/patch/BottomControlsResourcePatch.kt index e569e56aa..d6fb1889c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/resource/patch/BottomControlsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/resource/patch/BottomControlsResourcePatch.kt @@ -8,12 +8,9 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.playercontrols.annotation.PlayerControlsCompatibility @Name("bottom-controls-resource-patch") -@DependsOn([FixLocaleConfigErrorPatch::class]) @Description("Manages the resources for the bottom controls of the YouTube player.") @PlayerControlsCompatibility @Version("0.0.1")