-
-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(youtube/hide-shorts-button): bump compatibility to v17.45.36
- Loading branch information
Showing
7 changed files
with
111 additions
and
76 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
.../annotations/ShortsButtonCompatibility.kt → ...tbar/annotations/PivotBarCompatibility.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.pivotbar.shortsbutton.annotations | ||
package app.revanced.patches.youtube.layout.pivotbar.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.36.37", "17.41.37", "17.42.35", "17.43.36") | ||
"com.google.android.youtube", arrayOf("17.36.37", "17.41.37", "17.42.35", "17.43.36", "17.45.36") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class ShortsButtonCompatibility | ||
internal annotation class PivotBarCompatibility |
15 changes: 15 additions & 0 deletions
15
...app/revanced/patches/youtube/layout/pivotbar/fingerprints/InitializeButtonsFingerprint.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,15 @@ | ||
package app.revanced.patches.youtube.layout.pivotbar.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.pivotbar.resource.patch.ResolvePivotBarFingerprintsPatch | ||
import org.jf.dexlib2.Opcode | ||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction | ||
|
||
object InitializeButtonsFingerprint : MethodFingerprint( | ||
customFingerprint = { methodDef -> | ||
methodDef.implementation?.instructions?.any { | ||
it.opcode == Opcode.CONST && (it as WideLiteralInstruction).wideLiteral == | ||
ResolvePivotBarFingerprintsPatch.imageOnlyTabResourceId | ||
} == true | ||
} | ||
) |
10 changes: 10 additions & 0 deletions
10
...p/revanced/patches/youtube/layout/pivotbar/fingerprints/PivotBarConstructorFingerprint.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,10 @@ | ||
package app.revanced.patches.youtube.layout.pivotbar.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
object PivotBarConstructorFingerprint : MethodFingerprint( | ||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, | ||
strings = listOf("com.google.android.apps.youtube.app.endpoint.flags") | ||
) |
44 changes: 0 additions & 44 deletions
44
...n/kotlin/app/revanced/patches/youtube/layout/pivotbar/fingerprints/PivotBarFingerprint.kt
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...vanced/patches/youtube/layout/pivotbar/resource/patch/ResolvePivotBarFingerprintsPatch.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,45 @@ | ||
package app.revanced.patches.youtube.layout.pivotbar.resource.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultError | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch | ||
import app.revanced.patches.youtube.layout.pivotbar.annotations.PivotBarCompatibility | ||
import app.revanced.patches.youtube.layout.pivotbar.fingerprints.InitializeButtonsFingerprint | ||
import app.revanced.patches.youtube.layout.pivotbar.fingerprints.PivotBarConstructorFingerprint | ||
import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.toErrorResult | ||
|
||
@DependsOn([ResourceMappingPatch::class]) | ||
@PivotBarCompatibility | ||
@Description("Resolves necessary fingerprints.") | ||
@Version("0.0.1") | ||
class ResolvePivotBarFingerprintsPatch : BytecodePatch( | ||
listOf(PivotBarConstructorFingerprint) | ||
) { | ||
internal companion object { | ||
var imageOnlyTabResourceId: Long = -1 | ||
} | ||
|
||
override fun execute(context: BytecodeContext): PatchResult { | ||
// imageOnlyTabResourceId is used in InitializeButtonsFingerprint fingerprint | ||
ResourceMappingPatch.resourceMappings.find { it.type == "layout" && it.name == "image_only_tab" } | ||
?.let { imageOnlyTabResourceId = it.id } ?: return PatchResultError("Failed to find resource") | ||
|
||
PivotBarConstructorFingerprint.result?.let { | ||
// Resolve InitializeButtonsFingerprint on the class of the method | ||
// which PivotBarConstructorFingerprint resolved to | ||
if (!InitializeButtonsFingerprint.resolve( | ||
context, | ||
it.classDef | ||
) | ||
) return InitializeButtonsFingerprint.toErrorResult() | ||
} ?: return PivotBarConstructorFingerprint.toErrorResult() | ||
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
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