mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 13:47:42 +02:00
add change-homepage
patch
This commit is contained in:
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.navigation.homepage.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object IntentExceptionFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
parameters = listOf("L", "L"),
|
||||||
|
opcodes = listOf(Opcode.MOVE_EXCEPTION),
|
||||||
|
strings = listOf("Failed to resolve intent")
|
||||||
|
)
|
@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.navigation.homepage.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object LauncherActivityFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
strings = listOf("forLauncherActivity", "Launcher config used on invalid activity: %s")
|
||||||
|
)
|
@ -0,0 +1,73 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.navigation.homepage.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.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
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.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.navigation.homepage.fingerprints.IntentExceptionFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.navigation.homepage.fingerprints.LauncherActivityFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.NAVIGATION
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("change-homepage")
|
||||||
|
@Description("Change home page to subscription feed.")
|
||||||
|
@DependsOn([SettingsPatch::class])
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ChangeHomePagePatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
IntentExceptionFingerprint,
|
||||||
|
LauncherActivityFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
LauncherActivityFingerprint.result?.mutableMethod?.let {
|
||||||
|
it.addInstructions(
|
||||||
|
it.implementation!!.instructions.size - 1, """
|
||||||
|
move-object/from16 v0, p1
|
||||||
|
invoke-static {v0}, $NAVIGATION->changeHomePage(Lcom/google/android/apps/youtube/app/watchwhile/WatchWhileActivity;)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: return LauncherActivityFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
IntentExceptionFingerprint.result?.let {
|
||||||
|
with (it.mutableMethod) {
|
||||||
|
val index = it.scanResult.patternScanResult!!.endIndex + 1
|
||||||
|
addInstructions(
|
||||||
|
index, """
|
||||||
|
invoke-static {}, $NAVIGATION->changeHomePage()Z
|
||||||
|
move-result v0
|
||||||
|
if-eqz v0, :default
|
||||||
|
return-void
|
||||||
|
""", listOf(ExternalLabel("default", instruction(index)))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return IntentExceptionFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"PREFERENCE: NAVIGATION_SETTINGS",
|
||||||
|
"SETTINGS: CHANGE_HOMEPAGE_TO_SUBSCRIPTION"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("change-homepage")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -91,6 +91,9 @@ Is it ready to submit?"</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_comments_title">Comments</string>
|
<string name="revanced_comments_title">Comments</string>
|
||||||
<string name="revanced_copytimestamp_success">Time Stamp copied to clipboard</string>
|
<string name="revanced_copytimestamp_success">Time Stamp copied to clipboard</string>
|
||||||
<string name="revanced_custom_seekbar_color_value_summary">Type the hex code of the seekbar color</string>
|
<string name="revanced_custom_seekbar_color_value_summary">Type the hex code of the seekbar color</string>
|
||||||
|
@ -298,6 +298,9 @@
|
|||||||
<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 -->
|
||||||
|
|
||||||
@ -495,6 +498,7 @@
|
|||||||
<Preference android:title="hide-flyout-panel" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-flyout-panel" 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="switch-create-notification" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="switch-create-notification" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-create-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-create-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Reference in New Issue
Block a user