add hide-tooltip-content patch

This commit is contained in:
inotia00
2023-02-05 12:45:53 +09:00
parent 503ede30d7
commit fdc30bd43a
5 changed files with 95 additions and 0 deletions

View File

@ -35,6 +35,7 @@ class SharedResourcdIdPatch : ResourcePatch {
var liveChatButtonId: Long = -1
var scrubbingLabelId: Long = -1
var timebarColorLabelId: Long = -1
var tooltipLabelId: Long = -1
var videoqualityfragmentLabelId: Long = -1
}
@ -63,6 +64,7 @@ class SharedResourcdIdPatch : ResourcePatch {
liveChatButtonId = findSharedResourceId("id", "live_chat_overlay_button")
scrubbingLabelId = findSharedResourceId("dimen", "vertical_touch_offset_to_enter_fine_scrubbing")
timebarColorLabelId = findSharedResourceId("color", "inline_time_bar_progress_color")
tooltipLabelId = findSharedResourceId("layout", "tooltip_content_view")
videoqualityfragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title")
return PatchResultSuccess()

View File

@ -0,0 +1,20 @@
package app.revanced.patches.youtube.misc.tooltip.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object TooltipContentViewFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.tooltipLabelId
} == true
}
)

View File

@ -0,0 +1,34 @@
package app.revanced.patches.youtube.misc.tooltip.bytecode.patch
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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.tooltip.bytecode.fingerprints.TooltipContentViewFingerprint
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.extensions.toErrorResult
@Name("hide-tooltip-content-bytecode-patch")
@DependsOn([SharedResourcdIdPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class TooltipContentViewBytecodePatch : BytecodePatch(
listOf(
TooltipContentViewFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
TooltipContentViewFingerprint.result?.mutableMethod?.addInstruction(
0,
"return-void"
) ?: return TooltipContentViewFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,38 @@
package app.revanced.patches.youtube.misc.tooltip.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.youtube.misc.tooltip.bytecode.patch.TooltipContentViewBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.resources.ResourceHelper
@Patch
@Name("hide-tooltip-content")
@Description("Hides the tooltip box that appears on first install.")
@DependsOn(
[
TooltipContentViewBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class MinimizedPlaybackPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
ResourceHelper.patchSuccess(
context,
"hide-tooltip-content"
)
return PatchResultSuccess()
}
}

View File

@ -431,6 +431,7 @@
<Preference android:title="microg-support" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="client-spoof" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-pip-notification" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-tooltip-content" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="optimize-resource" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="remove-player-button-background" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="translations" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>