feat(YouTube): remove Change homepage patch

This commit is contained in:
inotia00 2023-12-12 18:26:12 +09:00
parent ad98601954
commit 6a4ca210df
5 changed files with 0 additions and 122 deletions

View File

@ -1,96 +0,0 @@
package app.revanced.patches.youtube.navigation.homepage
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
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.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.navigation.homepage.fingerprints.IntentExceptionFingerprint
import app.revanced.patches.youtube.navigation.homepage.fingerprints.LauncherActivityFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.NAVIGATION
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Change homepage",
description = "Change home page to subscription feed.",
dependencies = [SettingsPatch::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",
"18.42.41",
"18.43.45",
"18.44.41",
"18.45.43"
]
)
]
)
@Suppress("unused")
object ChangeHomePagePatch : BytecodePatch(
setOf(
IntentExceptionFingerprint,
LauncherActivityFingerprint
)
) {
override fun execute(context: BytecodeContext) {
LauncherActivityFingerprint.result?.let {
it.mutableMethod.apply {
addInstructions(
implementation!!.instructions.size - 1, """
move-object/from16 v0, p1
invoke-static {v0}, $NAVIGATION->changeHomePage(Landroid/app/Activity;)V
"""
)
}
} ?: throw LauncherActivityFingerprint.exception
IntentExceptionFingerprint.result?.let {
it.mutableMethod.apply {
val index = it.scanResult.patternScanResult!!.endIndex + 1
addInstructionsWithLabels(
index, """
invoke-static {}, $NAVIGATION->changeHomePage()Z
move-result v0
if-eqz v0, :default
return-void
""", ExternalLabel("default", getInstruction(index))
)
}
} ?: throw IntentExceptionFingerprint.exception
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: NAVIGATION_SETTINGS",
"SETTINGS: CHANGE_HOMEPAGE_TO_SUBSCRIPTION"
)
)
SettingsPatch.updatePatchStatus("Change homepage")
}
}

View File

@ -1,11 +0,0 @@
package app.revanced.patches.youtube.navigation.homepage.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object IntentExceptionFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("L", "L"),
opcodes = listOf(Opcode.MOVE_EXCEPTION),
strings = listOf("Failed to resolve intent")
)

View File

@ -1,8 +0,0 @@
package app.revanced.patches.youtube.navigation.homepage.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
object LauncherActivityFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf("forLauncherActivity", "Launcher config used on invalid activity: %s")
)

View File

@ -55,9 +55,6 @@ Tap here to learn more about DeArrow."</string>
<string name="revanced_bypass_ambient_mode_restrictions_summary_off">Ambient mode is disabled in battery saver mode.</string> <string name="revanced_bypass_ambient_mode_restrictions_summary_off">Ambient mode is disabled in battery saver mode.</string>
<string name="revanced_bypass_ambient_mode_restrictions_summary_on">Ambient mode is enabled in battery saver mode.</string> <string name="revanced_bypass_ambient_mode_restrictions_summary_on">Ambient mode is enabled in battery saver mode.</string>
<string name="revanced_bypass_ambient_mode_restrictions_title">Bypass ambient mode restrictions</string> <string name="revanced_bypass_ambient_mode_restrictions_title">Bypass ambient mode restrictions</string>
<string name="revanced_change_homepage_summary_off">Current homepage: Home.</string>
<string name="revanced_change_homepage_summary_on">Current homepage: Subscriptions.</string>
<string name="revanced_change_homepage_title">Change homepage to subscriptions</string>
<string name="revanced_change_start_page_entry_default">Default</string> <string name="revanced_change_start_page_entry_default">Default</string>
<string name="revanced_change_start_page_entry_explore">Explore</string> <string name="revanced_change_start_page_entry_explore">Explore</string>
<string name="revanced_change_start_page_entry_history">History</string> <string name="revanced_change_start_page_entry_history">History</string>

View File

@ -439,7 +439,6 @@
<Preference android:title="Spoof player parameters" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Spoof player parameters" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_navigation" /> <Preference android:title=" " android:selectable="false" android:summary="@string/revanced_navigation" />
<Preference android:title="Change homepage" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable tablet navigation bar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Enable tablet navigation bar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide navigation buttons" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Hide navigation buttons" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide navigation label" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Hide navigation label" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
@ -511,9 +510,6 @@
<PreferenceScreen android:title="@string/revanced_navigation" android:key="navigation"> <PreferenceScreen android:title="@string/revanced_navigation" android:key="navigation">
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_navigation" />PREFERENCE: NAVIGATION_SETTINGS --> <Preference android:title=" " android:selectable="false" android:summary="@string/revanced_navigation" />PREFERENCE: NAVIGATION_SETTINGS -->
<!-- SETTINGS: CHANGE_HOMEPAGE_TO_SUBSCRIPTION
<SwitchPreference android:title="@string/revanced_change_homepage_title" android:key="revanced_change_homepage" android:defaultValue="false" android:summaryOn="@string/revanced_change_homepage_summary_on" android:summaryOff="@string/revanced_change_homepage_summary_off" />SETTINGS: CHANGE_HOMEPAGE_TO_SUBSCRIPTION -->
<!-- SETTINGS: ENABLE_TABLET_NAVIGATION_BAR <!-- SETTINGS: ENABLE_TABLET_NAVIGATION_BAR
<SwitchPreference android:title="@string/revanced_enable_tablet_navigation_bar_title" android:key="revanced_enable_tablet_navigation_bar" android:defaultValue="false" android:summaryOn="@string/revanced_enable_tablet_navigation_bar_summary_on" android:summaryOff="@string/revanced_enable_tablet_navigation_bar_summary_off" />SETTINGS: ENABLE_TABLET_NAVIGATION_BAR --> <SwitchPreference android:title="@string/revanced_enable_tablet_navigation_bar_title" android:key="revanced_enable_tablet_navigation_bar" android:defaultValue="false" android:summaryOn="@string/revanced_enable_tablet_navigation_bar_summary_on" android:summaryOff="@string/revanced_enable_tablet_navigation_bar_summary_off" />SETTINGS: ENABLE_TABLET_NAVIGATION_BAR -->