refactor: simplify use of dependencies field in Dependencies annotations

This commit is contained in:
oSumAtrIX 2022-07-16 17:32:03 +02:00
parent e01915cdee
commit 69490d7e83
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
21 changed files with 23 additions and 33 deletions

View file

@ -38,9 +38,7 @@ import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
@Patch @Patch
@Dependencies( @Dependencies([ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class])
dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class]
)
@Name("general-ads") @Name("general-ads")
@Description("Removes general ads in bytecode.") @Description("Removes general ads in bytecode.")
@GeneralAdsCompatibility @GeneralAdsCompatibility

View file

@ -21,7 +21,7 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("hide-infocard-suggestions") @Name("hide-infocard-suggestions")
@Description("Hides infocards in videos.") @Description("Hides infocards in videos.")
@HideInfocardSuggestionsCompatibility @HideInfocardSuggestionsCompatibility

View file

@ -17,7 +17,7 @@ import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprin
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("video-ads") @Name("video-ads")
@Description("Removes ads in the YouTube video player.") @Description("Removes ads in the YouTube video player.")
@VideoAdsCompatibility @VideoAdsCompatibility

View file

@ -22,7 +22,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction11n
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("seekbar-tapping") @Name("seekbar-tapping")
@Description("Enables tapping on the seekbar of the YouTube player.") @Description("Enables tapping on the seekbar of the YouTube player.")
@SeekbarTappingCompatibility @SeekbarTappingCompatibility

View file

