mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-23 18:37:14 +02:00
feat(youtube): add enable-new-comment-popup-panels
patch
This commit is contained in:
parent
e4b1c487b7
commit
66113e0655
@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.shorts.commentpopuppanels.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object ReelWatchFragmentBuilderFingerprint : MethodFingerprint(
|
||||
returnType = "Landroid/view/View;",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Landroid/view/LayoutInflater;", "Landroid/view/ViewGroup;", "Landroid/os/Bundle;"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45401415) }
|
||||
)
|
@ -0,0 +1,60 @@
|
||||
package app.revanced.patches.youtube.shorts.commentpopuppanels.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.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.shorts.commentpopuppanels.fingerprints.ReelWatchFragmentBuilderFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWide32LiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("enable-new-comment-popup-panels")
|
||||
@Description("Enables a new type of comment popup panel in the shorts player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewCommentPopupPanelsPatch : BytecodePatch(
|
||||
listOf(ReelWatchFragmentBuilderFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
ReelWatchFragmentBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWide32LiteralIndex(45401415) + 2
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $SHORTS->enableNewCommentPopupPanels()Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ReelWatchFragmentBuilderFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"SETTINGS: ENABLE_NEW_COMMENT_POPUP_PANELS"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-new-comment-popup-panels")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -83,6 +83,9 @@
|
||||
<string name="revanced_enable_external_browser_summary_off">External browser is disabled</string>
|
||||
<string name="revanced_enable_external_browser_summary_on">External browser is enabled</string>
|
||||
<string name="revanced_enable_external_browser_title">Enable external browser</string>
|
||||
<string name="revanced_enable_new_comment_popup_panels_summary_off">New comment popup panels is disabled</string>
|
||||
<string name="revanced_enable_new_comment_popup_panels_summary_on">New comment popup panels is enabled</string>
|
||||
<string name="revanced_enable_new_comment_popup_panels_title">Enable new comment popup panels</string>
|
||||
<string name="revanced_enable_new_splash_animation_summary_off">New splash animation is disabled</string>
|
||||
<string name="revanced_enable_new_splash_animation_summary_on">New splash animation is enabled</string>
|
||||
<string name="revanced_enable_new_splash_animation_title">Enable new splash animation</string>
|
||||
|
@ -361,6 +361,7 @@
|
||||
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_shorts" />
|
||||
<Preference android:title="disable-startup-shorts-player" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-new-comment-popup-panels" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="hide-shorts-component" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_swipe_controls" />
|
||||
@ -543,6 +544,9 @@
|
||||
<!-- SETTINGS: DISABLE_STARTUP_SHORTS_PLAYER
|
||||
<SwitchPreference android:title="@string/revanced_disable_startup_shorts_player_title" android:key="revanced_disable_startup_shorts_player" android:defaultValue="true" android:summaryOn="@string/revanced_disable_startup_shorts_player_summary_on" android:summaryOff="@string/revanced_disable_startup_shorts_player_summary_off" />SETTINGS: DISABLE_STARTUP_SHORTS_PLAYER -->
|
||||
|
||||
<!-- SETTINGS: ENABLE_NEW_COMMENT_POPUP_PANELS
|
||||
<SwitchPreference android:title="@string/revanced_enable_new_comment_popup_panels_title" android:key="revanced_enable_new_comment_popup_panels" android:defaultValue="false" android:summaryOn="@string/revanced_enable_new_comment_popup_panels_summary_on" android:summaryOff="@string/revanced_enable_new_comment_popup_panels_summary_off" />SETTINGS: ENABLE_NEW_COMMENT_POPUP_PANELS -->
|
||||
|
||||
<!-- SETTINGS: HIDE_SHORTS_COMPONENTS
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_comments_button_title" android:key="revanced_hide_shorts_player_comments_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_comments_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_comments_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_dislike_button_title" android:key="revanced_hide_shorts_player_dislike_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_dislike_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_dislike_button_summary_off" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user