From 69490d7e838e8601d3d87c7b36cc58db3d826ce0 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 16 Jul 2022 17:32:03 +0200 Subject: [PATCH] refactor: simplify use of `dependencies` field in `Dependencies` annotations --- .../ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt | 4 +--- .../patch/HideInfocardSuggestionsPatch.kt | 2 +- .../patches/youtube/ad/video/patch/VideoAdsPatch.kt | 2 +- .../interaction/seekbar/patch/EnableSeekbarTappingPatch.kt | 2 +- .../patch/bytecode/SwipeControlsBytecodePatch.kt | 2 +- .../patches/youtube/layout/amoled/patch/AmoledPatch.kt | 6 +----- .../layout/autoplaybutton/patch/HideAutoplayButton.kt | 2 +- .../layout/branding/header/patch/PremiumHeadingPatch.kt | 6 ++---- .../layout/branding/icon/patch/CustomBrandingPatch.kt | 4 +--- .../youtube/layout/castbutton/patch/HideCastButtonPatch.kt | 2 +- .../layout/createbutton/patch/CreateButtonRemoverPatch.kt | 2 +- .../layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt | 2 +- .../layout/shorts/button/patch/ShortsButtonRemoverPatch.kt | 2 +- .../youtube/layout/watermark/patch/HideWatermarkPatch.kt | 2 +- .../layout/widesearchbar/patch/WideSearchbarPatch.kt | 2 +- .../youtube/misc/autorepeat/patch/AutoRepeatPatch.kt | 4 ++-- .../customplaybackspeed/patch/CustomPlaybackSpeedPatch.kt | 2 +- .../misc/microg/patch/bytecode/MicroGBytecodePatch.kt | 2 +- .../misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt | 2 +- .../youtube/misc/playertype/patch/PlayerTypeHookPatch.kt | 2 +- .../patches/youtube/misc/videoid/patch/VideoIdPatch.kt | 2 +- 21 files changed, 23 insertions(+), 33 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt index bb60474f7..0ade2cb3a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt @@ -38,9 +38,7 @@ import org.jf.dexlib2.iface.reference.StringReference import org.jf.dexlib2.immutable.reference.ImmutableMethodReference @Patch -@Dependencies( - dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class] -) +@Dependencies([ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class]) @Name("general-ads") @Description("Removes general ads in bytecode.") @GeneralAdsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/infocardsuggestions/patch/HideInfocardSuggestionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/infocardsuggestions/patch/HideInfocardSuggestionsPatch.kt index dfad49501..e11af2240 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/infocardsuggestions/patch/HideInfocardSuggestionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/infocardsuggestions/patch/HideInfocardSuggestionsPatch.kt @@ -21,7 +21,7 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction35c import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("hide-infocard-suggestions") @Description("Hides infocards in videos.") @HideInfocardSuggestionsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt index 6e4763e11..b4c5304ae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprin import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("video-ads") @Description("Removes ads in the YouTube video player.") @VideoAdsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt index 32ade7254..18a0da060 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt @@ -22,7 +22,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction11n import org.jf.dexlib2.iface.instruction.formats.Instruction35c @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("seekbar-tapping") @Description("Enables tapping on the seekbar of the YouTube player.") @SeekbarTappingCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt index 66516f3bb..03cb06208 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt @@ -23,7 +23,7 @@ import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch @SwipeControlsCompatibility @Version("0.0.2") @Dependencies( - dependencies = [ + [ IntegrationsPatch::class, PlayerTypeHookPatch::class, PlayerOverlaysHookPatch::class, diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt index 5a0c140fc..ff469aa78 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/amoled/patch/AmoledPatch.kt @@ -15,11 +15,7 @@ import org.w3c.dom.Element import java.io.File @Patch -@Dependencies( - dependencies = [ - FixLocaleConfigErrorPatch::class - ] -) +@Dependencies([FixLocaleConfigErrorPatch::class]) @Name("amoled") @Description("Enables pure black theme.") @AmoledCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt index b7b29cb60..2a2aaddd9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt @@ -18,7 +18,7 @@ import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProvider import org.jf.dexlib2.iface.instruction.WideLiteralInstruction @Patch -@Dependencies(dependencies = [ResourceIdMappingProviderResourcePatch::class]) +@Dependencies([ResourceIdMappingProviderResourcePatch::class]) @Name("hide-autoplay-button") @Description("Disables the autoplay button.") @AutoplayButtonCompatibility 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 7fbaf168c..a13ca2d0e 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 @@ -17,9 +17,7 @@ import java.nio.file.StandardCopyOption import kotlin.io.path.exists @Patch -@Dependencies( - dependencies = [FixLocaleConfigErrorPatch::class] -) +@Dependencies([FixLocaleConfigErrorPatch::class]) @Name("premium-heading") @Description("Shows premium branding on the YouTube home screen.") @PremiumHeadingCompatibility @@ -34,7 +32,7 @@ class PremiumHeadingPatch : ResourcePatch() { arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size -> val headingDirectory = resDirectory.resolve("drawable-$size") - modes.forEach {mode -> + modes.forEach { mode -> val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath() val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath() 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 740936eb0..a39afde21 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 @@ -15,9 +15,7 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc import java.nio.file.Files @Patch -@Dependencies( - dependencies = [FixLocaleConfigErrorPatch::class] -) +@Dependencies([FixLocaleConfigErrorPatch::class]) @Name("custom-branding") @Description("Changes the branding of YouTube.") @CustomBrandingCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt index a41e09fb6..e91b579d4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonComp import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("hide-cast-button") @Description("Hides the cast button.") @CastButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt index ca6121c60..50ef2f079 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/createbutton/patch/CreateButtonRemoverPatch.kt @@ -22,7 +22,7 @@ import org.jf.dexlib2.iface.instruction.WideLiteralInstruction import org.jf.dexlib2.iface.reference.MethodReference @Patch -@Dependencies(dependencies = [IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class]) +@Dependencies([IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class]) @Name("disable-create-button") @Description("Disables the create button.") @CreateButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt index 6fb1e3d50..0c35d4368 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt @@ -20,7 +20,7 @@ import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21t @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("old-quality-layout") @Description("Enables the original quality flyout menu.") @OldQualityLayoutCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt index a0452fd36..9cd0c489a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/button/patch/ShortsButtonRemoverPatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("hide-shorts-button") @Description("Hides the shorts button.") @ShortsButtonCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt index 1b81e9de2..77de2903c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt @@ -19,7 +19,7 @@ import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkF import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch @Patch -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("hide-watermark") @Description("Hides the creator's watermark on videos.") @HideWatermarkCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt index 2bf2b9bcb..40c510608 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt @@ -21,7 +21,7 @@ import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch @Patch(include = false) -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("enable-wide-searchbar") @Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.") @WideSearchbarCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt index 8d567d59d..6e21fbca3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt @@ -19,7 +19,7 @@ import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParen import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch @Patch(include = false) -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @Name("autorepeat-by-default") @Description("Enables auto repeating of videos by default.") @AutoRepeatCompatibility @@ -61,7 +61,7 @@ class AutoRepeatPatch : BytecodePatch( //Since addInstructions needs an index which starts counting at 0 and size starts counting at 1, //we have to remove 1 to get the latest instruction - val index = implementation.instructions.size-1 + val index = implementation.instructions.size - 1 //remove last instruction which is return-void diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/customplaybackspeed/patch/CustomPlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/customplaybackspeed/patch/CustomPlaybackSpeedPatch.kt index 71b9302fa..72afece64 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/customplaybackspeed/patch/CustomPlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/customplaybackspeed/patch/CustomPlaybackSpeedPatch.kt @@ -25,7 +25,7 @@ import org.jf.dexlib2.iface.reference.MethodReference @Patch @Name("custom-playback-speed") @Description("Allows to change the default playback speed options.") -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) @CustomPlaybackSpeedCompatibility @Version("0.0.1") class CustomPlaybackSpeedPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt index b935ab6bf..25dcf49ef 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt @@ -30,7 +30,7 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference @Patch @Dependencies( - dependencies = [ + [ MicroGResourcePatch::class, HideCastButtonPatch::class, FixLocaleConfigErrorPatch::class diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt index d3e3c7681..42e32f03e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.playeroverlay.fingerprint.PlayerOverlay @Description("hook for adding custom overlays to the video player.") @PlayerOverlaysHookCompatibility @Version("0.0.1") -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) class PlayerOverlaysHookPatch : BytecodePatch( listOf( PlayerOverlaysOnFinishInflateFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt index bd122fe99..6e714ad52 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.playertype.fingerprint.UpdatePlayerType @Description("hook to get the current player type of WatchWhileActivity") @PlayerTypeHookCompatibility @Version("0.0.1") -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) class PlayerTypeHookPatch : BytecodePatch( listOf( UpdatePlayerTypeFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/patch/VideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/patch/VideoIdPatch.kt index 028a38734..1057da4be 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/patch/VideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/patch/VideoIdPatch.kt @@ -18,7 +18,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction11x @Description("hook to detect when the video id changes") @VideoIdCompatibility @Version("0.0.1") -@Dependencies(dependencies = [IntegrationsPatch::class]) +@Dependencies([IntegrationsPatch::class]) class VideoIdPatch : BytecodePatch( listOf( VideoIdFingerprint