Skip to content

Commit

Permalink
feat: Dependencies annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 3, 2022
1 parent 52f9147 commit 85806bb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
Expand All @@ -20,7 +21,8 @@ import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorS
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.AccessFlags

@Patch(dependencies = [IntegrationsPatch::class])
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("video-ads")
@Description("Patch to remove ads in the YouTube video player.")
@VideoAdsCompatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
Expand All @@ -21,8 +22,8 @@ import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
import org.jf.dexlib2.iface.instruction.formats.Instruction35c


@Patch(dependencies = [IntegrationsPatch::class])
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("seekbar-tapping")
@Description("Enable tapping on the seekbar of the YouTube player.")
@SeekbarTappingCompatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
Expand All @@ -13,7 +14,8 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc
import org.w3c.dom.Element
import java.io.File

@Patch(
@Patch
@Dependencies(
dependencies = [
FixLocaleConfigErrorPatch::class
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
Expand All @@ -16,7 +17,8 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction35c

@Patch(dependencies = [IntegrationsPatch::class])
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("disable-create-button")
@Description("Disable the create button.")
@CreateButtonCompatibility
Expand All @@ -32,8 +34,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
// Get the required register which holds the view object we need to pass to the method hideCreateButton
val implementation = result.method.implementation!!
val instruction = implementation.instructions[result.scanResult.endIndex + 1]
if (instruction.opcode != Opcode.INVOKE_STATIC)
return PatchResultError("Could not find the correct register")
if (instruction.opcode != Opcode.INVOKE_STATIC) return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC

// Hide the button view via proxy by passing it to the hideCreateButton method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
Expand All @@ -22,7 +23,8 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t

@Patch(dependencies = [IntegrationsPatch::class])
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("old-quality-layout")
@Description("Enable the original quality flyout menu.")
@OldQualityLayoutCompatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
Expand All @@ -15,7 +16,8 @@ import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButt
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.formats.Instruction11x

@Patch(dependencies = [IntegrationsPatch::class])
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("shorts-button")
@Description("Hide the shorts button.")
@ShortsButtonCompatibility
Expand Down

0 comments on commit 85806bb

Please sign in to comment.