feat(YouTube): remove Header switch patch

This commit is contained in:
inotia00 2023-10-28 09:47:41 +09:00
parent 2253ed321a
commit c65aa00dc5
3 changed files with 0 additions and 95 deletions

View File

@ -1,88 +0,0 @@
package app.revanced.patches.youtube.general.headerswitch
import app.revanced.extensions.findMutableMethodOf
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.WordMarkHeader
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.bytecode.isWideLiteralExists
import app.revanced.util.integrations.Constants.GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
name = "Header switch",
description = "Add switch to change header.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
[
"18.25.40",
"18.27.36",
"18.29.38",
"18.30.37",
"18.31.40",
"18.32.39",
"18.33.40",
"18.34.38",
"18.35.36",
"18.36.39",
"18.37.36",
"18.38.44",
"18.39.41",
"18.40.34",
"18.41.39"
]
)
]
)
@Suppress("unused")
object HeaderSwitchPatch : BytecodePatch() {
@Suppress("LABEL_NAME_CLASH")
override fun execute(context: BytecodeContext) {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
if (!method.isWideLiteralExists(WordMarkHeader))
return@forEach
context.proxy(classDef)
.mutableClass
.findMutableMethodOf(method)
.apply {
val targetIndex = getWideLiteralIndex(WordMarkHeader)
val targetRegister =
getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(
targetIndex + 1, """
invoke-static {v$targetRegister}, $GENERAL->enablePremiumHeader(I)I
move-result v$targetRegister
"""
)
}
}
}
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: HEADER_SWITCH"
)
)
SettingsPatch.updatePatchStatus("Header switch")
}
}

View File

@ -609,9 +609,6 @@ Tap and hold to copy video timestamp"</string>
<string name="revanced_overlay_button_speed_dialog_summary">"Tap to open speed dialog
Tap and hold to set playback speed to 1.0x"</string>
<string name="revanced_overlay_button_speed_dialog_title">Show speed dialog button</string>
<string name="revanced_override_premium_header_summary_off">Current Header: Default Header</string>
<string name="revanced_override_premium_header_summary_on">Current Header: Premium Header</string>
<string name="revanced_override_premium_header_title">Premium Header</string>
<string name="revanced_patches_information">Patches Information</string>
<string name="revanced_patches_information_summary">Information about applied patches</string>
<string name="revanced_player">Player</string>

View File

@ -214,9 +214,6 @@
<!-- SETTINGS: HIDE_TRENDING_SEARCHES
<SwitchPreference android:title="@string/revanced_hide_trending_searches_title" android:key="revanced_hide_trending_searches" android:defaultValue="true" android:summaryOn="@string/revanced_hide_trending_searches_summary_on" android:summaryOff="@string/revanced_hide_trending_searches_summary_off" />SETTINGS: HIDE_TRENDING_SEARCHES -->
<!-- SETTINGS: HEADER_SWITCH
<SwitchPreference android:title="@string/revanced_override_premium_header_title" android:key="revanced_override_premium_header" android:defaultValue="false" android:summaryOn="@string/revanced_override_premium_header_summary_on" android:summaryOff="@string/revanced_override_premium_header_summary_off" />SETTINGS: HEADER_SWITCH -->
<!-- SETTINGS: HIDE_LAYOUT_COMPONENTS
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_layout_title" />
<SwitchPreference android:title="@string/revanced_custom_filter_title" android:key="revanced_custom_filter" android:defaultValue="false" android:summaryOn="@string/revanced_custom_filter_summary_on" android:summaryOff="@string/revanced_custom_filter_summary_off" />
@ -356,7 +353,6 @@
<Preference android:title="Enable gradient loading screen" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable tablet mini player" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable wide search bar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Header switch" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide account menu" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide auto player popup panels" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide category bar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>