refactor: remove unused imports and merge packages together (#136)

This commit is contained in:
TheJeterLP 2022-07-08 21:17:50 +02:00 committed by GitHub
parent ac1b645ae3
commit 9f75d66e83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 33 deletions

View File

@ -4,10 +4,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.extensions.removeInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
@ -15,18 +13,12 @@ import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toBuilderInstruction
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsFingerprint
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsParentFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodone
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
@ -7,6 +7,7 @@ import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMetho
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.widesearchbar.annotations.WideSearchbarCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -15,7 +16,7 @@ import org.jf.dexlib2.Opcode
"Ljkg;", "i"
)
@DirectPatternScanMethod
@HideReelsCompatibility
@WideSearchbarCompatibility
@Version("0.0.1")
/*

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodone
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
@ -7,6 +7,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.widesearchbar.annotations.WideSearchbarCompatibility
import org.jf.dexlib2.AccessFlags
@Name("wide-searchbar-methodone-parent-fingerprint")
@ -14,7 +15,7 @@ import org.jf.dexlib2.AccessFlags
"Ljkg;", "l"
)
@FuzzyPatternScanMethod(3)
@HideReelsCompatibility
@WideSearchbarCompatibility
@Version("0.0.1")
/*

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodtwo
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
@ -7,6 +7,7 @@ import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMetho
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.widesearchbar.annotations.WideSearchbarCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -15,7 +16,7 @@ import org.jf.dexlib2.Opcode
"Lkrf;", "h"
)
@DirectPatternScanMethod
@HideReelsCompatibility
@WideSearchbarCompatibility
@Version("0.0.1")
/*

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodtwo
package app.revanced.patches.youtube.layout.widesearchbar.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
@ -7,6 +7,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.widesearchbar.annotations.WideSearchbarCompatibility
import org.jf.dexlib2.AccessFlags
@Name("wide-searchbar-methodtwo-parent-fingerprint")
@ -14,7 +15,7 @@ import org.jf.dexlib2.AccessFlags
"Lkrf;", "i"
)
@FuzzyPatternScanMethod(3)
@HideReelsCompatibility
@WideSearchbarCompatibility
@Version("0.0.1")
/*

View File

@ -14,10 +14,10 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.layout.widesearchbar.annotations.WideSearchbarCompatibility
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodone.WideSearchbarOneFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodone.WideSearchbarOneParentFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodtwo.WideSearchbarTwoFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.methodtwo.WideSearchbarTwoParentFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarOneFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarOneParentFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarTwoFingerprint
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarTwoParentFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch(include = false)
@ -39,7 +39,7 @@ class WideSearchbarPatch : BytecodePatch(
//This should be the method aF in class fbn
val targetMethodOne =
data.toMethodWalker(resultOne!!.method).nextMethod(resultOne!!.patternScanResult!!.endIndex, true).getMethod() as MutableMethod
data.toMethodWalker(resultOne!!.method).nextMethod(resultOne.patternScanResult!!.endIndex, true).getMethod() as MutableMethod
//Since both methods have the same smali code, inject instructions using a method.
addInstructions(targetMethodOne)
@ -48,7 +48,7 @@ class WideSearchbarPatch : BytecodePatch(
//This should be the method aB in class fbn
val targetMethodTwo =
data.toMethodWalker(resultTwo!!.method).nextMethod(resultTwo!!.patternScanResult!!.startIndex, true).getMethod() as MutableMethod
data.toMethodWalker(resultTwo!!.method).nextMethod(resultTwo.patternScanResult!!.startIndex, true).getMethod() as MutableMethod
//Since both methods have the same smali code, inject instructions using a method.
addInstructions(targetMethodTwo)

View File

@ -1,20 +1,17 @@
package app.revanced.patches.youtube.misc.hdrbrightness.patch;
package app.revanced.patches.youtube.misc.hdrbrightness.patch
import app.revanced.patcher.annotation.Description;
import app.revanced.patcher.annotation.Name;
import app.revanced.patcher.annotation.Version;
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch;
import app.revanced.patcher.patch.impl.BytecodePatch;
import app.revanced.patcher.util.smali.toBuilderInstruction
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility;
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprint
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@ -35,7 +32,7 @@ class HDRBrightnessPatch : BytecodePatch(
val method = result.mutableMethod
//Get the index here so we know where to inject our code to override -1.0f
//Get the index here, so we know where to inject our code to override -1.0f
val index = method.implementation!!.instructions.indexOfFirst { ((it as? NarrowLiteralInstruction)?.narrowLiteral == (-1.0f).toRawBits()) }
val register = (method.implementation!!.instructions.get(index) as OneRegisterInstruction).registerA