generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: some more refactoring of integrations, add hide-watermark patch (#…
…63) * refactor: integrations * add HideWatermark patch * add hidewatermark patch * fix bug * use latest patcher version * Fix sig name * update to fingerprints * make cleaner patch * add 17.24.35 support for hide-watermark
- Loading branch information
1 parent
a7ee89d
commit feb09c5
Showing
6 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...n/app/revanced/patches/youtube/layout/watermark/annotations/HideWaterwarkCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.watermark.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class HideWatermarkCompatibility |
21 changes: 21 additions & 0 deletions
21
...in/app/revanced/patches/youtube/layout/watermark/fingerprints/HideWatermarkFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package app.revanced.patches.youtube.layout.watermark.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("hide-watermark-signature") | ||
@MatchingMethod( | ||
"Ljvy;", "<init>" | ||
) | ||
@FuzzyPatternScanMethod(3) | ||
@HideWatermarkCompatibility | ||
@Version("0.0.1") | ||
object HideWatermarkFingerprint : MethodFingerprint ( | ||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"), null ,null, null | ||
) |
21 changes: 21 additions & 0 deletions
21
.../revanced/patches/youtube/layout/watermark/fingerprints/HideWatermarkParentFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package app.revanced.patches.youtube.layout.watermark.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
@Name("hide-watermark-parent-signature") | ||
@MatchingMethod( | ||
"Ljvy;", "<init>" | ||
) | ||
@FuzzyPatternScanMethod(3) | ||
@HideWatermarkCompatibility | ||
@Version("0.0.1") | ||
object HideWatermarkParentFingerprint : MethodFingerprint ( | ||
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, null, null, listOf("player_overlay_in_video_programming"), null | ||
) |
51 changes: 51 additions & 0 deletions
51
src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package app.revanced.patches.youtube.layout.watermark.patch | ||
|
||
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.extensions.removeInstructions | ||
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultError | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Dependencies | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.impl.BytecodePatch | ||
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility | ||
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkParentFingerprint | ||
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkFingerprint | ||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch | ||
|
||
@Patch | ||
@Dependencies(dependencies = [IntegrationsPatch::class]) | ||
@Name("hide-watermark") | ||
@Description("Hide Watermark on the page.") | ||
@HideWatermarkCompatibility | ||
@Version("0.0.1") | ||
class HideWatermarkPatch : BytecodePatch( | ||
listOf( | ||
HideWatermarkParentFingerprint | ||
) | ||
) { | ||
override fun execute(data: BytecodeData): PatchResult { | ||
HideWatermarkFingerprint.resolve(data, HideWatermarkParentFingerprint.result!!.classDef) | ||
val result = HideWatermarkFingerprint.result | ||
?: return PatchResultError("Required parent method could not be found.") | ||
|
||
val method = result.mutableMethod | ||
val line = method.implementation!!.instructions.size - 5 | ||
|
||
method.removeInstruction(line) | ||
method.addInstructions( | ||
line, """ | ||
invoke-static {}, Lapp/revanced/integrations/patches/BrandingWaterMarkPatch;->isBrandingWatermarkShown()Z | ||
move-result p2 | ||
""" | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters