refactor: Fix package and code structure (#2541)
BREAKING CHANGE: Various public APIs have changed names and packages or were removed entirely
This commit is contained in:
@@ -65,7 +65,7 @@ object HideAdsPatch : BytecodePatch() {
|
||||
.injectHideViewCall(
|
||||
insertIndex,
|
||||
viewRegister,
|
||||
"Lapp/revanced/integrations/patches/components/AdsFilter;",
|
||||
"Lapp/revanced/integrations/youtube/patches/components/AdsFilter;",
|
||||
"hideAdAttributionView"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen
|
||||
)
|
||||
object HideAdsResourcePatch : ResourcePatch() {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/AdsFilter;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/AdsFilter;"
|
||||
|
||||
internal var adAttributionId: Long = -1
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
)
|
||||
object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideGetPremiumPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/HideGetPremiumPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
||||
|
||||
@@ -53,7 +53,7 @@ object VideoAdsPatch : BytecodePatch(
|
||||
|
||||
loadVideoAdsFingerprintMethod.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/VideoAdsPatch;->shouldShowAds()Z
|
||||
move-result v0
|
||||
if-nez v0, :show_video_ads
|
||||
return-void
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CopyVideoUrlBytecodePatch : BytecodePatch() {
|
||||
private const val INTEGRATIONS_PLAYER_PACKAGE = "Lapp/revanced/integrations/videoplayer"
|
||||
private const val INTEGRATIONS_PLAYER_PACKAGE = "Lapp/revanced/integrations/youtube/videoplayer"
|
||||
private val BUTTONS_DESCRIPTORS = listOf(
|
||||
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlButton;",
|
||||
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlTimestampButton;"
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ object RemoveViewerDiscretionDialogPatch : BytecodePatch(
|
||||
setOf(CreateDialogFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_METHOD_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/RemoveViewerDiscretionDialogPatch;->" +
|
||||
"Lapp/revanced/integrations/youtube/patches/RemoveViewerDiscretionDialogPatch;->" +
|
||||
"confirmDialog(Landroid/app/AlertDialog;)V"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ExternalDownloadsBytecodePatch : BytecodePatch() {
|
||||
private const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/ExternalDownloadButton;"
|
||||
private const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/youtube/videoplayer/ExternalDownloadButton;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
/*
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ object DisablePreciseSeekingGesturePatch : BytecodePatch(
|
||||
setOf(IsSwipingUpFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_METHOD_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/DisablePreciseSeekingGesturePatch;->" +
|
||||
"Lapp/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch;->" +
|
||||
"disableGesture(Landroid/view/VelocityTracker;Landroid/view/MotionEvent;)V"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ object EnableSeekbarTappingPatch : BytecodePatch(
|
||||
addInstructionsWithLabels(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->seekbarTappingEnabled()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/SeekbarTappingPatch;->seekbarTappingEnabled()Z
|
||||
move-result v$freeRegister
|
||||
if-eqz v$freeRegister, :disabled
|
||||
${oMethod.toInvokeInstructionString()}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ object EnableSlideToSeekPatch : BytecodePatch(
|
||||
DoubleSpeedSeekNoticeFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/SlideToSeekPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/SlideToSeekPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ internal object SwipeControlsHostActivityFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
parameters = listOf(),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;"
|
||||
methodDef.definingClass == "Lapp/revanced/integrations/youtube/swipecontrols/SwipeControlsHostActivity;"
|
||||
}
|
||||
)
|
||||
|
||||
+3
-3
@@ -57,7 +57,7 @@ object AutoCaptionsPatch : BytecodePatch(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x$enabled
|
||||
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
sput-boolean v0, Lapp/revanced/integrations/youtube/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
"""
|
||||
) ?: throw fingerprint.exception
|
||||
}
|
||||
@@ -65,10 +65,10 @@ object AutoCaptionsPatch : BytecodePatch(
|
||||
SubtitleTrackFingerprint.result?.mutableMethod?.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->autoCaptionsEnabled()Z
|
||||
invoke-static {}, Lapp/revanced/integrations/youtube/patches/DisableAutoCaptionsPatch;->autoCaptionsEnabled()Z
|
||||
move-result v0
|
||||
if-eqz v0, :auto_captions_enabled
|
||||
sget-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
sget-boolean v0, Lapp/revanced/integrations/youtube/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
|
||||
if-nez v0, :auto_captions_enabled
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
@Suppress("unused")
|
||||
object HideButtonsPatch : ResourcePatch() {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/ButtonsFilter;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/ButtonsFilter;"
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ object HideAutoplayButtonPatch : BytecodePatch(
|
||||
addInstructionsWithLabels(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonShown()Z
|
||||
invoke-static {}, Lapp/revanced/integrations/youtube/patches/HideAutoplayButtonPatch;->isButtonShown()Z
|
||||
move-result v$clobberRegister
|
||||
if-eqz v$clobberRegister, :hidden
|
||||
""",
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ object HideCaptionsButtonPatch : BytecodePatch(
|
||||
subtitleButtonControllerMethod.addInstruction(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v0}, Lapp/revanced/integrations/patches/HideCaptionsButtonPatch;->hideCaptionsButton(Landroid/widget/ImageView;)V
|
||||
invoke-static {v0}, Lapp/revanced/integrations/youtube/patches/HideCaptionsButtonPatch;->hideCaptionsButton(Landroid/widget/ImageView;)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ object HideCastButtonPatch : BytecodePatch() {
|
||||
addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static {p1}, Lapp/revanced/integrations/patches/HideCastButtonPatch;->getCastButtonOverrideV2(I)I
|
||||
invoke-static {p1}, Lapp/revanced/integrations/youtube/patches/HideCastButtonPatch;->getCastButtonOverrideV2(I)I
|
||||
move-result p1
|
||||
"""
|
||||
)
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ object NavigationButtonsPatch : BytecodePatch(
|
||||
setOf(AddCreateButtonViewFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/NavigationButtonsPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/NavigationButtonsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+2
-2
@@ -72,10 +72,10 @@ object HidePlayerButtonsPatch : BytecodePatch(
|
||||
mutableMethod.addInstructions(
|
||||
callIndex,
|
||||
"""
|
||||
invoke-static { v$hasNextParameterRegister }, Lapp/revanced/integrations/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z
|
||||
invoke-static { v$hasNextParameterRegister }, Lapp/revanced/integrations/youtube/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z
|
||||
move-result v$hasNextParameterRegister
|
||||
|
||||
invoke-static { v$hasPreviousParameterRegister }, Lapp/revanced/integrations/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z
|
||||
invoke-static { v$hasPreviousParameterRegister }, Lapp/revanced/integrations/youtube/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z
|
||||
move-result v$hasPreviousParameterRegister
|
||||
"""
|
||||
)
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ object AlbumCardsPatch : BytecodePatch(
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static {v$albumCardViewRegister}, " +
|
||||
"Lapp/revanced/integrations/patches/HideAlbumCardsPatch;" +
|
||||
"Lapp/revanced/integrations/youtube/patches/HideAlbumCardsPatch;" +
|
||||
"->" +
|
||||
"hideAlbumCard(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ object BreakingNewsPatch : BytecodePatch(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$breakingNewsViewRegister},
|
||||
Lapp/revanced/integrations/patches/HideBreakingNewsPatch;
|
||||
Lapp/revanced/integrations/youtube/patches/HideBreakingNewsPatch;
|
||||
->
|
||||
hideBreakingNews(Landroid/view/View;)V
|
||||
"""
|
||||
|
||||
@@ -35,7 +35,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
@Suppress("unused")
|
||||
object CommentsPatch : ResourcePatch() {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/CommentsFilter;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/CommentsFilter;"
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ object CrowdfundingBoxPatch : BytecodePatch(
|
||||
setOf(CrowdfundingBoxFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_METHOD_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V"
|
||||
"Lapp/revanced/integrations/youtube/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CrowdfundingBoxFingerprint.result?.let {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ object HideEndscreenCardsPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
||||
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/youtube/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ object HideFilterBarPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideFilterBarPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/HideFilterBarPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ object HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
||||
setOf(ShowFloatingMicrophoneButtonFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideFloatingMicrophoneButtonPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/HideFloatingMicrophoneButtonPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ object DisableFullscreenAmbientModePatch : BytecodePatch(
|
||||
setOf(InitializeAmbientModeFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/DisableFullscreenAmbientModePatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/DisableFullscreenAmbientModePatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+2
-2
@@ -48,9 +48,9 @@ object HideLayoutComponentsPatch : BytecodePatch(
|
||||
setOf(ParseElementFromBufferFingerprint, PlayerOverlayFingerprint)
|
||||
) {
|
||||
private const val LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/LayoutComponentsFilter;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/LayoutComponentsFilter;"
|
||||
private const val DESCRIPTION_COMPONENTS_FILTER_CLASS_NAME =
|
||||
"Lapp/revanced/integrations/patches/components/DescriptionComponentsFilter;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/DescriptionComponentsFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ object HideInfoCardsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/HideInfoCardsFilterPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/HideInfoCardsFilterPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
InfocardsIncognitoFingerprint.also {
|
||||
@@ -62,7 +62,7 @@ object HideInfoCardsPatch : BytecodePatch(
|
||||
addInstruction(
|
||||
invokeInstructionIndex,
|
||||
"invoke-static {v${getInstruction<FiveRegisterInstruction>(invokeInstructionIndex).registerC}}," +
|
||||
" Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
|
||||
" Lapp/revanced/integrations/youtube/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ object HideInfoCardsPatch : BytecodePatch(
|
||||
hideInfoCardsCallMethod.addInstructionsWithLabels(
|
||||
invokeInterfaceIndex,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsMethodCall()Z
|
||||
invoke-static {}, Lapp/revanced/integrations/youtube/patches/HideInfoCardsPatch;->hideInfoCardsMethodCall()Z
|
||||
move-result v$toggleRegister
|
||||
if-nez v$toggleRegister, :hide_info_cards
|
||||
""",
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ object HideLoadMoreButtonPatch : BytecodePatch(
|
||||
setOf(HideLoadMoreButtonFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideLoadMoreButtonPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/HideLoadMoreButtonPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
HideLoadMoreButtonFingerprint.result?.let {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ object HideEmailAddressPatch : BytecodePatch(
|
||||
addInstructions(
|
||||
setVisibilityConstIndex,
|
||||
"""
|
||||
invoke-static {v$setVisibilityConstRegister}, Lapp/revanced/integrations/patches/HideEmailAddressPatch;->hideEmailAddress(I)I
|
||||
invoke-static {v$setVisibilityConstRegister}, Lapp/revanced/integrations/youtube/patches/HideEmailAddressPatch;->hideEmailAddress(I)I
|
||||
move-result v$setVisibilityConstRegister
|
||||
"""
|
||||
)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ object HidePlayerFlyoutMenuPatch : ResourcePatch() {
|
||||
private const val KEY = "revanced_hide_player_flyout"
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/PlayerFlyoutMenuItemsFilter;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/PlayerFlyoutMenuItemsFilter;"
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ object DisableRollingNumberAnimationPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/DisableRollingNumberAnimationsPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/DisableRollingNumberAnimationsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ object HideSeekbarPatch : BytecodePatch(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x0
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/HideSeekbarPatch;->hideSeekbar()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/HideSeekbarPatch;->hideSeekbar()Z
|
||||
move-result v0
|
||||
if-eqz v0, :hide_seekbar
|
||||
return-void
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ object HideShortsComponentsPatch : BytecodePatch(
|
||||
SetPivotBarVisibilityParentFingerprint
|
||||
)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/ShortsFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Hide the Shorts shelf.
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ object DisableSuggestedVideoEndScreenPatch : BytecodePatch(
|
||||
setOf(CreateEndScreenViewFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/DisableSuggestedVideoEndScreenPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/DisableSuggestedVideoEndScreenPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CreateEndScreenViewFingerprint.result?.let {
|
||||
|
||||
@@ -48,7 +48,7 @@ object HideTimestampPatch : BytecodePatch(
|
||||
mutableMethod.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/HideTimestampPatch;->hideTimestamp()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/HideTimestampPatch;->hideTimestamp()Z
|
||||
move-result v0
|
||||
if-eqz v0, :hide_time
|
||||
return-void
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ object PlayerPopupPanelsPatch : BytecodePatch(
|
||||
engagementPanelControllerMethod.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/DisablePlayerPopupPanelsPatch;->disablePlayerPopupPanels()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/DisablePlayerPopupPanelsPatch;->disablePlayerPopupPanels()Z
|
||||
move-result v0
|
||||
if-eqz v0, :player_popup_panels
|
||||
if-eqz p4, :player_popup_panels
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomPlayerOverlayOpacityPatch : BytecodePatch(setOf(CreatePlayerOverviewFingerprint)) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/CustomPlayerOverlayOpacityPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/CustomPlayerOverlayOpacityPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CreatePlayerOverviewFingerprint.result?.let { result ->
|
||||
|
||||
+2
-2
@@ -62,10 +62,10 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch;"
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/ReturnYouTubeDislikeFilterPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Inject newVideoLoaded event handler to update dislikes when a new video is loaded.
|
||||
|
||||
@@ -80,7 +80,7 @@ object WideSearchbarPatch : BytecodePatch(
|
||||
addInstructions(
|
||||
implementation!!.instructions.size - 1,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/WideSearchbarPatch;->enableWideSearchbar()Z
|
||||
invoke-static {}, Lapp/revanced/integrations/youtube/patches/WideSearchbarPatch;->enableWideSearchbar()Z
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.seekbar.fingerprints.FullscreenSeekbarThumbnailsFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Restore old seekbar thumbnails",
|
||||
@@ -35,7 +34,7 @@ object RestoreOldSeekbarThumbnailsPatch : BytecodePatch(
|
||||
setOf(FullscreenSeekbarThumbnailsFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/RestoreOldSeekbarThumbnailsPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/RestoreOldSeekbarThumbnailsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SeekbarPreferencesPatch.addPreferences(
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
internal object SeekbarColorBytecodePatch : BytecodePatch(
|
||||
setOf(PlayerSeekbarColorFingerprint, ShortsSeekbarColorFingerprint, SetSeekbarClickedColorFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/SeekbarColorPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/theme/SeekbarColorPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
fun MutableMethod.addColorChangeInstructions(resourceId: Long) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ internal object SeekbarColorResourcePatch : ResourcePatch(){
|
||||
val scaleNode = progressNode.getElementsByTagName("scale").item(0) as Element
|
||||
val shapeNode = scaleNode.getElementsByTagName("shape").item(0) as Element
|
||||
val replacementNode = editor.file.createElement(
|
||||
"app.revanced.integrations.patches.theme.ProgressBarDrawable")
|
||||
"app.revanced.integrations.youtube.patches.theme.ProgressBarDrawable")
|
||||
scaleNode.replaceChild(replacementNode, shapeNode)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -69,13 +69,13 @@ object SponsorBlockBytecodePatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/sponsorblock/SegmentPlaybackController;"
|
||||
"Lapp/revanced/integrations/youtube/sponsorblock/SegmentPlaybackController;"
|
||||
private const val INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/sponsorblock/ui/CreateSegmentButtonController;"
|
||||
"Lapp/revanced/integrations/youtube/sponsorblock/ui/CreateSegmentButtonController;"
|
||||
private const val INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/sponsorblock/ui/VotingButtonController;"
|
||||
"Lapp/revanced/integrations/youtube/sponsorblock/ui/VotingButtonController;"
|
||||
private const val INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/sponsorblock/ui/SponsorBlockViewController;"
|
||||
"Lapp/revanced/integrations/youtube/sponsorblock/ui/SponsorBlockViewController;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
object SpoofAppVersionPatch : BytecodePatch(
|
||||
setOf(SpoofAppVersionFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/spoof/SpoofAppVersionPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/spoof/SpoofAppVersionPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+2
-3
@@ -29,7 +29,7 @@ object ChangeStartPagePatch : BytecodePatch(
|
||||
setOf(HomeActivityFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/ChangeStartPagePatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/ChangeStartPagePatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
@@ -60,8 +60,7 @@ object ChangeStartPagePatch : BytecodePatch(
|
||||
StringResource("revanced_start_page_explore_value_4", "open.explore"),
|
||||
StringResource("revanced_start_page_shorts_value_5", "open.shorts"),
|
||||
)
|
||||
),
|
||||
default = ""
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ object DisableResumingShortsOnStartupPatch : BytecodePatch(
|
||||
) {
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/DisableResumingStartupShortsPlayerPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/DisableResumingStartupShortsPlayerPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ object EnableTabletLayoutPatch : BytecodePatch(
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/EnableTabletLayoutPatch;->enableTabletLayout()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/EnableTabletLayoutPatch;->enableTabletLayout()Z
|
||||
move-result v0 # Free register
|
||||
if-nez v0, :is_large_form_factor
|
||||
""",
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ object TabletMiniPlayerPatch : BytecodePatch(
|
||||
this.addInstructions(
|
||||
index,
|
||||
"""
|
||||
invoke-static {v$overrideRegister}, Lapp/revanced/integrations/patches/TabletMiniPlayerOverridePatch;->getTabletMiniPlayerOverride(Z)Z
|
||||
invoke-static {v$overrideRegister}, Lapp/revanced/integrations/youtube/patches/TabletMiniPlayerOverridePatch;->getTabletMiniPlayerOverride(Z)Z
|
||||
move-result v$overrideRegister
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ object ThemeBytecodePatch : BytecodePatch(
|
||||
setOf(UseGradientLoadingScreenFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/theme/ThemePatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/theme/ThemePatch;"
|
||||
|
||||
internal const val GRADIENT_LOADING_SCREEN_AB_CONSTANT = 45412406L
|
||||
|
||||
|
||||
+3
-3
@@ -55,7 +55,7 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/AlternativeThumbnailsPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/AlternativeThumbnailsPatch;"
|
||||
|
||||
private lateinit var loadImageUrlMethod: MutableMethod
|
||||
private var loadImageUrlIndex = 0
|
||||
@@ -115,7 +115,7 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
NonInteractivePreference(
|
||||
StringResource("revanced_alt_thumbnail_about_title", "Thumbnails in use"),
|
||||
null, // Summary is dynamically updated based on the current settings.
|
||||
tag = "app.revanced.integrations.settingsmenu.AlternativeThumbnailsStatusPreference"
|
||||
tag = "app.revanced.integrations.youtube.settings.preference.AlternativeThumbnailsStatusPreference"
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_alt_thumbnail_dearrow",
|
||||
@@ -154,7 +154,7 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
+ "\\n\\nTap here to learn more about DeArrow"
|
||||
),
|
||||
// Custom about preference with link to the DeArrow website.
|
||||
tag = "app.revanced.integrations.settingsmenu.AlternativeThumbnailsAboutDeArrowPreference",
|
||||
tag = "app.revanced.integrations.youtube.settings.preference.AlternativeThumbnailsAboutDeArrowPreference",
|
||||
selectable = true
|
||||
),
|
||||
SwitchPreference(
|
||||
|
||||
+5
-3
@@ -24,7 +24,7 @@ object AnnouncementsPatch : BytecodePatch(
|
||||
setOf(WatchWhileActivityFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/announcements/AnnouncementsPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val onCreateMethod = WatchWhileActivityFingerprint.result?.let {
|
||||
@@ -48,10 +48,12 @@ object AnnouncementsPatch : BytecodePatch(
|
||||
StringResource(
|
||||
"revanced_announcements_summary_on",
|
||||
"Announcements are shown on startup"
|
||||
), StringResource(
|
||||
),
|
||||
StringResource(
|
||||
"revanced_announcements_summary_off",
|
||||
"Announcements are not shown on startup"
|
||||
), StringResource(
|
||||
),
|
||||
StringResource(
|
||||
"revanced_announcements_enabled_summary",
|
||||
"Show announcements on startup"
|
||||
),
|
||||
|
||||
@@ -52,7 +52,7 @@ object AutoRepeatPatch : BytecodePatch(
|
||||
val parentResult = AutoRepeatParentFingerprint.result
|
||||
?: throw PatchException("ParentFingerprint did not resolve.")
|
||||
|
||||
//this one needs to be called when app/revanced/integrations/patches/AutoRepeatPatch;->shouldAutoRepeat() returns true
|
||||
//this one needs to be called when app/revanced/integrations/youtube/patches/AutoRepeatPatch;->shouldAutoRepeat() returns true
|
||||
val playMethod = parentResult.mutableMethod
|
||||
AutoRepeatFingerprint.resolve(context, parentResult.classDef)
|
||||
//String is: Laamp;->E()V
|
||||
@@ -65,7 +65,7 @@ object AutoRepeatPatch : BytecodePatch(
|
||||
|
||||
//Instructions to add to the smali code
|
||||
val instructions = """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/AutoRepeatPatch;->shouldAutoRepeat()Z
|
||||
invoke-static {}, Lapp/revanced/integrations/youtube/patches/AutoRepeatPatch;->shouldAutoRepeat()Z
|
||||
move-result v0
|
||||
if-eqz v0, :noautorepeat
|
||||
invoke-virtual {p0}, $methodToCall
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ object SpoofDeviceDimensionsPatch : BytecodePatch(
|
||||
setOf(DeviceDimensionsModelToStringFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/spoof/SpoofDeviceDimensionsPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/spoof/SpoofDeviceDimensionsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
|
||||
+1
-1
@@ -64,6 +64,6 @@ internal object FixBackToExitGesturePatch : BytecodePatch(
|
||||
val register: String = "", val methodName: String, val parameterTypes: String = ""
|
||||
) {
|
||||
override fun toString() =
|
||||
"invoke-static {$register}, Lapp/revanced/integrations/patches/FixBackToExitGesturePatch;->$methodName($parameterTypes)V"
|
||||
"invoke-static {$register}, Lapp/revanced/integrations/youtube/patches/FixBackToExitGesturePatch;->$methodName($parameterTypes)V"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -43,7 +43,7 @@ object SpoofSignaturePatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/spoof/SpoofSignaturePatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/spoof/SpoofSignaturePatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
|
||||
@@ -59,7 +59,7 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
||||
// Check the availability of GmsCore.
|
||||
HomeActivityFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/integrations/patches/GmsCoreSupport;->checkAvailability()V"
|
||||
"invoke-static {}, Lapp/revanced/integrations/youtube/patches/GmsCoreSupport;->checkAvailability()V"
|
||||
) ?: throw HomeActivityFingerprint.exception
|
||||
|
||||
super.execute(context)
|
||||
|
||||
@@ -6,7 +6,6 @@ import app.revanced.patches.youtube.misc.integrations.fingerprints.*
|
||||
|
||||
@Patch(requiresIntegrations = true)
|
||||
object IntegrationsPatch : AbstractIntegrationsPatch(
|
||||
"Lapp/revanced/integrations/utils/ReVancedUtils;",
|
||||
setOf(
|
||||
ApplicationInitFingerprint,
|
||||
StandalonePlayerActivityFingerprint,
|
||||
|
||||
@@ -57,7 +57,7 @@ object BypassURLRedirectsPatch : BytecodePatch(
|
||||
replaceInstruction(
|
||||
insertIndex,
|
||||
"invoke-static {v$uriStringRegister}," +
|
||||
"Lapp/revanced/integrations/patches/BypassURLRedirectsPatch;" +
|
||||
"Lapp/revanced/integrations/youtube/patches/BypassURLRedirectsPatch;" +
|
||||
"->" +
|
||||
"parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;"
|
||||
)
|
||||
|
||||
@@ -55,7 +55,7 @@ object OpenLinksExternallyPatch : AbstractTransformInstructionsPatch<Pair<Int, I
|
||||
mutableMethod.addInstructions(
|
||||
intentStringIndex + 1,
|
||||
"""
|
||||
invoke-static {v$register}, Lapp/revanced/integrations/patches/OpenLinksExternallyPatch;->getIntent(Ljava/lang/String;)Ljava/lang/String;
|
||||
invoke-static {v$register}, Lapp/revanced/integrations/youtube/patches/OpenLinksExternallyPatch;->getIntent(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ object LithoFilterPatch : BytecodePatch(
|
||||
private val Instruction.descriptor
|
||||
get() = (this as ReferenceInstruction).reference.toString()
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/LithoFilterPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/LithoFilterPatch;"
|
||||
|
||||
internal lateinit var addFilter: (String) -> Unit
|
||||
private set
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ object MinimizedPlaybackPatch : BytecodePatch(
|
||||
KidsMinimizedPlaybackPolicyControllerFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/MinimizedPlaybackPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/MinimizedPlaybackPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// TODO: remove this empty preference sometime after mid 2023
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ object PlayerOverlaysHookPatch : BytecodePatch( // TODO: delete this unused outd
|
||||
val method = PlayerOverlaysOnFinishInflateFingerprint.result!!.mutableMethod
|
||||
method.addInstruction(
|
||||
method.implementation!!.instructions.size - 2,
|
||||
"invoke-static { p0 }, Lapp/revanced/integrations/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V"
|
||||
"invoke-static { p0 }, Lapp/revanced/integrations/youtube/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ object PlayerTypeHookPatch : BytecodePatch(
|
||||
setOf(PlayerTypeFingerprint, VideoStateFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/PlayerTypeHookPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/PlayerTypeHookPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PlayerTypeFingerprint.result?.mutableMethod?.addInstruction(
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
object RemoveTrackingQueryParameterPatch : BytecodePatch(
|
||||
setOf(CopyTextFingerprint, SystemShareSheetFingerprint, YouTubeShareSheetFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/RemoveTrackingQueryParameterPatch;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/RemoveTrackingQueryParameterPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.youtube.misc.settings
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@@ -11,8 +10,9 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.fingerprints.LicenseActivityFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.fingerprints.LicenseActivityOnCreateFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.fingerprints.SetThemeFingerprint
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
@@ -23,72 +23,53 @@ import java.io.Closeable
|
||||
dependencies = [IntegrationsPatch::class, SettingsResourcePatch::class]
|
||||
)
|
||||
object SettingsPatch : BytecodePatch(
|
||||
setOf(LicenseActivityFingerprint, SetThemeFingerprint)
|
||||
setOf(LicenseActivityOnCreateFingerprint, SetThemeFingerprint)
|
||||
), Closeable {
|
||||
private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations"
|
||||
private const val SETTINGS_ACTIVITY_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settingsmenu/ReVancedSettingActivity;"
|
||||
private const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/utils/ThemeHelper;"
|
||||
private const val SET_THEME_METHOD_NAME = "setTheme"
|
||||
private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations/youtube"
|
||||
private const val ACTIVITY_HOOK_CLASS_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settings/LicenseActivityHook;"
|
||||
|
||||
private const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/ThemeHelper;"
|
||||
private const val SET_THEME_METHOD_NAME: String = "setTheme"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// TODO: Remove this when it is only required at one place.
|
||||
fun getSetThemeInstructionString(
|
||||
registers: String = "v0",
|
||||
classDescriptor: String = THEME_HELPER_DESCRIPTOR,
|
||||
methodName: String = SET_THEME_METHOD_NAME,
|
||||
parameters: String = "Ljava/lang/Object;"
|
||||
) = "invoke-static { $registers }, $classDescriptor->$methodName($parameters)V"
|
||||
|
||||
SetThemeFingerprint.result?.mutableMethod?.let { setThemeMethod ->
|
||||
setThemeMethod.implementation!!.instructions.mapIndexedNotNull { i, instruction ->
|
||||
if (instruction.opcode == Opcode.RETURN_OBJECT) i else null
|
||||
}
|
||||
.asReversed() // Prevent index shifting.
|
||||
.forEach { returnIndex ->
|
||||
// The following strategy is to replace the return instruction with the setTheme instruction,
|
||||
// then add a return instruction after the setTheme instruction.
|
||||
// This is done because the return instruction is a target of another instruction.
|
||||
if (instruction.opcode == Opcode.RETURN_OBJECT) i else null
|
||||
}.asReversed().forEach { returnIndex ->
|
||||
// The following strategy is to replace the return instruction with the setTheme instruction,
|
||||
// then add a return instruction after the setTheme instruction.
|
||||
// This is done because the return instruction is a target of another instruction.
|
||||
|
||||
setThemeMethod.apply {
|
||||
// This register is returned by the setTheme method.
|
||||
val register = getInstruction<OneRegisterInstruction>(returnIndex).registerA
|
||||
|
||||
val setThemeInstruction = getSetThemeInstructionString("v$register")
|
||||
replaceInstruction(returnIndex, setThemeInstruction)
|
||||
addInstruction(returnIndex + 1, "return-object v0")
|
||||
}
|
||||
setThemeMethod.apply {
|
||||
// This register is returned by the setTheme method.
|
||||
val register = getInstruction<OneRegisterInstruction>(returnIndex).registerA
|
||||
replaceInstruction(
|
||||
returnIndex,
|
||||
"invoke-static { v$register }, " +
|
||||
"$THEME_HELPER_DESCRIPTOR->$SET_THEME_METHOD_NAME(Ljava/lang/Object;)V"
|
||||
)
|
||||
addInstruction(returnIndex + 1, "return-object v$register")
|
||||
}
|
||||
}
|
||||
} ?: throw SetThemeFingerprint.exception
|
||||
|
||||
|
||||
// Modify the license activity and remove all existing layout code.
|
||||
// Must modify an existing activity and cannot add a new activity to the manifest,
|
||||
// as that fails for root installations.
|
||||
LicenseActivityFingerprint.result!!.apply licenseActivity@{
|
||||
mutableMethod.apply {
|
||||
fun buildSettingsActivityInvokeString(
|
||||
registers: String = "p0",
|
||||
classDescriptor: String = SETTINGS_ACTIVITY_DESCRIPTOR,
|
||||
methodName: String = "initializeSettings",
|
||||
parameters: String = "Landroid/app/Activity;"
|
||||
) = getSetThemeInstructionString(registers, classDescriptor, methodName, parameters)
|
||||
LicenseActivityOnCreateFingerprint.result?.let { result ->
|
||||
result.mutableMethod.addInstructions(
|
||||
1,
|
||||
"""
|
||||
invoke-static { p0 }, $ACTIVITY_HOOK_CLASS_DESCRIPTOR->initialize(Landroid/app/Activity;)V
|
||||
return-void
|
||||
"""
|
||||
)
|
||||
|
||||
// initialize the settings
|
||||
addInstructions(
|
||||
1,
|
||||
"""
|
||||
${buildSettingsActivityInvokeString()}
|
||||
return-void
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
// remove method overrides
|
||||
mutableClass.apply {
|
||||
// Remove other methods as they will break as the onCreate method is modified above.
|
||||
result.mutableClass.apply {
|
||||
methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) }
|
||||
}
|
||||
}
|
||||
|
||||
} ?: throw LicenseActivityOnCreateFingerprint.exception
|
||||
}
|
||||
|
||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||
|
||||
@@ -96,11 +96,9 @@ object SettingsResourcePatch : AbstractSettingsResourcePatch(
|
||||
title = StringResource("revanced_pref_import_export_title", "Import / Export"),
|
||||
summary = StringResource("revanced_pref_import_export_summary", "Import / Export ReVanced settings"),
|
||||
inputType = InputType.TEXT_MULTI_LINE,
|
||||
tag = "app.revanced.integrations.settingsmenu.ImportExportPreference"
|
||||
tag = "app.revanced.integrations.shared.settings.preference.ImportExportPreference"
|
||||
)
|
||||
)
|
||||
|
||||
context.mergeStrings("settings/host/values/strings.xml")
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object LicenseActivityFingerprint : MethodFingerprint(
|
||||
internal object LicenseActivityOnCreateFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf("L"),
|
||||
@@ -37,7 +37,7 @@ object ZoomHapticsPatch : BytecodePatch(
|
||||
zoomHapticsFingerprintMethod.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/ZoomHapticsPatch;->shouldVibrate()Z
|
||||
invoke-static { }, Lapp/revanced/integrations/youtube/patches/ZoomHapticsPatch;->shouldVibrate()Z
|
||||
move-result v0
|
||||
if-nez v0, :vibrate
|
||||
return-void
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ object HDRBrightnessPatch : BytecodePatch(
|
||||
method.addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$register}, Lapp/revanced/integrations/patches/HDRAutoBrightnessPatch;->getHDRBrightness(F)F
|
||||
invoke-static {v$register}, Lapp/revanced/integrations/youtube/patches/HDRAutoBrightnessPatch;->getHDRBrightness(F)F
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ object VideoInformationPatch : BytecodePatch(
|
||||
OnPlaybackSpeedItemClickFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/VideoInformation;"
|
||||
|
||||
private lateinit var playerInitMethod: MutableMethod
|
||||
private var playerInitInsertIndex = 4
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ object RememberVideoQualityPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/RememberVideoQualityPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/playback/quality/RememberVideoQualityPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// This is bloated as each value has it's own String key/value
|
||||
|
||||
+2
-2
@@ -40,10 +40,10 @@ object CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/PlaybackSpeedMenuFilterPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/PlaybackSpeedMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/playback/speed/CustomPlaybackSpeedPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ object RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
setOf(InitializePlaybackSpeedValuesFingerprint)
|
||||
){
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/speed/RememberPlaybackSpeedPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/playback/speed/RememberPlaybackSpeedPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
|
||||
+2
-2
@@ -41,10 +41,10 @@ object RestoreOldVideoQualityMenuPatch : BytecodePatch(
|
||||
setOf(VideoQualityMenuViewInflateFingerprint)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/VideoQualityMenuFilterPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/components/VideoQualityMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/RestoreOldVideoQualityMenuPatch;"
|
||||
"Lapp/revanced/integrations/youtube/patches/playback/quality/RestoreOldVideoQualityMenuPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Patch for the old type of the video quality menu.
|
||||
|
||||
Reference in New Issue
Block a user