-
-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(youtube): bump patches compatibility to v17.43.36 (#924)
- Loading branch information
OxrxL
authored
Nov 1, 2022
1 parent
3bfcf36
commit be07271
Showing
57 changed files
with
346 additions
and
293 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
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
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
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
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
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
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
22 changes: 11 additions & 11 deletions
22
...rds/fingerprints/AlbumCardsFingerprint.kt → ...ode/fingerprints/AlbumCardsFingerprint.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,29 +1,29 @@ | ||
package app.revanced.patches.youtube.layout.hidealbumcards.fingerprints | ||
package app.revanced.patches.youtube.layout.hidealbumcards.bytecode.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.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility | ||
import org.jf.dexlib2.AccessFlags | ||
import app.revanced.patches.youtube.layout.hidealbumcards.resource.patch.AlbumCardsResourcePatch | ||
import org.jf.dexlib2.Opcode | ||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction | ||
|
||
@Name("album-cards-view-fingerprint") | ||
@AlbumCardsCompatibility | ||
@Version("0.0.1") | ||
object AlbumCardsFingerprint : MethodFingerprint( | ||
"V", | ||
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, | ||
listOf("L", "L", "L", "L", "L", "L", "[B"), | ||
listOf( | ||
Opcode.INVOKE_DIRECT, | ||
Opcode.IPUT_OBJECT, | ||
Opcode.INVOKE_STATIC, | ||
opcodes = listOf( | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CONST, | ||
Opcode.CONST_4, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CHECK_CAST, | ||
) | ||
), | ||
customFingerprint = { methodDef -> | ||
methodDef.implementation?.instructions?.any { instruction -> | ||
instruction.opcode.ordinal == Opcode.CONST.ordinal && | ||
(instruction as? WideLiteralInstruction)?.wideLiteral == AlbumCardsResourcePatch.albumCardId | ||
} == true | ||
} | ||
) |
45 changes: 45 additions & 0 deletions
45
...tlin/app/revanced/patches/youtube/layout/hidealbumcards/bytecode/patch/AlbumCardsPatch.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.hidealbumcards.bytecode.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.addInstruction | ||
import app.revanced.patcher.extensions.instruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility | ||
import app.revanced.patches.youtube.layout.hidealbumcards.bytecode.fingerprints.AlbumCardsFingerprint | ||
import app.revanced.patches.youtube.layout.hidealbumcards.resource.patch.AlbumCardsResourcePatch | ||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch | ||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction | ||
|
||
@Patch | ||
@DependsOn([IntegrationsPatch::class, AlbumCardsResourcePatch::class]) | ||
@Name("hide-album-cards") | ||
@Description("Hides the album cards below the artist description.") | ||
@AlbumCardsCompatibility | ||
@Version("0.0.1") | ||
class AlbumCardsPatch : BytecodePatch( | ||
listOf( | ||
AlbumCardsFingerprint, | ||
) | ||
) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
val albumCardsResult = AlbumCardsFingerprint.result!! | ||
val albumCardsMethod = albumCardsResult.mutableMethod | ||
|
||
val checkCastAnchorIndex = albumCardsResult.scanResult.patternScanResult!!.endIndex | ||
|
||
albumCardsMethod.addInstruction( | ||
checkCastAnchorIndex + 1, """ | ||
invoke-static {v${(albumCardsMethod.instruction(checkCastAnchorIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideAlbumCardsPatch;->hideAlbumCards(Landroid/view/View;)V | ||
""" | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |
59 changes: 0 additions & 59 deletions
59
src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/patch/AlbumCardsPatch.kt
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
.../revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.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,42 @@ | ||
package app.revanced.patches.youtube.layout.hidealbumcards.resource.patch | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility | ||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch | ||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference | ||
|
||
@Name("hide-album-cards-resource-patch") | ||
@AlbumCardsCompatibility | ||
@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class]) | ||
@Version("0.0.1") | ||
class AlbumCardsResourcePatch : ResourcePatch { | ||
companion object { | ||
internal var albumCardId: Long = -1 | ||
} | ||
|
||
override fun execute(context: ResourceContext): PatchResult { | ||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( | ||
SwitchPreference( | ||
"revanced_hide_album_cards", | ||
StringResource("revanced_hide_album_cards_title", "Hide the album cards"), | ||
false, | ||
StringResource("revanced_hide_album_cards_summary_on", "Album cards is hidden"), | ||
StringResource("revanced_hide_album_cards_summary_off", "Album cards is visible") | ||
) | ||
) | ||
|
||
albumCardId = ResourceMappingResourcePatch.resourceMappings.single { | ||
it.type == "layout" && it.name == "album_card" | ||
}.id | ||
|
||
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
29 changes: 29 additions & 0 deletions
29
...es/youtube/layout/hidecrowdfundingbox/bytecode/fingerprints/CrowdfundingBoxFingerprint.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,29 @@ | ||
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.bytecode.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility | ||
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.resource.patch.CrowdfundingBoxResourcePatch | ||
import org.jf.dexlib2.Opcode | ||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction | ||
|
||
@Name("crowdfunding-box-view-parent-fingerprint") | ||
@CrowdfundingBoxCompatibility | ||
@Version("0.0.1") | ||
object CrowdfundingBoxFingerprint : MethodFingerprint( | ||
opcodes = listOf( | ||
Opcode.CONST_4, | ||
Opcode.CONST, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.IPUT_OBJECT, | ||
Opcode.CONST, | ||
), | ||
customFingerprint = { methodDef -> | ||
methodDef.implementation?.instructions?.any { instruction -> | ||
instruction.opcode.ordinal == Opcode.CONST.ordinal && | ||
(instruction as? WideLiteralInstruction)?.wideLiteral == CrowdfundingBoxResourcePatch.crowdfundingBoxId | ||
} == true | ||
} | ||
) |
Oops, something went wrong.