This commit is contained in:
inotia00
2023-02-15 11:57:57 +09:00
parent ec8bf1c2bb
commit 79a808db5c
213 changed files with 1710 additions and 3027 deletions

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.autocaptions.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.autocaptions.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.autocaptions.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.patch
package app.revanced.patches.youtube.layout.general.autocaptions.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
@ -10,16 +11,23 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
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.shared.fingerprints.SubtitleButtonControllerFingerprint
import app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.autocaptions.fingerprints.StartVideoInformerFingerprint
import app.revanced.patches.youtube.layout.general.autocaptions.fingerprints.SubtitleTrackFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("hide-auto-captions-bytecode-patch")
@Patch
@Name("hide-auto-captions")
@Description("Hide captions from being automatically enabled.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class AutoCaptionsBytecodePatch : BytecodePatch(
class AutoCaptionsPatch : BytecodePatch(
listOf(
StartVideoInformerFingerprint,
SubtitleButtonControllerFingerprint,
@ -56,6 +64,19 @@ class AutoCaptionsBytecodePatch : BytecodePatch(
)
} ?: return SubtitleTrackFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_CAPTIONS"
)
)
SettingsPatch.updatePatchStatus("hide-auto-captions")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.autocaptions.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.autocaptions.bytecode.patch.AutoCaptionsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-auto-captions")
@Description("Hide captions from being automatically enabled.")
@DependsOn(
[
AutoCaptionsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class AutoCaptionsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_CAPTIONS"
)
ResourceHelper.patchSuccess(
context,
"hide-auto-captions"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.patch
package app.revanced.patches.youtube.layout.general.autopopuppanels.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
@ -9,15 +10,21 @@ 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.general.autopopuppanels.bytecode.fingerprints.EngagementPanelControllerFingerprint
import app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("hide-auto-player-popup-panels-bytecode-patch")
@Patch
@Name("hide-auto-player-popup-panels")
@Description("Hide automatic popup panels (playlist or live chat) on video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class PlayerPopupPanelsBytecodePatch : BytecodePatch(
class PlayerPopupPanelsPatch : BytecodePatch(
listOf(
EngagementPanelControllerFingerprint
)
@ -37,6 +44,19 @@ class PlayerPopupPanelsBytecodePatch : BytecodePatch(
)
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_PLAYER_POPUP_PANELS"
)
)
SettingsPatch.updatePatchStatus("hide-auto-player-popup-panels")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.patch.PlayerPopupPanelsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-auto-player-popup-panels")
@Description("Hide automatic popup panels (playlist or live chat) on video player.")
@DependsOn(
[
PlayerPopupPanelsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class PlayerPopupPanelsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_PLAYER_POPUP_PANELS"
)
ResourceHelper.patchSuccess(
context,
"hide-auto-player-popup-panels"
)
return PatchResultSuccess()
}
}

View File

@ -1,25 +1,36 @@
package app.revanced.patches.youtube.layout.general.crowdfundingbox.bytecode.patch
package app.revanced.patches.youtube.layout.general.crowdfundingbox.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toResult
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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-crowdfunding-box-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-crowdfunding-box")
@Description("Hides the crowdfunding box between the player and video description.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CrowdfundingBoxBytecodePatch : BytecodePatch() {
class CrowdfundingBoxPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -56,6 +67,25 @@ class CrowdfundingBoxBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CROWDFUNDING_BOX"
)
)
SettingsPatch.updatePatchStatus("hide-crowdfunding-box")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.crowdfundingbox.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.crowdfundingbox.bytecode.patch.CrowdfundingBoxBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-crowdfunding-box")
@Description("Hides the crowdfunding box between the player and video description.")
@DependsOn(
[
CrowdfundingBoxBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CrowdfundingBoxPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CROWDFUNDING_BOX"
)
ResourceHelper.patchSuccess(
context,
"hide-crowdfunding-box"
)
return PatchResultSuccess()
}
}

View File