@ -23,7 +23,7 @@ import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
@SwipeControlsCompatibility @SwipeControlsCompatibility
@Version("0.0.2") @Version("0.0.2")
@Dependencies( @Dependencies(
dependencies = [ [
IntegrationsPatch::class, IntegrationsPatch::class,
PlayerTypeHookPatch::class, PlayerTypeHookPatch::class,
PlayerOverlaysHookPatch::class, PlayerOverlaysHookPatch::class,

View file

@ -15,11 +15,7 @@ import org.w3c.dom.Element
import java.io.File import java.io.File
@Patch @Patch
@Dependencies( @Dependencies([FixLocaleConfigErrorPatch::class])
dependencies = [
FixLocaleConfigErrorPatch::class
]
)
@Name("amoled") @Name("amoled")
@Description("Enables pure black theme.") @Description("Enables pure black theme.")
@AmoledCompatibility @AmoledCompatibility

View file

@ -18,7 +18,7 @@ import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProvider
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
@Patch @Patch
@Dependencies(dependencies = [ResourceIdMappingProviderResourcePatch::class]) @Dependencies([ResourceIdMappingProviderResourcePatch::class])
@Name("hide-autoplay-button") @Name("hide-autoplay-button")
@Description("Disables the autoplay button.") @Description("Disables the autoplay button.")
@AutoplayButtonCompatibility @AutoplayButtonCompatibility

View file

@ -17,9 +17,7 @@ import java.nio.file.StandardCopyOption
import kotlin.io.path.exists import kotlin.io.path.exists
@Patch @Patch
@Dependencies( @Dependencies([FixLocaleConfigErrorPatch::class])
dependencies = [FixLocaleConfigErrorPatch::class]
)
@Name("premium-heading") @Name("premium-heading")
@Description("Shows premium branding on the YouTube home screen.") @Description("Shows premium branding on the YouTube home screen.")
@PremiumHeadingCompatibility @PremiumHeadingCompatibility
@ -34,7 +32,7 @@ class PremiumHeadingPatch : ResourcePatch() {
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size -> arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size ->
val headingDirectory = resDirectory.resolve("drawable-$size") val headingDirectory = resDirectory.resolve("drawable-$size")
modes.forEach {mode -> modes.forEach { mode ->
val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath() val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath()
val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath() val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath()

View file

@ -15,9 +15,7 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc
import java.nio.file.Files import java.nio.file.Files
@Patch @Patch
@Dependencies( @Dependencies([FixLocaleConfigErrorPatch::class])
dependencies = [FixLocaleConfigErrorPatch::class]
)
@Name("custom-branding") @Name("custom-branding")
@Description("Changes the branding of YouTube.") @Description("Changes the branding of YouTube.")
@CustomBrandingCompatibility @CustomBrandingCompatibility

View file

@ -14,7 +14,7 @@ import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonComp
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("hide-cast-button") @Name("hide-cast-button")
@Description("Hides the cast button.") @Description("Hides the cast button.")
@CastButtonCompatibility @CastButtonCompatibility

View file

@ -22,7 +22,7 @@ import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.iface.reference.MethodReference import org.jf.dexlib2.iface.reference.MethodReference
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class]) @Dependencies([IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class])
@Name("disable-create-button") @Name("disable-create-button")
@Description("Disables the create button.") @Description("Disables the create button.")
@CreateButtonCompatibility @CreateButtonCompatibility

View file

@ -20,7 +20,7 @@ import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("old-quality-layout") @Name("old-quality-layout")
@Description("Enables the original quality flyout menu.") @Description("Enables the original quality flyout menu.")
@OldQualityLayoutCompatibility @OldQualityLayoutCompatibility

View file

@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("hide-shorts-button") @Name("hide-shorts-button")
@Description("Hides the shorts button.") @Description("Hides the shorts button.")
@ShortsButtonCompatibility @ShortsButtonCompatibility

View file

@ -19,7 +19,7 @@ import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkF
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("hide-watermark") @Name("hide-watermark")
@Description("Hides the creator's watermark on videos.") @Description("Hides the creator's watermark on videos.")
@HideWatermarkCompatibility @HideWatermarkCompatibility

View file

@ -21,7 +21,7 @@ import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch(include = false) @Patch(include = false)
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("enable-wide-searchbar") @Name("enable-wide-searchbar")
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.") @Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
@WideSearchbarCompatibility @WideSearchbarCompatibility

View file

@ -19,7 +19,7 @@ import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParen
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch(include = false) @Patch(include = false)
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@Name("autorepeat-by-default") @Name("autorepeat-by-default")
@Description("Enables auto repeating of videos by default.") @Description("Enables auto repeating of videos by default.")
@AutoRepeatCompatibility @AutoRepeatCompatibility
@ -61,7 +61,7 @@ class AutoRepeatPatch : BytecodePatch(
//Since addInstructions needs an index which starts counting at 0 and size starts counting at 1, //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 //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 //remove last instruction which is return-void

View file

@ -25,7 +25,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
@Patch @Patch
@Name("custom-playback-speed") @Name("custom-playback-speed")
@Description("Allows to change the default playback speed options.") @Description("Allows to change the default playback speed options.")
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
@CustomPlaybackSpeedCompatibility @CustomPlaybackSpeedCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomPlaybackSpeedPatch : BytecodePatch( class CustomPlaybackSpeedPatch : BytecodePatch(

View file

@ -30,7 +30,7 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@Patch @Patch
@Dependencies( @Dependencies(
dependencies = [ [
MicroGResourcePatch::class, MicroGResourcePatch::class,
HideCastButtonPatch::class, HideCastButtonPatch::class,
FixLocaleConfigErrorPatch::class FixLocaleConfigErrorPatch::class

View file

@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.playeroverlay.fingerprint.PlayerOverlay
@Description("hook for adding custom overlays to the video player.") @Description("hook for adding custom overlays to the video player.")
@PlayerOverlaysHookCompatibility @PlayerOverlaysHookCompatibility
@Version("0.0.1") @Version("0.0.1")
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
class PlayerOverlaysHookPatch : BytecodePatch( class PlayerOverlaysHookPatch : BytecodePatch(
listOf( listOf(
PlayerOverlaysOnFinishInflateFingerprint PlayerOverlaysOnFinishInflateFingerprint

View file

@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.playertype.fingerprint.UpdatePlayerType
@Description("hook to get the current player type of WatchWhileActivity") @Description("hook to get the current player type of WatchWhileActivity")
@PlayerTypeHookCompatibility @PlayerTypeHookCompatibility
@Version("0.0.1") @Version("0.0.1")
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
class PlayerTypeHookPatch : BytecodePatch( class PlayerTypeHookPatch : BytecodePatch(
listOf( listOf(
UpdatePlayerTypeFingerprint UpdatePlayerTypeFingerprint

View file

@ -18,7 +18,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction11x
@Description("hook to detect when the video id changes") @Description("hook to detect when the video id changes")
@VideoIdCompatibility @VideoIdCompatibility
@Version("0.0.1") @Version("0.0.1")
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies([IntegrationsPatch::class])
class VideoIdPatch : BytecodePatch( class VideoIdPatch : BytecodePatch(
listOf( listOf(
VideoIdFingerprint VideoIdFingerprint