mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
refactor(settings): moved General/Shorts component
setting to Shorts
setting
This commit is contained in:
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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"
|
||||
)
|
||||
)
|
||||
|
@ -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
|
||||
"""
|
||||
)
|
@ -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
|
||||
"""
|
||||
)
|
@ -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()
|
@ -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
|
||||
"""
|
||||
)
|
@ -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
|
@ -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()
|
||||
}
|
@ -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"
|
||||
|
||||
|
Reference in New Issue
Block a user