feat(YouTube): Add Change start page patch

This commit is contained in:
oSumAtrIX 2023-12-12 00:34:26 +01:00
parent 8133f3cbbe
commit ad9ba37c05
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
5 changed files with 101 additions and 5 deletions

View File

@ -521,6 +521,10 @@ public final class app/revanced/patches/serviceportalbund/detection/root/RootDet
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
} }
public final class app/revanced/patches/shared/fingerprints/HomeActivityFingerprint : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint {
public static final field INSTANCE Lapp/revanced/patches/shared/fingerprints/HomeActivityFingerprint;
}
public abstract class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch : app/revanced/patcher/patch/BytecodePatch { public abstract class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;Ljava/util/Set;)V public fun <init> (Ljava/lang/String;Ljava/util/Set;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
@ -1338,6 +1342,16 @@ public final class app/revanced/patches/youtube/layout/spoofappversion/SpoofAppV
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
} }
public final class app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint;
}
public final class app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch : app/revanced/patcher/patch/BytecodePatch { public final class app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch; public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
@ -1423,10 +1437,6 @@ public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourceP
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
} }
public final class app/revanced/patches/youtube/misc/gms/fingerprints/HomeActivityFingerprint : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/gms/fingerprints/HomeActivityFingerprint;
}
public final class app/revanced/patches/youtube/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch { public final class app/revanced/patches/youtube/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/integrations/IntegrationsPatch; public static final field INSTANCE Lapp/revanced/patches/youtube/misc/integrations/IntegrationsPatch;
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.gms.fingerprints package app.revanced.patches.shared.fingerprints
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint

View File

@ -0,0 +1,78 @@
package app.revanced.patches.youtube.layout.startpage
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.fingerprints.HomeActivityFingerprint
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
import app.revanced.patches.shared.settings.preference.impl.ListPreference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.youtube.layout.startpage.fingerprints.StartActivityFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Change start page",
description = "Changes the start page of the app.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube"
)
]
)
@Suppress("unused")
object ChangeStartPagePatch : BytecodePatch(
setOf(HomeActivityFingerprint)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/ChangeStartPagePatch;"
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
ListPreference(
"revanced_start_page",
StringResource(
"revanced_start_page_title",
"Set start page"
),
ArrayResource(
"revanced_start_page_entries",
listOf(
StringResource("revanced_start_page_home_entry_0", "Default"),
StringResource("revanced_start_page_home_entry_1", "Home"),
StringResource("revanced_start_page_search_entry_2", "Search"),
StringResource("revanced_start_page_subscriptions_entry_3", "Subscriptions"),
StringResource("revanced_start_page_explore_entry_4", "Explore"),
StringResource("revanced_start_page_shorts_entry_5", "Shorts"),
)
),
ArrayResource(
"revanced_start_page_values",
listOf(
StringResource("revanced_start_page_home_value_0", ""),
StringResource("revanced_start_page_home_value_1", "MAIN"),
StringResource("revanced_start_page_search_value_2", "open.search"),
StringResource("revanced_start_page_subscriptions_value_3", "open.subscriptions"),
StringResource("revanced_start_page_explore_value_4", "open.explore"),
StringResource("revanced_start_page_shorts_value_5", "open.shorts"),
)
),
default = ""
)
)
StartActivityFingerprint.resolve(
context,
HomeActivityFingerprint.result?.classDef ?: throw HomeActivityFingerprint.exception
)
StartActivityFingerprint.result?.mutableMethod?.addInstruction(
0,
"invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->changeIntent(Landroid/content/Intent;)V"
) ?: throw StartActivityFingerprint.exception
}
}

View File

@ -0,0 +1,7 @@
package app.revanced.patches.youtube.layout.startpage.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
object StartActivityFingerprint : MethodFingerprint(
parameters = listOf("Landroid/content/Intent;"),
)

View File

@ -2,6 +2,7 @@ package app.revanced.patches.youtube.misc.gms
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patches.shared.fingerprints.HomeActivityFingerprint
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch
import app.revanced.patches.youtube.layout.buttons.cast.HideCastButtonPatch import app.revanced.patches.youtube.layout.buttons.cast.HideCastButtonPatch
import app.revanced.patches.youtube.misc.fix.playback.ClientSpoofPatch import app.revanced.patches.youtube.misc.fix.playback.ClientSpoofPatch