mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(YouTube - SponsorBlock): After the skip button is automatically hidden, makes the visibility of the skip button match the player control's (#142)
* ci: workflow to ping Discord users when patches are released (#72)
* init: Workflow to notify discord users of releases
* Rename workflow
* chore (Background playback): Shorten description
* Revert "chore (Background playback): Shorten description"
This reverts commit 10661b870f
.
* Change message contents
* feat(YouTube - SponsorBlock): Display skip segment button when player controls are shown
Closes https://github.com/anddea/revanced-patches/issues/962
* feat: Apply code review suggestions
---------
Co-authored-by: KobeW50 <84587632+KobeW50@users.noreply.github.com>
Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
Co-authored-by: Aaron Veil <70171475+anddea@users.noreply.github.com>
This commit is contained in:
@ -201,25 +201,25 @@ private fun MutableMethod.initializeHook(classDescriptor: String) =
|
||||
"invoke-static {p0}, $classDescriptor->initialize(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
private fun changeVisibilityHook(classDescriptor: String) =
|
||||
internal fun changeVisibilityHook(classDescriptor: String) =
|
||||
changeVisibilityMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static {p0, p1}, $classDescriptor->changeVisibility(ZZ)V"
|
||||
)
|
||||
|
||||
private fun changeVisibilityNegatedImmediateHook(classDescriptor: String) =
|
||||
internal fun changeVisibilityNegatedImmediateHook(classDescriptor: String) =
|
||||
changeVisibilityNegatedImmediatelyMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, $classDescriptor->changeVisibilityNegatedImmediate()V"
|
||||
)
|
||||
|
||||
fun hookBottomControlButton(classDescriptor: String) {
|
||||
internal fun hookBottomControlButton(classDescriptor: String) {
|
||||
initializeBottomControlButtonMethod.initializeHook(classDescriptor)
|
||||
changeVisibilityHook(classDescriptor)
|
||||
changeVisibilityNegatedImmediateHook(classDescriptor)
|
||||
}
|
||||
|
||||
fun hookTopControlButton(classDescriptor: String) {
|
||||
internal fun hookTopControlButton(classDescriptor: String) {
|
||||
initializeTopControlButtonMethod.initializeHook(classDescriptor)
|
||||
changeVisibilityHook(classDescriptor)
|
||||
changeVisibilityNegatedImmediateHook(classDescriptor)
|
||||
|
@ -12,6 +12,8 @@ import app.revanced.patches.youtube.utils.extension.Constants.EXTENSION_PATH
|
||||
import app.revanced.patches.youtube.utils.extension.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.patch.PatchList.SPONSORBLOCK
|
||||
import app.revanced.patches.youtube.utils.playercontrols.addTopControl
|
||||
import app.revanced.patches.youtube.utils.playercontrols.changeVisibilityHook
|
||||
import app.revanced.patches.youtube.utils.playercontrols.changeVisibilityNegatedImmediateHook
|
||||
import app.revanced.patches.youtube.utils.playercontrols.hookTopControlButton
|
||||
import app.revanced.patches.youtube.utils.playercontrols.playerControlsPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.insetOverlayViewLayout
|
||||
@ -111,10 +113,17 @@ val sponsorBlockBytecodePatch = bytecodePatch(
|
||||
}
|
||||
|
||||
// Voting & Shield button
|
||||
setOf("CreateSegmentButtonController;", "VotingButtonController;").forEach { className ->
|
||||
setOf(
|
||||
"CreateSegmentButtonController;",
|
||||
"VotingButtonController;"
|
||||
).forEach { className ->
|
||||
hookTopControlButton("$EXTENSION_SPONSOR_BLOCK_UI_PATH/$className")
|
||||
}
|
||||
|
||||
// Skip button
|
||||
changeVisibilityHook(EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR)
|
||||
changeVisibilityNegatedImmediateHook(EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR)
|
||||
|
||||
// Append timestamp
|
||||
totalTimeFingerprint.methodOrThrow().apply {
|
||||
val targetIndex = indexOfFirstInstructionOrThrow {
|
||||
|
Reference in New Issue
Block a user