refactor(settings): moved General/Shorts component setting to Shorts setting

This commit is contained in:
inotia00
2023-04-08 06:56:43 +09:00
parent 0258af5e16
commit 052d5a39de
19 changed files with 104 additions and 103 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
)
)

View File

@ -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
"""
)

View File

@ -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
"""
)

View File

@ -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()

View File

@ -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
"""
)

View File

@ -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

View File

@ -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()
}