forked from inotia00/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube/Hide feed components):
Hide related videos
setting hide…
…s the player flyout component
- Loading branch information
Showing
4 changed files
with
59 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
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/app/revanced/patches/youtube/utils/bottomsheet/BottomSheetHookPatch.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,39 @@ | ||
package app.revanced.patches.youtube.utils.bottomsheet | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.youtube.utils.bottomsheet.fingerprint.BottomSheetBehaviorFingerprint | ||
import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH | ||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch | ||
import app.revanced.util.findMethodOrThrow | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch(dependencies = [SharedResourceIdPatch::class]) | ||
object BottomSheetHookPatch : BytecodePatch( | ||
setOf(BottomSheetBehaviorFingerprint) | ||
) { | ||
private const val INTEGRATIONS_BOTTOM_SHEET_HOOK_CLASS_DESCRIPTOR = | ||
"$UTILS_PATH/BottomSheetHookPatch;" | ||
|
||
override fun execute(context: BytecodeContext) { | ||
|
||
// region patch for set player type | ||
|
||
val bottomSheetClass = | ||
BottomSheetBehaviorFingerprint.resultOrThrow().mutableMethod.definingClass | ||
|
||
arrayOf( | ||
"onAttachedToWindow", | ||
"onDetachedFromWindow" | ||
).forEach { methodName -> | ||
context.findMethodOrThrow(bottomSheetClass) { | ||
name == methodName | ||
}.addInstruction( | ||
1, | ||
"invoke-static {}, $INTEGRATIONS_BOTTOM_SHEET_HOOK_CLASS_DESCRIPTOR->$methodName()V" | ||
) | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
.../revanced/patches/youtube/utils/bottomsheet/fingerprint/BottomSheetBehaviorFingerprint.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,9 @@ | ||
package app.revanced.patches.youtube.utils.bottomsheet.fingerprint | ||
|
||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DesignBottomSheet | ||
import app.revanced.util.fingerprint.LiteralValueFingerprint | ||
|
||
internal object BottomSheetBehaviorFingerprint : LiteralValueFingerprint( | ||
returnType = "V", | ||
literalSupplier = { DesignBottomSheet } | ||
) |
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