mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-30 14:44:30 +02:00
feat(youtube): add hide-suggested-video-overlay
patch
This commit is contained in:
parent
eaced9527e
commit
b03dee0549
@ -116,6 +116,7 @@ class HideFilmstripOverlayPatch : BytecodePatch(
|
|||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
arrayOf(
|
arrayOf(
|
||||||
"PREFERENCE: PLAYER_SETTINGS",
|
"PREFERENCE: PLAYER_SETTINGS",
|
||||||
|
"SETTINGS: PLAYER_EXPERIMENTAL_FLAGS",
|
||||||
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
|
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package app.revanced.patches.youtube.player.suggestedvideooverlay.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.CoreContainer
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object CoreConatinerBuilderFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Landroid/view/View;",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("Landroid/content/Context;"),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.isWideLiteralExists(
|
||||||
|
CoreContainer
|
||||||
|
)
|
||||||
|
})
|
@ -0,0 +1,81 @@
|
|||||||
|
package app.revanced.patches.youtube.player.suggestedvideooverlay.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
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.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
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.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.player.suggestedvideooverlay.fingerprints.CoreConatinerBuilderFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.CoreContainer
|
||||||
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
|
import app.revanced.util.integrations.Constants.PLAYER
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("Hide suggested video overlay")
|
||||||
|
@Description("Hide the suggested video overlay to play next.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
SettingsPatch::class,
|
||||||
|
SharedResourceIdPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class SuggestedVideoOverlayPatch : BytecodePatch(
|
||||||
|
listOf(CoreConatinerBuilderFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
CoreConatinerBuilderFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val targetIndex = getWideLiteralIndex(CoreContainer) + 4
|
||||||
|
val targetReference =
|
||||||
|
getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||||
|
|
||||||
|
if (!targetReference.toString().endsWith("Landroid/view/ViewGroup;"))
|
||||||
|
return PatchResultError("Reference did not match: $targetReference")
|
||||||
|
|
||||||
|
val targetRegister =
|
||||||
|
getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
targetIndex,
|
||||||
|
"invoke-static {v$targetRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return CoreConatinerBuilderFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"PREFERENCE: PLAYER_SETTINGS",
|
||||||
|
"SETTINGS: PLAYER_EXPERIMENTAL_FLAGS",
|
||||||
|
"SETTINGS: HIDE_SUGGESTED_VIDEO_OVERLAY"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("hide-suggested-video-overlay")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"$PLAYER->hideSuggestedVideoOverlay(Landroid/view/ViewGroup;)V"
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
var ChannelListSubMenu: Long = -1
|
var ChannelListSubMenu: Long = -1
|
||||||
var CompactLink: Long = -1
|
var CompactLink: Long = -1
|
||||||
var ControlsLayoutStub: Long = -1
|
var ControlsLayoutStub: Long = -1
|
||||||
|
var CoreContainer: Long = -1
|
||||||
var DislikeButton: Long = -1
|
var DislikeButton: Long = -1
|
||||||
var DonationCompanion: Long = -1
|
var DonationCompanion: Long = -1
|
||||||
var EasySeekEduContainer: Long = -1
|
var EasySeekEduContainer: Long = -1
|
||||||
@ -105,6 +106,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
||||||
CompactLink = find(LAYOUT, "compact_link")
|
CompactLink = find(LAYOUT, "compact_link")
|
||||||
ControlsLayoutStub = find(ID, "controls_layout_stub")
|
ControlsLayoutStub = find(ID, "controls_layout_stub")
|
||||||
|
CoreContainer = find(ID, "core_container")
|
||||||
DislikeButton = find(ID, "dislike_button")
|
DislikeButton = find(ID, "dislike_button")
|
||||||
DonationCompanion = find(LAYOUT, "donation_companion")
|
DonationCompanion = find(LAYOUT, "donation_companion")
|
||||||
EasySeekEduContainer = find(ID, "easy_seek_edu_container")
|
EasySeekEduContainer = find(ID, "easy_seek_edu_container")
|
||||||
|
@ -481,6 +481,9 @@ Only available on YouTube v18.24.37+"</string>
|
|||||||
- Shopping
|
- Shopping
|
||||||
- Watch it Again"</string>
|
- Watch it Again"</string>
|
||||||
<string name="revanced_hide_suggestions_shelf_title">Hide suggestions shelf</string>
|
<string name="revanced_hide_suggestions_shelf_title">Hide suggestions shelf</string>
|
||||||
|
<string name="revanced_hide_suggested_video_overlay_summary">"Hides suggested video overlay to play next
|
||||||
|
Known issue: autoplay does not work"</string>
|
||||||
|
<string name="revanced_hide_suggested_video_overlay_title">Hide suggested video overlay</string>
|
||||||
<string name="revanced_hide_ticket_shelf_summary_off">Ticket shelves are shown</string>
|
<string name="revanced_hide_ticket_shelf_summary_off">Ticket shelves are shown</string>
|
||||||
<string name="revanced_hide_ticket_shelf_summary_on">Ticket shelves are hidden</string>
|
<string name="revanced_hide_ticket_shelf_summary_on">Ticket shelves are hidden</string>
|
||||||
<string name="revanced_hide_ticket_shelf_title">Hide ticket shelf</string>
|
<string name="revanced_hide_ticket_shelf_title">Hide ticket shelf</string>
|
||||||
|
@ -307,6 +307,7 @@
|
|||||||
<Preference android:title="hide-quick-actions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-quick-actions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-seek-message" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-seek-message" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-speed-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-speed-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
<Preference android:title="hide-suggested-video-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_general" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_general" />
|
||||||
<Preference android:title="disable-auto-captions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="disable-auto-captions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
@ -495,10 +496,15 @@
|
|||||||
<!-- SETTINGS: HIDE_YOUTUBE_MUSIC_BUTTON
|
<!-- SETTINGS: HIDE_YOUTUBE_MUSIC_BUTTON
|
||||||
<SwitchPreference android:title="@string/revanced_hide_youtube_music_button_title" android:key="revanced_hide_youtube_music_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_youtube_music_button_summary_on" android:summaryOff="@string/revanced_hide_youtube_music_button_summary_off" />SETTINGS: HIDE_YOUTUBE_MUSIC_BUTTON -->
|
<SwitchPreference android:title="@string/revanced_hide_youtube_music_button_title" android:key="revanced_hide_youtube_music_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_youtube_music_button_summary_on" android:summaryOff="@string/revanced_hide_youtube_music_button_summary_off" />SETTINGS: HIDE_YOUTUBE_MUSIC_BUTTON -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: PLAYER_EXPERIMENTAL_FLAGS
|
||||||
|
<Preference android:title=" " android:selectable="false" android:key="revanced_experimental_flag" android:summary="@string/revanced_experimental_flag" />SETTINGS: PLAYER_EXPERIMENTAL_FLAGS -->
|
||||||
|
|
||||||
<!-- SETTINGS: HIDE_FILMSTRIP_OVERLAY
|
<!-- SETTINGS: HIDE_FILMSTRIP_OVERLAY
|
||||||
<Preference android:title=" " android:selectable="false" android:key="revanced_experimental_flag" android:summary="@string/revanced_experimental_flag" />
|
|
||||||
<SwitchPreference android:title="@string/revanced_hide_filmstrip_overlay_title" android:key="revanced_hide_filmstrip_overlay" android:defaultValue="false" android:summaryOn="@string/revanced_hide_filmstrip_overlay_summary_on" android:summaryOff="@string/revanced_hide_filmstrip_overlay_summary_off" />SETTINGS: HIDE_FILMSTRIP_OVERLAY -->
|
<SwitchPreference android:title="@string/revanced_hide_filmstrip_overlay_title" android:key="revanced_hide_filmstrip_overlay" android:defaultValue="false" android:summaryOn="@string/revanced_hide_filmstrip_overlay_summary_on" android:summaryOff="@string/revanced_hide_filmstrip_overlay_summary_off" />SETTINGS: HIDE_FILMSTRIP_OVERLAY -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: HIDE_SUGGESTED_VIDEO_OVERLAY
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_suggested_video_overlay_title" android:key="revanced_hide_suggested_video_overlay" android:defaultValue="false" android:summary="@string/revanced_hide_suggested_video_overlay_summary" />SETTINGS: HIDE_SUGGESTED_VIDEO_OVERLAY -->
|
||||||
|
|
||||||
<!-- SETTINGS: DISABLE_HAPTIC_FEEDBACK
|
<!-- SETTINGS: DISABLE_HAPTIC_FEEDBACK
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_haptic_feedback_title" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_haptic_feedback_title" />
|
||||||
<SwitchPreference android:title="@string/revanced_disable_haptic_feedback_chapters_title" android:key="revanced_disable_haptic_feedback_chapters" android:defaultValue="false" android:summaryOn="@string/revanced_disable_haptic_feedback_chapters_summary_on" android:summaryOff="@string/revanced_disable_haptic_feedback_chapters_summary_off" />
|
<SwitchPreference android:title="@string/revanced_disable_haptic_feedback_chapters_title" android:key="revanced_disable_haptic_feedback_chapters" android:defaultValue="false" android:summaryOn="@string/revanced_disable_haptic_feedback_chapters_summary_on" android:summaryOff="@string/revanced_disable_haptic_feedback_chapters_summary_off" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user