From 052d5a39de138efa0249440dbb9411fd4135a3f2 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Sat, 8 Apr 2023 06:56:43 +0900 Subject: [PATCH] refactor(settings): moved `General/Shorts component` setting to `Shorts` setting --- .../fingerprints/ShortsCommentFingerprint.kt | 2 +- .../ShortsInfoPanelFingerprint.kt | 2 +- .../ShortsPaidContentFingerprint.kt | 2 +- .../fingerprints/ShortsRemixFingerprint.kt | 2 +- .../ShortsSubscriptionsFingerprint.kt | 2 +- .../ShortsSubscriptionsTabletFingerprint.kt | 2 +- ...rtsSubscriptionsTabletParentFingerprint.kt | 2 +- .../patch/ShortsCommentButtonPatch.kt | 4 +- .../patch/ShortsComponentPatch.kt | 12 ++-- .../patch/ShortsInfoPanelPatch.kt | 8 +-- .../patch/ShortsPaidContentBannerPatch.kt | 10 ++-- .../patch/ShortsRemixButtonPatch.kt | 8 +-- .../patch/ShortsSubscriptionsButtonPatch.kt | 14 ++--- .../UserWasInShortsFingerprint.kt | 2 +- .../patch/DisableShortsOnStartupPatch.kt} | 21 ++++--- .../revanced/util/integrations/Constants.kt | 1 + .../youtube/settings/host/values/strings.xml | 38 +++++------- .../youtube/settings/values-v21/strings.xml | 16 ++++- .../youtube/settings/xml/revanced_prefs.xml | 59 ++++++++++--------- 19 files changed, 104 insertions(+), 103 deletions(-) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsCommentFingerprint.kt (87%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt (88%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt (87%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsRemixFingerprint.kt (87%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt (87%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt (80%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt (88%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/patch/ShortsCommentButtonPatch.kt (90%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/patch/ShortsComponentPatch.kt (83%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/patch/ShortsInfoPanelPatch.kt (81%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/patch/ShortsPaidContentBannerPatch.kt (83%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/patch/ShortsRemixButtonPatch.kt (82%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt (84%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general => shorts}/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt (87%) rename src/main/kotlin/app/revanced/patches/youtube/layout/{general/startupshortsreset/patch/HideShortsOnStartupPatch.kt => shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt} (74%) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsCommentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsCommentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt index 6ea743681..d741c3820 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsCommentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt similarity index 88% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt index 8f9a0e928..44cbc92e4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt index 1e339b989..232169b83 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsRemixFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsRemixFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt index 2400eb5db..94f39dbc1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsRemixFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt index a7a017e04..c1be64225 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt similarity index 80% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt index 8c3682add..a8d7bec32 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import org.jf.dexlib2.Opcode diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt similarity index 88% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt index 577ac5252..bfda9510c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints +package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsCommentButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt similarity index 90% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsCommentButtonPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt index 3fffce202..6458ebeed 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsCommentButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.patch +package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name @@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsCommentFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch import app.revanced.util.integrations.Constants.GENERAL import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsComponentPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsComponentPatch.kt similarity index 83% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsComponentPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsComponentPatch.kt index d1c8ef7ed..7cdbb55cc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsComponentPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.patch +package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name @@ -46,12 +46,10 @@ class ShortsComponentPatch : BytecodePatch() { */ SettingsPatch.addPreference( arrayOf( - "PREFERENCE: GENERAL_SETTINGS", - "SETTINGS: SHORTS_COMPONENT.PARENT", - "SETTINGS: SHORTS_COMPONENT_PARENT.A", - "SETTINGS: SHORTS_COMPONENT_PARENT.B", - "SETTINGS: HIDE_SHORTS_COMPONENTS", - "SETTINGS: HIDE_SHORTS_SHELF" + "PREFERENCE: SHORTS_SETTINGS", + "SETTINGS: HIDE_SHORTS_SHELF", + "SETTINGS: SHORTS_PLAYER_PARENT", + "SETTINGS: HIDE_SHORTS_COMPONENTS" ) ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsInfoPanelPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt similarity index 81% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsInfoPanelPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt index 318830d87..e50ca9604 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsInfoPanelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.patch +package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name @@ -10,9 +10,9 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsInfoPanelFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch -import app.revanced.util.integrations.Constants.GENERAL +import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.WideLiteralInstruction @@ -34,7 +34,7 @@ class ShortsInfoPanelPatch : BytecodePatch( method.addInstructions( insertIndex + 1, """ - invoke-static {v$insertRegister}, $GENERAL->hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup; + invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup; move-result-object v$insertRegister """ ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsPaidContentBannerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt similarity index 83% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsPaidContentBannerPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt index d1ec1b71c..7e69f5b05 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsPaidContentBannerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt @@ -1,10 +1,9 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.patch +package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.instruction import app.revanced.patcher.patch.BytecodePatch @@ -13,10 +12,9 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsPaidContentFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsPaidContentFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch -import app.revanced.util.integrations.Constants -import app.revanced.util.integrations.Constants.GENERAL +import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.WideLiteralInstruction @@ -55,7 +53,7 @@ class ShortsPaidContentBannerPatch : BytecodePatch( val insertRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA addInstructions( insertIndex + 1, """ - invoke-static {v$insertRegister}, $GENERAL->hideShortsPlayerPaidContent(Landroid/view/ViewStub;)Landroid/view/ViewStub; + invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerPaidContent(Landroid/view/ViewStub;)Landroid/view/ViewStub; move-result-object v$insertRegister """ ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsRemixButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt similarity index 82% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsRemixButtonPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt index 0fd0f81d9..4fe07f2c4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsRemixButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.patch +package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name @@ -10,9 +10,9 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsRemixFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsRemixFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch -import app.revanced.util.integrations.Constants.GENERAL +import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.WideLiteralInstruction @@ -34,7 +34,7 @@ class ShortsRemixButtonPatch : BytecodePatch( method.addInstruction( insertIndex, - "invoke-static {v$insertRegister}, $GENERAL->hideShortsPlayerRemixButton(Landroid/view/View;)V" + "invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerRemixButton(Landroid/view/View;)V" ) } } ?: return ShortsRemixFingerprint.toErrorResult() diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt similarity index 84% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt index 73db8833e..88370cbbd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.shortscomponent.patch +package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name @@ -12,11 +12,11 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsSubscriptionsFingerprint -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsSubscriptionsTabletFingerprint -import app.revanced.patches.youtube.layout.general.shortscomponent.fingerprints.ShortsSubscriptionsTabletParentFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsSubscriptionsFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletFingerprint +import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletParentFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch -import app.revanced.util.integrations.Constants.GENERAL +import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction @@ -45,7 +45,7 @@ class ShortsSubscriptionsButtonPatch : BytecodePatch( method.addInstruction( insertIndex + 1, - "invoke-static {v$insertRegister}, $GENERAL->hideShortsPlayerSubscriptionsButton(Landroid/view/View;)V" + "invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerSubscriptionsButton(Landroid/view/View;)V" ) } } ?: return ShortsSubscriptionsFingerprint.toErrorResult() @@ -69,7 +69,7 @@ class ShortsSubscriptionsButtonPatch : BytecodePatch( it.addInstructions( insertIndex,""" - invoke-static {v$register}, $GENERAL->hideShortsPlayerSubscriptionsButton(I)I + invoke-static {v$register}, $SHORTS->hideShortsPlayerSubscriptionsButton(I)I move-result v$register """ ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt index 13b5e313f..1fd4bd195 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.startupshortsreset.fingerprints +package app.revanced.patches.youtube.layout.shorts.startupshortsreset.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/patch/HideShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt similarity index 74% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/patch/HideShortsOnStartupPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt index 70934139a..d3c6119c8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/patch/HideShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.startupshortsreset.patch +package app.revanced.patches.youtube.layout.shorts.startupshortsreset.patch import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description @@ -14,18 +14,18 @@ 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.general.startupshortsreset.fingerprints.UserWasInShortsFingerprint +import app.revanced.patches.youtube.layout.shorts.startupshortsreset.fingerprints.UserWasInShortsFingerprint import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.util.integrations.Constants.GENERAL +import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Patch -@Name("hide-startup-shorts-player") +@Name("disable-startup-shorts-player") @Description("Disables playing YouTube Shorts when launching YouTube.") @DependsOn([SettingsPatch::class]) @YouTubeCompatibility @Version("0.0.1") -class HideShortsOnStartupPatch : BytecodePatch( +class DisableShortsOnStartupPatch : BytecodePatch( listOf( UserWasInShortsFingerprint ) @@ -39,7 +39,7 @@ class HideShortsOnStartupPatch : BytecodePatch( val register = (instruction(insertIndex - 1) as OneRegisterInstruction).registerA + 2 addInstructions( insertIndex, """ - invoke-static { }, $GENERAL->hideStartupShortsPlayer()Z + invoke-static { }, $SHORTS->disableStartupShortsPlayer()Z move-result v$register if-eqz v$register, :show_startup_shorts_player return-void @@ -53,14 +53,13 @@ class HideShortsOnStartupPatch : BytecodePatch( */ SettingsPatch.addPreference( arrayOf( - "PREFERENCE: GENERAL_SETTINGS", - "SETTINGS: SHORTS_COMPONENT.PARENT", - "SETTINGS: SHORTS_COMPONENT_PARENT.B", - "SETTINGS: HIDE_STARTUP_SHORTS_PLAYER" + "PREFERENCE: SHORTS_SETTINGS", + "SETTINGS: SHORTS_PLAYER_PARENT", + "SETTINGS: DISABLE_STARTUP_SHORTS_PLAYER" ) ) - SettingsPatch.updatePatchStatus("hide-startup-shorts-player") + SettingsPatch.updatePatchStatus("disable-startup-shorts-player") return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/util/integrations/Constants.kt b/src/main/kotlin/app/revanced/util/integrations/Constants.kt index 715d475d5..ec61c525f 100644 --- a/src/main/kotlin/app/revanced/util/integrations/Constants.kt +++ b/src/main/kotlin/app/revanced/util/integrations/Constants.kt @@ -15,6 +15,7 @@ internal object Constants { const val NAVIGATION = "$PATCHES_PATH/layout/NavigationPatch;" const val PLAYER = "$PATCHES_PATH/layout/PlayerPatch;" const val SEEKBAR = "$PATCHES_PATH/layout/SeekBarPatch;" + const val SHORTS = "$PATCHES_PATH/layout/ShortsPatch;" const val MISC_PATH = "$PATCHES_PATH/misc" diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index b774deea1..f12a3d0b7 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -113,6 +113,9 @@ Is it ready to submit?" Landscape mode when entering fullscreen is enabled Landscape mode when entering fullscreen is disabled Disable landscape mode + Shorts player is enabled at app startup + Shorts player is disabled at app startup + Disable shorts player at app startup "Disable CronetEngine's QUIC protocol" Disable QUIC protocol The amount of seconds the double press back to exit @@ -299,9 +302,6 @@ Please do not report any issues you encounter while using this feature."Comment section is shown Comment section is hidden Hide comments section - Thanks button is shown - Thanks button is hidden - Hide thanks button Community posts in home feed are shown Community posts in home feed are hidden Hide community posts in home feed @@ -433,33 +433,23 @@ Please do not report any issues you encounter while using this feature."Navigation bar is shown Navigation bar is hidden Hide navigation bar in shorts - Shorts player comments button is shown - Shorts player comments button is hidden - Hide shorts player comments button - Hide shorts player component - Hide shorts player info panels - Shorts player join button is shown - Shorts player join button is hidden - Hide shorts player join button - Hide shorts player paid promotion - Shorts player remix button is shown - Shorts player remix button is hidden - Hide shorts player remix button - Shorts player subscriptions button is shown - Shorts player subscriptions button is hidden - Hide shorts player subscriptions button - Shorts player thanks button is shown - Shorts player thanks button is hidden - Hide shorts player thanks button + Comments button is shown + Comments button is hidden + Hide comments button + Join button is shown + Join button is hidden + Hide join button + Subscriptions button is shown + Subscriptions button is hidden + Hide subscriptions button Shorts shelves are shown Shorts shelves are hidden Hide shorts shelf + Shorts + Shorts player Snackbar is shown Snackbar is hidden Hide snackbar - Shorts player is shown at app startup - Shorts player is hidden at app startup - Hide shorts player at app startup Stories shelves are shown Stories shelves are hidden Hide stories shelf diff --git a/src/main/resources/youtube/settings/values-v21/strings.xml b/src/main/resources/youtube/settings/values-v21/strings.xml index 3972d37ac..ce28bac2d 100644 --- a/src/main/resources/youtube/settings/values-v21/strings.xml +++ b/src/main/resources/youtube/settings/values-v21/strings.xml @@ -1,6 +1,6 @@ - + @string/pref_about_category @string/revanced_adremover_custom_filter_summary @@ -8,10 +8,24 @@ @string/settings_ie ReVanced Extended + + @string/revanced_hide_button_thanks_summary_off + @string/revanced_hide_button_thanks_summary_on + @string/revanced_hide_button_thanks_title + @string/revanced_hide_info_panel_summary_off @string/revanced_hide_info_panel_summary_on + @string/revanced_hide_info_panel_title @string/revanced_adremover_paid_content_summary_off @string/revanced_adremover_paid_content_summary_on + @string/revanced_adremover_paid_content_title + @string/revanced_hide_button_remix_summary_off + @string/revanced_hide_button_remix_summary_on + @string/revanced_hide_button_remix_title + @string/revanced_hide_button_thanks_summary_off + @string/revanced_hide_button_thanks_summary_on + @string/revanced_hide_button_thanks_title + @string/camera_speed_button_label afn / blue diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 23d076d9e..c64cfbdb3 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -44,6 +44,32 @@ PREFERENCE: SWIPE_SETTINGS --> + + + + + + + + + + + + + @@ -51,33 +77,6 @@ - - - - - - - - - - - - - - @@ -443,10 +442,12 @@ + + + + - -