From aca35227d4306f8da4778ae2130836b8c0475acc Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 20 Nov 2022 23:08:51 +0100 Subject: [PATCH] style(youtube/resource-mapping): use shorter name for class --- .../patch/PremiumNavbarTabPatch.kt | 6 +++--- .../bytecode/patch/GeneralAdsBytecodePatch.kt | 19 +++++++++++++++++++ .../{ => resource}/patch/GeneralAdsPatch.kt | 2 +- .../patch/HideAutoplayButtonPatch.kt | 6 +++--- .../layout/buttons/patch/HideButtonsPatch.kt | 4 ++-- .../resource/patch/CommentsResourcePatch.kt | 6 +++--- .../resource/patch/AlbumCardsResourcePatch.kt | 6 +++--- .../patch/HideArtistCardPatch.kt | 4 ++-- .../patch/CrowdfundingBoxResourcePatch.kt | 6 +++--- .../patch/HideEndscreenCardsResourcePatch.kt | 6 +++--- .../patch/HideInfocardsResourcePatch.kt | 6 +++--- .../patch/HideEmailAddressResourcePatch.kt | 6 +++--- .../patch/CreateButtonRemoverPatch.kt | 4 ++-- .../patch/SponsorBlockBytecodePatch.kt | 6 +++--- .../patch/SponsorBlockResourcePatch.kt | 6 +++--- ...sourcePatch.kt => ResourceMappingPatch.kt} | 2 +- .../patch/PlayerControlsBytecodePatch.kt | 6 +++--- .../resource/patch/SettingsResourcePatch.kt | 6 +++--- 18 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsBytecodePatch.kt rename src/main/kotlin/app/revanced/patches/youtube/ad/general/{ => resource}/patch/GeneralAdsPatch.kt (99%) rename src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/{ResourceMappingResourcePatch.kt => ResourceMappingPatch.kt} (98%) diff --git a/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt b/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt index 4c992bbf2..8b6a4f67c 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabFingerprint import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabParentFingerprint -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.WideLiteralInstruction @@ -23,7 +23,7 @@ import org.jf.dexlib2.iface.instruction.WideLiteralInstruction @Description("Removes the premium tab from the navbar.") @PremiumNavbarTabCompatibility @Version("0.0.1") -@DependsOn([ResourceMappingResourcePatch::class]) +@DependsOn([ResourceMappingPatch::class]) class PremiumNavbarTabPatch : BytecodePatch( listOf( AddPremiumNavbarTabParentFingerprint @@ -40,7 +40,7 @@ class PremiumNavbarTabPatch : BytecodePatch( val lastInstructionIdx = methodInstructions.size - 1 val premiumTabId = - ResourceMappingResourcePatch.resourceMappings.single { it.type == "id" && it.name == "premium_tab" }.id + ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "premium_tab" }.id var removeAmount = 2 // 2nd const remove method diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsBytecodePatch.kt new file mode 100644 index 000000000..ae3d70aa4 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsBytecodePatch.kt @@ -0,0 +1,19 @@ +package app.revanced.patches.youtube.ad.general.bytecode.patch + +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility +import app.revanced.patches.youtube.misc.settings.framework.components.impl.* + +@DependsOn() +@GeneralAdsCompatibility +@Version("0.0.1") +class GeneralAdsBytecodePatch : BytecodePatch() { + override fun execute(context: BytecodeContext): PatchResult { + TODO("Not yet implemented") + } + +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/patch/GeneralAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsPatch.kt similarity index 99% rename from src/main/kotlin/app/revanced/patches/youtube/ad/general/patch/GeneralAdsPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsPatch.kt index 5f4ba8c37..8913daa06 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/patch/GeneralAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsPatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.P import app.revanced.patches.youtube.misc.settings.framework.components.impl.* @Patch -@DependsOn(dependencies = [FixLocaleConfigErrorPatch::class, LithoFilterPatch::class, SettingsPatch::class]) +@DependsOn(dependencies = [FixLocaleConfigErrorPatch::class, LithoFilterPatch::class, SettingsPatch::class, ResourceMappingPatch::class]) @Name("general-ads") @Description("Removes general ads.") @GeneralAdsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt index b3860c207..48fda6249 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt @@ -15,7 +15,7 @@ import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayBu import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutoNavInformerFingerprint import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @@ -25,7 +25,7 @@ import org.jf.dexlib2.iface.instruction.WideLiteralInstruction import org.jf.dexlib2.iface.reference.MethodReference @Patch -@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingPatch::class]) @Name("hide-autoplay-button") @Description("Hides the autoplay button in the video player.") @AutoplayButtonCompatibility @@ -53,7 +53,7 @@ class HideAutoplayButtonPatch : BytecodePatch( val layoutGenMethodInstructions = layoutGenMethod.implementation!!.instructions // resolve the offsets such as ... - val autoNavPreviewStubId = ResourceMappingResourcePatch.resourceMappings.single { + val autoNavPreviewStubId = ResourceMappingPatch.resourceMappings.single { it.name == "autonav_preview_stub" }.id // where to insert the branch instructions and ... diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt index 51a7e1f2b..84d0c8b35 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt @@ -11,14 +11,14 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.layout.buttons.annotations.HideButtonsCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Patch -@DependsOn([ResourceMappingResourcePatch::class, LithoFilterPatch::class]) +@DependsOn([ResourceMappingPatch::class, LithoFilterPatch::class]) @Name("hide-video-buttons") @Description("Adds options to hide action buttons under a video.") @HideButtonsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt index 4ce5197aa..0ef6a6057 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt @@ -8,7 +8,7 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource @@ -16,7 +16,7 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Swit @Name("comments-resource-patch") @CommentsCompatibility -@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class CommentsResourcePatch : ResourcePatch { companion object { @@ -55,7 +55,7 @@ class CommentsResourcePatch : ResourcePatch { ) ) - shortsCommentsButtonId = ResourceMappingResourcePatch.resourceMappings.single { + shortsCommentsButtonId = ResourceMappingPatch.resourceMappings.single { it.type == "drawable" && it.name == "ic_right_comment_32c" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt index 26ab6bdbd..09dc82d5a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt @@ -8,14 +8,14 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Name("hide-album-cards-resource-patch") @AlbumCardsCompatibility -@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class AlbumCardsResourcePatch : ResourcePatch { companion object { @@ -33,7 +33,7 @@ class AlbumCardsResourcePatch : ResourcePatch { ) ) - albumCardId = ResourceMappingResourcePatch.resourceMappings.single { + albumCardId = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "album_card" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt index ca7b1acc7..3e1db221b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt @@ -11,13 +11,13 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.layout.buttons.annotations.HideArtistCardCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Patch -@DependsOn([ResourceMappingResourcePatch::class, LithoFilterPatch::class]) +@DependsOn([ResourceMappingPatch::class, LithoFilterPatch::class]) @Name("hide-artist-card") @Description("Hides the artist card below the searchbar.") @HideArtistCardCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt index 784b31a11..ecd0883df 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt @@ -8,14 +8,14 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Name("crowdfunding-box-resource-patch") @CrowdfundingBoxCompatibility -@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class CrowdfundingBoxResourcePatch : ResourcePatch { companion object { @@ -33,7 +33,7 @@ class CrowdfundingBoxResourcePatch : ResourcePatch { ) ) - crowdfundingBoxId = ResourceMappingResourcePatch.resourceMappings.single { + crowdfundingBoxId = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "donation_companion" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt index c5404d3d4..5f4d8a8b5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt @@ -8,14 +8,14 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Name("hide-endscreen-cards-resource-patch") @HideEndscreenCardsCompatibility -@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class HideEndscreenCardsResourcePatch : ResourcePatch { internal companion object { @@ -35,7 +35,7 @@ class HideEndscreenCardsResourcePatch : ResourcePatch { ), ) - fun findEndscreenResourceId(name: String) = ResourceMappingResourcePatch.resourceMappings.single { + fun findEndscreenResourceId(name: String) = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "endscreen_element_layout_$name" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt index e7f12a9c4..4e380ae22 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt @@ -7,13 +7,13 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @HideInfocardsCompatibility -@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class HideInfocardsResourcePatch : ResourcePatch { internal companion object { @@ -31,7 +31,7 @@ class HideInfocardsResourcePatch : ResourcePatch { ) ) - drawerResourceId = ResourceMappingResourcePatch.resourceMappings.single { + drawerResourceId = ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "info_cards_drawer_header" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt index bb56bb0cc..ab77581df 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt @@ -8,14 +8,14 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.personalinformation.annotations.HideEmailAddressCompatibility -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Name("hide-email-address-resource-patch") @HideEmailAddressCompatibility -@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class HideEmailAddressResourcePatch : ResourcePatch { companion object { @@ -33,7 +33,7 @@ class HideEmailAddressResourcePatch : ResourcePatch { ) ) - accountSwitcherAccessibilityLabelId = ResourceMappingResourcePatch.resourceMappings.single { + accountSwitcherAccessibilityLabelId = ResourceMappingPatch.resourceMappings.single { it.type == "string" && it.name == "account_switcher_accessibility_label" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt index d9ac146f6..f1fbe0850 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt @@ -18,13 +18,13 @@ import app.revanced.patches.youtube.layout.pivotbar.fingerprints.PivotBarFingerp import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.injectHook import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference @Patch -@DependsOn([IntegrationsPatch::class, ResourceMappingResourcePatch::class, SettingsPatch::class]) +@DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class]) @Name("hide-create-button") @Description("Hides the create button in the navigation bar.") @CreateButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt index 3f4f6e40c..5f30191ca 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt @@ -21,7 +21,7 @@ import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlock import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.* import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch @@ -158,9 +158,9 @@ class SponsorBlockBytecodePatch : BytecodePatch( val controlsMethodResult = PlayerControlsBytecodePatch.showPlayerControlsFingerprintResult val controlsLayoutStubResourceId = - ResourceMappingResourcePatch.resourceMappings.single { it.type == "id" && it.name == "controls_layout_stub" }.id + ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "controls_layout_stub" }.id val zoomOverlayResourceId = - ResourceMappingResourcePatch.resourceMappings.single { it.type == "id" && it.name == "video_zoom_overlay_stub" }.id + ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "video_zoom_overlay_stub" }.id methods@ for (method in controlsMethodResult.mutableClass.methods) { val instructions = method.implementation?.instructions!! 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 425bee6c8..95e238198 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 @@ -9,7 +9,7 @@ import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource @@ -20,7 +20,7 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode @Name("sponsorblock-resource-patch") @SponsorBlockCompatibility -@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class SponsorBlockResourcePatch : ResourcePatch { companion object { @@ -107,7 +107,7 @@ class SponsorBlockResourcePatch : ResourcePatch { } }.close() // close afterwards - reelButtonGroupResourceId = ResourceMappingResourcePatch.resourceMappings.single { + reelButtonGroupResourceId = ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "reel_persistent_edu_button_group" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceMappingResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceMappingPatch.kt similarity index 98% rename from src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceMappingResourcePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceMappingPatch.kt index 7e08d4bee..48e6716e7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceMappingResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceMappingPatch.kt @@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit @Name("resource-mapping") @Description("Creates a map of public resources.") @Version("0.0.1") -class ResourceMappingResourcePatch : ResourcePatch { +class ResourceMappingPatch : ResourcePatch { companion object { internal lateinit var resourceMappings: List private set diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt index d21e6cea5..7d49f812e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt @@ -11,14 +11,14 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.playercontrols.annotation.PlayerControlsCompatibility import app.revanced.patches.youtube.misc.playercontrols.fingerprints.BottomControlsInflateFingerprint import app.revanced.patches.youtube.misc.playercontrols.fingerprints.PlayerControlsVisibilityFingerprint import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("player-controls-bytecode-patch") -@DependsOn([ResourceMappingResourcePatch::class]) +@DependsOn([ResourceMappingPatch::class]) @Description("Manages the code for the player controls of the YouTube player.") @PlayerControlsCompatibility @Version("0.0.1") @@ -28,7 +28,7 @@ class PlayerControlsBytecodePatch : BytecodePatch( override fun execute(context: BytecodeContext): PatchResult { showPlayerControlsFingerprintResult = PlayerControlsVisibilityFingerprint.result!! - bottomUiContainerResourceId = ResourceMappingResourcePatch + bottomUiContainerResourceId = ResourceMappingPatch .resourceMappings .single { it.type == "id" && it.name == "bottom_ui_container_stub" }.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt index d6ab6abc7..beae84408 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt @@ -9,7 +9,7 @@ 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.mapping.patch.ResourceMappingResourcePatch +import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference @@ -21,14 +21,14 @@ import org.w3c.dom.Node @Name("settings-resource-patch") @SettingsCompatibility -@DependsOn([FixLocaleConfigErrorPatch::class, ResourceMappingResourcePatch::class]) +@DependsOn([FixLocaleConfigErrorPatch::class, ResourceMappingPatch::class]) @Version("0.0.1") class SettingsResourcePatch : ResourcePatch { override fun execute(context: ResourceContext): PatchResult { /* * used by a fingerprint of SettingsPatch */ - appearanceStringId = ResourceMappingResourcePatch.resourceMappings.find { + appearanceStringId = ResourceMappingPatch.resourceMappings.find { it.type == "string" && it.name == "app_theme_appearance_dark" }!!.id