From 00fb748025bc4d4a19f88ceeba911fef5bff1fce Mon Sep 17 00:00:00 2001 From: inotia00 Date: Fri, 23 Jun 2023 19:38:17 +0900 Subject: [PATCH] fix(youtube): separate `hide-general-ads` to `hide-layout-components` patch --- .../fingerprints/TabLayoutFingerprint.kt | 2 +- .../blacknavbar/patch/BlackNavbarPatch.kt | 2 +- .../castbutton/patch/HideCastButtonPatch.kt | 2 +- .../fingerprints/ChipCloudFingerprint.kt | 2 +- .../categorybar/patch/CategoryBarPatch.kt | 2 +- .../patch/ColorMatchPlayerPatch.kt | 4 +- .../fingerprints/DialogSolidFingerprint.kt | 2 +- .../compactdialog/patch/CompactDialogPatch.kt | 2 +- .../fingerprints/DismissQueueFingerprint.kt | 2 +- .../dismissqueue/patch/DismissQueuePatch.kt | 2 +- .../FloatingButtonParentFingerprint.kt | 2 +- .../patch/NewPlaylistButtonPatch.kt | 2 +- .../TabletIdentifierFingerprint.kt | 2 +- .../landscapemode/patch/LandScapeModePatch.kt | 2 +- .../patch/MinimizedPlayerPatch.kt | 2 +- .../fingerprints/TabLayoutTextFingerprint.kt | 2 +- .../patch/NavigationLabelPatch.kt | 2 +- .../fingerprints/NewLayoutFingerprint.kt | 2 +- .../layout/newlayout/patch/NewLayoutPatch.kt | 2 +- .../fingerprints/SwipeToCloseFingerprint.kt | 2 +- .../patch/OldStyleMiniPlayerPatch.kt | 4 +- .../fingerprints/SleepTimerFingerprint.kt | 2 +- .../sleeptimer/patch/SleepTimerPatch.kt | 2 +- .../layout/zenmode/patch/ZenModePatch.kt | 4 +- .../BackgroundPlaybackParentFingerprint.kt | 2 +- .../patch/BackgroundPlayPatch.kt | 2 +- .../bitrate/patch/BitrateDefaultValuePatch.kt | 22 +++---- .../patch/ExclusiveAudioPatch.kt | 2 +- .../patch/MinimizedPlaybackPatch.kt | 2 +- .../AccountMenuFooterFingerprint.kt | 2 +- .../misc/premium/patch/HideGetPremiumPatch.kt | 2 +- ...icVideoQualitySettingsParentFingerprint.kt | 2 +- .../misc/quality/patch/VideoQualityPatch.kt | 2 +- .../FullStackTraceActivityFingerprint.kt | 2 +- .../patch/ShareButtonHookPatch.kt | 2 +- .../MusicPlaybackControlsFingerprint.kt | 2 +- .../fingerprints/ShuffleClassFingerprint.kt | 6 +- .../misc/shuffle/patch/EnforceShufflePatch.kt | 2 +- .../patch/RemoveTasteBuilderPatch.kt | 2 +- .../fingerprints/NotifierShelfFingerprint.kt | 2 +- .../PivotBarConstructorFingerprint.kt | 6 +- .../patch/RemoveUpgradeButtonPatch.kt | 2 +- .../fingerprints/PreferenceFingerprint.kt | 2 +- .../SettingsHeadersFragmentFingerprint.kt | 2 +- .../videoid/fingerprint/VideoIdFingerprint.kt | 2 +- .../fingerprints/HideCommentAdsFingerprint.kt | 2 +- .../ScreenNavigatorFingerprint.kt | 2 +- .../patch/litho/ComponentParserPatch.kt | 12 ++-- .../general/resource/patch/GeneralAdsPatch.kt | 23 ++++---- .../CompactYpcOfferModuleViewFingerprint.kt | 2 +- .../comment/patch/CommentComponentPatch.kt | 3 + .../patch/FlyoutPanelPatch.kt | 8 ++- .../QualityMenuViewInflateFingerprint.kt | 2 +- .../patch/OldQualityLayoutPatch.kt | 2 +- .../patch/HideAutoplayPreviewPatch.kt | 19 ++----- .../patch/CompactControlsOverlayPatch.kt | 2 +- .../EndScreenResultsFingerprint.kt | 2 +- .../patch/HideEndScreenOverlayPatch.kt | 2 +- .../FullscreenEngagementPanelFingerprint.kt | 5 +- .../FullscreenViewAdderFingerprint.kt | 2 +- .../patch/HideFullscreenPanelsPatch.kt | 4 +- .../OrientationPrimaryFingerprint.kt | 2 +- .../landscapemode/patch/LandScapeModePatch.kt | 2 +- .../quickactions/patch/QuickActionsPatch.kt | 6 +- .../AccountMenuParentFingerprint.kt | 2 +- .../accountmenu/patch/AccountMenuPatch.kt | 2 +- .../autocaptions/patch/AutoCaptionsPatch.kt | 8 ++- .../patch/PlayerPopupPanelsPatch.kt | 2 +- .../FilterBarHeightFingerprint.kt | 2 +- .../RelatedChipCloudFingerprint.kt | 2 +- .../SearchResultsChipBarFingerprint.kt | 2 +- .../categorybar/patch/CategoryBarPatch.kt | 2 +- .../ChannelListSubMenuFingerprint.kt | 2 +- .../patch/ChannelListSubMenuPatch.kt | 2 +- .../CrowdfundingBoxFingerprint.kt | 2 +- .../patch/CrowdfundingBoxPatch.kt | 2 +- .../FloatingMicrophoneFingerprint.kt | 2 +- .../patch/FloatingMicrophonePatch.kt | 2 +- .../layout/patch/LayoutComponentsPatch.kt | 54 ++++++++++++++++++ .../fingerprints/LoadMoreButtonFingerprint.kt | 2 +- .../patch/LoadMoreButtonPatch.kt | 2 +- .../BottomPanelOverlayTextFingerprint.kt | 2 +- .../mixplaylists/patch/MixPlaylistsPatch.kt | 2 +- ...ntSwitcherAccessibilityLabelFingerprint.kt | 2 +- .../patch/HideEmailAddressPatch.kt | 2 +- .../SearchSuggestionEntryFingerprint.kt | 2 +- .../searchterms/patch/SearchTermsPatch.kt | 2 +- .../fingerprints/HideSnackBarFingerprint.kt | 2 +- .../snackbar/patch/HideSnackBarPatch.kt | 2 +- .../fingerprints/BreakingNewsFingerprint.kt | 2 +- .../patch/SuggestionsShelfPatch.kt | 2 +- ...niPlayerDimensionsCalculatorFingerprint.kt | 2 +- .../patch/TabletMiniPlayerPatch.kt | 2 +- .../SetActionBarRingoFingerprint.kt | 2 +- .../SetToolBarPaddingFingerprint.kt | 2 +- .../widesearchbar/patch/WideSearchbarPatch.kt | 2 +- .../materialyou/patch/MaterialYouPatch.kt | 2 +- .../patch/PiPNotificationPatch.kt | 2 +- .../youtube/layout/theme/patch/ThemePatch.kt | 2 +- .../TooltipContentViewFingerprint.kt | 2 +- .../tooltip/patch/TooltipContentViewPatch.kt | 2 +- .../fingerprints/PowerSaveModeFingerprint.kt | 2 +- .../ambientmode/patch/PowerSaveModePatch.kt | 2 +- .../patch/ExternalBrowserPatch.kt | 2 +- .../VideoCapabilitiesFingerprint.kt | 2 +- .../misc/forcevp9/patch/ForceVP9CodecPatch.kt | 4 +- .../fingerprints/GeneralPrefsFingerprint.kt | 2 +- .../language/patch/LanguageSelectorPatch.kt | 2 +- .../layoutswitch/patch/LayoutSwitchPatch.kt | 4 +- ...izedPlaybackPolicyControllerFingerprint.kt | 29 +++++++++- .../MinimizedPlaybackManagerFingerprint.kt | 2 +- .../MinimizedPlaybackSettingsFingerprint.kt | 2 +- .../patch/MinimizedPlaybackPatch.kt | 2 +- .../patch/OpenLinksDirectlyPatch.kt | 2 +- .../CronetEngineBuilderFingerprint.kt | 2 +- ...erimentalCronetEngineBuilderFingerprint.kt | 2 +- .../misc/quic/patch/QUICProtocolPatch.kt | 2 +- .../SplashAnimationBuilderFingerprint.kt | 2 +- .../patch/NewSplashAnimationPatch.kt | 2 +- .../homepage/patch/ChangeHomePagePatch.kt | 2 +- .../PivotBarSetTextFingerprint.kt | 2 +- .../label/patch/NavigationLabelPatch.kt | 2 +- .../patch/NavigationButtonsPatch.kt | 4 +- .../ReelWatchEndpointFingerprint.kt | 2 +- .../shortsnavbar/patch/ShortsNavBarPatch.kt | 4 +- .../PivotBarChangedFingerprint.kt | 2 +- .../fingerprints/PivotBarStyleFingerprint.kt | 2 +- .../patch/TabletNavigationBarPatch.kt | 2 +- .../AutoNavInformerFingerprint.kt | 18 +++++- .../fingerprints/VideoEndFingerprint.kt | 2 +- .../autorepeat/patch/AutoRepeatPatch.kt | 11 +++- .../general/patch/OverlayButtonsPatch.kt | 6 +- .../patch/HideAutoplayButtonPatch.kt | 18 ++---- .../patch/HideCaptionsButtonPatch.kt | 10 +++- .../fingerprints/CastButtonFingerprint.kt | 2 +- .../castbutton/patch/HideCastButtonPatch.kt | 2 +- .../SpeedOverlayHookFingerprint.kt | 2 +- .../YouTubeTextViewFingerprint.kt | 2 +- .../patch/CustomSpeedOverlayPatch.kt | 2 +- .../fingerprints/LayoutCircleFingerprint.kt | 2 +- .../fingerprints/LayoutIconFingerprint.kt | 2 +- .../fingerprints/LayoutVideoFingerprint.kt | 2 +- .../patch/HideEndScreenCardsPatch.kt | 2 +- .../FilmStripOverlayConfigFingerprint.kt | 2 +- .../FilmStripOverlayParentFingerprint.kt | 2 +- .../TimeBarOnClickListenerFingerprint.kt | 14 ----- .../patch/HideFilmstripOverlayPatch.kt | 28 +++++---- .../fingerprints/SeekHapticsFingerprint.kt | 2 +- .../patch/HapticFeedBackPatch.kt | 2 +- .../infocards/patch/HideInfoCardsPatch.kt | 2 +- .../MusicAppDeeplinkButtonFingerprint.kt | 12 +++- .../musicbutton/patch/HideMusicButtonPatch.kt | 10 +++- .../HidePlayerButtonFingerprint.kt | 2 +- .../patch/HidePlayerButtonBackgroundPatch.kt | 2 +- .../fingerprints/ScrimOverlayFingerprint.kt | 13 ----- .../patch/PlayerOverlayFilterPatch.kt | 8 +-- .../SeekEduContainerFingerprint.kt | 2 +- .../seekmessage/patch/SeekMessagePatch.kt | 2 +- .../SpeedOverlayConfigFingerprint.kt | 2 +- .../patch/HideSpeedOverlayPatch.kt | 2 +- .../SuggestedActionsFingerprint.kt | 2 +- .../patch/SuggestedActionsPatch.kt | 2 +- .../patch/HideChannelWatermarkPatch.kt | 2 +- .../seekbar/seekbar/patch/HideSeekbarPatch.kt | 2 +- .../fingerprints/SeekbarColorFingerprint.kt | 6 +- .../seekbar/speed/patch/AppendSpeedPatch.kt | 2 +- .../fingerprints/SeekbarTappingFingerprint.kt | 2 +- .../SeekbarTappingReferenceFingerprint.kt | 2 +- .../tapping/patch/SeekbarTappingPatch.kt | 2 +- .../ThumbnailPreviewConfigFingerprint.kt | 2 +- .../patch/NewThumbnailPreviewPatch.kt | 2 +- .../fingerprints/TimeCounterFingerprint.kt | 3 +- .../timestamps/patch/HideTimeStampPatch.kt | 2 +- .../fingerprints/ShortsCommentFingerprint.kt | 2 +- .../ShortsInfoPanelFingerprint.kt | 2 +- .../ShortsPaidContentFingerprint.kt | 2 +- .../fingerprints/ShortsRemixFingerprint.kt | 2 +- .../ShortsSubscriptionsFingerprint.kt | 2 +- ...rtsSubscriptionsTabletParentFingerprint.kt | 2 +- .../patch/ShortsCommentButtonPatch.kt | 2 +- .../patch/ShortsComponentPatch.kt | 16 ++---- .../patch/ShortsInfoPanelPatch.kt | 3 +- .../patch/ShortsPaidContentBannerPatch.kt | 2 +- .../patch/ShortsRemixButtonPatch.kt | 2 +- .../patch/ShortsSubscriptionsButtonPatch.kt | 2 +- .../patch/DisableShortsOnStartupPatch.kt | 2 +- .../hdrbrightness/patch/HDRBrightnessPatch.kt | 2 +- .../SwipeControlsHostActivityFingerprint.kt | 2 +- .../WatchWhileActivityFingerprint.kt | 2 +- .../patch/SwipeControlsBytecodePatch.kt | 2 +- .../resource/patch/SwipeControlsPatch.kt | 2 +- .../LayoutConstructorFingerprint.kt | 8 ++- .../fingerprints/OnBackPressedFingerprint.kt | 2 +- .../PivotBarCreateButtonViewFingerprint.kt | 2 +- .../SubtitleButtonControllerFingerprint.kt | 10 +++- .../fingerprints/TotalTimeFingerprint.kt | 2 +- .../YouTubeControlsOverlayFingerprint.kt | 10 +++- .../fingerprint/ScrollTopParentFingerprint.kt | 2 +- .../patch/DoubleBackToClosePatch.kt | 2 +- .../fingerprints/SubtitleWindowFingerprint.kt | 2 +- .../SwipeRefreshLayoutFingerprint.kt | 2 +- .../fingerprints/LithoFilterFingerprint.kt | 11 ++++ .../fingerprints/LithoThemeFingerprint.kt | 2 +- .../utils/litho/patch/LithoFilterPatch.kt | 45 ++++++++++++--- .../fingerprints/TopBarButtonFingerprint.kt | 2 +- .../navbarindex/patch/NavBarIndexPatch.kt | 2 +- .../VideoSpeedChangedFingerprint.kt | 2 +- .../VideoSpeedPatchFingerprint.kt | 2 +- .../fingerprints/LiveChatFingerprint.kt | 2 +- .../BottomControlsInflateFingerprint.kt | 2 +- .../ControlsLayoutInflateFingerprint.kt | 2 +- .../PlayerControlsVisibilityFingerprint.kt | 3 +- .../SpeedEduVisibleFingerprint.kt | 2 +- .../patch/PlayerControlsPatch.kt | 13 ++++- ...layerOverlaysOnFinishInflateFingerprint.kt | 2 +- .../fingerprint/PlayerTypeFingerprint.kt | 2 +- .../fingerprint/VideoStateFingerprint.kt | 3 +- .../playertype/patch/PlayerTypeHookPatch.kt | 28 ++++++--- .../QuickActionsElementFingerprint.kt | 2 +- .../resourceid/patch/SharedResourceIdPatch.kt | 12 +++- .../fingerprints/ButtonTagFingerprint.kt | 2 +- .../ThemeSetterSystemFingerprint.kt | 2 +- .../OverlayViewLayoutFingerprint.kt | 20 ------- .../PlayerControllerFingerprint.kt | 2 +- .../patch/SponsorBlockBytecodePatch.kt | 12 ++-- .../fingerprint/LegacyVideoIdFingerprint.kt | 14 ----- .../LegacyVideoIdParentFingerprint.kt | 23 ++++++++ .../legacy/patch/LegacyVideoIdPatch.kt | 30 ++++++---- .../MainstreamVideoIdFingerprint.kt | 3 +- .../MainstreamVideoIdParentFingerprint.kt | 9 +++ .../fingerprint/TimebarFingerprint.kt | 6 +- .../fingerprint/VideoLengthFingerprint.kt | 2 +- .../patch/MainstreamVideoIdPatch.kt | 26 ++++++--- .../VideoUserQualityChangeFingerprint.kt | 2 +- .../youtube/settings/host/values/strings.xml | 10 ++-- .../youtube/settings/values-v21/strings.xml | 6 +- .../youtube/settings/xml/revanced_prefs.xml | 57 ++++++++++--------- 237 files changed, 655 insertions(+), 471 deletions(-) rename src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/{flyoutpanel => general}/patch/FlyoutPanelPatch.kt (80%) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/general/layout/patch/LayoutComponentsPatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/TimeBarOnClickListenerFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/fingerprints/ScrimOverlayFingerprint.kt rename src/main/kotlin/app/revanced/patches/youtube/{fullscreen/compactcontrolsoverlay => utils}/fingerprints/YouTubeControlsOverlayFingerprint.kt (62%) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoFilterFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/OverlayViewLayoutFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdFingerprint.kt create mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdParentFingerprint.kt create mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdParentFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/fingerprints/TabLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/fingerprints/TabLayoutFingerprint.kt index a2e79cb9a..c7c0e456c 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/fingerprints/TabLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/fingerprints/TabLayoutFingerprint.kt @@ -16,6 +16,6 @@ object TabLayoutFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ColorGrey) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ColorGrey) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/patch/BlackNavbarPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/patch/BlackNavbarPatch.kt index d58decd24..1f3ddec60 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/patch/BlackNavbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/blacknavbar/patch/BlackNavbarPatch.kt @@ -12,8 +12,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.blacknavbar.fingerprints.TabLayoutFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/layout/castbutton/patch/HideCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/castbutton/patch/HideCastButtonPatch.kt index fc93c08c7..32e685d91 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/castbutton/patch/HideCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/castbutton/patch/HideCastButtonPatch.kt @@ -12,9 +12,9 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonFingerprint import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonParentFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT diff --git a/src/main/kotlin/app/revanced/patches/music/layout/categorybar/fingerprints/ChipCloudFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/categorybar/fingerprints/ChipCloudFingerprint.kt index 04e7df990..c2c1d8183 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/categorybar/fingerprints/ChipCloudFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/categorybar/fingerprints/ChipCloudFingerprint.kt @@ -13,6 +13,6 @@ object ChipCloudFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ChipCloud) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ChipCloud) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/categorybar/patch/CategoryBarPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/categorybar/patch/CategoryBarPatch.kt index 90ec99d7b..9d0281619 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/categorybar/patch/CategoryBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/categorybar/patch/CategoryBarPatch.kt @@ -12,8 +12,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.categorybar.fingerprints.ChipCloudFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/layout/colormatchplayer/patch/ColorMatchPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/colormatchplayer/patch/ColorMatchPlayerPatch.kt index 759201233..57d028806 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/colormatchplayer/patch/ColorMatchPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/colormatchplayer/patch/ColorMatchPlayerPatch.kt @@ -16,10 +16,10 @@ 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.patcher.util.smali.ExternalLabel -import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.colormatchplayer.fingerprints.ColorMatchPlayerFingerprint -import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint +import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT import org.jf.dexlib2.iface.instruction.Instruction diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/fingerprints/DialogSolidFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/fingerprints/DialogSolidFingerprint.kt index b888e232c..6cfb91bc5 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/fingerprints/DialogSolidFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/fingerprints/DialogSolidFingerprint.kt @@ -16,6 +16,6 @@ object DialogSolidFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_STATIC ), - customFingerprint = { it, _ -> it.isWideLiteralExists(DialogSolid) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(DialogSolid) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/patch/CompactDialogPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/patch/CompactDialogPatch.kt index d77b239f8..9aa9edaeb 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/patch/CompactDialogPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactdialog/patch/CompactDialogPatch.kt @@ -13,8 +13,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.compactdialog.fingerprints.DialogSolidFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/fingerprints/DismissQueueFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/fingerprints/DismissQueueFingerprint.kt index 1fbacdee7..d32a58158 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/fingerprints/DismissQueueFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/fingerprints/DismissQueueFingerprint.kt @@ -11,5 +11,5 @@ object DismissQueueFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT ), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45413042) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45413042) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/patch/DismissQueuePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/patch/DismissQueuePatch.kt index 276dc183c..fc460d695 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/patch/DismissQueuePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/dismissqueue/patch/DismissQueuePatch.kt @@ -12,8 +12,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.dismissqueue.fingerprints.DismissQueueFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT diff --git a/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/fingerprints/FloatingButtonParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/fingerprints/FloatingButtonParentFingerprint.kt index 0b4a58284..42a0cff85 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/fingerprints/FloatingButtonParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/fingerprints/FloatingButtonParentFingerprint.kt @@ -11,6 +11,6 @@ object FloatingButtonParentFingerprint : MethodFingerprint( accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL, parameters = listOf("L"), opcodes = listOf(Opcode.INVOKE_DIRECT), - customFingerprint = { it, _ -> it.isNarrowLiteralExists(259982244) } + customFingerprint = { methodDef, _ -> methodDef.isNarrowLiteralExists(259982244) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/patch/NewPlaylistButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/patch/NewPlaylistButtonPatch.kt index f88a0cbd3..1b0c00cc4 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/patch/NewPlaylistButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/floatingbutton/patch/NewPlaylistButtonPatch.kt @@ -14,9 +14,9 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonFingerprint import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonParentFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/fingerprints/TabletIdentifierFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/fingerprints/TabletIdentifierFingerprint.kt index 4b6f0cbdb..c3b0a21fc 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/fingerprints/TabletIdentifierFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/fingerprints/TabletIdentifierFingerprint.kt @@ -16,6 +16,6 @@ object TabletIdentifierFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(IsTablet) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(IsTablet) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/patch/LandScapeModePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/patch/LandScapeModePatch.kt index 4d1a2a71f..3380b2b0f 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/patch/LandScapeModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/landscapemode/patch/LandScapeModePatch.kt @@ -11,8 +11,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.landscapemode.fingerprints.TabletIdentifierFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayer/patch/MinimizedPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayer/patch/MinimizedPlayerPatch.kt index 69db4e758..8bc5bc5f8 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayer/patch/MinimizedPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayer/patch/MinimizedPlayerPatch.kt @@ -11,8 +11,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.minimizedplayer.fingerprints.MinimizedPlayerFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT diff --git a/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/fingerprints/TabLayoutTextFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/fingerprints/TabLayoutTextFingerprint.kt index be98a560f..177783ecc 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/fingerprints/TabLayoutTextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/fingerprints/TabLayoutTextFingerprint.kt @@ -16,6 +16,6 @@ object TabLayoutTextFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(Text1) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(Text1) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/patch/NavigationLabelPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/patch/NavigationLabelPatch.kt index 185decefa..62d5c70ef 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/patch/NavigationLabelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/navigationlabel/patch/NavigationLabelPatch.kt @@ -13,8 +13,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.navigationlabel.fingerprints.TabLayoutTextFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.Text1 import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch diff --git a/src/main/kotlin/app/revanced/patches/music/layout/newlayout/fingerprints/NewLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/newlayout/fingerprints/NewLayoutFingerprint.kt index 410079289..9ab3ff9f7 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/newlayout/fingerprints/NewLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/newlayout/fingerprints/NewLayoutFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object NewLayoutFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf(), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45399578) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45399578) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/layout/newlayout/patch/NewLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/newlayout/patch/NewLayoutPatch.kt index cd883bd65..11d711fa8 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/newlayout/patch/NewLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/newlayout/patch/NewLayoutPatch.kt @@ -12,8 +12,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.newlayout.fingerprints.NewLayoutFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT diff --git a/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/fingerprints/SwipeToCloseFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/fingerprints/SwipeToCloseFingerprint.kt index fdad35825..f11bcfc45 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/fingerprints/SwipeToCloseFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/fingerprints/SwipeToCloseFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object SwipeToCloseFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf(), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45398432) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45398432) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/patch/OldStyleMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/patch/OldStyleMiniPlayerPatch.kt index 88d40421b..5731cfd92 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/patch/OldStyleMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/oldstyleminiplayer/patch/OldStyleMiniPlayerPatch.kt @@ -13,11 +13,11 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint import app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint -import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint +import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/fingerprints/SleepTimerFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/fingerprints/SleepTimerFingerprint.kt index 31955874b..3b41f0b80 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/fingerprints/SleepTimerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/fingerprints/SleepTimerFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object SleepTimerFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf(), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45372767) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45372767) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/patch/SleepTimerPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/patch/SleepTimerPatch.kt index 968127b93..bf4fb68e5 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/patch/SleepTimerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/sleeptimer/patch/SleepTimerPatch.kt @@ -12,8 +12,8 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.sleeptimer.fingerprints.SleepTimerFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT diff --git a/src/main/kotlin/app/revanced/patches/music/layout/zenmode/patch/ZenModePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/zenmode/patch/ZenModePatch.kt index 276bdc802..154f299ad 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/zenmode/patch/ZenModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/zenmode/patch/ZenModePatch.kt @@ -14,10 +14,10 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.layout.zenmode.fingerprints.ZenModeFingerprint -import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint +import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType import app.revanced.util.integrations.Constants.MUSIC_LAYOUT import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/fingerprints/BackgroundPlaybackParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/fingerprints/BackgroundPlaybackParentFingerprint.kt index 7128b0f2e..0a2af5696 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/fingerprints/BackgroundPlaybackParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/fingerprints/BackgroundPlaybackParentFingerprint.kt @@ -17,5 +17,5 @@ object BackgroundPlaybackParentFingerprint : MethodFingerprint( Opcode.GOTO, Opcode.NOP ), - customFingerprint = { it, _ -> it.definingClass.endsWith("/WatchFragment;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/WatchFragment;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt index 84aebe806..41ea9dfa6 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt @@ -12,8 +12,8 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility @Patch @Name("background-play") diff --git a/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt index 3c4af3b40..2e74f51d3 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt @@ -20,20 +20,20 @@ class BitrateDefaultValuePatch : ResourcePatch { context.xmlEditor[RESOURCE_FILE_PATH].use { editor -> editor.file.getElementsByTagName("com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat") .item(0).childNodes.apply { - arrayOf("BitrateAudioMobile", "BitrateAudioWiFi").forEach { - for (i in 1 until length) { - val view = item(i) - if ( - view.hasAttributes() && - view.attributes.getNamedItem("android:key").nodeValue.endsWith(it) - ) { - view.attributes.getNamedItem("android:defaultValue").nodeValue = - "Always High" - break + arrayOf("BitrateAudioMobile", "BitrateAudioWiFi").forEach { + for (i in 1 until length) { + val view = item(i) + if ( + view.hasAttributes() && + view.attributes.getNamedItem("android:key").nodeValue.endsWith(it) + ) { + view.attributes.getNamedItem("android:defaultValue").nodeValue = + "Always High" + break + } } } } - } } return PatchResultSuccess() diff --git a/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt index 368f9ddd8..4b81b1004 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt @@ -11,8 +11,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility @Patch @Name("exclusive-audio-playback") diff --git a/src/main/kotlin/app/revanced/patches/music/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt index 9d33027f8..c65f8fe99 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt @@ -10,8 +10,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility @Patch @Name("minimized-playback-music") diff --git a/src/main/kotlin/app/revanced/patches/music/misc/premium/fingerprints/AccountMenuFooterFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/premium/fingerprints/AccountMenuFooterFingerprint.kt index 0bab15609..fac3254e2 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/premium/fingerprints/AccountMenuFooterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/premium/fingerprints/AccountMenuFooterFingerprint.kt @@ -18,5 +18,5 @@ object AccountMenuFooterFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.IGET_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(PrivacyTosFooter) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(PrivacyTosFooter) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt index bb4d2569a..0ffd31390 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt @@ -14,9 +14,9 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.premium.fingerprints.AccountMenuFooterFingerprint import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter import app.revanced.util.bytecode.getWideLiteralIndex diff --git a/src/main/kotlin/app/revanced/patches/music/misc/quality/fingerprints/MusicVideoQualitySettingsParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/quality/fingerprints/MusicVideoQualitySettingsParentFingerprint.kt index 79d08ce12..04ebe2395 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/quality/fingerprints/MusicVideoQualitySettingsParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/quality/fingerprints/MusicVideoQualitySettingsParentFingerprint.kt @@ -10,5 +10,5 @@ object MusicVideoQualitySettingsParentFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, parameters = listOf("L"), - customFingerprint = { it, _ -> it.isWideLiteralExists(QualityTitle) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(QualityTitle) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt index d425f0dc7..54beec6fe 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt @@ -15,10 +15,10 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.quality.fingerprints.MusicVideoQualitySettingsFingerprint import app.revanced.patches.music.misc.quality.fingerprints.MusicVideoQualitySettingsParentFingerprint import app.revanced.patches.music.misc.quality.fingerprints.UserQualityChangeFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.patches.music.utils.videoid.patch.VideoIdPatch diff --git a/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/fingerprints/FullStackTraceActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/fingerprints/FullStackTraceActivityFingerprint.kt index e937db4b0..f36c14f1d 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/fingerprints/FullStackTraceActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/fingerprints/FullStackTraceActivityFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.music.misc.sharebuttonhook.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object FullStackTraceActivityFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.definingClass.endsWith("FullStackTraceActivity;") && it.name == "onCreate" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("FullStackTraceActivity;") && methodDef.name == "onCreate" } ) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/patch/ShareButtonHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/patch/ShareButtonHookPatch.kt index 2c9ddb5e6..c55f1668d 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/patch/ShareButtonHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/sharebuttonhook/patch/ShareButtonHookPatch.kt @@ -15,11 +15,11 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.ConnectionTrackerFingerprint import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.FullStackTraceActivityFingerprint import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.SharePanelFingerprint import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.ShowToastFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.patches.music.utils.videoid.patch.VideoIdPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt index 93f123b31..7d1655601 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt @@ -14,5 +14,5 @@ object MusicPlaybackControlsFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.definingClass.endsWith("MusicPlaybackControls;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("MusicPlaybackControls;") } ) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/ShuffleClassFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/ShuffleClassFingerprint.kt index aa3f83961..36ad0ab71 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/ShuffleClassFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/shuffle/fingerprints/ShuffleClassFingerprint.kt @@ -18,6 +18,10 @@ object ShuffleClassFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.name == "" && it.isWideLiteralExists(DisabledIconAlpha) } + customFingerprint = { methodDef, _ -> + methodDef.name == "" && methodDef.isWideLiteralExists( + DisabledIconAlpha + ) + } ) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/shuffle/patch/EnforceShufflePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/shuffle/patch/EnforceShufflePatch.kt index 888890f6f..1aad61de1 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/shuffle/patch/EnforceShufflePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/shuffle/patch/EnforceShufflePatch.kt @@ -19,10 +19,10 @@ import app.revanced.patcher.util.TypeUtil.traverseClassHierarchy import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.util.smali.toInstructions -import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.shuffle.fingerprints.MusicPlaybackControlsFingerprint import app.revanced.patches.music.misc.shuffle.fingerprints.ShuffleClassFingerprint import app.revanced.patches.music.misc.shuffle.fingerprints.ShuffleClassReferenceFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch import app.revanced.util.enum.CategoryType diff --git a/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/RemoveTasteBuilderPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/RemoveTasteBuilderPatch.kt index d5fdf7e0a..41e0cc449 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/RemoveTasteBuilderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/RemoveTasteBuilderPatch.kt @@ -11,8 +11,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Patch diff --git a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/NotifierShelfFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/NotifierShelfFingerprint.kt index 47c21538c..c9c612368 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/NotifierShelfFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/NotifierShelfFingerprint.kt @@ -16,6 +16,6 @@ object NotifierShelfFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(MusicNotifierShelf) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(MusicNotifierShelf) } ) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt index 17544a104..6c7b2ff4d 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt @@ -13,5 +13,9 @@ object PivotBarConstructorFingerprint : MethodFingerprint( Opcode.IPUT_OBJECT, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.name == "" && it.isNarrowLiteralExists(117501096) } + customFingerprint = { methodDef, _ -> + methodDef.name == "" && methodDef.isNarrowLiteralExists( + 117501096 + ) + } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/RemoveUpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/RemoveUpgradeButtonPatch.kt index b915a41db..0e2fce8c0 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/RemoveUpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/RemoveUpgradeButtonPatch.kt @@ -14,9 +14,9 @@ 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.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint +import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/PreferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/PreferenceFingerprint.kt index 2e504dbf5..a774b6606 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/PreferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/PreferenceFingerprint.kt @@ -19,5 +19,5 @@ object PreferenceFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.INVOKE_INTERFACE ), - customFingerprint = { it, _ -> it.definingClass == "Landroidx/preference/Preference;" } + customFingerprint = { methodDef, _ -> methodDef.definingClass == "Landroidx/preference/Preference;" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/SettingsHeadersFragmentFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/SettingsHeadersFragmentFingerprint.kt index 838117251..8b5a4de8a 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/SettingsHeadersFragmentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/settings/bytecode/fingerprints/SettingsHeadersFragmentFingerprint.kt @@ -12,5 +12,5 @@ object SettingsHeadersFragmentFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.definingClass.endsWith("/SettingsHeadersFragment;") && it.name == "onCreate" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/SettingsHeadersFragment;") && methodDef.name == "onCreate" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/utils/videoid/fingerprint/VideoIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/videoid/fingerprint/VideoIdFingerprint.kt index 23db87420..9335b2be3 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/videoid/fingerprint/VideoIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/videoid/fingerprint/VideoIdFingerprint.kt @@ -12,5 +12,5 @@ object VideoIdFingerprint : MethodFingerprint( Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SubtitlesOverlayPresenter;") && methodDef.name == "handleVideoStageEvent" } ) diff --git a/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt index 1af494fa8..5b282ea6d 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt @@ -7,5 +7,5 @@ import org.jf.dexlib2.AccessFlags object HideCommentAdsFingerprint : MethodFingerprint( returnType = "Ljava/lang/Object;", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - customFingerprint = { it, _ -> it.definingClass.endsWith("RedditCommentsPageAdRepository;") }, + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("RedditCommentsPageAdRepository;") }, ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/fingerprints/ScreenNavigatorFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/fingerprints/ScreenNavigatorFingerprint.kt index 05f494666..e63861697 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/fingerprints/ScreenNavigatorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/fingerprints/ScreenNavigatorFingerprint.kt @@ -16,5 +16,5 @@ object ScreenNavigatorFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC ), strings = listOf("uri", "android.intent.action.VIEW"), - customFingerprint = { it, _ -> it.definingClass.endsWith("/RedditScreenNavigator;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/RedditScreenNavigator;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/patch/litho/ComponentParserPatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/litho/ComponentParserPatch.kt index a24350147..f0f92bd46 100644 --- a/src/main/kotlin/app/revanced/patches/shared/patch/litho/ComponentParserPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/litho/ComponentParserPatch.kt @@ -140,9 +140,9 @@ class ComponentParserPatch : BytecodePatch( sget-object v$freeRegister, $definingClass->buffer:Ljava/nio/ByteBuffer; invoke-static {v$stringBuilderRegister, v$identifierRegister, v$objectRegister, v$freeRegister}, $descriptor(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/Object;Ljava/nio/ByteBuffer;)Z move-result v$freeRegister - if-eqz v$freeRegister, :not_an_ad + if-eqz v$freeRegister, :unfiltered """ + emptyComponentLabel, - ExternalLabel("not_an_ad", getInstruction(insertIndex)) + ExternalLabel("unfiltered", getInstruction(insertIndex)) ) } } @@ -156,9 +156,9 @@ class ComponentParserPatch : BytecodePatch( """ invoke-static {v$stringBuilderRegister, v$identifierRegister}, $descriptor(Ljava/lang/StringBuilder;Ljava/lang/String;)Z move-result v$freeRegister - if-eqz v$freeRegister, :not_an_ad + if-eqz v$freeRegister, :unfiltered """ + emptyComponentLabel, - ExternalLabel("not_an_ad", getInstruction(insertIndex)) + ExternalLabel("unfiltered", getInstruction(insertIndex)) ) } } @@ -173,8 +173,8 @@ class ComponentParserPatch : BytecodePatch( sget-object v1, $definingClass->buffer:Ljava/nio/ByteBuffer; invoke-static {v0, v1}, $descriptor(Ljava/lang/Object;Ljava/nio/ByteBuffer;)Z move-result v0 - if-eqz v0, :not_an_ad - """ + emptyComponentLabel, ExternalLabel("not_an_ad", getInstruction(0)) + if-eqz v0, :unfiltered + """ + emptyComponentLabel, ExternalLabel("unfiltered", getInstruction(0)) ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/ads/general/resource/patch/GeneralAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ads/general/resource/patch/GeneralAdsPatch.kt index ebfd53ed0..15aa5e2ac 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ads/general/resource/patch/GeneralAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ads/general/resource/patch/GeneralAdsPatch.kt @@ -14,8 +14,11 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch import app.revanced.patches.youtube.ads.getpremium.patch.HideGetPremiumPatch import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fix.doublebacktoclose.patch.DoubleBackToClosePatch +import app.revanced.patches.youtube.utils.fix.swiperefresh.patch.SwipeRefreshPatch import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch +import app.revanced.util.integrations.Constants.PATCHES_PATH import app.revanced.util.resources.ResourceUtils.copyXmlNode import org.w3c.dom.Element @@ -24,10 +27,12 @@ import org.w3c.dom.Element @Description("Removes general ads.") @DependsOn( [ + DoubleBackToClosePatch::class, GeneralAdsBytecodePatch::class, HideGetPremiumPatch::class, LithoFilterPatch::class, - SettingsPatch::class + SettingsPatch::class, + SwipeRefreshPatch::class ] ) @YouTubeCompatibility @@ -55,6 +60,8 @@ class GeneralAdsPatch : ResourcePatch { ) override fun execute(context: ResourceContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/AdsFilter;") + context.forEach { if (!it.name.startsWithAny(*resourceFileNames)) return@forEach @@ -90,7 +97,7 @@ class GeneralAdsPatch : ResourcePatch { */ context.copyXmlNode("youtube/doubleback/host", "values/arrays.xml", "resources") - /* + /** * Add settings */ SettingsPatch.addPreference( @@ -98,17 +105,7 @@ class GeneralAdsPatch : ResourcePatch { "PREFERENCE: ADS_SETTINGS", "SETTINGS: HIDE_GENERAL_ADS", - "PREFERENCE: GENERAL_SETTINGS", - "SETTINGS: HIDE_GENERAL_ADS", - - "PREFERENCE: GENERAL_SETTINGS", - "PREFERENCE_HEADER: PLAYER", - "SETTINGS: HIDE_AUDIO_TRACK_BUTTON", - "SETTINGS: HIDE_VIEW_PRODUCT", - "SETTINGS: DOUBLE_BACK_TIMEOUT", - - "PREFERENCE: BOTTOM_PLAYER_SETTINGS", - "SETTINGS: COMMENT_COMPONENT_PARENT" + "SETTINGS: DOUBLE_BACK_TIMEOUT" ) ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ads/getpremium/fingerprints/CompactYpcOfferModuleViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/ads/getpremium/fingerprints/CompactYpcOfferModuleViewFingerprint.kt index cfcdcf785..57e365b96 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ads/getpremium/fingerprints/CompactYpcOfferModuleViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ads/getpremium/fingerprints/CompactYpcOfferModuleViewFingerprint.kt @@ -15,5 +15,5 @@ object CompactYpcOfferModuleViewFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("CompactYpcOfferModuleView;") && methodDef.name == "onMeasure" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/buttomplayer/comment/patch/CommentComponentPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/buttomplayer/comment/patch/CommentComponentPatch.kt index 5ce320e7a..54cb337db 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/buttomplayer/comment/patch/CommentComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/buttomplayer/comment/patch/CommentComponentPatch.kt @@ -11,7 +11,9 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch +import app.revanced.util.integrations.Constants.PATCHES_PATH @Patch @Name("hide-comment-component") @@ -26,6 +28,7 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch @Version("0.0.1") class CommentComponentPatch : ResourcePatch { override fun execute(context: ResourceContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/CommentsFilter;") /** * Add settings diff --git a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/general/patch/FlyoutPanelPatch.kt similarity index 80% rename from src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/general/patch/FlyoutPanelPatch.kt index bbff9f24a..20b3d03fe 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/general/patch/FlyoutPanelPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.flyoutpanel.flyoutpanel.patch +package app.revanced.patches.youtube.flyoutpanel.general.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name @@ -9,16 +9,17 @@ 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.youtube.ads.general.resource.patch.GeneralAdsPatch import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch +import app.revanced.util.integrations.Constants.PATCHES_PATH @Patch @Name("hide-flyout-panel") @Description("Adds options to hide player settings flyout panel.") @DependsOn( [ - GeneralAdsPatch::class, + LithoFilterPatch::class, SettingsPatch::class ] ) @@ -26,6 +27,7 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch @Version("0.0.1") class FlyoutPanelPatch : ResourcePatch { override fun execute(context: ResourceContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/FlyoutPanelsFilter;") /** * Add settings diff --git a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/fingerprints/QualityMenuViewInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/fingerprints/QualityMenuViewInflateFingerprint.kt index ae0d66d6b..b132f53ee 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/fingerprints/QualityMenuViewInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/fingerprints/QualityMenuViewInflateFingerprint.kt @@ -22,5 +22,5 @@ object QualityMenuViewInflateFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST ), - customFingerprint = { it, _ -> it.isWideLiteralExists(VideoQualityBottomSheet) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(VideoQualityBottomSheet) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt index 27947edaf..63ccc28e9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.FLYOUT_PANEL diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/autoplaypreview/patch/HideAutoplayPreviewPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/autoplaypreview/patch/HideAutoplayPreviewPatch.kt index 802dcfca1..26ca630dd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/autoplaypreview/patch/HideAutoplayPreviewPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/autoplaypreview/patch/HideAutoplayPreviewPatch.kt @@ -13,18 +13,16 @@ 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.youtube.utils.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AutoNavPreviewStub +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AutoNavToggle import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.bytecode.getStringIndex import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.integrations.Constants.FULLSCREEN -import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction -import org.jf.dexlib2.iface.instruction.ReferenceInstruction -import org.jf.dexlib2.iface.reference.FieldReference @Patch @Name("hide-autoplay-preview") @@ -43,26 +41,17 @@ class HideAutoplayPreviewPatch : BytecodePatch( override fun execute(context: BytecodeContext): PatchResult { LayoutConstructorFingerprint.result?.let { it.mutableMethod.apply { - val insertInstruction = implementation!!.instructions - val dummyRegister = getInstruction(getStringIndex("1.0x")).registerA val insertIndex = getWideLiteralIndex(AutoNavPreviewStub) - - val branchIndex = - insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1) - .indexOfFirst { instruction -> - ((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;" - } + 1 - - val jumpInstruction = getInstruction(insertIndex + branchIndex) + val jumpIndex = getWideLiteralIndex(AutoNavToggle) - 1 addInstructionsWithLabels( insertIndex, """ invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z move-result v$dummyRegister if-nez v$dummyRegister, :hidden - """, ExternalLabel("hidden", jumpInstruction) + """, ExternalLabel("hidden", getInstruction(jumpIndex)) ) } } ?: return LayoutConstructorFingerprint.toErrorResult() diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/patch/CompactControlsOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/patch/CompactControlsOverlayPatch.kt index 885b13a62..372936224 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/patch/CompactControlsOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/patch/CompactControlsOverlayPatch.kt @@ -15,7 +15,7 @@ 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.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.fullscreen.compactcontrolsoverlay.fingerprints.YouTubeControlsOverlayFingerprint +import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.FULLSCREEN diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/fingerprints/EndScreenResultsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/fingerprints/EndScreenResultsFingerprint.kt index ea56527ab..ca69523b4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/fingerprints/EndScreenResultsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/fingerprints/EndScreenResultsFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists object EndScreenResultsFingerprint : MethodFingerprint( returnType = "V", - customFingerprint = { it, _ -> it.isWideLiteralExists(AppRelatedEndScreenResults) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(AppRelatedEndScreenResults) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/patch/HideEndScreenOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/patch/HideEndScreenOverlayPatch.kt index de47797b0..fe3a83cba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/patch/HideEndScreenOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/endscreenoverlay/patch/HideEndScreenOverlayPatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.fullscreen.endscreenoverlay.fingerprints.EndScreenResultsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.FULLSCREEN diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenEngagementPanelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenEngagementPanelFingerprint.kt index a7f944574..34783bf4a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenEngagementPanelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenEngagementPanelFingerprint.kt @@ -6,8 +6,9 @@ import app.revanced.util.bytecode.isWideLiteralExists object FullscreenEngagementPanelFingerprint : MethodFingerprint( returnType = "L", - customFingerprint = { it, _ -> - it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") && it.isWideLiteralExists( + parameters = listOf("L"), + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists( FullScreenEngagementPanel ) } diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenViewAdderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenViewAdderFingerprint.kt index 48556b507..1d12d34c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenViewAdderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/fingerprints/FullscreenViewAdderFingerprint.kt @@ -12,5 +12,5 @@ object FullscreenViewAdderFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.INVOKE_VIRTUAL ), - customFingerprint = { it, _ -> it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("FullscreenEngagementPanelOverlay;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt index ff02fbf84..33a2e65fe 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt @@ -16,10 +16,10 @@ 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.youtube.utils.fingerprints.LayoutConstructorFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenEngagementPanelFingerprint import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/fingerprints/OrientationPrimaryFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/fingerprints/OrientationPrimaryFingerprint.kt index aeb620a40..fd722fdb2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/fingerprints/OrientationPrimaryFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/fingerprints/OrientationPrimaryFingerprint.kt @@ -13,5 +13,5 @@ object OrientationPrimaryFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT ), - customFingerprint = { it, _ -> it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.name == "" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/patch/LandScapeModePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/patch/LandScapeModePatch.kt index c75241307..9fcc05edf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/patch/LandScapeModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/landscapemode/patch/LandScapeModePatch.kt @@ -14,10 +14,10 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationParentFingerprint import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationPrimaryFingerprint import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationSecondaryFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.FULLSCREEN import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/quickactions/patch/QuickActionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/quickactions/patch/QuickActionsPatch.kt index fb6003158..873b0fc60 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/quickactions/patch/QuickActionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/fullscreen/quickactions/patch/QuickActionsPatch.kt @@ -9,17 +9,18 @@ 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.youtube.ads.general.resource.patch.GeneralAdsPatch import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch +import app.revanced.util.integrations.Constants.PATCHES_PATH @Patch @Name("hide-quick-actions") @Description("Adds the options to hide quick actions components in the fullscreen.") @DependsOn( [ - GeneralAdsPatch::class, + LithoFilterPatch::class, HideQuickActionsContainerPatch::class, SettingsPatch::class ] @@ -28,6 +29,7 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch @Version("0.0.1") class QuickActionsPatch : ResourcePatch { override fun execute(context: ResourceContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/QuickActionButtonsFilter;") /** * Add settings diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/fingerprints/AccountMenuParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/fingerprints/AccountMenuParentFingerprint.kt index ff74997ac..4646c30e4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/fingerprints/AccountMenuParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/fingerprints/AccountMenuParentFingerprint.kt @@ -12,5 +12,5 @@ object AccountMenuParentFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(CompactLink) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(CompactLink) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/patch/AccountMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/patch/AccountMenuPatch.kt index ef2f45a2c..f6db22e75 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/patch/AccountMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/accountmenu/patch/AccountMenuPatch.kt @@ -13,9 +13,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuFingerprint import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuParentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/autocaptions/patch/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/autocaptions/patch/AutoCaptionsPatch.kt index f404cfcf2..fcfbb2910 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/autocaptions/patch/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/autocaptions/patch/AutoCaptionsPatch.kt @@ -15,11 +15,12 @@ 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.youtube.utils.fingerprints.SubtitleButtonControllerFingerprint import app.revanced.patches.shared.fingerprints.captions.SubtitleTrackFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.autocaptions.fingerprints.StartVideoInformerFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.SubtitleButtonControllerFingerprint import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL @@ -29,7 +30,8 @@ import app.revanced.util.integrations.Constants.GENERAL @DependsOn( [ PlayerTypeHookPatch::class, - SettingsPatch::class + SettingsPatch::class, + SharedResourceIdPatch::class ] ) @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/autopopuppanels/patch/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/autopopuppanels/patch/PlayerPopupPanelsPatch.kt index 799686033..95ae889cf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/autopopuppanels/patch/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/autopopuppanels/patch/PlayerPopupPanelsPatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/FilterBarHeightFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/FilterBarHeightFingerprint.kt index e935cce3c..7f66d3f2b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/FilterBarHeightFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/FilterBarHeightFingerprint.kt @@ -12,5 +12,5 @@ object FilterBarHeightFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.IPUT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(FilterBarHeight) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(FilterBarHeight) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/RelatedChipCloudFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/RelatedChipCloudFingerprint.kt index a9351a65e..0db15d36b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/RelatedChipCloudFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/RelatedChipCloudFingerprint.kt @@ -11,5 +11,5 @@ object RelatedChipCloudFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(RelatedChipCloudMargin) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(RelatedChipCloudMargin) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/SearchResultsChipBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/SearchResultsChipBarFingerprint.kt index 26e9464ef..b7aaab88f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/SearchResultsChipBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/fingerprints/SearchResultsChipBarFingerprint.kt @@ -13,5 +13,5 @@ object SearchResultsChipBarFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(BarContainerHeight) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BarContainerHeight) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/patch/CategoryBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/patch/CategoryBarPatch.kt index 2bb70293e..d99fcbbda 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/patch/CategoryBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/categorybar/patch/CategoryBarPatch.kt @@ -13,10 +13,10 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.categorybar.fingerprints.FilterBarHeightFingerprint import app.revanced.patches.youtube.general.categorybar.fingerprints.RelatedChipCloudFingerprint import app.revanced.patches.youtube.general.categorybar.fingerprints.SearchResultsChipBarFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/fingerprints/ChannelListSubMenuFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/fingerprints/ChannelListSubMenuFingerprint.kt index c0dca6286..467e37b24 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/fingerprints/ChannelListSubMenuFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/fingerprints/ChannelListSubMenuFingerprint.kt @@ -12,5 +12,5 @@ object ChannelListSubMenuFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ChannelListSubMenu) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ChannelListSubMenu) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/patch/ChannelListSubMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/patch/ChannelListSubMenuPatch.kt index e45dd1eea..28785e973 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/patch/ChannelListSubMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/channellistsubmenu/patch/ChannelListSubMenuPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.channellistsubmenu.fingerprints.ChannelListSubMenuFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt index 8623e2334..dc2edd8a1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt @@ -11,5 +11,5 @@ object CrowdfundingBoxFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IPUT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(DonationCompanion) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(DonationCompanion) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/patch/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/patch/CrowdfundingBoxPatch.kt index 4eb4f4138..e427fcf5f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/patch/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/crowdfundingbox/patch/CrowdfundingBoxPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/fingerprints/FloatingMicrophoneFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/fingerprints/FloatingMicrophoneFingerprint.kt index 4dd5148bb..8688cc520 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/fingerprints/FloatingMicrophoneFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/fingerprints/FloatingMicrophoneFingerprint.kt @@ -11,5 +11,5 @@ object FloatingMicrophoneFingerprint : MethodFingerprint( Opcode.IF_EQZ, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.isWideLiteralExists(Fab) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(Fab) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/patch/FloatingMicrophonePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/patch/FloatingMicrophonePatch.kt index 8f2688a2b..f4e65ff2e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/patch/FloatingMicrophonePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/floatingmicrophone/patch/FloatingMicrophonePatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.floatingmicrophone.fingerprints.FloatingMicrophoneFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/layout/patch/LayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/layout/patch/LayoutComponentsPatch.kt new file mode 100644 index 000000000..c2c0f5345 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/general/layout/patch/LayoutComponentsPatch.kt @@ -0,0 +1,54 @@ +package app.revanced.patches.youtube.general.layout.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.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch +import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch +import app.revanced.util.integrations.Constants.PATCHES_PATH + +@Patch +@Name("hide-layout-components") +@Description("Hides general layout components.") +@DependsOn( + [ + LithoFilterPatch::class, + SettingsPatch::class + ] +) +@YouTubeCompatibility +@Version("0.0.1") +class LayoutComponentsPatch : ResourcePatch { + override fun execute(context: ResourceContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/CommunityPostFilter;") + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/LayoutComponentsFilter;") + + /** + * Add settings + */ + SettingsPatch.addPreference( + arrayOf( + "PREFERENCE: BOTTOM_PLAYER_SETTINGS", + "PREFERENCE: GENERAL_SETTINGS", + "PREFERENCE: PLAYER", + + "SETTINGS: COMMENT_COMPONENT_PARENT", + + "SETTINGS: HIDE_AUDIO_TRACK_BUTTON", + "SETTINGS: HIDE_LAYOUT_COMPONENTS", + "SETTINGS: HIDE_VIEW_PRODUCT" + ) + ) + + SettingsPatch.updatePatchStatus("hide-layout-components") + + return PatchResultSuccess() + } +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/fingerprints/LoadMoreButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/fingerprints/LoadMoreButtonFingerprint.kt index 3a37a2fc6..01ea647f9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/fingerprints/LoadMoreButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/fingerprints/LoadMoreButtonFingerprint.kt @@ -12,5 +12,5 @@ object LoadMoreButtonFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ExpandButtonDown) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ExpandButtonDown) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/patch/LoadMoreButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/patch/LoadMoreButtonPatch.kt index 80fd08b31..891d62cb8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/patch/LoadMoreButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/loadmorebutton/patch/LoadMoreButtonPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.loadmorebutton.fingerprints.LoadMoreButtonFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/fingerprints/BottomPanelOverlayTextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/fingerprints/BottomPanelOverlayTextFingerprint.kt index 8aa933539..08a74f523 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/fingerprints/BottomPanelOverlayTextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/fingerprints/BottomPanelOverlayTextFingerprint.kt @@ -11,5 +11,5 @@ object BottomPanelOverlayTextFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IPUT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(BottomPanelOverlayText) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BottomPanelOverlayText) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/patch/MixPlaylistsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/patch/MixPlaylistsPatch.kt index e02c27ea4..864390d27 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/patch/MixPlaylistsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/mixplaylists/patch/MixPlaylistsPatch.kt @@ -15,8 +15,8 @@ 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.fingerprints.litho.EmptyComponentBuilderFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.mixplaylists.fingerprints.BottomPanelOverlayTextFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.bytecode.getStringIndex import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt index 3b99621b8..fe790d136 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt @@ -15,5 +15,5 @@ object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint( Opcode.APUT_OBJECT, Opcode.CONST ), - customFingerprint = { it, _ -> it.isWideLiteralExists(AccountSwitcherAccessibility) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(AccountSwitcherAccessibility) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/patch/HideEmailAddressPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/patch/HideEmailAddressPatch.kt index 2ef5e6c12..4a5162c88 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/patch/HideEmailAddressPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/personalinformation/patch/HideEmailAddressPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/fingerprints/SearchSuggestionEntryFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/fingerprints/SearchSuggestionEntryFingerprint.kt index eca6ca369..728ea5d5f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/fingerprints/SearchSuggestionEntryFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/fingerprints/SearchSuggestionEntryFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object SearchSuggestionEntryFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(SearchSuggestionEntry) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(SearchSuggestionEntry) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/patch/SearchTermsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/patch/SearchTermsPatch.kt index 49687e02e..792af57df 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/patch/SearchTermsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/searchterms/patch/SearchTermsPatch.kt @@ -13,10 +13,10 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchEndpointFingerprint import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchEndpointParentFingerprint import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchSuggestionEntryFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.SearchSuggestionEntry import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/fingerprints/HideSnackBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/fingerprints/HideSnackBarFingerprint.kt index c2ccbed63..4ccbdcd74 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/fingerprints/HideSnackBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/fingerprints/HideSnackBarFingerprint.kt @@ -8,5 +8,5 @@ object HideSnackBarFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L", "L"), - customFingerprint = { it, _ -> it.definingClass.endsWith("BottomUiContainer;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("BottomUiContainer;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/patch/HideSnackBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/patch/HideSnackBarPatch.kt index 5d3c16b06..0c9ba4ae2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/patch/HideSnackBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/patch/HideSnackBarPatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.snackbar.fingerprints.HideSnackBarFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/fingerprints/BreakingNewsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/fingerprints/BreakingNewsFingerprint.kt index bfec07db9..b2e3d95dc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/fingerprints/BreakingNewsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/fingerprints/BreakingNewsFingerprint.kt @@ -12,5 +12,5 @@ object BreakingNewsFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(HorizontalCardList) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(HorizontalCardList) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/patch/SuggestionsShelfPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/patch/SuggestionsShelfPatch.kt index e06f6c657..ef16db674 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/patch/SuggestionsShelfPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/suggestions/patch/SuggestionsShelfPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.suggestions.fingerprints.BreakingNewsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.navbarindex.patch.NavBarIndexPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorFingerprint.kt index 72a116117..1737e2a73 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorFingerprint.kt @@ -9,5 +9,5 @@ import org.jf.dexlib2.AccessFlags object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - customFingerprint = { it, _ -> it.isWideLiteralExists(FloatyBarTopMargin) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(FloatyBarTopMargin) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/patch/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/patch/TabletMiniPlayerPatch.kt index 2d22ea984..1765531ba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/patch/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/tabletminiplayer/patch/TabletMiniPlayerPatch.kt @@ -16,11 +16,11 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerDimensionsCalculatorFingerprint import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerOverrideFingerprint import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerOverrideNoContextFingerprint import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerResponseModelSizeCheckFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.bytecode.getStringIndex diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetActionBarRingoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetActionBarRingoFingerprint.kt index bdd0a1c0a..df4883b02 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetActionBarRingoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetActionBarRingoFingerprint.kt @@ -14,5 +14,5 @@ object SetActionBarRingoFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.INVOKE_STATIC ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ActionBarRingo) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ActionBarRingo) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetToolBarPaddingFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetToolBarPaddingFingerprint.kt index 793a7b13c..089122ad4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetToolBarPaddingFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/fingerprints/SetToolBarPaddingFingerprint.kt @@ -13,5 +13,5 @@ object SetToolBarPaddingFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.INVOKE_STATIC ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ToolBarPaddingHome) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ToolBarPaddingHome) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/patch/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/patch/WideSearchbarPatch.kt index 65ea46cdc..f3bc5eee1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/patch/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/widesearchbar/patch/WideSearchbarPatch.kt @@ -14,9 +14,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetActionBarRingoFingerprint import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetToolBarPaddingFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch.Companion.contexts diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/materialyou/patch/MaterialYouPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/materialyou/patch/MaterialYouPatch.kt index 5c58faf7b..fdd30b495 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/materialyou/patch/MaterialYouPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/materialyou/patch/MaterialYouPatch.kt @@ -9,9 +9,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.layout.theme.patch.GeneralThemePatch import app.revanced.patches.youtube.layout.theme.patch.GeneralThemePatch.Companion.isMonetPatchIncluded +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme import app.revanced.util.resources.ResourceUtils diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/pipnotification/patch/PiPNotificationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/pipnotification/patch/PiPNotificationPatch.kt index b421973f4..0bf1d8b44 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/pipnotification/patch/PiPNotificationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/pipnotification/patch/PiPNotificationPatch.kt @@ -11,9 +11,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.layout.pipnotification.fingerprints.PrimaryPiPFingerprint import app.revanced.patches.youtube.layout.pipnotification.fingerprints.SecondaryPiPFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt index bd93336a9..8909f9898 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt @@ -11,8 +11,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.layout.theme.patch.GeneralThemePatch.Companion.isMonetPatchIncluded +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme import org.w3c.dom.Element diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/fingerprints/TooltipContentViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/fingerprints/TooltipContentViewFingerprint.kt index 408ae20fb..714b3f776 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/fingerprints/TooltipContentViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/fingerprints/TooltipContentViewFingerprint.kt @@ -10,5 +10,5 @@ object TooltipContentViewFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), - customFingerprint = { it, _ -> it.isWideLiteralExists(ToolTipContentView) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ToolTipContentView) } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/patch/TooltipContentViewPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/patch/TooltipContentViewPatch.kt index aac4766aa..905878b30 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/patch/TooltipContentViewPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tooltip/patch/TooltipContentViewPatch.kt @@ -11,8 +11,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.layout.tooltip.fingerprints.TooltipContentViewFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/fingerprints/PowerSaveModeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/fingerprints/PowerSaveModeFingerprint.kt index 420c5f406..91ebc2cab 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/fingerprints/PowerSaveModeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/fingerprints/PowerSaveModeFingerprint.kt @@ -21,5 +21,5 @@ object PowerSaveModeFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.name == "accept" } + customFingerprint = { methodDef, _ -> methodDef.name == "accept" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/patch/PowerSaveModePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/patch/PowerSaveModePatch.kt index 9665b8c61..d6ea5fc68 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/patch/PowerSaveModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/ambientmode/patch/PowerSaveModePatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.ambientmode.fingerprints.PowerSaveModeFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.Opcode diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/patch/ExternalBrowserPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/patch/ExternalBrowserPatch.kt index 4ceb64707..e4f159eeb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/patch/ExternalBrowserPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/patch/ExternalBrowserPatch.kt @@ -12,10 +12,10 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBrowserPrimaryFingerprint import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBrowserSecondaryFingerprint import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBrowserTertiaryFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/fingerprints/VideoCapabilitiesFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/fingerprints/VideoCapabilitiesFingerprint.kt index d3e6c761c..77dd2d7ff 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/fingerprints/VideoCapabilitiesFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/fingerprints/VideoCapabilitiesFingerprint.kt @@ -11,5 +11,5 @@ object VideoCapabilitiesFingerprint : MethodFingerprint( Opcode.IPUT, Opcode.IPUT ), - customFingerprint = { it, _ -> it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.name == "" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/patch/ForceVP9CodecPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/patch/ForceVP9CodecPatch.kt index 9ab79e03b..5e6c55121 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/patch/ForceVP9CodecPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/forcevp9/patch/ForceVP9CodecPatch.kt @@ -16,14 +16,14 @@ 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.youtube.utils.fingerprints.LayoutSwitchFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.forcevp9.fingerprints.VideoCapabilitiesFingerprint import app.revanced.patches.youtube.misc.forcevp9.fingerprints.VideoCapabilitiesParentFingerprint import app.revanced.patches.youtube.misc.forcevp9.fingerprints.Vp9PrimaryFingerprint import app.revanced.patches.youtube.misc.forcevp9.fingerprints.Vp9PropsFingerprint import app.revanced.patches.youtube.misc.forcevp9.fingerprints.Vp9PropsParentFingerprint import app.revanced.patches.youtube.misc.forcevp9.fingerprints.Vp9SecondaryFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.LayoutSwitchFingerprint import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.Opcode diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/language/fingerprints/GeneralPrefsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/language/fingerprints/GeneralPrefsFingerprint.kt index a30f7060e..4d6997758 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/language/fingerprints/GeneralPrefsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/language/fingerprints/GeneralPrefsFingerprint.kt @@ -14,5 +14,5 @@ object GeneralPrefsFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT ), strings = listOf("bedtime_reminder_toggle"), - customFingerprint = { it, _ -> it.definingClass.endsWith("GeneralPrefsFragment;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("GeneralPrefsFragment;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/language/patch/LanguageSelectorPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/language/patch/LanguageSelectorPatch.kt index 6bd538e66..5b549d662 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/language/patch/LanguageSelectorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/language/patch/LanguageSelectorPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.language.fingerprints.GeneralPrefsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/layoutswitch/patch/LayoutSwitchPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/layoutswitch/patch/LayoutSwitchPatch.kt index 5429a3f31..21ba37d63 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/layoutswitch/patch/LayoutSwitchPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/layoutswitch/patch/LayoutSwitchPatch.kt @@ -17,11 +17,11 @@ 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.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.utils.fingerprints.LayoutSwitchFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.ClientFormFactorFingerprint import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.ClientFormFactorParentFingerprint import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.ClientFormFactorWalkerFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.LayoutSwitchFingerprint import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.Opcode diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt index 599fd8bb2..0fc715a0d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt @@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode +import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint( returnType = "V", @@ -17,7 +18,29 @@ object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint( Opcode.IPUT_BOOLEAN, Opcode.IF_EQZ, Opcode.IGET, - Opcode.INVOKE_STATIC + Opcode.INVOKE_STATIC, + Opcode.MOVE_RESULT, + Opcode.IF_NEZ, + Opcode.GOTO, + Opcode.CONST_4, + Opcode.IF_NE, + Opcode.CONST_4, + Opcode.IF_NE, + Opcode.SGET_OBJECT, + Opcode.IF_NE, + Opcode.IGET, + Opcode.CONST_4, + Opcode.IF_NE, + Opcode.IGET_OBJECT, + Opcode.SGET_OBJECT, + Opcode.IF_EQ, + Opcode.GOTO, + Opcode.IGET_OBJECT, + Opcode.INVOKE_VIRTUAL, + Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.definingClass.endsWith("MinimizedPlaybackPolicyController;") } -) + customFingerprint = { methodDef, _ -> + methodDef.implementation!!.instructions.any { + ((it as? NarrowLiteralInstruction)?.narrowLiteral == 5) + } + }) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt index 59d7618c5..cafc72cff 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt @@ -11,5 +11,5 @@ object MinimizedPlaybackManagerFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, parameters = listOf("L"), opcodes = listOf(Opcode.AND_INT_LIT16), - customFingerprint = { it, _ -> it.isNarrowLiteralExists(64657230) } + customFingerprint = { methodDef, _ -> methodDef.isNarrowLiteralExists(64657230) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt index 2c05597ee..127c030bf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt @@ -19,5 +19,5 @@ object MinimizedPlaybackSettingsFingerprint : MethodFingerprint( Opcode.IF_NEZ, Opcode.GOTO ), - customFingerprint = { it, _ -> it.isWideLiteralExists(BackgroundCategory) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BackgroundCategory) } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt index 8677c83d1..0d747d381 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt @@ -14,10 +14,10 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt index 2d0551e49..46830a292 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt @@ -12,9 +12,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.openlinksdirectly.fingerprints.OpenLinksDirectlyFingerprintPrimary import app.revanced.patches.youtube.misc.openlinksdirectly.fingerprints.OpenLinksDirectlyFingerprintSecondary +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.iface.instruction.formats.Instruction35c diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/CronetEngineBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/CronetEngineBuilderFingerprint.kt index 1169bc16d..096e58af0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/CronetEngineBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/CronetEngineBuilderFingerprint.kt @@ -7,5 +7,5 @@ object CronetEngineBuilderFingerprint : MethodFingerprint( returnType = "L", accessFlags = AccessFlags.PUBLIC.value, parameters = listOf("Z"), - customFingerprint = { it, _ -> it.definingClass.endsWith("CronetEngine\$Builder;") && it.name == "enableQuic" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("CronetEngine\$Builder;") && methodDef.name == "enableQuic" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/ExperimentalCronetEngineBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/ExperimentalCronetEngineBuilderFingerprint.kt index 56c083544..5976b92c4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/ExperimentalCronetEngineBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/quic/fingerprints/ExperimentalCronetEngineBuilderFingerprint.kt @@ -7,5 +7,5 @@ object ExperimentalCronetEngineBuilderFingerprint : MethodFingerprint( returnType = "L", accessFlags = AccessFlags.PUBLIC.value, parameters = listOf("Z"), - customFingerprint = { it, _ -> it.definingClass.endsWith("ExperimentalCronetEngine\$Builder;") && it.name == "enableQuic" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("ExperimentalCronetEngine\$Builder;") && methodDef.name == "enableQuic" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/quic/patch/QUICProtocolPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/quic/patch/QUICProtocolPatch.kt index 6eba13004..0d3792762 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/quic/patch/QUICProtocolPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/quic/patch/QUICProtocolPatch.kt @@ -11,9 +11,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.quic.fingerprints.CronetEngineBuilderFingerprint import app.revanced.patches.youtube.misc.quic.fingerprints.ExperimentalCronetEngineBuilderFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.MISC_PATH diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/fingerprints/SplashAnimationBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/fingerprints/SplashAnimationBuilderFingerprint.kt index 8b58a9d50..aab6fa587 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/fingerprints/SplashAnimationBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/fingerprints/SplashAnimationBuilderFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object SplashAnimationBuilderFingerprint : MethodFingerprint( returnType = "V", - customFingerprint = { it, _ -> it.isWide32LiteralExists(45407550) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45407550) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/patch/NewSplashAnimationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/patch/NewSplashAnimationPatch.kt index e3b1469af..d0717224b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/patch/NewSplashAnimationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/splashanimation/patch/NewSplashAnimationPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.misc.splashanimation.fingerprints.SplashAnimationBuilderFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.bytecode.getWide32LiteralIndex import app.revanced.util.integrations.Constants.MISC_PATH diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/homepage/patch/ChangeHomePagePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/homepage/patch/ChangeHomePagePatch.kt index c10accc84..0d0568bc2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/homepage/patch/ChangeHomePagePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/homepage/patch/ChangeHomePagePatch.kt @@ -14,9 +14,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.navigation.homepage.fingerprints.IntentExceptionFingerprint import app.revanced.patches.youtube.navigation.homepage.fingerprints.LauncherActivityFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.NAVIGATION diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/label/fingerprints/PivotBarSetTextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/label/fingerprints/PivotBarSetTextFingerprint.kt index 0e3173b0e..1d30d999f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/label/fingerprints/PivotBarSetTextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/label/fingerprints/PivotBarSetTextFingerprint.kt @@ -19,5 +19,5 @@ object PivotBarSetTextFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.name == "" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/label/patch/NavigationLabelPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/label/patch/NavigationLabelPatch.kt index 5a6618534..1a807ef15 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/label/patch/NavigationLabelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/label/patch/NavigationLabelPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.navigation.label.fingerprints.PivotBarSetTextFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.NAVIGATION import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt index ce6001992..9178c8af9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt @@ -13,11 +13,11 @@ 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.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.AutoMotiveFingerprint import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.PivotBarEnumFingerprint import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.PivotBarShortsButtonViewFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.NAVIGATION diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/fingerprints/ReelWatchEndpointFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/fingerprints/ReelWatchEndpointFingerprint.kt index bb689cda8..d6fc75442 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/fingerprints/ReelWatchEndpointFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/fingerprints/ReelWatchEndpointFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object ReelWatchEndpointFingerprint : MethodFingerprint( returnType = "V", - customFingerprint = { it, _ -> it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.name == "" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/patch/ShortsNavBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/patch/ShortsNavBarPatch.kt index 068bc3c98..957be77e9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/patch/ShortsNavBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/shortsnavbar/patch/ShortsNavBarPatch.kt @@ -16,13 +16,13 @@ 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.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.NavigationEndpointFingerprint import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.ReelWatchBundleFingerprint import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.ReelWatchEndpointFingerprint import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.ReelWatchEndpointParentFingerprint import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.SetPivotBarFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.NAVIGATION import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarChangedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarChangedFingerprint.kt index 4d3a54ad3..fbb7495cb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarChangedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarChangedFingerprint.kt @@ -9,5 +9,5 @@ object PivotBarChangedFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT ), - customFingerprint = { it, _ -> it.definingClass.endsWith("PivotBar;") && it.name == "onConfigurationChanged" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PivotBar;") && methodDef.name == "onConfigurationChanged" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarStyleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarStyleFingerprint.kt index 32975049c..2f44775ea 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarStyleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/fingerprints/PivotBarStyleFingerprint.kt @@ -11,5 +11,5 @@ object PivotBarStyleFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.XOR_INT_2ADDR ), - customFingerprint = { it, _ -> it.definingClass.endsWith("PivotBar;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PivotBar;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/patch/TabletNavigationBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/patch/TabletNavigationBarPatch.kt index cb6a80e4e..a50f6571d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/patch/TabletNavigationBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/tabletnavbar/patch/TabletNavigationBarPatch.kt @@ -13,9 +13,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.navigation.tabletnavbar.fingerprints.PivotBarChangedFingerprint import app.revanced.patches.youtube.navigation.tabletnavbar.fingerprints.PivotBarStyleFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.NAVIGATION import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/AutoNavInformerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/AutoNavInformerFingerprint.kt index a46fe59ee..64bfdd44f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/AutoNavInformerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/AutoNavInformerFingerprint.kt @@ -2,11 +2,23 @@ package app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.SettingsBooleanTimeRangeDialog +import app.revanced.util.bytecode.isWideLiteralExists import org.jf.dexlib2.AccessFlags +import org.jf.dexlib2.Opcode object AutoNavInformerFingerprint : MethodFingerprint( - returnType = "Z", + returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf(), - customFingerprint = { it, _ -> it.definingClass.endsWith("WillAutonavInformer;") } + parameters = listOf("L"), + opcodes = listOf( + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT, + Opcode.XOR_INT_2ADDR + ), + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists( + SettingsBooleanTimeRangeDialog + ) + } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/VideoEndFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/VideoEndFingerprint.kt index d92f9007b..0975e2198 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/VideoEndFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/fingerprints/VideoEndFingerprint.kt @@ -8,5 +8,5 @@ object VideoEndFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf(), - customFingerprint = { it, _ -> it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty() } + customFingerprint = { methodDef, _ -> methodDef.implementation!!.instructions.count() == 3 && methodDef.annotations.isEmpty() } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/patch/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/patch/AutoRepeatPatch.kt index 39fe177b3..067799393 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/patch/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/autorepeat/patch/AutoRepeatPatch.kt @@ -4,6 +4,7 @@ import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.data.toMethodWalker import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -12,12 +13,13 @@ 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.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.AutoNavInformerFingerprint import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.RepeatListenerFingerprint import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.VideoEndFingerprint import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.VideoEndParentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.util.integrations.Constants.UTILS_PATH import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.builder.instruction.BuilderInstruction35c @@ -74,7 +76,12 @@ class AutoRepeatPatch : BytecodePatch( } ?: return RepeatListenerFingerprint.toErrorResult() AutoNavInformerFingerprint.result?.let { - it.mutableMethod.apply { + with( + context + .toMethodWalker(it.method) + .nextMethod(it.scanResult.patternScanResult!!.startIndex, true) + .getMethod() as MutableMethod + ) { val index = implementation!!.instructions.size - 1 - 1 val register = getInstruction(index).registerA diff --git a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/general/patch/OverlayButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/general/patch/OverlayButtonsPatch.kt index 3b84c6921..c17624eac 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/general/patch/OverlayButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/overlaybutton/general/patch/OverlayButtonsPatch.kt @@ -10,10 +10,11 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.overlaybutton.autorepeat.patch.AutoRepeatPatch +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch import app.revanced.patches.youtube.utils.playercontrols.patch.PlayerControlsPatch +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.utils.videoid.mainstream.patch.MainstreamVideoIdPatch import app.revanced.util.integrations.Constants.BUTTON_PATH @@ -31,7 +32,8 @@ import org.w3c.dom.Element MainstreamVideoIdPatch::class, OverrideSpeedHookPatch::class, PlayerControlsPatch::class, - SettingsPatch::class + SettingsPatch::class, + SharedResourceIdPatch::class ] ) @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/autoplaybutton/patch/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/autoplaybutton/patch/HideAutoplayButtonPatch.kt index 7423bcdc5..78396dc35 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/autoplaybutton/patch/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/autoplaybutton/patch/HideAutoplayButtonPatch.kt @@ -13,18 +13,16 @@ 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.youtube.utils.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AutoNavPreviewStub +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.VideoZoomIndicatorLayout import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.bytecode.getStringIndex import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.integrations.Constants.PLAYER -import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction -import org.jf.dexlib2.iface.instruction.ReferenceInstruction -import org.jf.dexlib2.iface.reference.MethodReference @Patch @Name("hide-autoplay-button") @@ -47,22 +45,14 @@ class HideAutoplayButtonPatch : BytecodePatch( val dummyRegister = getInstruction(getStringIndex("1.0x")).registerA val insertIndex = getWideLiteralIndex(AutoNavPreviewStub) - - val branchIndex = implementation!!.instructions.subList( - insertIndex + 1, - implementation!!.instructions.size - 1 - ).indexOfFirst { instruction -> - ((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == "addOnLayoutChangeListener" - } + 2 - - val jumpInstruction = getInstruction(insertIndex + branchIndex) + val jumpIndex = getWideLiteralIndex(VideoZoomIndicatorLayout) - 1 addInstructionsWithLabels( insertIndex, """ invoke-static {}, $PLAYER->hideAutoPlayButton()Z move-result v$dummyRegister if-nez v$dummyRegister, :hidden - """, ExternalLabel("hidden", jumpInstruction) + """, ExternalLabel("hidden", getInstruction(jumpIndex)) ) } } ?: return LayoutConstructorFingerprint.toErrorResult() diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/captionsbutton/patch/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/captionsbutton/patch/HideCaptionsButtonPatch.kt index 39bf952db..7238c4edc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/captionsbutton/patch/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/captionsbutton/patch/HideCaptionsButtonPatch.kt @@ -12,8 +12,9 @@ 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.youtube.utils.fingerprints.SubtitleButtonControllerFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.SubtitleButtonControllerFingerprint +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.Opcode @@ -22,7 +23,12 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Patch @Name("hide-captions-button") @Description("Hides the captions button in the video player.") -@DependsOn([SettingsPatch::class]) +@DependsOn( + [ + SettingsPatch::class, + SharedResourceIdPatch::class + ] +) @YouTubeCompatibility @Version("0.0.1") class HideCaptionsButtonBytecodePatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/fingerprints/CastButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/fingerprints/CastButtonFingerprint.kt index 5035fa374..272eeb0dd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/fingerprints/CastButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/fingerprints/CastButtonFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.youtube.player.castbutton.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object CastButtonFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.definingClass.endsWith("MediaRouteButton;") && it.name == "setVisibility" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("MediaRouteButton;") && methodDef.name == "setVisibility" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/patch/HideCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/patch/HideCastButtonPatch.kt index fb8897e09..0c625384e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/patch/HideCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/castbutton/patch/HideCastButtonPatch.kt @@ -11,8 +11,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.castbutton.fingerprints.CastButtonFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt index 0506c8c2f..0f2caeb0d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt @@ -12,5 +12,5 @@ object SpeedOverlayHookFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL ), strings = listOf("Failed to easy seek haptics vibrate."), - customFingerprint = { it, _ -> it.name == "run" } + customFingerprint = { methodDef, _ -> methodDef.name == "run" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt index 04a036f8e..2296506af 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt @@ -6,5 +6,5 @@ import org.jf.dexlib2.Opcode object YouTubeTextViewFingerprint : MethodFingerprint( returnType = "V", opcodes = listOf(Opcode.INVOKE_SUPER), - customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeTextView;") && it.name == "setText" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("YouTubeTextView;") && methodDef.name == "setText" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt index f6cc57dac..63a96d76e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt @@ -13,9 +13,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.customspeedoverlay.fingerprints.SpeedOverlayHookFingerprint import app.revanced.patches.youtube.player.customspeedoverlay.fingerprints.YouTubeTextViewFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.iface.instruction.ReferenceInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutCircleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutCircleFingerprint.kt index c5b792887..1490a378e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutCircleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutCircleFingerprint.kt @@ -13,5 +13,5 @@ object LayoutCircleFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - customFingerprint = { it, _ -> it.isWideLiteralExists(EndScreenElementLayoutCircle) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(EndScreenElementLayoutCircle) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutIconFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutIconFingerprint.kt index 3dbc12fd7..3c94e54a7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutIconFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutIconFingerprint.kt @@ -13,5 +13,5 @@ object LayoutIconFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - customFingerprint = { it, _ -> it.isWideLiteralExists(EndScreenElementLayoutIcon) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(EndScreenElementLayoutIcon) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutVideoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutVideoFingerprint.kt index 87a635efe..8ceb8dc9a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutVideoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/fingerprints/LayoutVideoFingerprint.kt @@ -13,5 +13,5 @@ object LayoutVideoFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - customFingerprint = { it, _ -> it.isWideLiteralExists(EndScreenElementLayoutVideo) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(EndScreenElementLayoutVideo) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/patch/HideEndScreenCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/patch/HideEndScreenCardsPatch.kt index 8a27d4d55..2e03f9422 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/patch/HideEndScreenCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/endscreencards/patch/HideEndScreenCardsPatch.kt @@ -13,10 +13,10 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.endscreencards.fingerprints.LayoutCircleFingerprint import app.revanced.patches.youtube.player.endscreencards.fingerprints.LayoutIconFingerprint import app.revanced.patches.youtube.player.endscreencards.fingerprints.LayoutVideoFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayConfigFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayConfigFingerprint.kt index 11dc2fe0c..ce8a82182 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayConfigFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayConfigFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object FilmStripOverlayConfigFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf(), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45381958) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45381958) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayParentFingerprint.kt index 6cab63276..bf6fbc946 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/FilmStripOverlayParentFingerprint.kt @@ -9,5 +9,5 @@ import org.jf.dexlib2.AccessFlags object FilmStripOverlayParentFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - customFingerprint = { it, _ -> it.isWideLiteralExists(Scrubbing) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(Scrubbing) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/TimeBarOnClickListenerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/TimeBarOnClickListenerFingerprint.kt deleted file mode 100644 index 75aa2a6c9..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/fingerprints/TimeBarOnClickListenerFingerprint.kt +++ /dev/null @@ -1,14 +0,0 @@ -package app.revanced.patches.youtube.player.filmstripoverlay.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.WatchWhileTimeBarOverlayStub -import app.revanced.util.bytecode.isWideLiteralExists - -object TimeBarOnClickListenerFingerprint : MethodFingerprint( - returnType = "V", - customFingerprint = { it, _ -> - it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists( - WatchWhileTimeBarOverlayStub - ) - } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/patch/HideFilmstripOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/patch/HideFilmstripOverlayPatch.kt index d71f6ab0a..6a64dbf57 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/patch/HideFilmstripOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/filmstripoverlay/patch/HideFilmstripOverlayPatch.kt @@ -15,19 +15,19 @@ 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.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStripOverlayConfigFingerprint import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStripOverlayInteractionFingerprint import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStripOverlayParentFingerprint import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStripOverlayPreviewFingerprint -import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.TimeBarOnClickListenerFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch -import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.WatchWhileTimeBarOverlayStub import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch -import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.Opcode +import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction +import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.reference.MethodReference @@ -45,7 +45,7 @@ import org.jf.dexlib2.iface.reference.MethodReference class HideFilmstripOverlayPatch : BytecodePatch( listOf( FilmStripOverlayParentFingerprint, - TimeBarOnClickListenerFingerprint + YouTubeControlsOverlayFingerprint ) ) { override fun execute(context: BytecodeContext): PatchResult { @@ -66,23 +66,27 @@ class HideFilmstripOverlayPatch : BytecodePatch( } } ?: return FilmStripOverlayParentFingerprint.toErrorResult() - TimeBarOnClickListenerFingerprint.result?.let { + YouTubeControlsOverlayFingerprint.result?.let { it.mutableMethod.apply { - val freeIndex = getWideLiteralIndex(WatchWhileTimeBarOverlayStub) - val freeRegister = getInstruction(freeIndex).registerA - val insertIndex = getIndex("bringChildToFront") + 1 + val insertRegister = getInstruction(insertIndex).registerA + val jumpIndex = getIndex("setOnClickListener") + 3 + val fixIndex = + implementation!!.instructions.indexOfFirst { instruction -> (instruction as? NarrowLiteralInstruction)?.narrowLiteral == 12 } + val fixRegister = getInstruction(fixIndex).registerA + addInstructionsWithLabels( insertIndex, """ + const/16 v$fixRegister, 0xc invoke-static {}, $PLAYER->hideFilmstripOverlay()Z - move-result v$freeRegister - if-nez v$freeRegister, :hidden + move-result v$insertRegister + if-nez v$insertRegister, :hidden """, ExternalLabel("hidden", getInstruction(jumpIndex)) ) } - } ?: return TimeBarOnClickListenerFingerprint.toErrorResult() + } ?: return YouTubeControlsOverlayFingerprint.toErrorResult() /** * Add settings diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/fingerprints/SeekHapticsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/fingerprints/SeekHapticsFingerprint.kt index 59b06d200..9d8fef6e4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/fingerprints/SeekHapticsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/fingerprints/SeekHapticsFingerprint.kt @@ -11,5 +11,5 @@ object SeekHapticsFingerprint : MethodFingerprint( Opcode.IF_LE ), strings = listOf("Failed to easy seek haptics vibrate."), - customFingerprint = { it, _ -> it.name == "run" } + customFingerprint = { methodDef, _ -> methodDef.name == "run" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/patch/HapticFeedBackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/patch/HapticFeedBackPatch.kt index 9bd2cb2f2..2a15b561c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/patch/HapticFeedBackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/hapticfeedback/patch/HapticFeedBackPatch.kt @@ -15,11 +15,11 @@ 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.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.hapticfeedback.fingerprints.MarkerHapticsFingerprint import app.revanced.patches.youtube.player.hapticfeedback.fingerprints.ScrubbingHapticsFingerprint import app.revanced.patches.youtube.player.hapticfeedback.fingerprints.SeekHapticsFingerprint import app.revanced.patches.youtube.player.hapticfeedback.fingerprints.ZoomHapticsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/infocards/patch/HideInfoCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/infocards/patch/HideInfoCardsPatch.kt index 6364f9a8f..f8f0b3f07 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/infocards/patch/HideInfoCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/infocards/patch/HideInfoCardsPatch.kt @@ -13,9 +13,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.infocards.fingerprints.InfoCardsIncognitoFingerprint import app.revanced.patches.youtube.player.infocards.fingerprints.InfoCardsIncognitoParentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/fingerprints/MusicAppDeeplinkButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/fingerprints/MusicAppDeeplinkButtonFingerprint.kt index 2fb20072d..244ba16b7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/fingerprints/MusicAppDeeplinkButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/fingerprints/MusicAppDeeplinkButtonFingerprint.kt @@ -1,9 +1,17 @@ package app.revanced.patches.youtube.player.musicbutton.fingerprints +import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.MusicAppDeeplinkButtonView +import app.revanced.util.bytecode.isWideLiteralExists +import org.jf.dexlib2.AccessFlags object MusicAppDeeplinkButtonFingerprint : MethodFingerprint( returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("Z", "Z"), - customFingerprint = { it, _ -> it.definingClass.endsWith("MusicAppDeeplinkButtonController;") } -) \ No newline at end of file + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists( + MusicAppDeeplinkButtonView + ) + }) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/patch/HideMusicButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/patch/HideMusicButtonPatch.kt index bf99f080b..75c2363bd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/patch/HideMusicButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/musicbutton/patch/HideMusicButtonPatch.kt @@ -13,15 +13,21 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.musicbutton.fingerprints.MusicAppDeeplinkButtonFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER @Patch @Name("hide-music-button") @Description("Hides the YouTube Music button in the video player.") -@DependsOn([SettingsPatch::class]) +@DependsOn( + [ + SettingsPatch::class, + SharedResourceIdPatch::class + ] +) @YouTubeCompatibility @Version("0.0.1") class HideMusicButtonPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/HidePlayerButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/HidePlayerButtonFingerprint.kt index 8d0d4025d..a19e77a87 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/HidePlayerButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/HidePlayerButtonFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.youtube.player.playerbuttonbg.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object HidePlayerButtonFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.definingClass.endsWith("PlayerPatch;") && it.name == "hidePlayerButton" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PlayerPatch;") && methodDef.name == "hidePlayerButton" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/patch/HidePlayerButtonBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/patch/HidePlayerButtonBackgroundPatch.kt index 0cc727200..0709e7661 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/patch/HidePlayerButtonBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/playerbuttonbg/patch/HidePlayerButtonBackgroundPatch.kt @@ -11,8 +11,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.HidePlayerButtonFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.playerbutton.patch.PlayerButtonPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/fingerprints/ScrimOverlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/fingerprints/ScrimOverlayFingerprint.kt deleted file mode 100644 index 30aa365f2..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/fingerprints/ScrimOverlayFingerprint.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.patches.youtube.player.playeroverlayfilter.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ScrimOverlay -import app.revanced.util.bytecode.isWideLiteralExists - -object ScrimOverlayFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> - it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists( - ScrimOverlay - ) - } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/patch/PlayerOverlayFilterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/patch/PlayerOverlayFilterPatch.kt index 7faac0fee..d35937061 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/patch/PlayerOverlayFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/playeroverlayfilter/patch/PlayerOverlayFilterPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.player.playeroverlayfilter.fingerprints.ScrimOverlayFingerprint +import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ScrimOverlay import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch @@ -35,11 +35,11 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction @YouTubeCompatibility @Version("0.0.1") class PlayerOverlayFilterPatch : BytecodePatch( - listOf(ScrimOverlayFingerprint) + listOf(YouTubeControlsOverlayFingerprint) ) { override fun execute(context: BytecodeContext): PatchResult { - ScrimOverlayFingerprint.result?.let { + YouTubeControlsOverlayFingerprint.result?.let { it.mutableMethod.apply { val targetIndex = getWideLiteralIndex(ScrimOverlay) + 3 val targetParameter = getInstruction(targetIndex).reference @@ -53,7 +53,7 @@ class PlayerOverlayFilterPatch : BytecodePatch( "invoke-static {v$targetRegister}, $PLAYER->hidePlayerOverlayFilter(Landroid/widget/ImageView;)V" ) } - } ?: return ScrimOverlayFingerprint.toErrorResult() + } ?: return YouTubeControlsOverlayFingerprint.toErrorResult() /** * Add settings diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/fingerprints/SeekEduContainerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/fingerprints/SeekEduContainerFingerprint.kt index 955502332..cb1cc8737 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/fingerprints/SeekEduContainerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/fingerprints/SeekEduContainerFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists object SeekEduContainerFingerprint : MethodFingerprint( returnType = "V", - customFingerprint = { it, _ -> it.isWideLiteralExists(EasySeekEduContainer) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(EasySeekEduContainer) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/patch/SeekMessagePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/patch/SeekMessagePatch.kt index ea6d62494..aa5089612 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/patch/SeekMessagePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/seekmessage/patch/SeekMessagePatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.seekmessage.fingerprints.SeekEduContainerFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/fingerprints/SpeedOverlayConfigFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/fingerprints/SpeedOverlayConfigFingerprint.kt index aaef1191c..be737b16a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/fingerprints/SpeedOverlayConfigFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/fingerprints/SpeedOverlayConfigFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object SpeedOverlayConfigFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf(), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45411330) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45411330) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/patch/HideSpeedOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/patch/HideSpeedOverlayPatch.kt index f1a3a850b..9c461cbb6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/patch/HideSpeedOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/speedoverlay/patch/HideSpeedOverlayPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.speedoverlay.fingerprints.SpeedOverlayConfigFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/fingerprints/SuggestedActionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/fingerprints/SuggestedActionsFingerprint.kt index 0eae3375f..ca561076d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/fingerprints/SuggestedActionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/fingerprints/SuggestedActionsFingerprint.kt @@ -13,5 +13,5 @@ object SuggestedActionsFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(SuggestedAction) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(SuggestedAction) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/patch/SuggestedActionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/patch/SuggestedActionsPatch.kt index a12b06309..5295518a9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/patch/SuggestedActionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/suggestactions/patch/SuggestedActionsPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.suggestactions.fingerprints.SuggestedActionsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/watermark/patch/HideChannelWatermarkPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/watermark/patch/HideChannelWatermarkPatch.kt index 06fb73c1c..9fbb08f39 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/watermark/patch/HideChannelWatermarkPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/watermark/patch/HideChannelWatermarkPatch.kt @@ -14,9 +14,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.player.watermark.fingerprints.HideWatermarkFingerprint import app.revanced.patches.youtube.player.watermark.fingerprints.HideWatermarkParentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.PLAYER import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbar/patch/HideSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbar/patch/HideSeekbarPatch.kt index 0cbf3ec53..e07eaf574 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbar/patch/HideSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbar/patch/HideSeekbarPatch.kt @@ -15,9 +15,9 @@ 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.youtube.seekbar.seekbarcolor.patch.SeekbarColorPatch +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.fingerprints.SeekbarFingerprint import app.revanced.patches.youtube.utils.fingerprints.SeekbarOnDrawFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.SEEKBAR diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/fingerprints/SeekbarColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/fingerprints/SeekbarColorFingerprint.kt index 453143380..4eee79480 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/fingerprints/SeekbarColorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/fingerprints/SeekbarColorFingerprint.kt @@ -5,5 +5,9 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object SeekbarColorFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(InlineTimeBarColorizedBarPlayedColorDark) } + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists( + InlineTimeBarColorizedBarPlayedColorDark + ) + } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/speed/patch/AppendSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/speed/patch/AppendSpeedPatch.kt index 9d87209f7..673c7078e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/speed/patch/AppendSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/speed/patch/AppendSpeedPatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.fingerprints.TotalTimeFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.TotalTimeFingerprint import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingFingerprint.kt index 31b5c1976..29c6d1c9a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingFingerprint.kt @@ -26,5 +26,5 @@ object SeekbarTappingFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.IF_EQZ ), - customFingerprint = { it, _ -> it.name == "onTouchEvent" } + customFingerprint = { methodDef, _ -> methodDef.name == "onTouchEvent" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingReferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingReferenceFingerprint.kt index 4cdcd96b1..e3f92e6d4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingReferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/fingerprints/SeekbarTappingReferenceFingerprint.kt @@ -27,5 +27,5 @@ object SeekbarTappingReferenceFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, // pMethodReference Opcode.RETURN ), - customFingerprint = { it, _ -> it.name == "onTouchEvent" } + customFingerprint = { methodDef, _ -> methodDef.name == "onTouchEvent" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/patch/SeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/patch/SeekbarTappingPatch.kt index 8d100369e..573d6bc18 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/patch/SeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/tapping/patch/SeekbarTappingPatch.kt @@ -13,9 +13,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.seekbar.tapping.fingerprints.SeekbarTappingFingerprint import app.revanced.patches.youtube.seekbar.tapping.fingerprints.SeekbarTappingReferenceFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.SEEKBAR import org.jf.dexlib2.iface.instruction.ReferenceInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/fingerprints/ThumbnailPreviewConfigFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/fingerprints/ThumbnailPreviewConfigFingerprint.kt index a27f89d22..e8a086de3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/fingerprints/ThumbnailPreviewConfigFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/fingerprints/ThumbnailPreviewConfigFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWide32LiteralExists object ThumbnailPreviewConfigFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf(), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45398577) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45398577) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/patch/NewThumbnailPreviewPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/patch/NewThumbnailPreviewPatch.kt index 94a6ea6c6..c5f742315 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/patch/NewThumbnailPreviewPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/thumbnailpreview/patch/NewThumbnailPreviewPatch.kt @@ -12,8 +12,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.seekbar.thumbnailpreview.fingerprints.ThumbnailPreviewConfigFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.SEEKBAR import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/fingerprints/TimeCounterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/fingerprints/TimeCounterFingerprint.kt index 4019b985d..01043bc43 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/fingerprints/TimeCounterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/fingerprints/TimeCounterFingerprint.kt @@ -21,6 +21,5 @@ object TimeCounterFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.IF_EQZ, Opcode.GOTO - ), - customFingerprint = { _, classDef -> classDef.methods.count() == 14 } + ) ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/patch/HideTimeStampPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/patch/HideTimeStampPatch.kt index 24b306d96..dc8f1e85b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/patch/HideTimeStampPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/timestamps/patch/HideTimeStampPatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.seekbar.timestamps.fingerprints.TimeCounterFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.SEEKBAR diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt index b641093ef..08d1cd482 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object ShortsCommentFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(RightComment) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(RightComment) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt index 29798f803..ccd91a7d2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists object ShortsInfoPanelFingerprint : MethodFingerprint( returnType = "V", - customFingerprint = { it, _ -> it.isWideLiteralExists(ReelPlayerInfoPanel) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelPlayerInfoPanel) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt index 03b237e30..f257fd1dd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidContentFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object ShortsPaidContentFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(ReelPlayerBadge) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelPlayerBadge) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt index b955b753d..0c6d1bb02 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object ShortsRemixFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(ReelDynRemix) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelDynRemix) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt index 425221d75..327ea85a8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object ShortsSubscriptionsFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(ReelPlayerPausedStateButton) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelPlayerPausedStateButton) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt index 6db9eb7d1..06ec5b01a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.util.bytecode.isWideLiteralExists object ShortsSubscriptionsTabletParentFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.isWideLiteralExists(ReelPlayerFooter) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelPlayerFooter) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt index d3fa06420..8196acdfd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsCommentButtonPatch.kt @@ -9,8 +9,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.RightComment import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.integrations.Constants.SHORTS diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsComponentPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsComponentPatch.kt index 15050c504..1009d70cb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsComponentPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.shorts.shortscomponent.patch +package app.revanced.patches.youtube.shorts.shortscomponent.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name @@ -9,25 +9,19 @@ 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.patch.mapping.ResourceMappingPatch -import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.shorts.shortscomponent.patch.ShortsCommentButtonPatch -import app.revanced.patches.youtube.shorts.shortscomponent.patch.ShortsInfoPanelPatch -import app.revanced.patches.youtube.shorts.shortscomponent.patch.ShortsPaidContentBannerPatch -import app.revanced.patches.youtube.shorts.shortscomponent.patch.ShortsRemixButtonPatch -import app.revanced.patches.youtube.shorts.shortscomponent.patch.ShortsSubscriptionsButtonPatch +import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus +import app.revanced.util.integrations.Constants.PATCHES_PATH @Patch @Name("hide-shorts-component") @Description("Hides other Shorts components.") @DependsOn( [ - GeneralAdsPatch::class, - ResourceMappingPatch::class, + LithoFilterPatch::class, SettingsPatch::class, SharedResourceIdPatch::class, ShortsCommentButtonPatch::class, @@ -42,6 +36,8 @@ import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus class ShortsComponentPatch : BytecodePatch() { override fun execute(context: BytecodeContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/ShortsFilter;") + context.updatePatchStatus("ShortsComponent") /** diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt index e9127d64f..109ed4a38 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsInfoPanelPatch.kt @@ -9,10 +9,9 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPlayerInfoPanel - import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt index 4ce6ddd57..2d5600a48 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsPaidContentBannerPatch.kt @@ -10,8 +10,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPaidContentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPlayerBadge import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPlayerBadge2 import app.revanced.util.bytecode.getWideLiteralIndex diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt index 197f21756..398e6d33d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsRemixButtonPatch.kt @@ -9,8 +9,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsRemixFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelDynRemix import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.integrations.Constants.SHORTS diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt index 3f8d7c974..56cca4544 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/patch/ShortsSubscriptionsButtonPatch.kt @@ -11,10 +11,10 @@ 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.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsFingerprint import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletFingerprint import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletParentFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPlayerFooter import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPlayerPausedStateButton import app.revanced.util.bytecode.getWideLiteralIndex diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt index c5f35b08d..70b080e30 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/patch/DisableShortsOnStartupPatch.kt @@ -13,8 +13,8 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.shorts.startupshortsreset.fingerprints.UserWasInShortsFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.SHORTS import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/swipe/hdrbrightness/patch/HDRBrightnessPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/swipe/hdrbrightness/patch/HDRBrightnessPatch.kt index 1007447f0..ad448b961 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/swipe/hdrbrightness/patch/HDRBrightnessPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/swipe/hdrbrightness/patch/HDRBrightnessPatch.kt @@ -10,8 +10,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.swipe.hdrbrightness.fingerprints.HDRBrightnessFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.util.integrations.Constants.SWIPE_PATH @Name("disable-hdr-auto-brightness") diff --git a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/SwipeControlsHostActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/SwipeControlsHostActivityFingerprint.kt index e77ccb7d1..099b72b17 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/SwipeControlsHostActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/SwipeControlsHostActivityFingerprint.kt @@ -7,5 +7,5 @@ import org.jf.dexlib2.AccessFlags object SwipeControlsHostActivityFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, parameters = emptyList(), - customFingerprint = { it, _ -> it.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;" } + customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/WatchWhileActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/WatchWhileActivityFingerprint.kt index c777e8455..ff6c5a14f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/WatchWhileActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/fingerprints/WatchWhileActivityFingerprint.kt @@ -7,5 +7,5 @@ import org.jf.dexlib2.AccessFlags object WatchWhileActivityFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, parameters = emptyList(), - customFingerprint = { it, _ -> it.definingClass.endsWith("WatchWhileActivity;") && it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/patch/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/patch/SwipeControlsBytecodePatch.kt index da269517a..124aa9579 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/patch/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/bytecode/patch/SwipeControlsBytecodePatch.kt @@ -11,9 +11,9 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.TypeUtil.traverseClassHierarchy import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints.SwipeControlsHostActivityFingerprint import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints.WatchWhileActivityFingerprint +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.immutable.ImmutableMethod diff --git a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/resource/patch/SwipeControlsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/resource/patch/SwipeControlsPatch.kt index e5b382156..56f54b7eb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/resource/patch/SwipeControlsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipecontrols/resource/patch/SwipeControlsPatch.kt @@ -9,9 +9,9 @@ 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.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.swipe.hdrbrightness.patch.HDRBrightnessPatch import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.patch.SwipeControlsBytecodePatch +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/LayoutConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/LayoutConstructorFingerprint.kt index 3e232d742..ddd08f9cc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/LayoutConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/LayoutConstructorFingerprint.kt @@ -1,8 +1,12 @@ package app.revanced.patches.youtube.utils.fingerprints +import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import org.jf.dexlib2.AccessFlags object LayoutConstructorFingerprint : MethodFingerprint( - strings = listOf("1.0x"), - customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") } + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = emptyList(), + strings = listOf("1.0x") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/OnBackPressedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/OnBackPressedFingerprint.kt index b9857c0e2..f25e2fe45 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/OnBackPressedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/OnBackPressedFingerprint.kt @@ -5,5 +5,5 @@ import org.jf.dexlib2.Opcode object OnBackPressedFingerprint : MethodFingerprint( opcodes = listOf(Opcode.RETURN_VOID), - customFingerprint = { it, _ -> it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "onBackPressed" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/PivotBarCreateButtonViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/PivotBarCreateButtonViewFingerprint.kt index a72e3b690..56107b133 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/PivotBarCreateButtonViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/PivotBarCreateButtonViewFingerprint.kt @@ -14,5 +14,5 @@ object PivotBarCreateButtonViewFingerprint : MethodFingerprint( Opcode.MOVE_OBJECT, Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ImageOnlyTab) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ImageOnlyTab) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/SubtitleButtonControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/SubtitleButtonControllerFingerprint.kt index 80d9b2746..261db0bbd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/SubtitleButtonControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/SubtitleButtonControllerFingerprint.kt @@ -2,13 +2,15 @@ package app.revanced.patches.youtube.utils.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AccessibilityCaptionsButtonName +import app.revanced.util.bytecode.isWideLiteralExists import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode object SubtitleButtonControllerFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleTrack;"), + parameters = listOf("L"), opcodes = listOf( Opcode.IGET_OBJECT, Opcode.IF_NEZ, @@ -20,5 +22,9 @@ object SubtitleButtonControllerFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.IGET_OBJECT ), - customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitleButtonController;") } + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists( + AccessibilityCaptionsButtonName + ) + } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/TotalTimeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/TotalTimeFingerprint.kt index 9e4666494..cde9408cf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/TotalTimeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/TotalTimeFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists object TotalTimeFingerprint : MethodFingerprint( returnType = "V", - customFingerprint = { it, _ -> it.isWideLiteralExists(TotalTime) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(TotalTime) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/fingerprints/YouTubeControlsOverlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/YouTubeControlsOverlayFingerprint.kt similarity index 62% rename from src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/fingerprints/YouTubeControlsOverlayFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/YouTubeControlsOverlayFingerprint.kt index eba71f5e9..73d61cbf6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/fullscreen/compactcontrolsoverlay/fingerprints/YouTubeControlsOverlayFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fingerprints/YouTubeControlsOverlayFingerprint.kt @@ -1,19 +1,23 @@ -package app.revanced.patches.youtube.fullscreen.compactcontrolsoverlay.fingerprints +package app.revanced.patches.youtube.utils.fingerprints +import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.YoutubeControlsOverlay import app.revanced.util.bytecode.isWideLiteralExists +import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode object YouTubeControlsOverlayFingerprint : MethodFingerprint( returnType = "V", + accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, + parameters = emptyList(), opcodes = listOf( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, Opcode.IF_EQZ ), - customFingerprint = { it, _ -> - it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists( + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists( YoutubeControlsOverlay ) } diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/fingerprint/ScrollTopParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/fingerprint/ScrollTopParentFingerprint.kt index 6c35a53a0..342b12cfa 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/fingerprint/ScrollTopParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/fingerprint/ScrollTopParentFingerprint.kt @@ -20,6 +20,6 @@ object ScrollTopParentFingerprint : MethodFingerprint( Opcode.IPUT_OBJECT, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.name == "" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/patch/DoubleBackToClosePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/patch/DoubleBackToClosePatch.kt index 8589c968f..d76162586 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/patch/DoubleBackToClosePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/doublebacktoclose/patch/DoubleBackToClosePatch.kt @@ -11,8 +11,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.patches.youtube.utils.fingerprints.OnBackPressedFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.OnBackPressedFingerprint import app.revanced.patches.youtube.utils.fix.doublebacktoclose.fingerprint.ScrollPositionFingerprint import app.revanced.patches.youtube.utils.fix.doublebacktoclose.fingerprint.ScrollTopFingerprint import app.revanced.patches.youtube.utils.fix.doublebacktoclose.fingerprint.ScrollTopParentFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/protobufpoof/fingerprints/SubtitleWindowFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/protobufpoof/fingerprints/SubtitleWindowFingerprint.kt index c6ce60467..4bef89960 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/protobufpoof/fingerprints/SubtitleWindowFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/protobufpoof/fingerprints/SubtitleWindowFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object SubtitleWindowFingerprint : MethodFingerprint( parameters = listOf("I", "I", "I", "Z", "Z"), - customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitleWindowSettings;") && it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SubtitleWindowSettings;") && methodDef.name == "" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt index 6378a0c2f..cddc4e1ea 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt @@ -15,5 +15,5 @@ object SwipeRefreshLayoutFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.RETURN ), - customFingerprint = { it, _ -> it.definingClass.endsWith("SwipeRefreshLayout;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoFilterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoFilterFingerprint.kt new file mode 100644 index 000000000..3047e1da5 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoFilterFingerprint.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.youtube.utils.litho.fingerprints + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object LithoFilterFingerprint : MethodFingerprint( + customFingerprint = custom@{ method, classDef -> + if (method.name != "") return@custom false + + classDef.type.endsWith("LithoFilterPatch;") + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt index 1630dc9b4..f3dc5d431 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt @@ -15,5 +15,5 @@ object LithoThemeFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, // Paint.setColor: inject point Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.name == "onBoundsChange" } + customFingerprint = { methodDef, _ -> methodDef.name == "onBoundsChange" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoFilterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoFilterPatch.kt index e06a2a9fa..f9b387fa8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoFilterPatch.kt @@ -4,6 +4,9 @@ import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions +import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess @@ -11,25 +14,26 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.shared.patch.litho.ComponentParserPatch import app.revanced.patches.shared.patch.litho.ComponentParserPatch.Companion.generalHook import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.utils.fix.doublebacktoclose.patch.DoubleBackToClosePatch -import app.revanced.patches.youtube.utils.fix.swiperefresh.patch.SwipeRefreshPatch import app.revanced.patches.youtube.utils.litho.fingerprints.ByteBufferFingerprint +import app.revanced.patches.youtube.utils.litho.fingerprints.LithoFilterFingerprint import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch import app.revanced.util.integrations.Constants.ADS_PATH +import java.io.Closeable @DependsOn( [ ComponentParserPatch::class, - DoubleBackToClosePatch::class, - PlayerTypeHookPatch::class, - SwipeRefreshPatch::class + PlayerTypeHookPatch::class ] ) @YouTubeCompatibility @Version("0.0.1") class LithoFilterPatch : BytecodePatch( - listOf(ByteBufferFingerprint) -) { + listOf( + ByteBufferFingerprint, + LithoFilterFingerprint + ) +), Closeable { override fun execute(context: BytecodeContext): PatchResult { @@ -38,9 +42,34 @@ class LithoFilterPatch : BytecodePatch( "sput-object p0, $ADS_PATH/ByteBufferFilterPatch;->bytebuffer:Ljava/nio/ByteBuffer;" ) ?: return ByteBufferFingerprint.toErrorResult() - generalHook("$ADS_PATH/LithoFilterPatch;->filters") + LithoFilterFingerprint.result?.mutableMethod?.apply { + removeInstructions(2, 4) // Remove dummy filter. + + addFilter = { classDescriptor -> + addInstructions( + 2, + """ + new-instance v1, $classDescriptor + invoke-direct {v1}, $classDescriptor->()V + const/4 v2, ${filterCount++} + aput-object v1, v0, v2 + """ + ) + } + } ?: return LithoFilterFingerprint.toErrorResult() + return PatchResultSuccess() } + + override fun close() = LithoFilterFingerprint.result!! + .mutableMethod.replaceInstruction(0, "const/4 v0, $filterCount") + + companion object { + internal lateinit var addFilter: (String) -> Unit + private set + + private var filterCount = 0 + } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/fingerprints/TopBarButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/fingerprints/TopBarButtonFingerprint.kt index 241b51996..a3a9d5781 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/fingerprints/TopBarButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/fingerprints/TopBarButtonFingerprint.kt @@ -15,5 +15,5 @@ object TopBarButtonFingerprint : MethodFingerprint( Opcode.IF_EQZ ), strings = listOf("parent_csn", "parent_ve_type"), - customFingerprint = { it, _ -> it.name == "onClick" } + customFingerprint = { methodDef, _ -> methodDef.name == "onClick" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/patch/NavBarIndexPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/patch/NavBarIndexPatch.kt index 7c8ec011a..0221e4830 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/patch/NavBarIndexPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/navbarindex/patch/NavBarIndexPatch.kt @@ -11,8 +11,8 @@ 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.patches.youtube.utils.fingerprints.OnBackPressedFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.OnBackPressedFingerprint import app.revanced.patches.youtube.utils.navbarindex.fingerprints.NavBarBuilderFingerprint import app.revanced.patches.youtube.utils.navbarindex.fingerprints.TopBarButtonFingerprint import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedChangedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedChangedFingerprint.kt index d762fcfca..874902d65 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedChangedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedChangedFingerprint.kt @@ -12,5 +12,5 @@ object VideoSpeedChangedFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL ), - customFingerprint = { it, _ -> it.name == "onItemClick" } + customFingerprint = { methodDef, _ -> methodDef.name == "onItemClick" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedPatchFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedPatchFingerprint.kt index 03bfdbc56..7fa879107 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedPatchFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/overridespeed/fingerprints/VideoSpeedPatchFingerprint.kt @@ -8,5 +8,5 @@ object VideoSpeedPatchFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, parameters = listOf("F"), - customFingerprint = { it, _ -> it.definingClass.endsWith("/VideoSpeedPatch;") && it.name == "overrideSpeed" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/VideoSpeedPatch;") && methodDef.name == "overrideSpeed" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playerbutton/fingerprints/LiveChatFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playerbutton/fingerprints/LiveChatFingerprint.kt index 4cf5be80b..ef81fdbc0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playerbutton/fingerprints/LiveChatFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playerbutton/fingerprints/LiveChatFingerprint.kt @@ -7,5 +7,5 @@ import org.jf.dexlib2.Opcode object LiveChatFingerprint : MethodFingerprint( opcodes = listOf(Opcode.NEW_INSTANCE), - customFingerprint = { it, _ -> it.isWideLiteralExists(LiveChatButton) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(LiveChatButton) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt index f40a9da3d..b64f3b4d2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt @@ -11,5 +11,5 @@ object BottomControlsInflateFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(BottomUiContainerStub) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BottomUiContainerStub) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/ControlsLayoutInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/ControlsLayoutInflateFingerprint.kt index 97c5398b3..7f729b450 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/ControlsLayoutInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/ControlsLayoutInflateFingerprint.kt @@ -13,5 +13,5 @@ object ControlsLayoutInflateFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - customFingerprint = { it, _ -> it.isWideLiteralExists(ControlsLayoutStub) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ControlsLayoutStub) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt index 09ca86f9f..2d9b9f0d1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt @@ -4,6 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object PlayerControlsVisibilityFingerprint : MethodFingerprint( returnType = "V", - parameters = listOf("Z", "Z"), - customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") } + parameters = listOf("Z", "Z") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/SpeedEduVisibleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/SpeedEduVisibleFingerprint.kt index e2bab2a9d..87d0c4724 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/SpeedEduVisibleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/fingerprints/SpeedEduVisibleFingerprint.kt @@ -6,5 +6,5 @@ import org.jf.dexlib2.Opcode object SpeedEduVisibleFingerprint : MethodFingerprint( returnType = "V", opcodes = listOf(Opcode.IPUT_BOOLEAN), - customFingerprint = { it, _ -> it.name == "" } + customFingerprint = { methodDef, _ -> methodDef.name == "" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/patch/PlayerControlsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/patch/PlayerControlsPatch.kt index 25c164589..22a0c37b6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/patch/PlayerControlsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/patch/PlayerControlsPatch.kt @@ -16,6 +16,7 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint import app.revanced.patches.youtube.utils.playercontrols.fingerprints.BottomControlsInflateFingerprint import app.revanced.patches.youtube.utils.playercontrols.fingerprints.ControlsLayoutInflateFingerprint import app.revanced.patches.youtube.utils.playercontrols.fingerprints.PlayerControlsVisibilityFingerprint @@ -33,7 +34,7 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.reference.Reference -@Name("player-controls-bytecode-patch") +@Name("player-controls-patch") @DependsOn([SharedResourceIdPatch::class]) @Description("Manages the code for the player controls of the YouTube player.") @YouTubeCompatibility @@ -42,9 +43,9 @@ class PlayerControlsPatch : BytecodePatch( listOf( BottomControlsInflateFingerprint, ControlsLayoutInflateFingerprint, - PlayerControlsVisibilityFingerprint, PlayerControlsVisibilityModelFingerprint, - SpeedEduVisibleParentFingerprint + SpeedEduVisibleParentFingerprint, + YouTubeControlsOverlayFingerprint ) ) { override fun execute(context: BytecodeContext): PatchResult { @@ -61,8 +62,14 @@ class PlayerControlsPatch : BytecodePatch( userScrubbingResult = UserScrubbingFingerprint.result ?: return UserScrubbingFingerprint.toErrorResult() + val controlsOverlayClassDef = + YouTubeControlsOverlayFingerprint.result?.classDef + ?: return YouTubeControlsOverlayFingerprint.toErrorResult() + + PlayerControlsVisibilityFingerprint.resolve(context, controlsOverlayClassDef) playerControlsVisibilityResult = PlayerControlsVisibilityFingerprint.result ?: return PlayerControlsVisibilityFingerprint.toErrorResult() + controlsLayoutInflateResult = ControlsLayoutInflateFingerprint.result ?: return ControlsLayoutInflateFingerprint.toErrorResult() inflateResult = BottomControlsInflateFingerprint.result diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt index 49abd94d9..d72f968b8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.youtube.utils.playeroverlay.fingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object PlayerOverlaysOnFinishInflateFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubePlayerOverlaysLayout;") && it.name == "onFinishInflate" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("YouTubePlayerOverlaysLayout;") && methodDef.name == "onFinishInflate" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/PlayerTypeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/PlayerTypeFingerprint.kt index 676d84b63..415a0a02e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/PlayerTypeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/PlayerTypeFingerprint.kt @@ -13,5 +13,5 @@ object PlayerTypeFingerprint : MethodFingerprint( Opcode.IF_NE, Opcode.RETURN_VOID ), - customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubePlayerOverlaysLayout;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("YouTubePlayerOverlaysLayout;") } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/VideoStateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/VideoStateFingerprint.kt index 630a4a204..ddaf5804c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/VideoStateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/fingerprint/VideoStateFingerprint.kt @@ -17,6 +17,5 @@ object VideoStateFingerprint : MethodFingerprint( Opcode.IF_EQZ, Opcode.IF_EQZ, Opcode.IGET_OBJECT, // obfuscated parameter field name - ), - customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") } + ) ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/patch/PlayerTypeHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/patch/PlayerTypeHookPatch.kt index 800839262..18950837f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/patch/PlayerTypeHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/patch/PlayerTypeHookPatch.kt @@ -8,10 +8,12 @@ import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint import app.revanced.patches.youtube.utils.playertype.fingerprint.PlayerTypeFingerprint import app.revanced.patches.youtube.utils.playertype.fingerprint.VideoStateFingerprint import app.revanced.util.integrations.Constants.UTILS_PATH @@ -24,7 +26,7 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction class PlayerTypeHookPatch : BytecodePatch( listOf( PlayerTypeFingerprint, - VideoStateFingerprint + YouTubeControlsOverlayFingerprint ) ) { override fun execute(context: BytecodeContext): PatchResult { @@ -38,18 +40,26 @@ class PlayerTypeHookPatch : BytecodePatch( } } ?: return PlayerTypeFingerprint.toErrorResult() - VideoStateFingerprint.result?.let { - it.mutableMethod.apply { - val endIndex = it.scanResult.patternScanResult!!.endIndex - val videoStateFieldName = getInstruction(endIndex).reference - addInstructions( - 0, """ + YouTubeControlsOverlayFingerprint.result?.let { parentResult -> + VideoStateFingerprint.also { + it.resolve( + context, + parentResult.classDef + ) + }.result?.let { + it.mutableMethod.apply { + val endIndex = it.scanResult.patternScanResult!!.endIndex + val videoStateFieldName = + getInstruction(endIndex).reference + addInstructions( + 0, """ iget-object v0, p1, $videoStateFieldName # copy VideoState parameter field invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->setVideoState(Ljava/lang/Enum;)V """ - ) + ) + } } - } ?: return VideoStateFingerprint.toErrorResult() + } ?: return YouTubeControlsOverlayFingerprint.toErrorResult() return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/quickactionscontainer/fingerprints/QuickActionsElementFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/quickactionscontainer/fingerprints/QuickActionsElementFingerprint.kt index ead309168..52bb921ed 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/quickactionscontainer/fingerprints/QuickActionsElementFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/quickactionscontainer/fingerprints/QuickActionsElementFingerprint.kt @@ -19,5 +19,5 @@ object QuickActionsElementFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST ), - customFingerprint = { it, _ -> it.isWideLiteralExists(QuickActionsElementContainer) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(QuickActionsElementContainer) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/patch/SharedResourceIdPatch.kt index 30e48a8ca..9991196e6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/patch/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/patch/SharedResourceIdPatch.kt @@ -26,11 +26,13 @@ import app.revanced.util.enum.ResourceType.STRING class SharedResourceIdPatch : ResourcePatch { internal companion object { var AccountSwitcherAccessibility: Long = -1 + var AccessibilityCaptionsButtonName: Long = -1 var ActionBarRingo: Long = -1 var AdAttribution: Long = -1 var Appearance: Long = -1 var AppRelatedEndScreenResults: Long = -1 var AutoNavPreviewStub: Long = -1 + var AutoNavToggle: Long = -1 var BackgroundCategory: Long = -1 var BarContainerHeight: Long = -1 var BottomPanelOverlayText: Long = -1 @@ -55,6 +57,7 @@ class SharedResourceIdPatch : ResourcePatch { var InlineTimeBarPlayedNotHighlightedColor: Long = -1 var InsetOverlayViewLayout: Long = -1 var LiveChatButton: Long = -1 + var MusicAppDeeplinkButtonView: Long = -1 var QuickActionsElementContainer: Long = -1 var ReelDynRemix: Long = -1 var ReelPlayerBadge: Long = -1 @@ -67,12 +70,13 @@ class SharedResourceIdPatch : ResourcePatch { var ScrimOverlay: Long = -1 var Scrubbing: Long = -1 var SearchSuggestionEntry: Long = -1 + var SettingsBooleanTimeRangeDialog: Long = -1 var SuggestedAction: Long = -1 var ToolBarPaddingHome: Long = -1 var ToolTipContentView: Long = -1 var TotalTime: Long = -1 var VideoQualityBottomSheet: Long = -1 - var WatchWhileTimeBarOverlayStub: Long = -1 + var VideoZoomIndicatorLayout: Long = -1 var WordMarkHeader: Long = -1 var YoutubeControlsOverlay: Long = -1 } @@ -85,11 +89,13 @@ class SharedResourceIdPatch : ResourcePatch { ?: throw PatchResultError("Failed to find resource id : $resourceName") AccountSwitcherAccessibility = find(STRING, "account_switcher_accessibility_label") + AccessibilityCaptionsButtonName = find(STRING, "accessibility_captions_button_name") ActionBarRingo = find(LAYOUT, "action_bar_ringo") AdAttribution = find(ID, "ad_attribution") Appearance = find(STRING, "app_theme_appearance_dark") AppRelatedEndScreenResults = find(LAYOUT, "app_related_endscreen_results") AutoNavPreviewStub = find(ID, "autonav_preview_stub") + AutoNavToggle = find(ID, "autonav_toggle") BackgroundCategory = find(STRING, "pref_background_and_offline_category") BarContainerHeight = find(DIMEN, "bar_container_height") BottomPanelOverlayText = find(ID, "bottom_panel_overlay_text") @@ -116,6 +122,7 @@ class SharedResourceIdPatch : ResourcePatch { find(COLOR, "inline_time_bar_played_not_highlighted_color") InsetOverlayViewLayout = find(ID, "inset_overlay_view_layout") LiveChatButton = find(ID, "live_chat_overlay_button") + MusicAppDeeplinkButtonView = find(ID, "music_app_deeplink_button_view") QuickActionsElementContainer = find(ID, "quick_actions_element_container") ReelDynRemix = find(ID, "reel_dyn_remix") ReelPlayerBadge = find(ID, "reel_player_badge") @@ -128,12 +135,13 @@ class SharedResourceIdPatch : ResourcePatch { ScrimOverlay = find(ID, "scrim_overlay") Scrubbing = find(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing") SearchSuggestionEntry = find(LAYOUT, "search_suggestion_entry") + SettingsBooleanTimeRangeDialog = find(LAYOUT, "setting_boolean_time_range_dialog") SuggestedAction = find(LAYOUT, "suggested_action") ToolBarPaddingHome = find(DIMEN, "toolbar_padding_home_action_up") ToolTipContentView = find(LAYOUT, "tooltip_content_view") TotalTime = find(STRING, "total_time") VideoQualityBottomSheet = find(LAYOUT, "video_quality_bottom_sheet_list_fragment_title") - WatchWhileTimeBarOverlayStub = find(ID, "watch_while_timebar_overlay_stub") + VideoZoomIndicatorLayout = find(ID, "video_zoom_indicator_layout") WordMarkHeader = find(ATTR, "ytWordmarkHeader") YoutubeControlsOverlay = find(ID, "youtube_controls_overlay") diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/oldlayout/fingerprints/ButtonTagFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/oldlayout/fingerprints/ButtonTagFingerprint.kt index 954f0fe67..34af845e8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/oldlayout/fingerprints/ButtonTagFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/oldlayout/fingerprints/ButtonTagFingerprint.kt @@ -10,5 +10,5 @@ object ButtonTagFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), - customFingerprint = { it, _ -> it.isWideLiteralExists(DislikeButton) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(DislikeButton) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/settings/bytecode/fingerprints/ThemeSetterSystemFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/settings/bytecode/fingerprints/ThemeSetterSystemFingerprint.kt index 7c7487e2f..8ebd39788 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/settings/bytecode/fingerprints/ThemeSetterSystemFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/settings/bytecode/fingerprints/ThemeSetterSystemFingerprint.kt @@ -8,5 +8,5 @@ import org.jf.dexlib2.Opcode object ThemeSetterSystemFingerprint : MethodFingerprint( returnType = "L", opcodes = listOf(Opcode.RETURN_OBJECT), - customFingerprint = { it, _ -> it.isWideLiteralExists(Appearance) } + customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(Appearance) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/OverlayViewLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/OverlayViewLayoutFingerprint.kt deleted file mode 100644 index 7c52fed48..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/OverlayViewLayoutFingerprint.kt +++ /dev/null @@ -1,20 +0,0 @@ -package app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.InsetOverlayViewLayout -import app.revanced.util.bytecode.isWideLiteralExists -import org.jf.dexlib2.Opcode - -object OverlayViewLayoutFingerprint : MethodFingerprint( - opcodes = listOf( - Opcode.CONST, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST - ), - customFingerprint = { it, _ -> - it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists( - InsetOverlayViewLayout - ) - } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/PlayerControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/PlayerControllerFingerprint.kt index d61ed6d64..bdcbbac00 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/PlayerControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/fingerprints/PlayerControllerFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object PlayerControllerFingerprint : MethodFingerprint( - customFingerprint = { it, _ -> it.definingClass.endsWith("SegmentPlaybackController;") && it.name == "setSponsorBarRect" } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SegmentPlaybackController;") && methodDef.name == "setSponsorBarRect" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt index e096241ad..a3ce8db8c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt @@ -14,17 +14,17 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.fingerprints.SeekbarFingerprint import app.revanced.patches.youtube.utils.fingerprints.SeekbarOnDrawFingerprint import app.revanced.patches.youtube.utils.fingerprints.TotalTimeFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch import app.revanced.patches.youtube.utils.playercontrols.patch.PlayerControlsPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.InsetOverlayViewLayout import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.TotalTime import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.EndScreenEngagementPanelsFingerprint -import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.OverlayViewLayoutFingerprint import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.PlayerControllerFingerprint import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.RectangleFieldInvalidatorFingerprint import app.revanced.patches.youtube.utils.videoid.legacy.patch.LegacyVideoIdPatch @@ -57,9 +57,9 @@ import org.jf.dexlib2.iface.reference.MethodReference class SponsorBlockBytecodePatch : BytecodePatch( listOf( EndScreenEngagementPanelsFingerprint, - OverlayViewLayoutFingerprint, PlayerControllerFingerprint, - TotalTimeFingerprint + TotalTimeFingerprint, + YouTubeControlsOverlayFingerprint ) ) { override fun execute(context: BytecodeContext): PatchResult { @@ -175,7 +175,7 @@ class SponsorBlockBytecodePatch : BytecodePatch( /** * Initialize the SponsorBlock view */ - OverlayViewLayoutFingerprint.result?.mutableMethod?.let { + YouTubeControlsOverlayFingerprint.result?.mutableMethod?.let { it.apply { val targetIndex = getWideLiteralIndex(InsetOverlayViewLayout) + 3 val targetRegister = getInstruction(targetIndex).registerA @@ -185,7 +185,7 @@ class SponsorBlockBytecodePatch : BytecodePatch( "invoke-static {v$targetRegister}, $INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/ui/SponsorBlockViewController;->initialize(Landroid/view/ViewGroup;)V" ) } - } ?: return OverlayViewLayoutFingerprint.toErrorResult() + } ?: return YouTubeControlsOverlayFingerprint.toErrorResult() /** * Replace strings diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdFingerprint.kt deleted file mode 100644 index 2210f7937..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdFingerprint.kt +++ /dev/null @@ -1,14 +0,0 @@ -package app.revanced.patches.youtube.utils.videoid.legacy.fingerprint - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode - -object LegacyVideoIdFingerprint : MethodFingerprint( - returnType = "V", - accessFlags = AccessFlags.DECLARED_SYNCHRONIZED or AccessFlags.FINAL or AccessFlags.PUBLIC, - parameters = listOf("L"), - opcodes = listOf(Opcode.INVOKE_INTERFACE), - customFingerprint = { it, _ -> it.definingClass.endsWith("PlaybackLifecycleMonitor;") } -) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdParentFingerprint.kt new file mode 100644 index 000000000..c03065fbf --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/fingerprint/LegacyVideoIdParentFingerprint.kt @@ -0,0 +1,23 @@ +package app.revanced.patches.youtube.utils.videoid.legacy.fingerprint + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.util.bytecode.isWideLiteralExists +import org.jf.dexlib2.AccessFlags +import org.jf.dexlib2.Opcode + +object LegacyVideoIdParentFingerprint : MethodFingerprint( + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = listOf("L"), + opcodes = listOf( + Opcode.IGET_OBJECT, + Opcode.CHECK_CAST, + Opcode.CHECK_CAST, + Opcode.INVOKE_VIRTUAL, + Opcode.RETURN_VOID + ), + customFingerprint = { methodDef, _ -> + methodDef.isWideLiteralExists(78882851) + } +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/patch/LegacyVideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/patch/LegacyVideoIdPatch.kt index 7263dc514..c36222d56 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/patch/LegacyVideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/legacy/patch/LegacyVideoIdPatch.kt @@ -5,14 +5,17 @@ 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.data.toMethodWalker import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.utils.videoid.legacy.fingerprint.LegacyVideoIdFingerprint +import app.revanced.patches.youtube.utils.videoid.legacy.fingerprint.LegacyVideoIdParentFingerprint import app.revanced.util.integrations.Constants.VIDEO_PATH +import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("video-id-hook-legacy") @@ -20,20 +23,23 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @YouTubeCompatibility @Version("0.0.1") class LegacyVideoIdPatch : BytecodePatch( - listOf(LegacyVideoIdFingerprint) + listOf(LegacyVideoIdParentFingerprint) ) { override fun execute(context: BytecodeContext): PatchResult { - LegacyVideoIdFingerprint.result?.let { - insertIndex = it.scanResult.patternScanResult!!.endIndex + LegacyVideoIdParentFingerprint.result?.let { + insertMethod = context + .toMethodWalker(it.method) + .nextMethod(it.scanResult.patternScanResult!!.startIndex + 3, true) + .getMethod() as MutableMethod - it.mutableMethod.apply { - insertMethod = this - videoIdRegister = - (implementation!!.instructions[insertIndex + 1] as OneRegisterInstruction).registerA + insertIndex = insertMethod.implementation!!.instructions.indexOfFirst { instruction -> + instruction.opcode == Opcode.INVOKE_INTERFACE } - offset++ // offset so setCurrentVideoId is called before any injected call - } ?: return LegacyVideoIdFingerprint.toErrorResult() + + insertRegister = + insertMethod.getInstruction(insertIndex + 1).registerA + } ?: return LegacyVideoIdParentFingerprint.toErrorResult() injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V") @@ -45,7 +51,7 @@ class LegacyVideoIdPatch : BytecodePatch( private var offset = 2 private var insertIndex: Int = 0 - private var videoIdRegister: Int = 0 + private var insertRegister: Int = 0 private lateinit var insertMethod: MutableMethod @@ -58,7 +64,7 @@ class LegacyVideoIdPatch : BytecodePatch( ) { insertMethod.addInstructions( insertIndex + offset, // move-result-object offset - "invoke-static {v$videoIdRegister}, $methodDescriptor" + "invoke-static {v$insertRegister}, $methodDescriptor" ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt index 534fb4c19..6dd8008b4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt @@ -14,6 +14,5 @@ object MainstreamVideoIdFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT - ), - customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") } + ) ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdParentFingerprint.kt new file mode 100644 index 000000000..9751f5463 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/MainstreamVideoIdParentFingerprint.kt @@ -0,0 +1,9 @@ +package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object MainstreamVideoIdParentFingerprint : MethodFingerprint( + returnType = "V", + parameters = listOf("L", "L"), + strings = listOf("error retrieving subtitle"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/TimebarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/TimebarFingerprint.kt index 6aae65a06..a5673fade 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/TimebarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/TimebarFingerprint.kt @@ -8,5 +8,9 @@ object TimebarFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), - customFingerprint = { it, _ -> it.definingClass.endsWith("/TimeBar;") && it.name.contains("draw") } + customFingerprint = { methodDef, _ -> + methodDef.definingClass.endsWith("/TimeBar;") && methodDef.name.contains( + "draw" + ) + } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/VideoLengthFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/VideoLengthFingerprint.kt index c49d0ef68..ab6d722e1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/VideoLengthFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/fingerprint/VideoLengthFingerprint.kt @@ -15,5 +15,5 @@ object VideoLengthFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.INVOKE_VIRTUAL ), - customFingerprint = { it, _ -> it.isWide32LiteralExists(45388753) } + customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45388753) } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/patch/MainstreamVideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/patch/MainstreamVideoIdPatch.kt index 1c7cd2ad3..caa207510 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/patch/MainstreamVideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/videoid/mainstream/patch/MainstreamVideoIdPatch.kt @@ -20,6 +20,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMu import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.MainstreamVideoIdFingerprint +import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.MainstreamVideoIdParentFingerprint import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.PlayerControllerSetTimeReferenceFingerprint import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.PlayerInitFingerprint import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.SeekFingerprint @@ -42,7 +43,7 @@ import org.jf.dexlib2.util.MethodUtil @DependsOn([PlayerTypeHookPatch::class]) class MainstreamVideoIdPatch : BytecodePatch( listOf( - MainstreamVideoIdFingerprint, + MainstreamVideoIdParentFingerprint, PlayerControllerSetTimeReferenceFingerprint, PlayerInitFingerprint, SeekFingerprint, @@ -133,14 +134,21 @@ class MainstreamVideoIdPatch : BytecodePatch( } } ?: return VideoLengthFingerprint.toErrorResult() - MainstreamVideoIdFingerprint.result?.let { - it.mutableMethod.apply { - insertMethod = this - insertIndex = it.scanResult.patternScanResult!!.endIndex - videoIdRegister = getInstruction(insertIndex).registerA - } - offset++ // offset so setVideoId is called before any injected call - } ?: return MainstreamVideoIdFingerprint.toErrorResult() + MainstreamVideoIdParentFingerprint.result?.let { parentResult -> + MainstreamVideoIdFingerprint.also { + it.resolve( + context, + parentResult.classDef + ) + }.result?.let { + it.mutableMethod.apply { + insertMethod = this + insertIndex = it.scanResult.patternScanResult!!.endIndex + videoIdRegister = getInstruction(insertIndex).registerA + } + offset++ // offset so setVideoId is called before any injected call + } ?: return MainstreamVideoIdFingerprint.toErrorResult() + } ?: return MainstreamVideoIdParentFingerprint.toErrorResult() return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoUserQualityChangeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoUserQualityChangeFingerprint.kt index 19042178e..2bf786060 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoUserQualityChangeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoUserQualityChangeFingerprint.kt @@ -7,5 +7,5 @@ import org.jf.dexlib2.AccessFlags object VideoUserQualityChangeFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - customFingerprint = { it, _ -> it.name == "onItemClick" } + customFingerprint = { methodDef, _ -> methodDef.name == "onItemClick" } ) \ No newline at end of file diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 7ac6ea151..9daa8ceb4 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -6,8 +6,6 @@ Enable cloud messaging settings to receive notifications Open MicroG Ads - Filter components by line-separated names - Custom filter General ads are shown General ads are hidden Hide general ads @@ -20,9 +18,6 @@ Self sponsored cards are shown Self sponsored cards are hidden Hide self sponsored cards - User filter is disabled - User filter is enabled - Enable user filter Import ReVanced settings from file or export ReVanced settings to file Bottom player Button container @@ -34,6 +29,11 @@ Change homepage to subscriptions Comments Time Stamp copied to clipboard + Filter components by line-separated names + Custom filter + Custom filter is disabled + Custom filter is enabled + Enable custom filter Type the hex code of the seekbar color Custom seekbar color value Type the video speed to change when pressing and holding the player diff --git a/src/main/resources/youtube/settings/values-v21/strings.xml b/src/main/resources/youtube/settings/values-v21/strings.xml index 17db57eb3..c1409fc2c 100644 --- a/src/main/resources/youtube/settings/values-v21/strings.xml +++ b/src/main/resources/youtube/settings/values-v21/strings.xml @@ -6,12 +6,12 @@ <b>%1$s</b><br><br>This will change the language used on YouTube, including buttons, text and dialogs, but will not change the language of ReVanced Extended settings. System default - @string/revanced_ad_remover_custom_filter_summary - @string/revanced_ad_remover_custom_filter_title - @string/settings_ie ReVanced Extended + @string/revanced_custom_filter_strings_summary + @string/revanced_custom_filter_strings_title + @string/revanced_hide_button_thanks_summary_off @string/revanced_hide_button_thanks_summary_on @string/revanced_hide_button_thanks_title diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index a62d9412a..740354040 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -15,10 +15,7 @@ SETTINGS: HIDE_VIDEO_ADS --> + SETTINGS: HIDE_GENERAL_ADS --> @@ -48,8 +45,8 @@ - + + + + + + SETTINGS: HIDE_ACCOUNT_MENU --> - + @@ -152,16 +156,16 @@ SETTINGS: HIDE_CATEGORY_BAR --> - + - + SETTINGS: HIDE_LAYOUT_COMPONENTS --> @@ -172,32 +176,32 @@ - + SETTINGS: HIDE_LAYOUT_COMPONENTS --> - + SETTINGS: HIDE_LAYOUT_COMPONENTS --> - + SETTINGS: HIDE_LAYOUT_COMPONENTS --> - + @@ -208,11 +212,11 @@ - + SETTINGS: HIDE_LAYOUT_COMPONENTS --> @@ -254,7 +258,7 @@ SETTINGS: DISABLE_QUIC_PROTOCOL --> + SETTINGS: ENABLE_OPUS_CODEC --> @@ -282,7 +286,7 @@ - + @@ -321,6 +325,7 @@ +