@ -1,24 +1,35 @@
package app.revanced.patches.youtube.layout.general.headerswitch.bytecode.patch
package app.revanced.patches.youtube.layout.general.headerswitch.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.toResult
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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@DependsOn([ResourceMappingPatch::class])
@Name("header-switch-bytecode-patch")
@Patch
@Name("header-switch")
@Description("Add switch to change header.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HeaderSwitchBytecodePatch : BytecodePatch() {
class HeaderSwitchPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -60,6 +71,25 @@ class HeaderSwitchBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HEADER_SWITCH"
)
)
SettingsPatch.updatePatchStatus("header-switch")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.headerswitch.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.headerswitch.bytecode.patch.HeaderSwitchBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("header-switch")
@Description("Add switch to change header.")
@DependsOn(
[
HeaderSwitchBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HeaderSwitchPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HEADER_SWITCH"
)
ResourceHelper.patchSuccess(
context,
"header-switch"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.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.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.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.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,7 +1,8 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.patch
package app.revanced.patches.youtube.layout.general.mixplaylists.patch
import app.revanced.extensions.injectHideCall
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
@ -10,17 +11,23 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
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.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
@Name("hide-mix-playlists-bytecode-patch")
@Patch
@Name("hide-mix-playlists")
@Description("Removes mix playlists from home feed and video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class MixPlaylistsBytecodePatch : BytecodePatch(
class MixPlaylistsPatch : BytecodePatch(
listOf(
CreateMixPlaylistFingerprint,
SecondCreateMixPlaylistFingerprint,
@ -44,6 +51,19 @@ class MixPlaylistsBytecodePatch : BytecodePatch(
fingerprint.result?.hookMixPlaylists(boolean) ?: return fingerprint.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_MIX_PLAYLISTS"
)
)
SettingsPatch.updatePatchStatus("hide-mix-playlists")
return PatchResultSuccess()
}

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.patch.MixPlaylistsBytecodePatch
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-mix-playlists")
@Description("Removes mix playlists from home feed and video player.")
@DependsOn(
[
LithoFilterPatch::class,
MixPlaylistsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class MixPlaylistsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_MIX_PLAYLISTS"
)
ResourceHelper.patchSuccess(
context,
"hide-mix-playlists"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.personalinformation.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.personalinformation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.personalinformation.bytecode.patch
package app.revanced.patches.youtube.layout.general.personalinformation.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
@ -9,15 +9,20 @@ 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.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.personalinformation.bytecode.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
import app.revanced.patches.youtube.layout.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("hide-email-address-bytecode-patch")
@Patch
@Name("hide-email-address")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideEmailAddressBytecodePatch : BytecodePatch(
class HideEmailAddressPatch : BytecodePatch(
listOf(
AccountSwitcherAccessibilityLabelFingerprint
)
@ -38,6 +43,19 @@ class HideEmailAddressBytecodePatch : BytecodePatch(
}
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_EMAIL_ADDRESS"
)
)
SettingsPatch.updatePatchStatus("hide-email-address")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.personalinformation.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.personalinformation.bytecode.patch.HideEmailAddressBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-email-address")
@Description("Hides the email address in the account switcher.")
@DependsOn(
[
HideEmailAddressBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEmailAddressPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_EMAIL_ADDRESS"
)
ResourceHelper.patchSuccess(
context,
"hide-email-address"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
@ -15,11 +15,11 @@ object PivotBarFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.RETURN_OBJECT
),
customFingerprint = {
it.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" &&
it.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId
} == true
customFingerprint = { methodDef ->
methodDef.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" &&
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId
} == true
}
)

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.patch
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.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
@ -8,21 +9,30 @@ 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.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints.PivotBarFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.fingerprints.PivotBarFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook
import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
@Name("hide-create-button-bytecode-patch")
@DependsOn([SharedResourcdIdPatch::class])
@Patch
@Name("hide-create-button")
@Description("Hides the create button in the navigation bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CreateButtonRemoverBytecodePatch : BytecodePatch(
class CreateButtonRemoverPatch : BytecodePatch(
listOf(
PivotBarCreateButtonViewFingerprint,
PivotBarFingerprint
@ -58,6 +68,19 @@ class CreateButtonRemoverBytecodePatch : BytecodePatch(
injectHook(hook, createButtonInstructions.indexOf(instruction) + 2)
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CREATE_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-create-button")
return PatchResultSuccess()
}
return PivotBarCreateButtonViewFingerprint.toErrorResult()

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.patch.CreateButtonRemoverBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-create-button")
@Description("Hides the create button in the navigation bar.")
@DependsOn(
[
CreateButtonRemoverBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CreateButtonRemoverPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CREATE_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-create-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.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.pivotbar.shortsbutton.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.patch
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.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
@ -9,20 +10,29 @@ 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.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarEnumFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarShortsButtonViewFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints.PivotBarEnumFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints.PivotBarShortsButtonViewFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook
@Patch
@Name("hide-shorts-button")
@DependsOn([SharedResourcdIdPatch::class])
@Description("Hides the shorts button in the navigation bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsButtonRemoverBytecodePatch : BytecodePatch(
class ShortsButtonRemoverPatch : BytecodePatch(
listOf(PivotBarCreateButtonViewFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -62,6 +72,22 @@ class ShortsButtonRemoverBytecodePatch : BytecodePatch(
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: HIDE_SHORTS_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-shorts-button")
return PatchResultSuccess()
}
private companion object {

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.patch.ShortsButtonRemoverBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-shorts-button")
@Description("Hides the shorts button in the navigation bar.")
@DependsOn(
[
ShortsButtonRemoverBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsButtonRemoverPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings4(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: HIDE_SHORTS_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-shorts-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,7 +1,8 @@
package app.revanced.patches.youtube.layout.general.shortscomponent.bytecode.patch
package app.revanced.patches.youtube.layout.general.shortscomponent.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,19 +11,30 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.util.bytecode.BytecodeHelper
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-shorts-component-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-shorts-component")
@Description("Hides other Shorts components.")
@DependsOn(
[
LithoFilterPatch::class,
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsComponentBytecodePatch : BytecodePatch() {
class ShortsComponentPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -88,11 +100,31 @@ class ShortsComponentBytecodePatch : BytecodePatch() {
}
}
}
val errorIndex = patchSuccessArray.indexOf(false)
return if (errorIndex == -1) {
BytecodeHelper.patchStatus(context, "ShortsComponent")
PatchResultSuccess()
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
context.updatePatchStatus("ShortsComponent")
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_SHORTS_COMPONENTS",
"SETTINGS: HIDE_SHORTS_SHELF"
)
)
SettingsPatch.updatePatchStatus("hide-shorts-component")
return PatchResultSuccess()
} else
PatchResultError("Instruction not found: $errorIndex")
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,64 +0,0 @@
package app.revanced.patches.youtube.layout.general.shortscomponent.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.shortscomponent.bytecode.patch.ShortsComponentBytecodePatch
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-shorts-component")
@Description("Hides other Shorts components.")
@DependsOn(
[
LithoFilterPatch::class,
ShortsComponentBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsComponentPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings5(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_SHORTS_COMPONENTS"
)
ResourceHelper.addSettings4(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: HIDE_SHORTS_SHELF"
)
ResourceHelper.patchSuccess(
context,
"hide-shorts-component"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.snackbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.snackbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch
package app.revanced.patches.youtube.layout.general.snackbar.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
@ -9,15 +10,21 @@ 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.general.snackbar.bytecode.fingerprints.HideSnackbarFingerprint
import app.revanced.patches.youtube.layout.general.snackbar.fingerprints.HideSnackbarFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("hide-snackbar-bytecode-patch")
@Patch
@Name("hide-snackbar")
@Description("Hides the snackbar action popup.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideSnackbarBytecodePatch : BytecodePatch(
class HideSnackbarPatch : BytecodePatch(
listOf(
HideSnackbarFingerprint
)
@ -35,6 +42,19 @@ class HideSnackbarBytecodePatch : BytecodePatch(
)
} ?: return HideSnackbarFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_SNACKBAR"
)
)
SettingsPatch.updatePatchStatus("hide-snackbar")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.snackbar.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch.HideSnackbarBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-snackbar")
@Description("Hides the snackbar action popup.")
@DependsOn(
[
HideSnackbarBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideSnackbarPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_SNACKBAR"
)
ResourceHelper.patchSuccess(
context,
"hide-snackbar"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.startupshortsreset.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.patch
package app.revanced.patches.youtube.layout.general.startupshortsreset.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
@ -9,16 +10,22 @@ 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.general.startupshortsreset.bytecode.fingerprints.UserWasInShortsFingerprint
import app.revanced.patches.youtube.layout.general.startupshortsreset.fingerprints.UserWasInShortsFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("hide-startup-shorts-player-bytecode-patch")
@Patch
@Name("hide-startup-shorts-player")
@Description("Disables playing YouTube Shorts when launching YouTube.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideShortsOnStartupBytecodePatch : BytecodePatch(
class HideShortsOnStartupPatch : BytecodePatch(
listOf(
UserWasInShortsFingerprint
)
@ -41,6 +48,21 @@ class HideShortsOnStartupBytecodePatch : BytecodePatch(
}
} ?: return UserWasInShortsFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_STARTUP_SHORTS_PLAYER"
)
)
SettingsPatch.updatePatchStatus("hide-startup-shorts-player")
return PatchResultSuccess()
}
}

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.general.startupshortsreset.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.patch.HideShortsOnStartupBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-startup-shorts-player")
@Description("Disables playing YouTube Shorts when launching YouTube.")
@DependsOn(
[
HideShortsOnStartupBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideShortsOnStartupPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings4(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_STARTUP_SHORTS_PLAYER"
)
ResourceHelper.patchSuccess(
context,
"hide-startup-shorts-player"
)
return PatchResultSuccess()
}
}

View File

@ -1,25 +1,36 @@
package app.revanced.patches.youtube.layout.general.stories.bytecode.patch
package app.revanced.patches.youtube.layout.general.stories.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toResult
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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-stories-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-stories")
@Description("Hides YouTube Stories shelf on the feed.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideStoriesBytecodePatch : BytecodePatch() {
class HideStoriesPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -59,6 +70,25 @@ class HideStoriesBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_STORIES_SHELF"
)
)
SettingsPatch.updatePatchStatus("hide-stories")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.stories.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.stories.bytecode.patch.HideStoriesBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-stories")
@Description("Hides YouTube Stories shelf on the feed.")
@DependsOn(
[
HideStoriesBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideStoriesPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_STORIES_SHELF"
)
ResourceHelper.patchSuccess(
context,
"hide-stories"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
@ -11,9 +11,9 @@ object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.FINAL,
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.floatybarQueueLabelId
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.floatybarQueueLabelId
} == true
}
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.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.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.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.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.patch
package app.revanced.patches.youtube.layout.general.tabletminiplayer.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
@ -11,18 +12,27 @@ 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.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints.*
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("enable-tablet-miniplayer-bytecode-patch")
@DependsOn([SharedResourcdIdPatch::class])
@Patch
@Name("enable-tablet-miniplayer")
@Description("Enables the tablet mini player layout.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class TabletMiniPlayerBytecodePatch : BytecodePatch(
class TabletMiniPlayerPatch : BytecodePatch(
listOf(
MiniPlayerDimensionsCalculatorFingerprint,
MiniPlayerResponseModelSizeCheckFingerprint
@ -50,6 +60,19 @@ class TabletMiniPlayerBytecodePatch : BytecodePatch(
}
} ?: return MiniPlayerDimensionsCalculatorFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_TABLET_MINIPLAYER"
)
)
SettingsPatch.updatePatchStatus("enable-tablet-miniplayer")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.patch.TabletMiniPlayerBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("enable-tablet-miniplayer")
@Description("Enables the tablet mini player layout.")
@DependsOn(
[
TabletMiniPlayerBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class TabletMiniPlayerPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_TABLET_MINIPLAYER"
)
ResourceHelper.patchSuccess(
context,
"enable-tablet-miniplayer"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.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.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.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.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.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.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch
package app.revanced.patches.youtube.layout.general.widesearchbar.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
@ -10,15 +11,21 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
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.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("enable-wide-searchbar-bytecode-patch")
@Patch
@Name("enable-wide-searchbar")
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class WideSearchbarBytecodePatch : BytecodePatch(
class WideSearchbarPatch : BytecodePatch(
listOf(
WideSearchbarOneParentFingerprint,
WideSearchbarTwoParentFingerprint
@ -46,6 +53,19 @@ class WideSearchbarBytecodePatch : BytecodePatch(
} ?: return parentFingerprint.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_WIDE_SEARCHBAR"
)
)
SettingsPatch.updatePatchStatus("enable-wide-searchbar")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch.WideSearchbarBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("enable-wide-searchbar")
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
@DependsOn(
[
WideSearchbarBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class WideSearchbarPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_WIDE_SEARCHBAR"
)
ResourceHelper.patchSuccess(
context,
"enable-wide-searchbar"
)
return PatchResultSuccess()
}
}