From ec8bf1c2bb272e3eaea7518ead72bea6b049871e Mon Sep 17 00:00:00 2001 From: inotia00 Date: Mon, 13 Feb 2023 18:34:56 +0900 Subject: [PATCH] cleanup --- .../{shared => }/extensions/Extensions.kt | 6 +- .../ad/video/patch/MusicVideoAdsPatch.kt | 6 +- .../audio/codecs/patch/CodecsUnlockPatch.kt | 12 ++-- .../patch/ExclusiveAudioPatch.kt | 6 +- .../blacknavbar/patch/BlackNavbarPatch.kt | 8 +-- .../patch/CustomBrandingMusicPatch_Blue.kt | 4 +- .../patch/CustomBrandingMusicPatch_Red.kt | 4 +- .../CustomBrandingMusicPatch_Revancify.kt | 4 +- .../castbutton/patch/HideCastButtonPatch.kt | 6 +- .../compactheader/patch/CompactHeaderPatch.kt | 10 ++-- .../patch/MinimizedPlaybackPatch.kt | 4 +- .../patch/MinimizedPlayerPatch.kt | 6 +- .../patch/MiniplayerColorPatch.kt | 8 +-- .../premium/patch/HideGetPremiumPatch.kt | 10 ++-- .../MusicPlaybackControlsFingerprint.kt | 4 +- .../fingerprints/ShuffleClassFingerprint.kt | 6 +- .../shuffle/patch/EnforceShufflePatch.kt | 12 ++-- .../fingerprints/TabletLayoutFingerprint.kt | 6 +- .../tabletmode/patch/TabletModePatch.kt | 6 +- .../patch/RemoveTasteBuilderPatch.kt | 6 +- .../patch/RemoveUpgradeButtonPatch.kt | 8 +-- .../layout/zenmode/patch/ZenModePatch.kt | 8 +-- .../patch/BackgroundPlayPatch.kt | 6 +- .../patch/ClientSpoofMusicPatch.kt | 6 +- .../fingerprints/InitFingerprint.kt | 2 +- .../patch/MusicIntegrationsPatch.kt | 6 +- .../patch/MusicMicroGBytecodePatch.kt | 12 ++-- .../patch/MusicMicroGResourcePatch.kt | 10 ++-- .../patch/OptimizeResourcePatch.kt | 4 +- .../resourceid/patch/SharedResourceIdPatch.kt | 4 +- .../misc/settings/patch/MusicSettingsPatch.kt | 6 +- .../patch/MusicTranslationsPatch.kt | 4 +- .../shared/annotation/RVXCompatibility.kt | 2 +- .../shared/annotation/YouTubeCompatibility.kt | 8 +-- .../annotation/YouTubeMusicCompatibility.kt | 2 +- .../LayoutConstructorFingerprint.kt | 2 +- .../fingerprints/LayoutSwitchFingerprint.kt | 2 +- .../fingerprints/LegacyVideoAdsFingerprint.kt | 2 +- .../MainstreamVideoAdsFingerprint.kt | 2 +- .../MainstreamVideoAdsParentFingerprint.kt | 2 +- .../MiniplayerColorParentFingerprint.kt | 2 +- .../PivotBarCreateButtonViewFingerprint.kt | 2 +- .../SubtitleButtonControllerFingerprint.kt | 2 +- .../gestures/PredictiveBackGesturePatch.kt | 2 +- .../integrations/AbstractIntegrationsPatch.kt | 4 +- .../patch}/mapping/ResourceMappingPatch.kt | 4 +- .../shared/patch}/options/PatchOptions.kt | 4 +- .../settings/AbstractSettingsResourcePatch.kt | 10 ++-- .../patch}/videoads/GeneralVideoAdsPatch.kt | 12 ++-- .../bytecode/patch/GeneralAdsBytecodePatch.kt | 13 ++-- .../patch/GeneralAdsSecondaryBytecodePatch.kt | 16 ++--- .../general/resource/patch/GeneralAdsPatch.kt | 12 ++-- .../bytecode/patch/VideoAdsBytecodePatch.kt | 16 ++--- .../ads/video/resource/patch/VideoAdsPatch.kt | 8 +-- .../autorepeat/patch/AutoRepeatPatch.kt | 8 +-- .../patch/OverlayButtonsBytecodePatch.kt | 19 +++--- .../resource/patch/OverlayButtonsPatch.kt | 18 +++--- .../button/whitelist/patch/WhitelistPatch.kt | 6 +- .../patch/ForceVP9CodecBytecodePatch.kt | 8 +-- .../resource/patch/ForceVP9CodecPatch.kt | 8 +-- .../patch/LayoutSwitchBytecodePatch.kt | 8 +-- .../resource/patch/LayoutSwitchPatch.kt | 8 +-- .../bytecode/patch/OldLayoutBytecodePatch.kt | 6 +- .../resource/patch/OldLayoutPatch.kt | 8 +-- .../patch/ButtonContainerPatch.kt | 8 +-- .../comment/patch/CommentComponentPatch.kt | 4 +- .../flyoutpanel/patch/FlyoutPanelPatch.kt | 4 +- .../patch/OldQualityLayoutBytecodePatch.kt | 6 +- .../resource/patch/OldQualityLayoutPatch.kt | 8 +-- .../HideEndscreenOverlayBytecodePatch.kt | 10 ++-- .../patch/HideEndscreenOverlayPatch.kt | 4 +- .../HideFilmstripOverlayBytecodePatch.kt | 6 +- .../patch/HideFilmstripOverlayPatch.kt | 8 +-- .../FullscreenButtonContainerBytecodePatch.kt | 10 ++-- .../HideFullscreenPanelsBytecodePatch.kt | 8 +-- .../patch/HideFullscreenPanelsPatch.kt | 10 ++-- .../patch/HapticFeedBackBytecodePatch.kt | 6 +- .../resource/patch/HapticFeedBackPatch.kt | 8 +-- .../StartVideoInformerFingerprint.kt | 2 +- .../patch/AutoCaptionsBytecodePatch.kt | 11 ++-- .../resource/patch/AutoCaptionsPatch.kt | 8 +-- .../patch/PlayerPopupPanelsBytecodePatch.kt | 6 +- .../resource/patch/PlayerPopupPanelsPatch.kt | 8 +-- .../patch/CrowdfundingBoxBytecodePatch.kt | 10 ++-- .../resource/patch/CrowdfundingBoxPatch.kt | 8 +-- .../patch/HeaderSwitchBytecodePatch.kt | 8 +-- .../resource/patch/HeaderSwitchPatch.kt | 8 +-- .../patch/MixPlaylistsBytecodePatch.kt | 12 ++-- .../resource/patch/MixPlaylistsPatch.kt | 8 +-- .../patch/HideEmailAddressBytecodePatch.kt | 6 +- .../resource/patch/HideEmailAddressPatch.kt | 8 +-- .../fingerprints/PivotBarFingerprint.kt | 6 +- .../patch/CreateButtonRemoverBytecodePatch.kt | 22 +++---- .../patch/CreateButtonRemoverPatch.kt | 8 +-- .../patch/ShortsButtonRemoverBytecodePatch.kt | 21 ++++--- .../patch/ShortsButtonRemoverPatch.kt | 8 +-- .../patch/ShortsComponentBytecodePatch.kt | 16 ++--- .../resource/patch/ShortsComponentPatch.kt | 8 +-- .../patch/HideSnackbarBytecodePatch.kt | 6 +- .../resource/patch/HideSnackbarPatch.kt | 8 +-- .../patch/HideShortsOnStartupBytecodePatch.kt | 6 +- .../patch/HideShortsOnStartupPatch.kt | 8 +-- .../patch/HideStoriesBytecodePatch.kt | 10 ++-- .../resource/patch/HideStoriesPatch.kt | 8 +-- .../patch/TabletMiniPlayerBytecodePatch.kt | 6 +- .../resource/patch/TabletMiniPlayerPatch.kt | 8 +-- .../patch/WideSearchbarBytecodePatch.kt | 6 +- .../resource/patch/WideSearchbarPatch.kt | 8 +-- .../patch/HideAutoplayButtonBytecodePatch.kt | 10 ++-- .../resource/patch/HideAutoplayButtonPatch.kt | 8 +-- .../patch/HideCaptionsButtonBytecodePatch.kt | 8 +-- .../resource/patch/HideCaptionsButtonPatch.kt | 8 +-- .../patch/HideCastButtonBytecodePatch.kt | 4 +- .../resource/patch/HideCastButtonPatch.kt | 8 +-- .../fingerprints/LayoutCircleFingerprint.kt | 6 +- .../fingerprints/LayoutIconFingerprint.kt | 6 +- .../fingerprints/LayoutVideoFingerprint.kt | 6 +- .../patch/HideEndscreenCardsBytecodePatch.kt | 29 +++++---- .../resource/patch/HideEndscreenCardsPatch.kt | 8 +-- .../InfocardsIncognitoFingerprint.kt | 2 +- .../InfocardsIncognitoParentFingerprint.kt | 2 +- .../patch/HideInfoCardsBytecodePatch.kt | 6 +- .../resource/patch/HideInfocardsPatch.kt | 8 +-- .../patch/HideLiveChatButtonPatch.kt | 6 +- .../patch/HideNextPrevButtonPatch.kt | 6 +- .../patch/PlayerOverlayFilterBytecodePatch.kt | 8 +-- .../patch/PlayerOverlayFilterPatch.kt | 8 +-- .../patch/SuggestedActionsBytecodePatch.kt | 10 ++-- .../resource/patch/SuggestedActionsPatch.kt | 8 +-- .../HideChannelWatermarkBytecodePatch.kt | 6 +- .../patch/HideChannelWatermarkPatch.kt | 8 +-- .../patch/CustomSeekbarColorBytecodePatch.kt | 10 ++-- .../resource/patch/CustomSeekbarColorPatch.kt | 8 +-- .../patch/SeekbarTappingBytecodePatch.kt | 12 ++-- .../resource/patch/SeekbarTappingPatch.kt | 8 +-- .../TimeCounterParentFingerprint.kt | 6 +- .../patch/HideTimeAndSeekbarBytecodePatch.kt | 19 +++--- .../resource/patch/HideTimeAndSeekbarPatch.kt | 8 +-- .../icon/patch/CustomBrandingPatch_Blue.kt | 10 ++-- .../icon/patch/CustomBrandingPatch_Red.kt | 10 ++-- .../patch/CustomBrandingPatch_Revancify.kt | 10 ++-- .../name/patch/CustomBrandingNamePatch.kt | 12 ++-- .../patch/ClientSpoofBytecodePatch.kt | 4 +- .../resource/patch/ClientSpoofPatch.kt | 8 +-- .../patch/DoubleBackToClosePatch.kt | 13 ++-- .../patch/ExternalBrowserBytecodePatch.kt | 6 +- .../resource/patch/ExternalBrowserPatch.kt | 8 +-- .../{ => patch}/PremiumHeadingPatch.kt | 14 ++--- .../fingerprints/InitFingerprint.kt | 4 +- .../fingerprints/ServiceFingerprint.kt | 4 +- .../StandalonePlayerFingerprint.kt | 2 +- .../integrations/patch/IntegrationsPatch.kt | 8 +-- .../filter/fingerprints/LithoFingerprint.kt | 4 +- .../litho/filter/patch/LithoFilterPatch.kt | 59 +++++++++---------- .../materialyou/patch/MaterialYouPatch.kt | 14 ++--- .../CastContextFetchFingerprint.kt | 1 + .../CastDynamiteModuleFingerprint.kt | 1 + .../CastDynamiteModuleV2Fingerprint.kt | 1 + .../fingerprints/IntegrityCheckFingerprint.kt | 10 ---- .../bytecode/fingerprints/PrimeFingerprint.kt | 1 + .../bytecode/patch/MicroGBytecodePatch.kt | 10 ++-- .../misc/microg/resource/patch/MicroGPatch.kt | 10 ++-- .../patch/MinimizedPlaybackBytecodePatch.kt | 6 +- .../resource/patch/MinimizedPlaybackPatch.kt | 8 +-- .../patch/OpenLinksDirectlyBytecodePatch.kt | 6 +- .../resource/patch/OpenLinksDirectlyPatch.kt | 10 ++-- .../optimize/patch/OptimizeResourcePatch.kt | 7 +-- .../optimize/patch/RedundantResourcePatch.kt | 7 +-- .../patch/PiPNotificationBytecodePatch.kt | 4 +- .../resource/patch/PiPNotificationPatch.kt | 8 +-- .../fingerprints/LiveChatFingerprint.kt | 2 +- .../playerbutton/patch}/PlayerButtonPatch.kt | 12 ++-- .../patch/PlayerButtonOverlayPatch.kt | 10 ++-- .../patch/PlayerControlsBytecodePatch.kt | 6 +- .../patch/PlayerOverlaysHookPatch.kt | 6 +- .../playertype/patch/PlayerTypeHookPatch.kt | 6 +- .../resourceid/patch/SharedResourceIdPatch.kt | 4 +- .../ReturnYouTubeDislikeBytecodePatch.kt | 6 +- .../{ => patch}/ReturnYouTubeDislikePatch.kt | 8 +-- .../bytecode/patch/SettingsBytecodePatch.kt | 12 ++-- .../settings/resource/patch/SettingsPatch.kt | 12 ++-- .../fingerprints/AppendTimeFingerprint.kt | 29 --------- .../NextGenWatchLayoutFingerprint.kt | 4 +- .../PlayerOverlaysLayoutInitFingerprint.kt | 2 +- .../patch/SponsorBlockBytecodePatch.kt | 34 +++++------ .../SponsorBlockSecondaryBytecodePatch.kt | 8 +-- .../patch/SponsorBlockResourcePatch.kt | 14 ++--- .../SwipeRefreshLayoutFingerprint.kt | 4 +- .../swiperefresh/patch/SwipeRefreshPatch.kt | 4 +- .../fingerprints/LithoThemeFingerprint.kt | 16 +---- .../theme/bytecode/patch/GeneralThemePatch.kt | 45 ++++++++++++++ .../patch}/GeneralThemeResourcePatch.kt | 2 +- .../theme/{ => resource}/patch/ThemePatch.kt | 14 ++--- .../fingerprints/EmptyColorFingerprint.kt} | 10 ++-- .../fingerprints/OnDrawFingerprint.kt | 2 +- .../misc/timebar/patch/HookTimebarPatch.kt | 43 ++++++++++++++ .../TooltipContentViewFingerprint.kt | 6 +- .../patch/TooltipContentViewBytecodePatch.kt | 4 +- .../resource/patch/TooltipContentViewPatch.kt | 10 ++-- .../translations/patch/TranslationsPatch.kt | 4 +- .../legacy/patch/LegacyVideoIdPatch.kt | 4 +- .../MainstreamVideoIdFingerprint.kt | 9 --- .../PlayerControllerFingerprint.kt | 6 +- ...erControllerSetTimeReferenceFingerprint.kt | 5 +- .../fingerprint}/TimebarFingerprint.kt | 2 +- .../patch/MainstreamVideoIdPatch.kt | 17 +++--- .../patch/SwipeGestureBrightnessInHDRPatch.kt | 6 +- .../SwipeControlsHostActivityFingerprint.kt | 5 +- .../WatchWhileActivityFingerprint.kt | 6 +- .../patch/SwipeControlsBytecodePatch.kt | 6 +- .../resource/patch/SwipeControlsPatch.kt | 16 ++--- .../VideoSpeedEntriesFingerprint.kt | 4 +- .../patch/CustomVideoSpeedBytecodePatch.kt | 8 +-- .../resource/patch/CustomVideoSpeedPatch.kt | 8 +-- .../patch/VideoQualityBytecodePatch.kt | 6 +- .../resource/patch/VideoQualityPatch.kt | 12 ++-- .../bytecode/patch/VideoSpeedBytecodePatch.kt | 12 ++-- .../speed/resource/patch/VideoSpeedPatch.kt | 10 ++-- .../fingerprints/EmptyColorFingerprint.kt | 17 ------ .../theme/bytecode/GeneralThemePatch.kt | 38 ------------ .../patches/timebar/HookTimebarPatch.kt | 45 -------------- .../util/bytecode/BytecodeHelper.kt | 5 +- .../util/integrations/Constants.kt | 2 +- .../{shared => }/util/microg/Constants.kt | 2 +- .../util/microg/MicroGBytecodeHelper.kt | 10 ++-- .../util/microg/MicroGManifestHelper.kt | 10 ++-- .../util/microg/MicroGResourceHelper.kt | 2 +- .../util/pivotbar/InjectionUtils.kt | 4 +- .../{shared => }/util/resources/IconHelper.kt | 2 +- .../util/resources/ResourceHelper.kt | 2 +- .../util/resources/ResourceUtils.kt | 2 +- 231 files changed, 936 insertions(+), 1018 deletions(-) rename src/main/kotlin/app/revanced/{shared => }/extensions/Extensions.kt (94%) rename src/main/kotlin/app/revanced/{ => patches}/shared/annotation/RVXCompatibility.kt (88%) rename src/main/kotlin/app/revanced/{ => patches}/shared/annotation/YouTubeCompatibility.kt (62%) rename src/main/kotlin/app/revanced/{ => patches}/shared/annotation/YouTubeMusicCompatibility.kt (86%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/LayoutConstructorFingerprint.kt (83%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/LayoutSwitchFingerprint.kt (94%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/LegacyVideoAdsFingerprint.kt (94%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/MainstreamVideoAdsFingerprint.kt (91%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt (77%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/MiniplayerColorParentFingerprint.kt (93%) rename src/main/kotlin/app/revanced/patches/{youtube/layout/general/pivotbar/createbutton/bytecode => shared}/fingerprints/PivotBarCreateButtonViewFingerprint.kt (88%) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/SubtitleButtonControllerFingerprint.kt (92%) rename src/main/kotlin/app/revanced/{shared/patches => patches/shared/patch}/gestures/PredictiveBackGesturePatch.kt (95%) rename src/main/kotlin/app/revanced/{shared/patches => patches/shared/patch}/integrations/AbstractIntegrationsPatch.kt (96%) rename src/main/kotlin/app/revanced/{shared/patches => patches/shared/patch}/mapping/ResourceMappingPatch.kt (98%) rename src/main/kotlin/app/revanced/{shared/patches => patches/shared/patch}/options/PatchOptions.kt (96%) rename src/main/kotlin/app/revanced/{shared/patches => patches/shared/patch}/settings/AbstractSettingsResourcePatch.kt (83%) rename src/main/kotlin/app/revanced/{shared/patches => patches/shared/patch}/videoads/GeneralVideoAdsPatch.kt (88%) rename src/main/kotlin/app/revanced/{shared => patches/youtube/layout/general/autocaptions/bytecode}/fingerprints/StartVideoInformerFingerprint.kt (83%) rename src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/{ => patch}/PremiumHeadingPatch.kt (91%) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/IntegrityCheckFingerprint.kt rename src/main/kotlin/app/revanced/{shared => patches/youtube/misc/playerbutton}/fingerprints/LiveChatFingerprint.kt (89%) rename src/main/kotlin/app/revanced/{shared/patches/playerbutton => patches/youtube/misc/playerbutton/patch}/PlayerButtonPatch.kt (88%) rename src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/{ => patch}/ReturnYouTubeDislikePatch.kt (92%) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/AppendTimeFingerprint.kt rename src/main/kotlin/app/revanced/{shared => patches/youtube/misc/theme/bytecode}/fingerprints/LithoThemeFingerprint.kt (57%) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/patch/GeneralThemePatch.kt rename src/main/kotlin/app/revanced/{shared/patches/theme/resource => patches/youtube/misc/theme/resource/patch}/GeneralThemeResourcePatch.kt (98%) rename src/main/kotlin/app/revanced/patches/youtube/misc/theme/{ => resource}/patch/ThemePatch.kt (87%) rename src/main/kotlin/app/revanced/{shared/fingerprints/PivotBarFingerprint.kt => patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt} (59%) rename src/main/kotlin/app/revanced/{shared => patches/youtube/misc/timebar}/fingerprints/OnDrawFingerprint.kt (88%) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt rename src/main/kotlin/app/revanced/{shared/fingerprints => patches/youtube/misc/videoid/mainstream/fingerprint}/TimebarFingerprint.kt (85%) delete mode 100644 src/main/kotlin/app/revanced/shared/fingerprints/EmptyColorFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/shared/patches/theme/bytecode/GeneralThemePatch.kt delete mode 100644 src/main/kotlin/app/revanced/shared/patches/timebar/HookTimebarPatch.kt rename src/main/kotlin/app/revanced/{shared => }/util/bytecode/BytecodeHelper.kt (91%) rename src/main/kotlin/app/revanced/{shared => }/util/integrations/Constants.kt (95%) rename src/main/kotlin/app/revanced/{shared => }/util/microg/Constants.kt (99%) rename src/main/kotlin/app/revanced/{shared => }/util/microg/MicroGBytecodeHelper.kt (97%) rename src/main/kotlin/app/revanced/{shared => }/util/microg/MicroGManifestHelper.kt (85%) rename src/main/kotlin/app/revanced/{shared => }/util/microg/MicroGResourceHelper.kt (97%) rename src/main/kotlin/app/revanced/{shared => }/util/pivotbar/InjectionUtils.kt (96%) rename src/main/kotlin/app/revanced/{shared => }/util/resources/IconHelper.kt (99%) rename src/main/kotlin/app/revanced/{shared => }/util/resources/ResourceHelper.kt (99%) rename src/main/kotlin/app/revanced/{shared => }/util/resources/ResourceUtils.kt (98%) diff --git a/src/main/kotlin/app/revanced/shared/extensions/Extensions.kt b/src/main/kotlin/app/revanced/extensions/Extensions.kt similarity index 94% rename from src/main/kotlin/app/revanced/shared/extensions/Extensions.kt rename to src/main/kotlin/app/revanced/extensions/Extensions.kt index de081239a..dc294e383 100644 --- a/src/main/kotlin/app/revanced/shared/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/extensions/Extensions.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.extensions +package app.revanced.extensions import app.revanced.patcher.extensions.MethodFingerprintExtensions.name import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint @@ -9,8 +9,8 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableField import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.smali.toInstruction -import app.revanced.shared.util.integrations.Constants.INTEGRATIONS_PATH -import app.revanced.shared.util.integrations.Constants.PATCHES_PATH +import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH +import app.revanced.util.integrations.Constants.PATCHES_PATH import org.jf.dexlib2.builder.MutableMethodImplementation import org.jf.dexlib2.iface.Method import org.jf.dexlib2.util.MethodUtil diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/patch/MusicVideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/patch/MusicVideoAdsPatch.kt index cb01a8848..18e346eb9 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/patch/MusicVideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/patch/MusicVideoAdsPatch.kt @@ -10,9 +10,9 @@ 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.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.patches.videoads.GeneralVideoAdsPatch -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH @Patch @Name("hide-music-ads") diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt index f8117f681..bebd6b13e 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.music.audio.codecs.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -8,19 +9,18 @@ import app.revanced.patcher.data.toMethodWalker import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.instruction import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.audio.codecs.fingerprints.* import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH -import org.jf.dexlib2.iface.instruction.OneRegisterInstruction +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.iface.Method +import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Patch @Name("enable-opus-codec") diff --git a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt index 809b8b1cb..be26cbff1 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/patch/ExclusiveAudioPatch.kt @@ -1,18 +1,18 @@ package app.revanced.patches.music.audio.exclusiveaudio.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.patcher.patch.annotations.Patch 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.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility @Patch @Name("exclusive-audio-playback") 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 8139bd4e6..bf78c72d3 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 @@ -6,17 +6,17 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.instruction -import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.layout.blacknavbar.fingerprints.TabLayoutFingerprint import app.revanced.patches.music.misc.resourceid.patch.SharedResourcdIdPatch import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Blue.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Blue.kt index 6679ab312..40398d25f 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Blue.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Blue.kt @@ -6,8 +6,8 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.* import app.revanced.patcher.patch.annotations.Patch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.util.resources.IconHelper +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.resources.IconHelper @Patch @Name("custom-branding-music-afn-blue") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Red.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Red.kt index 03fe0ceb8..968c799e6 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Red.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Red.kt @@ -6,8 +6,8 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.* import app.revanced.patcher.patch.annotations.Patch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.util.resources.IconHelper +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.resources.IconHelper @Patch @Name("custom-branding-music-afn-red") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Revancify.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Revancify.kt index 293134429..a4869e5c5 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Revancify.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingMusicPatch_Revancify.kt @@ -6,8 +6,8 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.* import app.revanced.patcher.patch.annotations.Patch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.util.resources.IconHelper +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.resources.IconHelper @Patch(false) @Name("custom-branding-music-revancify") 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 d618e629c..3f349cef0 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 @@ -1,5 +1,6 @@ package app.revanced.patches.music.layout.castbutton.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -14,9 +15,8 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonFingerprint import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonParentFingerprint import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH @Patch @Name("hide-music-cast-button") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/patch/CompactHeaderPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/patch/CompactHeaderPatch.kt index cea53ca02..b732dfa3b 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/patch/CompactHeaderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/patch/CompactHeaderPatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.music.layout.compactheader.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -10,11 +12,9 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction21c import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt index 47af84f6d..735fb1b2f 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/patch/MinimizedPlaybackPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.music.layout.minimizedplayback.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -10,8 +11,7 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility @Patch @Name("minimized-playback-music") 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 2fddf25e9..22cc1f69b 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 @@ -1,5 +1,6 @@ package app.revanced.patches.music.layout.minimizedplayer.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -13,9 +14,8 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.layout.minimizedplayer.fingerprints.MinimizedPlayerFingerprint import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/patch/MiniplayerColorPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/patch/MiniplayerColorPatch.kt index 20893b5d8..165d9ca42 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/patch/MiniplayerColorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/patch/MiniplayerColorPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.music.layout.miniplayercolor.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -15,10 +16,9 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.layout.miniplayercolor.fingerprints.MiniplayerColorFingerprint import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.MiniplayerColorParentFingerprint -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.fingerprints.MiniplayerColorParentFingerprint +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.FieldReference diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/patch/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/patch/HideGetPremiumPatch.kt index c60bd892f..2fd63cb50 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/patch/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/patch/HideGetPremiumPatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.music.layout.premium.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -12,11 +14,9 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint import app.revanced.patches.music.misc.integrations.patch.MusicIntegrationsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.INTEGRATIONS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction22c diff --git a/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt index 496e7f3b4..5e9cd2fe2 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/MusicPlaybackControlsFingerprint.kt @@ -14,7 +14,5 @@ object MusicPlaybackControlsFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID ), - customFingerprint = { methodDef -> - methodDef.definingClass.endsWith("MusicPlaybackControls;") - } + customFingerprint = { it.definingClass.endsWith("MusicPlaybackControls;") } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/ShuffleClassFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/ShuffleClassFingerprint.kt index 724ab4a75..993df76b1 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/ShuffleClassFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/shuffle/fingerprints/ShuffleClassFingerprint.kt @@ -20,9 +20,9 @@ object ShuffleClassFingerprint : MethodFingerprint( ), customFingerprint = { methodDef -> methodDef.name == "" && - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.disabledIconLabelId + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.disabledIconLabelId } == true } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/shuffle/patch/EnforceShufflePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/shuffle/patch/EnforceShufflePatch.kt index 5c7ec886d..99bc2472c 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/shuffle/patch/EnforceShufflePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/shuffle/patch/EnforceShufflePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.music.layout.shuffle.patch +import app.revanced.extensions.toErrorResult +import app.revanced.extensions.transformFields import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -14,13 +16,13 @@ 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.layout.shuffle.fingerprints.* +import app.revanced.patches.music.layout.shuffle.fingerprints.MusicPlaybackControlsFingerprint +import app.revanced.patches.music.layout.shuffle.fingerprints.ShuffleClassFingerprint +import app.revanced.patches.music.layout.shuffle.fingerprints.ShuffleClassReferenceFingerprint import app.revanced.patches.music.misc.resourceid.patch.SharedResourcdIdPatch import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.extensions.transformFields -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference import org.jf.dexlib2.iface.instruction.ReferenceInstruction diff --git a/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/fingerprints/TabletLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/fingerprints/TabletLayoutFingerprint.kt index bc743ba86..d2c64efd4 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/fingerprints/TabletLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/fingerprints/TabletLayoutFingerprint.kt @@ -17,9 +17,9 @@ object TabletLayoutFingerprint : MethodFingerprint( Opcode.MOVE_RESULT ), customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.isTabletLabelId + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.isTabletLabelId } == true } ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/patch/TabletModePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/patch/TabletModePatch.kt index 0c374321f..c70c8a131 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/patch/TabletModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/tabletmode/patch/TabletModePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.music.layout.tabletmode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -13,9 +14,8 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.layout.tabletmode.fingerprints.TabletLayoutFingerprint import app.revanced.patches.music.misc.resourceid.patch.SharedResourcdIdPatch import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH @Patch @Name("enable-tablet-mode") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt index cdbffb0b3..b7feb8f78 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/patch/RemoveTasteBuilderPatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.music.layout.tastebuilder.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.patch.annotations.Patch 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.layout.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import org.jf.dexlib2.iface.instruction.formats.Instruction22c @Patch diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt index da90688e4..4ea938354 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/patch/RemoveUpgradeButtonPatch.kt @@ -1,22 +1,22 @@ package app.revanced.patches.music.layout.upgradebutton.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.patch.annotations.Patch 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.patcher.util.smali.toInstructions import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction22t import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction35c -import org.jf.dexlib2.Opcode @Patch @Name("hide-upgrade-button") 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 8948872e0..72f99f992 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 @@ -1,5 +1,6 @@ package app.revanced.patches.music.layout.zenmode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -13,10 +14,9 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.layout.zenmode.fingerprints.ZenModeFingerprint import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.MiniplayerColorParentFingerprint -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.fingerprints.MiniplayerColorParentFingerprint +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.FieldReference 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 c81aef169..a13f5ca8e 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 @@ -1,19 +1,19 @@ package app.revanced.patches.music.misc.backgroundplay.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.toMethodWalker import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.patch.annotations.Patch 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.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility @Patch @Name("background-play") diff --git a/src/main/kotlin/app/revanced/patches/music/misc/clientspoof/patch/ClientSpoofMusicPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/clientspoof/patch/ClientSpoofMusicPatch.kt index 216d1149e..a11b0c2e6 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/clientspoof/patch/ClientSpoofMusicPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/clientspoof/patch/ClientSpoofMusicPatch.kt @@ -1,19 +1,19 @@ package app.revanced.patches.music.misc.clientspoof.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.instruction -import app.revanced.patcher.patch.annotations.Patch 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.misc.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction @Patch diff --git a/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/InitFingerprint.kt index 1a8f5014a..ca9567029 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/InitFingerprint.kt @@ -1,6 +1,6 @@ package app.revanced.patches.music.misc.integrations.fingerprints -import app.revanced.shared.patches.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint object InitFingerprint : IntegrationsFingerprint( strings = listOf("YouTubeMusic", "activity") diff --git a/src/main/kotlin/app/revanced/patches/music/misc/integrations/patch/MusicIntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/integrations/patch/MusicIntegrationsPatch.kt index 67f7c6ce1..2a17d8cb0 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/integrations/patch/MusicIntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/integrations/patch/MusicIntegrationsPatch.kt @@ -2,9 +2,9 @@ package app.revanced.patches.music.misc.integrations.patch import app.revanced.patcher.annotation.Name import app.revanced.patches.music.misc.integrations.fingerprints.InitFingerprint -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.patches.integrations.AbstractIntegrationsPatch -import app.revanced.shared.util.integrations.Constants.MUSIC_SETTINGS_PATH +import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH @Name("music-integrations") @YouTubeMusicCompatibility diff --git a/src/main/kotlin/app/revanced/patches/music/misc/microg/bytecode/patch/MusicMicroGBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/microg/bytecode/patch/MusicMicroGBytecodePatch.kt index e2363cba3..a32e25716 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/microg/bytecode/patch/MusicMicroGBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/microg/bytecode/patch/MusicMicroGBytecodePatch.kt @@ -4,19 +4,19 @@ import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.misc.clientspoof.patch.ClientSpoofMusicPatch import app.revanced.patches.music.misc.microg.bytecode.fingerprints.* import app.revanced.patches.music.misc.microg.resource.patch.MusicMicroGResourcePatch -import app.revanced.patches.music.misc.microg.shared.Constants.YOUTUBE_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.microg.MicroGBytecodeHelper +import app.revanced.patches.music.misc.microg.shared.Constants.YOUTUBE_PACKAGE_NAME +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions +import app.revanced.util.microg.MicroGBytecodeHelper @Patch @DependsOn( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/microg/resource/patch/MusicMicroGResourcePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/microg/resource/patch/MusicMicroGResourcePatch.kt index 8df74fe21..478bd0772 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/microg/resource/patch/MusicMicroGResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/microg/resource/patch/MusicMicroGResourcePatch.kt @@ -4,17 +4,17 @@ 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.annotations.DependsOn 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.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.microg.MicroGManifestHelper -import app.revanced.shared.util.microg.MicroGResourceHelper +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions +import app.revanced.util.microg.MicroGManifestHelper +import app.revanced.util.microg.MicroGResourceHelper @Name("music-microg-resource-patch") @Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.") diff --git a/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt index fabe8c46c..35ec8b2bb 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt @@ -4,11 +4,11 @@ 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.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import java.nio.file.Files import java.nio.file.StandardCopyOption diff --git a/src/main/kotlin/app/revanced/patches/music/misc/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/resourceid/patch/SharedResourceIdPatch.kt index a972ae755..f765ea8d0 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/resourceid/patch/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/resourceid/patch/SharedResourceIdPatch.kt @@ -7,8 +7,8 @@ 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.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch @Name("music-resource-id") @DependsOn([ResourceMappingPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/settings/patch/MusicSettingsPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/settings/patch/MusicSettingsPatch.kt index b020fed56..ed16848af 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/settings/patch/MusicSettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/settings/patch/MusicSettingsPatch.kt @@ -4,14 +4,14 @@ 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.annotations.Patch 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.music.misc.integrations.patch.MusicIntegrationsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.resources.ResourceUtils.copyXmlNode import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/patches/music/misc/translations/patch/MusicTranslationsPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/translations/patch/MusicTranslationsPatch.kt index 538168aaa..f0182fe6c 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/translations/patch/MusicTranslationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/translations/patch/MusicTranslationsPatch.kt @@ -10,8 +10,8 @@ import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch -import app.revanced.shared.annotation.YouTubeMusicCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility +import app.revanced.util.resources.ResourceHelper @Patch @Name("translations-music") diff --git a/src/main/kotlin/app/revanced/shared/annotation/RVXCompatibility.kt b/src/main/kotlin/app/revanced/patches/shared/annotation/RVXCompatibility.kt similarity index 88% rename from src/main/kotlin/app/revanced/shared/annotation/RVXCompatibility.kt rename to src/main/kotlin/app/revanced/patches/shared/annotation/RVXCompatibility.kt index e5401f553..d6d730a70 100644 --- a/src/main/kotlin/app/revanced/shared/annotation/RVXCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/shared/annotation/RVXCompatibility.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.annotation +package app.revanced.patches.shared.annotation import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Package diff --git a/src/main/kotlin/app/revanced/shared/annotation/YouTubeCompatibility.kt b/src/main/kotlin/app/revanced/patches/shared/annotation/YouTubeCompatibility.kt similarity index 62% rename from src/main/kotlin/app/revanced/shared/annotation/YouTubeCompatibility.kt rename to src/main/kotlin/app/revanced/patches/shared/annotation/YouTubeCompatibility.kt index 51152a773..2e0be79bf 100644 --- a/src/main/kotlin/app/revanced/shared/annotation/YouTubeCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/shared/annotation/YouTubeCompatibility.kt @@ -1,13 +1,9 @@ -package app.revanced.shared.annotation +package app.revanced.patches.shared.annotation import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Package -@Compatibility( - [Package( - "com.google.android.youtube", arrayOf("18.05.40") - )] -) +@Compatibility([Package("com.google.android.youtube", arrayOf("18.05.40"))]) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/shared/annotation/YouTubeMusicCompatibility.kt b/src/main/kotlin/app/revanced/patches/shared/annotation/YouTubeMusicCompatibility.kt similarity index 86% rename from src/main/kotlin/app/revanced/shared/annotation/YouTubeMusicCompatibility.kt rename to src/main/kotlin/app/revanced/patches/shared/annotation/YouTubeMusicCompatibility.kt index da278a9b5..0f2d4fa8e 100644 --- a/src/main/kotlin/app/revanced/shared/annotation/YouTubeMusicCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/shared/annotation/YouTubeMusicCompatibility.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.annotation +package app.revanced.patches.shared.annotation import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Package diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/LayoutConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/LayoutConstructorFingerprint.kt similarity index 83% rename from src/main/kotlin/app/revanced/shared/fingerprints/LayoutConstructorFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/LayoutConstructorFingerprint.kt index 7fbc65228..6514ad2d4 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/LayoutConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/LayoutConstructorFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/LayoutSwitchFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/LayoutSwitchFingerprint.kt similarity index 94% rename from src/main/kotlin/app/revanced/shared/fingerprints/LayoutSwitchFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/LayoutSwitchFingerprint.kt index 76cc364ab..96bbde642 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/LayoutSwitchFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/LayoutSwitchFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/LegacyVideoAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/LegacyVideoAdsFingerprint.kt similarity index 94% rename from src/main/kotlin/app/revanced/shared/fingerprints/LegacyVideoAdsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/LegacyVideoAdsFingerprint.kt index 53866ac58..d911d2d47 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/LegacyVideoAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/LegacyVideoAdsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/MainstreamVideoAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/MainstreamVideoAdsFingerprint.kt similarity index 91% rename from src/main/kotlin/app/revanced/shared/fingerprints/MainstreamVideoAdsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/MainstreamVideoAdsFingerprint.kt index 8fca6e1c9..4fde3e1f0 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/MainstreamVideoAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/MainstreamVideoAdsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt similarity index 77% rename from src/main/kotlin/app/revanced/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt index c7af865d1..58f24da78 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/MainstreamVideoAdsParentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/MiniplayerColorParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/MiniplayerColorParentFingerprint.kt similarity index 93% rename from src/main/kotlin/app/revanced/shared/fingerprints/MiniplayerColorParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/MiniplayerColorParentFingerprint.kt index a7fcb2f11..129ef1383 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/MiniplayerColorParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/MiniplayerColorParentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarCreateButtonViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/PivotBarCreateButtonViewFingerprint.kt similarity index 88% rename from src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarCreateButtonViewFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/PivotBarCreateButtonViewFingerprint.kt index aae868865..408407c78 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarCreateButtonViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/PivotBarCreateButtonViewFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/SubtitleButtonControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/SubtitleButtonControllerFingerprint.kt similarity index 92% rename from src/main/kotlin/app/revanced/shared/fingerprints/SubtitleButtonControllerFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/SubtitleButtonControllerFingerprint.kt index a64554a06..2720a9bfa 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/SubtitleButtonControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/SubtitleButtonControllerFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/patches/gestures/PredictiveBackGesturePatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/gestures/PredictiveBackGesturePatch.kt similarity index 95% rename from src/main/kotlin/app/revanced/shared/patches/gestures/PredictiveBackGesturePatch.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/gestures/PredictiveBackGesturePatch.kt index ec262e3d9..0f67fe4fb 100644 --- a/src/main/kotlin/app/revanced/shared/patches/gestures/PredictiveBackGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/gestures/PredictiveBackGesturePatch.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.patches.gestures +package app.revanced.patches.shared.patch.gestures import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name diff --git a/src/main/kotlin/app/revanced/shared/patches/integrations/AbstractIntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/integrations/AbstractIntegrationsPatch.kt similarity index 96% rename from src/main/kotlin/app/revanced/shared/patches/integrations/AbstractIntegrationsPatch.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/integrations/AbstractIntegrationsPatch.kt index 2cb8ee5eb..4987d3636 100644 --- a/src/main/kotlin/app/revanced/shared/patches/integrations/AbstractIntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/integrations/AbstractIntegrationsPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.patches.integrations +package app.revanced.patches.shared.patch.integrations import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Version @@ -9,7 +9,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.extensions.toErrorResult +import app.revanced.extensions.toErrorResult import org.jf.dexlib2.iface.Method @Description("Applies mandatory patches to implement the ReVanced integrations into the application.") diff --git a/src/main/kotlin/app/revanced/shared/patches/mapping/ResourceMappingPatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/mapping/ResourceMappingPatch.kt similarity index 98% rename from src/main/kotlin/app/revanced/shared/patches/mapping/ResourceMappingPatch.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/mapping/ResourceMappingPatch.kt index f76ba4753..00d3ebe6c 100644 --- a/src/main/kotlin/app/revanced/shared/patches/mapping/ResourceMappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/mapping/ResourceMappingPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.patches.mapping +package app.revanced.patches.shared.patch.mapping import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name @@ -7,10 +7,10 @@ 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 org.w3c.dom.Element import java.util.* import java.util.concurrent.Executors import java.util.concurrent.TimeUnit -import org.w3c.dom.Element @Name("resource-mapping") @Description("Creates a map of public resources.") diff --git a/src/main/kotlin/app/revanced/shared/patches/options/PatchOptions.kt b/src/main/kotlin/app/revanced/patches/shared/patch/options/PatchOptions.kt similarity index 96% rename from src/main/kotlin/app/revanced/shared/patches/options/PatchOptions.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/options/PatchOptions.kt index c5b661f62..f9d804e68 100644 --- a/src/main/kotlin/app/revanced/shared/patches/options/PatchOptions.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/options/PatchOptions.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.patches.options +package app.revanced.patches.shared.patch.options import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name @@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.* -import app.revanced.shared.annotation.RVXCompatibility +import app.revanced.patches.shared.annotation.RVXCompatibility @Patch @Name("patch-options") diff --git a/src/main/kotlin/app/revanced/shared/patches/settings/AbstractSettingsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt similarity index 83% rename from src/main/kotlin/app/revanced/shared/patches/settings/AbstractSettingsResourcePatch.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt index 6ed0fab0e..1c392b57d 100644 --- a/src/main/kotlin/app/revanced/shared/patches/settings/AbstractSettingsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/settings/AbstractSettingsResourcePatch.kt @@ -1,13 +1,13 @@ -package app.revanced.shared.patches.settings +package app.revanced.patches.shared.patch.settings 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.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils -import app.revanced.shared.util.resources.ResourceUtils.copyResources -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources +import app.revanced.util.resources.ResourceUtils.copyXmlNode /** * Abstract settings resource patch diff --git a/src/main/kotlin/app/revanced/shared/patches/videoads/GeneralVideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/videoads/GeneralVideoAdsPatch.kt similarity index 88% rename from src/main/kotlin/app/revanced/shared/patches/videoads/GeneralVideoAdsPatch.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/videoads/GeneralVideoAdsPatch.kt index 7ddff6390..9d3188a51 100644 --- a/src/main/kotlin/app/revanced/shared/patches/videoads/GeneralVideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/videoads/GeneralVideoAdsPatch.kt @@ -1,5 +1,6 @@ -package app.revanced.shared.patches.videoads +package app.revanced.patches.shared.patch.videoads +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,12 +11,11 @@ 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.smali.ExternalLabel import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.shared.fingerprints.LegacyVideoAdsFingerprint -import app.revanced.shared.fingerprints.MainstreamVideoAdsFingerprint -import app.revanced.shared.fingerprints.MainstreamVideoAdsParentFingerprint -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.fingerprints.LegacyVideoAdsFingerprint +import app.revanced.patches.shared.fingerprints.MainstreamVideoAdsFingerprint +import app.revanced.patches.shared.fingerprints.MainstreamVideoAdsParentFingerprint @Name("general-video-ads-patch") @Version("0.0.1") diff --git a/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsBytecodePatch.kt index c6b14f665..ac09993dc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.ads.general.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -12,12 +13,12 @@ import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import app.revanced.patches.youtube.ads.general.bytecode.fingerprints.ComponentContextParserFingerprint import app.revanced.patches.youtube.ads.general.bytecode.fingerprints.EmptyComponentBuilderFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.bytecode.BytecodeHelper -import app.revanced.shared.util.integrations.Constants.ADS_PATH +import app.revanced.util.bytecode.BytecodeHelper +import app.revanced.util.integrations.Constants.ADS_PATH import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21s import org.jf.dexlib2.iface.instruction.Instruction @@ -38,7 +39,7 @@ class GeneralAdsBytecodePatch : BytecodePatch( ComponentContextParserFingerprint.result?.let { result -> val builderMethodIndex = EmptyComponentBuilderFingerprint .also { it.resolve(context, result.mutableMethod, result.mutableClass) } - .let { it.result!!.scanResult.patternScanResult!!.startIndex } + .let { it.result?.scanResult?.patternScanResult?.startIndex?: return EmptyComponentBuilderFingerprint.toErrorResult() } val emptyComponentFieldIndex = builderMethodIndex + 2 @@ -76,7 +77,7 @@ class GeneralAdsBytecodePatch : BytecodePatch( listOf(ExternalLabel("not_an_ad", instruction(insertHookIndex))) ) } - } ?: return PatchResultError("Could not find the method to hook.") + } ?: return ComponentContextParserFingerprint.toErrorResult() BytecodeHelper.patchStatus(context, "GeneralAds") diff --git a/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsSecondaryBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsSecondaryBytecodePatch.kt index b9a23e91b..790ba9c59 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsSecondaryBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ads/general/bytecode/patch/GeneralAdsSecondaryBytecodePatch.kt @@ -1,21 +1,21 @@ package app.revanced.patches.youtube.ads.general.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.instruction -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.ADS_PATH +import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.integrations.Constants.ADS_PATH import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.* 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 0ff1fd5bc..80f344c06 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 @@ -1,22 +1,22 @@ package app.revanced.patches.youtube.ads.general.resource.patch +import app.revanced.extensions.doRecursively +import app.revanced.extensions.startsWithAny 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsSecondaryBytecodePatch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.doRecursively -import app.revanced.shared.extensions.startsWithAny -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/ads/video/bytecode/patch/VideoAdsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ads/video/bytecode/patch/VideoAdsBytecodePatch.kt index c06c1e7ad..0845b2dd0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ads/video/bytecode/patch/VideoAdsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ads/video/bytecode/patch/VideoAdsBytecodePatch.kt @@ -3,14 +3,14 @@ package app.revanced.patches.youtube.ads.video.bytecode.patch import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.videoads.GeneralVideoAdsPatch -import app.revanced.shared.util.bytecode.BytecodeHelper -import app.revanced.shared.util.integrations.Constants.ADS_PATH +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch +import app.revanced.util.bytecode.BytecodeHelper +import app.revanced.util.integrations.Constants.ADS_PATH @DependsOn( [ @@ -22,14 +22,16 @@ import app.revanced.shared.util.integrations.Constants.ADS_PATH @Version("0.0.1") class VideoAdsBytecodePatch : BytecodePatch() { override fun execute(context: BytecodeContext): PatchResult { - val INTEGRATIONS_CLASS_DESCRIPTOR = "$ADS_PATH/HideVideoAdsPatch;->hideVideoAds()Z" GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR) - GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR) BytecodeHelper.patchStatus(context, "VideoAds") return PatchResultSuccess() } + + private companion object { + const val INTEGRATIONS_CLASS_DESCRIPTOR = "$ADS_PATH/HideVideoAdsPatch;->hideVideoAds()Z" + } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/ads/video/resource/patch/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ads/video/resource/patch/VideoAdsPatch.kt index 41e7bacb6..2b2f08f86 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ads/video/resource/patch/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ads/video/resource/patch/VideoAdsPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.ads.video.bytecode.patch.VideoAdsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-video-ads") diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/autorepeat/patch/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/autorepeat/patch/AutoRepeatPatch.kt index 1cc8a75b3..c77e6772c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/button/autorepeat/patch/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/button/autorepeat/patch/AutoRepeatPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.button.autorepeat.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,11 +11,10 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.button.autorepeat.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.UTILS_PATH -import app.revanced.shared.util.integrations.Constants.VIDEO_PATH +import app.revanced.util.integrations.Constants.UTILS_PATH +import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("always-autorepeat") diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt index 7043d53e7..52a5ab66c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt @@ -7,10 +7,10 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.integrations.Constants.BUTTON_PATH +import app.revanced.util.integrations.Constants.BUTTON_PATH @Name("overlay-buttons-bytecode-patch") @DependsOn( @@ -23,18 +23,13 @@ import app.revanced.shared.util.integrations.Constants.BUTTON_PATH @Version("0.0.1") class OverlayButtonsBytecodePatch : BytecodePatch() { override fun execute(context: BytecodeContext): PatchResult { - val AutoRepeat = "$BUTTON_PATH/AutoRepeat;" - val Copy = "$BUTTON_PATH/Copy;" - val CopyWithTimeStamp = "$BUTTON_PATH/CopyWithTimeStamp;" - val Download = "$BUTTON_PATH/Download;" - val Whitelists = "$BUTTON_PATH/Whitelists;" arrayOf( - Download, - AutoRepeat, - CopyWithTimeStamp, - Copy, - Whitelists + "$BUTTON_PATH/Download;", + "$BUTTON_PATH/AutoRepeat;", + "$BUTTON_PATH/CopyWithTimeStamp;", + "$BUTTON_PATH/Copy;", + "$BUTTON_PATH/Whitelists;" ).forEach { descriptor -> PlayerControlsBytecodePatch.initializeControl(descriptor) PlayerControlsBytecodePatch.injectVisibility(descriptor) diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt index 7ec342d89..ed045eea9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt @@ -4,21 +4,21 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch.OverlayButtonsBytecodePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.button.autorepeat.patch.AutoRepeatPatch +import app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch.OverlayButtonsBytecodePatch import app.revanced.patches.youtube.button.whitelist.patch.WhitelistPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils -import app.revanced.shared.util.resources.ResourceUtils.copyResources -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources +import app.revanced.util.resources.ResourceUtils.copyXmlNode @Patch @Name("overlay-buttons") diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt index 5d9237f67..a569852d4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.button.whitelist.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,10 +11,9 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.util.smali.toInstructions +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.button.whitelist.fingerprint.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.VIDEO_PATH +import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21c diff --git a/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/bytecode/patch/ForceVP9CodecBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/bytecode/patch/ForceVP9CodecBytecodePatch.kt index a710ecde1..1e4d63a4b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/bytecode/patch/ForceVP9CodecBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/bytecode/patch/ForceVP9CodecBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.extended.forcevp9.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -12,11 +13,10 @@ 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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.LayoutSwitchFingerprint import app.revanced.patches.youtube.extended.forcevp9.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.LayoutSwitchFingerprint -import app.revanced.shared.util.integrations.Constants.EXTENDED_PATH +import app.revanced.util.integrations.Constants.EXTENDED_PATH import org.jf.dexlib2.Opcode import org.jf.dexlib2.dexbacked.reference.DexBackedFieldReference import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/resource/patch/ForceVP9CodecPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/resource/patch/ForceVP9CodecPatch.kt index 057657d12..9aeb4d6f6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/resource/patch/ForceVP9CodecPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/extended/forcevp9/resource/patch/ForceVP9CodecPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.extended.forcevp9.bytecode.patch.ForceVP9CodecBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("force-vp9-codec") diff --git a/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/bytecode/patch/LayoutSwitchBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/bytecode/patch/LayoutSwitchBytecodePatch.kt index b59622e4a..9fd50fcd5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/bytecode/patch/LayoutSwitchBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/bytecode/patch/LayoutSwitchBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.extended.layoutswitch.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,10 +8,9 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.LayoutSwitchFingerprint -import app.revanced.shared.util.integrations.Constants.EXTENDED_PATH +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.LayoutSwitchFingerprint +import app.revanced.util.integrations.Constants.EXTENDED_PATH @Name("layout-switch-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/resource/patch/LayoutSwitchPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/resource/patch/LayoutSwitchPatch.kt index 4624ad026..adfeec4c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/resource/patch/LayoutSwitchPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/extended/layoutswitch/resource/patch/LayoutSwitchPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.extended.layoutswitch.bytecode.patch.LayoutSwitchBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("layout-switch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/bytecode/patch/OldLayoutBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/bytecode/patch/OldLayoutBytecodePatch.kt index b2a045c04..8bbc718d0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/bytecode/patch/OldLayoutBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/bytecode/patch/OldLayoutBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.extended.oldlayout.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,10 +8,9 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.extended.oldlayout.bytecode.fingerprints.OldLayoutFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.EXTENDED_PATH +import app.revanced.util.integrations.Constants.EXTENDED_PATH import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("enable-old-layout-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/resource/patch/OldLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/resource/patch/OldLayoutPatch.kt index a6f49269c..b692b39c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/resource/patch/OldLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/extended/oldlayout/resource/patch/OldLayoutPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.extended.oldlayout.bytecode.patch.OldLayoutBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-old-layout") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/buttoncontainer/patch/ButtonContainerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/buttoncontainer/patch/ButtonContainerPatch.kt index ca9643a62..d27ffc8ef 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/buttoncontainer/patch/ButtonContainerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/buttoncontainer/patch/ButtonContainerPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-button-container") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/comment/patch/CommentComponentPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/comment/patch/CommentComponentPatch.kt index 0b5cb3088..e12e054da 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/comment/patch/CommentComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttomplayer/comment/patch/CommentComponentPatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-comment-component") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt index 856173c45..e5fc7e368 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/flyoutpanel/patch/FlyoutPanelPatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-flyout-panel") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/bytecode/patch/OldQualityLayoutBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/bytecode/patch/OldQualityLayoutBytecodePatch.kt index 2defce33e..0c9137b29 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/bytecode/patch/OldQualityLayoutBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/bytecode/patch/OldQualityLayoutBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,10 +8,9 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.fingerprints.QualityMenuViewInflateFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.FLYOUTPANEL_LAYOUT +import app.revanced.util.integrations.Constants.FLYOUTPANEL_LAYOUT import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction @Name("enable-old-quality-layout-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/resource/patch/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/resource/patch/OldQualityLayoutPatch.kt index 225cd1ff4..36c4e7ce6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/resource/patch/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/flyoutpanel/oldqualitylayout/resource/patch/OldQualityLayoutPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.patch.OldQualityLayoutBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-old-quality-layout") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/bytecode/patch/HideEndscreenOverlayBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/bytecode/patch/HideEndscreenOverlayBytecodePatch.kt index fb0ae88b8..7cc33651f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/bytecode/patch/HideEndscreenOverlayBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/bytecode/patch/HideEndscreenOverlayBytecodePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,11 +11,9 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/resource/patch/HideEndscreenOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/resource/patch/HideEndscreenOverlayPatch.kt index 0c0a5f3f0..c9c3fb6c7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/resource/patch/HideEndscreenOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/endscreenoverlay/resource/patch/HideEndscreenOverlayPatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.bytecode.patch.HideEndscreenOverlayBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-endscreen-overlay") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/bytecode/patch/HideFilmstripOverlayBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/bytecode/patch/HideFilmstripOverlayBytecodePatch.kt index 7b49ca7e1..fd944f896 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/bytecode/patch/HideFilmstripOverlayBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/bytecode/patch/HideFilmstripOverlayBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,10 +10,9 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.fingerprints.ScrubbingLabelFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT +import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/resource/patch/HideFilmstripOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/resource/patch/HideFilmstripOverlayPatch.kt index 6b5f01bf6..736fda328 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/resource/patch/HideFilmstripOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/flimstripoverlay/resource/patch/HideFilmstripOverlayPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.patch.HideFilmstripOverlayBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-filmstrip-overlay") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt index 13cc4bb24..22d12daf0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction21c import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/HideFullscreenPanelsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/HideFullscreenPanelsBytecodePatch.kt index 3c3228e45..6369bf921 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/HideFullscreenPanelsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/bytecode/patch/HideFullscreenPanelsBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,11 +11,10 @@ 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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.fingerprints.FullscreenViewAdderFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.LayoutConstructorFingerprint -import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT +import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/resource/patch/HideFullscreenPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/resource/patch/HideFullscreenPanelsPatch.kt index 5ce827d95..777a62cd2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/resource/patch/HideFullscreenPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/resource/patch/HideFullscreenPanelsPatch.kt @@ -4,16 +4,16 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch.HideFullscreenPanelsBytecodePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch.FullscreenButtonContainerBytecodePatch +import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch.HideFullscreenPanelsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-fullscreen-panels") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/bytecode/patch/HapticFeedBackBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/bytecode/patch/HapticFeedBackBytecodePatch.kt index 76017aa44..4110646c4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/bytecode/patch/HapticFeedBackBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/bytecode/patch/HapticFeedBackBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -11,10 +12,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT +import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("disable-haptic-feedback-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/resource/patch/HapticFeedBackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/resource/patch/HapticFeedBackPatch.kt index f8b6e23fa..13e7fbc50 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/resource/patch/HapticFeedBackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/hapticfeedback/resource/patch/HapticFeedBackPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.patch.HapticFeedBackBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("disable-haptic-feedback") diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/StartVideoInformerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/fingerprints/StartVideoInformerFingerprint.kt similarity index 83% rename from src/main/kotlin/app/revanced/shared/fingerprints/StartVideoInformerFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/fingerprints/StartVideoInformerFingerprint.kt index 9c409ce05..4c621e6fa 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/StartVideoInformerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/fingerprints/StartVideoInformerFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/patch/AutoCaptionsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/patch/AutoCaptionsBytecodePatch.kt index 97f2651cd..9d3cc95f8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/patch/AutoCaptionsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/bytecode/patch/AutoCaptionsBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,12 +11,10 @@ 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.layout.general.autocaptions.bytecode.fingerprints.SubtitleTrackFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.SubtitleButtonControllerFingerprint -import app.revanced.shared.fingerprints.StartVideoInformerFingerprint -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint +import app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints.* +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT @Name("hide-auto-captions-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/resource/patch/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/resource/patch/AutoCaptionsPatch.kt index e77085930..e125eb2d2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/resource/patch/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autocaptions/resource/patch/AutoCaptionsPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.autocaptions.bytecode.patch.AutoCaptionsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-auto-captions") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/bytecode/patch/PlayerPopupPanelsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/bytecode/patch/PlayerPopupPanelsBytecodePatch.kt index e247f7bc2..3dc60bcea 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/bytecode/patch/PlayerPopupPanelsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/bytecode/patch/PlayerPopupPanelsBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,10 +10,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.fingerprints.EngagementPanelControllerFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT @Name("hide-auto-player-popup-panels-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/resource/patch/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/resource/patch/PlayerPopupPanelsPatch.kt index 4f13b89f8..9d44bd046 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/resource/patch/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/autopopuppanels/resource/patch/PlayerPopupPanelsPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.patch.PlayerPopupPanelsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-auto-player-popup-panels") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/bytecode/patch/CrowdfundingBoxBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/bytecode/patch/CrowdfundingBoxBytecodePatch.kt index cd2154772..7e90cd1ee 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/bytecode/patch/CrowdfundingBoxBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/bytecode/patch/CrowdfundingBoxBytecodePatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.youtube.layout.general.crowdfundingbox.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/resource/patch/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/resource/patch/CrowdfundingBoxPatch.kt index 4a904ca79..82b3db2c4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/resource/patch/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/crowdfundingbox/resource/patch/CrowdfundingBoxPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.crowdfundingbox.bytecode.patch.CrowdfundingBoxBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-crowdfunding-box") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/bytecode/patch/HeaderSwitchBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/bytecode/patch/HeaderSwitchBytecodePatch.kt index 3b57460fd..45169972e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/bytecode/patch/HeaderSwitchBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/bytecode/patch/HeaderSwitchBytecodePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.layout.general.headerswitch.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,10 +9,8 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/resource/patch/HeaderSwitchPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/resource/patch/HeaderSwitchPatch.kt index 9b2b78fd5..0ede9c3d1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/resource/patch/HeaderSwitchPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/headerswitch/resource/patch/HeaderSwitchPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.headerswitch.bytecode.patch.HeaderSwitchBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("header-switch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/bytecode/patch/MixPlaylistsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/bytecode/patch/MixPlaylistsBytecodePatch.kt index e75567b44..c9298566d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/bytecode/patch/MixPlaylistsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/bytecode/patch/MixPlaylistsBytecodePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.patch +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,10 +10,8 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toErrorResult import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @@ -33,10 +33,8 @@ class MixPlaylistsBytecodePatch : BytecodePatch( arrayOf( CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint - ).map { - it.result ?: return it.toErrorResult() - }.forEach { - it.addHook() + ).forEach { + it.result?.addHook() ?: return it.toErrorResult() } arrayOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/resource/patch/MixPlaylistsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/resource/patch/MixPlaylistsPatch.kt index 5734f479d..6c4678ac9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/resource/patch/MixPlaylistsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/mixplaylists/resource/patch/MixPlaylistsPatch.kt @@ -4,16 +4,16 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.patch.MixPlaylistsBytecodePatch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-mix-playlists") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/bytecode/patch/HideEmailAddressBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/bytecode/patch/HideEmailAddressBytecodePatch.kt index d1955cbd3..f0d4b08f6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/bytecode/patch/HideEmailAddressBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/bytecode/patch/HideEmailAddressBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.personalinformation.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,10 +9,9 @@ import app.revanced.patcher.extensions.instruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.personalinformation.bytecode.fingerprints.AccountSwitcherAccessibilityLabelFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("hide-email-address-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/resource/patch/HideEmailAddressPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/resource/patch/HideEmailAddressPatch.kt index 89031d74d..72ed058ba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/resource/patch/HideEmailAddressPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/personalinformation/resource/patch/HideEmailAddressPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.personalinformation.bytecode.patch.HideEmailAddressBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-email-address") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarFingerprint.kt index 7cdda8665..a17054565 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/fingerprints/PivotBarFingerprint.kt @@ -15,9 +15,9 @@ object PivotBarFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.RETURN_OBJECT ), - customFingerprint = { methodDef -> - methodDef.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" && - methodDef.implementation?.instructions?.any { + customFingerprint = { + it.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" && + it.implementation?.instructions?.any { it.opcode.ordinal == Opcode.CONST.ordinal && (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId } == true diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/patch/CreateButtonRemoverBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/patch/CreateButtonRemoverBytecodePatch.kt index 6005eec8c..9f2b7fc04 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/patch/CreateButtonRemoverBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/bytecode/patch/CreateButtonRemoverBytecodePatch.kt @@ -1,20 +1,20 @@ package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints.* +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint +import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints.PivotBarFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT -import app.revanced.shared.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT -import app.revanced.shared.util.pivotbar.InjectionUtils.injectHook +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT +import app.revanced.util.pivotbar.InjectionUtils.injectHook import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference import org.jf.dexlib2.iface.instruction.ReferenceInstruction @@ -47,8 +47,8 @@ class CreateButtonRemoverBytecodePatch : BytecodePatch( val fieldReference = (instruction as? ReferenceInstruction)?.reference as? DexBackedMethodReference fieldReference?.let { it.definingClass == createRef.definingClass && it.name == createRef.name } == true }.forEach { instruction -> - if (!isSeondary) { - isSeondary = true; + if (foundIndex == 0) { + foundIndex++ return@forEach } @@ -60,7 +60,7 @@ class CreateButtonRemoverBytecodePatch : BytecodePatch( return PatchResultSuccess() } - return PatchResultError("Could not find the method to hook.") + return PivotBarCreateButtonViewFingerprint.toErrorResult() } } ?: return PivotBarCreateButtonViewFingerprint.toErrorResult() } @@ -73,6 +73,6 @@ class CreateButtonRemoverBytecodePatch : BytecodePatch( lateinit var createRef: DexBackedMethodReference - var isSeondary: Boolean = false + var foundIndex: Int = 0 } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/resource/patch/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/resource/patch/CreateButtonRemoverPatch.kt index a4ca3d7b6..5bb9adcbe 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/resource/patch/CreateButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/createbutton/resource/patch/CreateButtonRemoverPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.patch.CreateButtonRemoverBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-create-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/bytecode/patch/ShortsButtonRemoverBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/bytecode/patch/ShortsButtonRemoverBytecodePatch.kt index bfba94737..80c2cec6e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/bytecode/patch/ShortsButtonRemoverBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/bytecode/patch/ShortsButtonRemoverBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,20 +8,22 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion. import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarEnumFingerprint import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarShortsButtonViewFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.PivotBarFingerprint -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT -import app.revanced.shared.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT -import app.revanced.shared.util.pivotbar.InjectionUtils.injectHook +import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT +import app.revanced.util.pivotbar.InjectionUtils.injectHook @Name("hide-shorts-button") +@DependsOn([SharedResourcdIdPatch::class]) @YouTubeCompatibility @Version("0.0.1") class ShortsButtonRemoverBytecodePatch : BytecodePatch( - listOf(PivotBarFingerprint) + listOf(PivotBarCreateButtonViewFingerprint) ) { override fun execute(context: BytecodeContext): PatchResult { @@ -28,7 +31,7 @@ class ShortsButtonRemoverBytecodePatch : BytecodePatch( * Resolve fingerprints */ - PivotBarFingerprint.result?.let { parentResult -> + PivotBarCreateButtonViewFingerprint.result?.let { parentResult -> with ( arrayOf( PivotBarEnumFingerprint, @@ -57,7 +60,7 @@ class ShortsButtonRemoverBytecodePatch : BytecodePatch( } } - } ?: return PivotBarFingerprint.toErrorResult() + } ?: return PivotBarCreateButtonViewFingerprint.toErrorResult() return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/resource/patch/ShortsButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/resource/patch/ShortsButtonRemoverPatch.kt index 2e71baefe..bcb321bff 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/resource/patch/ShortsButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/pivotbar/shortsbutton/resource/patch/ShortsButtonRemoverPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.patch.ShortsButtonRemoverBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-shorts-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/bytecode/patch/ShortsComponentBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/bytecode/patch/ShortsComponentBytecodePatch.kt index 2b6fceae8..e8d17dbc7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/bytecode/patch/ShortsComponentBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/bytecode/patch/ShortsComponentBytecodePatch.kt @@ -1,22 +1,22 @@ package app.revanced.patches.youtube.layout.general.shortscomponent.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectHideCall import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.bytecode.BytecodeHelper +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.bytecode.BytecodeHelper +import org.jf.dexlib2.Opcode +import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction21c import org.jf.dexlib2.iface.instruction.formats.Instruction31i -import org.jf.dexlib2.iface.instruction.OneRegisterInstruction -import org.jf.dexlib2.Opcode @Name("hide-shorts-component-bytecode-patch") @DependsOn([ResourceMappingPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/resource/patch/ShortsComponentPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/resource/patch/ShortsComponentPatch.kt index e670ba22e..b585fdeca 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/resource/patch/ShortsComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/shortscomponent/resource/patch/ShortsComponentPatch.kt @@ -4,16 +4,16 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.shortscomponent.bytecode.patch.ShortsComponentBytecodePatch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-shorts-component") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/bytecode/patch/HideSnackbarBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/bytecode/patch/HideSnackbarBytecodePatch.kt index c54dbdb7c..de17af348 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/bytecode/patch/HideSnackbarBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/bytecode/patch/HideSnackbarBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,10 +10,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.snackbar.bytecode.fingerprints.HideSnackbarFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT @Name("hide-snackbar-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/resource/patch/HideSnackbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/resource/patch/HideSnackbarPatch.kt index def46a495..122dc2a42 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/resource/patch/HideSnackbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/snackbar/resource/patch/HideSnackbarPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch.HideSnackbarBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-snackbar") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/bytecode/patch/HideShortsOnStartupBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/bytecode/patch/HideShortsOnStartupBytecodePatch.kt index e77103381..d10b80219 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/bytecode/patch/HideShortsOnStartupBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/bytecode/patch/HideShortsOnStartupBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,10 +10,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.fingerprints.UserWasInShortsFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("hide-startup-shorts-player-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/resource/patch/HideShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/resource/patch/HideShortsOnStartupPatch.kt index d6781c2e4..e02820920 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/resource/patch/HideShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/startupshortsreset/resource/patch/HideShortsOnStartupPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.patch.HideShortsOnStartupBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-startup-shorts-player") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/bytecode/patch/HideStoriesBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/bytecode/patch/HideStoriesBytecodePatch.kt index 4aa3ceb98..67723fe2d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/bytecode/patch/HideStoriesBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/bytecode/patch/HideStoriesBytecodePatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.youtube.layout.general.stories.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/resource/patch/HideStoriesPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/resource/patch/HideStoriesPatch.kt index 45766198d..01f119364 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/resource/patch/HideStoriesPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/stories/resource/patch/HideStoriesPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.stories.bytecode.patch.HideStoriesBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-stories") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/bytecode/patch/TabletMiniPlayerBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/bytecode/patch/TabletMiniPlayerBytecodePatch.kt index 69d1ca97c..bcc36ffe8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/bytecode/patch/TabletMiniPlayerBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/bytecode/patch/TabletMiniPlayerBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -11,11 +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.util.proxy.mutableTypes.MutableMethod +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints.* import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("enable-tablet-miniplayer-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/resource/patch/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/resource/patch/TabletMiniPlayerPatch.kt index 22c608524..4d3513ace 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/resource/patch/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/tabletminiplayer/resource/patch/TabletMiniPlayerPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.patch.TabletMiniPlayerBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-tablet-miniplayer") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/bytecode/patch/WideSearchbarBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/bytecode/patch/WideSearchbarBytecodePatch.kt index ed42fee3a..64b394067 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/bytecode/patch/WideSearchbarBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/bytecode/patch/WideSearchbarBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,10 +11,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT +import app.revanced.util.integrations.Constants.GENERAL_LAYOUT @Name("enable-wide-searchbar-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/resource/patch/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/resource/patch/WideSearchbarPatch.kt index c75d91033..93cd2b5a9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/resource/patch/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/general/widesearchbar/resource/patch/WideSearchbarPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch.WideSearchbarBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-wide-searchbar") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/bytecode/patch/HideAutoplayButtonBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/bytecode/patch/HideAutoplayButtonBytecodePatch.kt index fcd42b561..5af1cd050 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/bytecode/patch/HideAutoplayButtonBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/bytecode/patch/HideAutoplayButtonBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.player.autoplaybutton.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,11 +10,10 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.LayoutConstructorFingerprint -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.integrations.Constants.PLAYER_LAYOUT import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.WideLiteralInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/resource/patch/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/resource/patch/HideAutoplayButtonPatch.kt index 8a755e2ba..00f8a3748 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/resource/patch/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/autoplaybutton/resource/patch/HideAutoplayButtonPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.autoplaybutton.bytecode.patch.HideAutoplayButtonBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-autoplay-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/bytecode/patch/HideCaptionsButtonBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/bytecode/patch/HideCaptionsButtonBytecodePatch.kt index bf2f33ddd..594379740 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/bytecode/patch/HideCaptionsButtonBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/bytecode/patch/HideCaptionsButtonBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.player.captionsbutton.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,10 +8,9 @@ import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.SubtitleButtonControllerFingerprint -import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint +import app.revanced.util.integrations.Constants.PLAYER_LAYOUT import org.jf.dexlib2.Opcode @Name("hide-captions-button-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/resource/patch/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/resource/patch/HideCaptionsButtonPatch.kt index 94c705a76..e71f444ec 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/resource/patch/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/captionsbutton/resource/patch/HideCaptionsButtonPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.captionsbutton.bytecode.patch.HideCaptionsButtonBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-player-captions-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/bytecode/patch/HideCastButtonBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/bytecode/patch/HideCastButtonBytecodePatch.kt index 439e2b6fb..68c5a1dd8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/bytecode/patch/HideCastButtonBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/bytecode/patch/HideCastButtonBytecodePatch.kt @@ -7,8 +7,8 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.util.integrations.Constants.PLAYER_LAYOUT @Name("hide-cast-button-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/resource/patch/HideCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/resource/patch/HideCastButtonPatch.kt index 608115fee..d4ccc2414 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/resource/patch/HideCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/castbutton/resource/patch/HideCastButtonPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.castbutton.bytecode.patch.HideCastButtonBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-cast-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutCircleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutCircleFingerprint.kt index f1c52d273..bd4240ca8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutCircleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutCircleFingerprint.kt @@ -14,9 +14,9 @@ object LayoutCircleFingerprint : MethodFingerprint( Opcode.CHECK_CAST, ), customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.layoutCircle + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.layoutCircle } == true } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutIconFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutIconFingerprint.kt index 453e2e92d..efbcd112f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutIconFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutIconFingerprint.kt @@ -14,9 +14,9 @@ object LayoutIconFingerprint : MethodFingerprint( Opcode.CHECK_CAST, ), customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.layoutIcon + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.layoutIcon } == true } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutVideoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutVideoFingerprint.kt index 9e63c822d..ba0bdf171 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutVideoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/fingerprints/LayoutVideoFingerprint.kt @@ -14,9 +14,9 @@ object LayoutVideoFingerprint : MethodFingerprint( Opcode.CHECK_CAST, ), customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.layoutVideo + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.layoutVideo } == true } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/patch/HideEndscreenCardsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/patch/HideEndscreenCardsBytecodePatch.kt index e4d1e36ac..f5ad54773 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/patch/HideEndscreenCardsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/bytecode/patch/HideEndscreenCardsBytecodePatch.kt @@ -1,16 +1,17 @@ package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.patch +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.instruction -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.injectHideCall import org.jf.dexlib2.iface.instruction.formats.Instruction21c @Name("hide-endscreen-cards-bytecode-patch") @@ -25,17 +26,21 @@ class HideEndscreenCardsBytecodePatch : BytecodePatch( ) { override fun execute(context: BytecodeContext): PatchResult { - fun MethodFingerprint.injectHideCalls() { - val layoutResult = result!! - val layoutMethod = layoutResult.mutableMethod - - val checkCastIndex = layoutResult.scanResult.patternScanResult!!.endIndex - val viewRegister = (layoutMethod.instruction(checkCastIndex) as Instruction21c).registerA - - layoutMethod.implementation!!.injectHideCall(checkCastIndex + 1, viewRegister, "layout/PlayerLayoutPatch", "hideEndscreen") + fun MethodFingerprintResult.injectHideCalls() { + val index = this.scanResult.patternScanResult!!.endIndex + with (this.mutableMethod) { + val register = (this.instruction(index) as Instruction21c).registerA + this.implementation!!.injectHideCall(index + 1, register, "layout/PlayerLayoutPatch", "hideEndscreen") + } } - listOf(LayoutCircleFingerprint, LayoutIconFingerprint, LayoutVideoFingerprint).forEach(MethodFingerprint::injectHideCalls) + listOf( + LayoutCircleFingerprint, + LayoutIconFingerprint, + LayoutVideoFingerprint + ).forEach { + it.result?.injectHideCalls() ?: return it.toErrorResult() + } return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/resource/patch/HideEndscreenCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/resource/patch/HideEndscreenCardsPatch.kt index 5454cc709..dc805dcde 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/resource/patch/HideEndscreenCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/endscreencards/resource/patch/HideEndscreenCardsPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.endscreencards.bytecode.patch.HideEndscreenCardsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-endscreen-cards") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoFingerprint.kt index 07f5cde54..f3cd0aa96 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.annotation.YouTubeCompatibility import org.jf.dexlib2.AccessFlags @Name("infocards-incognito-fingerprint") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoParentFingerprint.kt index b1d2c2496..a0731f26f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/fingerprints/InfocardsIncognitoParentFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.annotation.YouTubeCompatibility import org.jf.dexlib2.AccessFlags @Name("infocards-incognito-parent-fingerprint") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/patch/HideInfoCardsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/patch/HideInfoCardsBytecodePatch.kt index a0bbdd695..ce08dbad6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/patch/HideInfoCardsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/bytecode/patch/HideInfoCardsBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.player.infocards.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,11 +9,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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints.InfocardsIncognitoFingerprint import app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints.InfocardsIncognitoParentFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT +import app.revanced.util.integrations.Constants.PLAYER_LAYOUT @Name("hide-info-cards-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/resource/patch/HideInfocardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/resource/patch/HideInfocardsPatch.kt index bef61b4d4..290af397a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/resource/patch/HideInfocardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/infocards/resource/patch/HideInfocardsPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.infocards.bytecode.patch.HideInfoCardsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-info-cards") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt index d0b3a6e05..e0d24b2ce 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.playerbutton.patch.PlayerButtonPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.playerbutton.PlayerButtonPatch -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-live-chat-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt index 7da762127..4d8fe8a18 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.playerbutton.patch.PlayerButtonPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.playerbutton.PlayerButtonPatch -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-next-prev-button") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/bytecode/patch/PlayerOverlayFilterBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/bytecode/patch/PlayerOverlayFilterBytecodePatch.kt index e51c28d38..61207c46b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/bytecode/patch/PlayerOverlayFilterBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/bytecode/patch/PlayerOverlayFilterBytecodePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.layout.player.playeroverlayfilter.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,10 +11,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction21c import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/resource/patch/PlayerOverlayFilterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/resource/patch/PlayerOverlayFilterPatch.kt index eb32a2690..11ee32423 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/resource/patch/PlayerOverlayFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/playeroverlayfilter/resource/patch/PlayerOverlayFilterPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.playeroverlayfilter.bytecode.patch.PlayerOverlayFilterBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-player-overlay-filter") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/bytecode/patch/SuggestedActionsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/bytecode/patch/SuggestedActionsBytecodePatch.kt index de1f8f489..d769cc9fc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/bytecode/patch/SuggestedActionsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/bytecode/patch/SuggestedActionsBytecodePatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.youtube.layout.player.suggestactions.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectHideCall +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/resource/patch/SuggestedActionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/resource/patch/SuggestedActionsPatch.kt index 78b85573f..b6192bb22 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/resource/patch/SuggestedActionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/suggestactions/resource/patch/SuggestedActionsPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.suggestactions.bytecode.patch.SuggestedActionsBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-suggested-actions") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/bytecode/patch/HideChannelWatermarkBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/bytecode/patch/HideChannelWatermarkBytecodePatch.kt index af12dc46f..8e5d920ed 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/bytecode/patch/HideChannelWatermarkBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/bytecode/patch/HideChannelWatermarkBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.player.watermark.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,11 +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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints.HideWatermarkFingerprint import app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints.HideWatermarkParentFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT +import app.revanced.util.integrations.Constants.PLAYER_LAYOUT import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Name("hide-channel-watermark-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/resource/patch/HideChannelWatermarkPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/resource/patch/HideChannelWatermarkPatch.kt index 3cb52f45b..86e65f6df 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/resource/patch/HideChannelWatermarkPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/watermark/resource/patch/HideChannelWatermarkPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.player.watermark.bytecode.patch.HideChannelWatermarkBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-channel-watermark") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/bytecode/patch/CustomSeekbarColorBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/bytecode/patch/CustomSeekbarColorBytecodePatch.kt index 339ff89fc..8e48cd4fb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/bytecode/patch/CustomSeekbarColorBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/bytecode/patch/CustomSeekbarColorBytecodePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,11 +9,9 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.SEEKBAR_LAYOUT +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch +import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/resource/patch/CustomSeekbarColorPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/resource/patch/CustomSeekbarColorPatch.kt index 0d85e5fc7..65f62a70f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/resource/patch/CustomSeekbarColorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/customseekbarcolor/resource/patch/CustomSeekbarColorPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.bytecode.patch.CustomSeekbarColorBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("custom-seekbar-color") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/bytecode/patch/SeekbarTappingBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/bytecode/patch/SeekbarTappingBytecodePatch.kt index a0007d6ab..705bedf72 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/bytecode/patch/SeekbarTappingBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/bytecode/patch/SeekbarTappingBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,12 +11,10 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.fingerprints.SeekbarTappingFingerprint -import app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.fingerprints.SeekbarTappingParentFingerprint +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.fingerprints.* import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.SEEKBAR_LAYOUT +import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.Method import org.jf.dexlib2.iface.instruction.formats.Instruction11n @@ -27,7 +26,8 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c @Version("0.0.1") class SeekbarTappingBytecodePatch : BytecodePatch( listOf( - SeekbarTappingParentFingerprint, SeekbarTappingFingerprint + SeekbarTappingParentFingerprint, + SeekbarTappingFingerprint ) ) { override fun execute(context: BytecodeContext): PatchResult { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/resource/patch/SeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/resource/patch/SeekbarTappingPatch.kt index 307c43a04..85c679b99 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/resource/patch/SeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbartapping/resource/patch/SeekbarTappingPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.patch.SeekbarTappingBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-seekbar-tapping") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/fingerprints/TimeCounterParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/fingerprints/TimeCounterParentFingerprint.kt index 5ac1e5730..e5955e474 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/fingerprints/TimeCounterParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/fingerprints/TimeCounterParentFingerprint.kt @@ -11,9 +11,9 @@ object TimeCounterParentFingerprint : MethodFingerprint( returnType = "V", access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.timebarColorLabelId + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.timebarColorLabelId } == true } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/patch/HideTimeAndSeekbarBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/patch/HideTimeAndSeekbarBytecodePatch.kt index 766172cd0..932d9830c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/patch/HideTimeAndSeekbarBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/bytecode/patch/HideTimeAndSeekbarBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -11,13 +12,12 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.fingerprints.TimeCounterFingerprint import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.fingerprints.TimeCounterParentFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.patches.timebar.HookTimebarPatch -import app.revanced.shared.util.integrations.Constants.SEEKBAR_LAYOUT +import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch +import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT @DependsOn([HookTimebarPatch::class, SharedResourcdIdPatch::class]) @Name("hide-time-and-seekbar-bytecode-patch") @@ -31,19 +31,18 @@ class HideTimeAndSeekbarBytecodePatch : BytecodePatch( override fun execute(context: BytecodeContext): PatchResult { TimeCounterParentFingerprint.result?.let { parentResult -> - TimeCounterFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let { counterResult -> + TimeCounterFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let { method -> listOf( - HookTimebarPatch.SetTimbarFingerprintResult, - counterResult + HookTimebarPatch.setTimebarMethod, + method ).forEach { - val method = it.mutableMethod - method.addInstructions( + it.addInstructions( 0, """ invoke-static {}, $SEEKBAR_LAYOUT->hideTimeAndSeekbar()Z move-result v0 if-eqz v0, :hide_time_and_seekbar return-void - """, listOf(ExternalLabel("hide_time_and_seekbar", method.instruction(0))) + """, listOf(ExternalLabel("hide_time_and_seekbar", it.instruction(0))) ) } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/resource/patch/HideTimeAndSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/resource/patch/HideTimeAndSeekbarPatch.kt index f71d1db93..fce8848fb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/resource/patch/HideTimeAndSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/resource/patch/HideTimeAndSeekbarPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.patch.HideTimeAndSeekbarBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-time-and-seekbar") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Blue.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Blue.kt index 4c499cacd..c8fb96290 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Blue.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Blue.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.IconHelper -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.IconHelper +import app.revanced.util.resources.ResourceHelper @Patch(false) @Name("custom-branding-icon-afn-blue") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Red.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Red.kt index 6c3d34eb4..fb0e68a6d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Red.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Red.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.IconHelper -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.IconHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("custom-branding-icon-afn-red") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Revancify.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Revancify.kt index 0e3726783..1be94811f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Revancify.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/icon/patch/CustomBrandingPatch_Revancify.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.IconHelper -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.IconHelper +import app.revanced.util.resources.ResourceHelper @Patch(false) @Name("custom-branding-icon-revancify") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/name/patch/CustomBrandingNamePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/name/patch/CustomBrandingNamePatch.kt index 55edb58f4..5c68ced34 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/branding/name/patch/CustomBrandingNamePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/branding/name/patch/CustomBrandingNamePatch.kt @@ -1,19 +1,19 @@ package app.revanced.patches.youtube.misc.branding.name.patch +import app.revanced.extensions.startsWithAny 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.startsWithAny -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/bytecode/patch/ClientSpoofBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/bytecode/patch/ClientSpoofBytecodePatch.kt index f1436c157..f07d65fb6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/bytecode/patch/ClientSpoofBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/bytecode/patch/ClientSpoofBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.clientspoof.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,10 +9,9 @@ import app.revanced.patcher.extensions.instruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.clientspoof.bytecode.fingerprints.UserAgentHeaderBuilderFingerprint import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction @Name("client-spoof-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/resource/patch/ClientSpoofPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/resource/patch/ClientSpoofPatch.kt index 10f3c842b..9769f06f7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/resource/patch/ClientSpoofPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/clientspoof/resource/patch/ClientSpoofPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.clientspoof.bytecode.patch.ClientSpoofBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("client-spoof") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/doublebacktoclose/patch/DoubleBackToClosePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/doublebacktoclose/patch/DoubleBackToClosePatch.kt index d4c8cf929..727cad384 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/doublebacktoclose/patch/DoubleBackToClosePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/doublebacktoclose/patch/DoubleBackToClosePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.doublebacktoclose.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -11,14 +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.util.proxy.mutableTypes.MutableMethod -import app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint.OnBackPressedFingerprint -import app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint.ScrollPositionFingerprint -import app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint.ScrollTopFingerprint -import app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint.ScrollTopParentFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.patches.gestures.PredictiveBackGesturePatch -import app.revanced.shared.util.integrations.Constants.UTILS_PATH +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.gestures.PredictiveBackGesturePatch +import app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint.* +import app.revanced.util.integrations.Constants.UTILS_PATH @Name("double-back-to-close") @DependsOn([PredictiveBackGesturePatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/bytecode/patch/ExternalBrowserBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/bytecode/patch/ExternalBrowserBytecodePatch.kt index 97f4a3896..06c62da1a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/bytecode/patch/ExternalBrowserBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/bytecode/patch/ExternalBrowserBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.externalbrowser.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,10 +8,9 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.externalbrowser.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MISC_PATH +import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.iface.instruction.formats.Instruction21c @Name("enable-external-browser-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/resource/patch/ExternalBrowserPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/resource/patch/ExternalBrowserPatch.kt index cb5ea26f2..873370d69 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/resource/patch/ExternalBrowserPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/externalbrowser/resource/patch/ExternalBrowserPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.externalbrowser.bytecode.patch.ExternalBrowserBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-external-browser") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/PremiumHeadingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/patch/PremiumHeadingPatch.kt similarity index 91% rename from src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/PremiumHeadingPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/patch/PremiumHeadingPatch.kt index 812a558fd..805cd164c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/PremiumHeadingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/forceheader/patch/PremiumHeadingPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper import java.nio.file.Files import java.nio.file.StandardCopyOption import kotlin.io.path.exists @@ -47,9 +47,9 @@ class PremiumHeadingPatch : ResourcePatch { } } - val revancedprefs = context["res/xml/revanced_prefs.xml"] - revancedprefs.writeText( - revancedprefs.readText() + val prefs = context["res/xml/revanced_prefs.xml"] + prefs.writeText( + prefs.readText() .replace( "", "" diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt index 2f48bd871..7cd854c23 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt @@ -1,7 +1,7 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints -import app.revanced.shared.patches.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint object InitFingerprint : IntegrationsFingerprint( - strings = listOf("Application creation"), + strings = listOf("Application.onCreate") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt index 72fddf9c4..922ff16e7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt @@ -1,8 +1,8 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints -import app.revanced.shared.patches.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint object ServiceFingerprint : IntegrationsFingerprint( - customFingerprint = { methodDef -> methodDef.definingClass.endsWith("ApiPlayerService;") && methodDef.name == "" }, + customFingerprint = { it.definingClass.endsWith("ApiPlayerService;") && it.name == "" }, contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt index 459460496..27d9aa151 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt @@ -1,6 +1,6 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints -import app.revanced.shared.patches.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint object StandalonePlayerFingerprint : IntegrationsFingerprint( strings = listOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt index 6401bccea..4a930ab00 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt @@ -1,11 +1,9 @@ package app.revanced.patches.youtube.misc.integrations.patch import app.revanced.patcher.annotation.Name -import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint -import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint -import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.integrations.AbstractIntegrationsPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch +import app.revanced.patches.youtube.misc.integrations.fingerprints.* @Name("integrations") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/LithoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/LithoFingerprint.kt index 7edbdd432..6038c90a5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/LithoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/LithoFingerprint.kt @@ -6,7 +6,9 @@ import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction object LithoFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L", "L", "L", "L", "I", "Z"), + returnType = "L", + access = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = listOf("L", "L", "L", "L", "L", "I", "Z"), customFingerprint = { methodDef -> methodDef.implementation!!.instructions.any { ((it as? NarrowLiteralInstruction)?.narrowLiteral == 255496645) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/patch/LithoFilterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/patch/LithoFilterPatch.kt index 150e2e67c..65f5ef154 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/patch/LithoFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/patch/LithoFilterPatch.kt @@ -1,24 +1,25 @@ package app.revanced.patches.youtube.misc.litho.filter.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.extensions.instruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.doublebacktoclose.patch.DoubleBackToClosePatch import app.revanced.patches.youtube.misc.litho.filter.fingerprints.LithoFingerprint import app.revanced.patches.youtube.misc.swiperefresh.patch.SwipeRefreshPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.integrations.Constants.ADS_PATH +import app.revanced.util.integrations.Constants.ADS_PATH +import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21c import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.FieldReference import org.jf.dexlib2.iface.reference.MethodReference -import org.jf.dexlib2.Opcode @DependsOn( [ @@ -36,45 +37,39 @@ class LithoFilterPatch : BytecodePatch( { override fun execute(context: BytecodeContext): PatchResult { - //Litho - val lithoMethod = LithoFingerprint.result!!.mutableMethod - val lithoMethodThirdParam = lithoMethod.parameters[2] - val lithoRegister1 = lithoMethod.implementation!!.registerCount - lithoMethod.parameters.size + 1 - val lithoRegister2 = lithoRegister1 + 1 - val lithoInstructions = lithoMethod.implementation!!.instructions + LithoFingerprint.result?.mutableMethod?.let { + val implementations = it.implementation!! + val instructions = implementations.instructions + val parameter = it.parameters[2] + val stringRegister = implementations.registerCount - it.parameters.size + 1 + val dummyRegister = stringRegister + 1 - val lithoIndex = lithoInstructions.indexOfFirst { - it.opcode == Opcode.CONST_STRING && - (it as BuilderInstruction21c).reference.toString() == "Element missing type extension" - } + 2 + val lithoIndex = instructions.indexOfFirst { instruction-> + instruction.opcode == Opcode.CONST_STRING && + (instruction as BuilderInstruction21c).reference.toString() == "Element missing type extension" + } + 2 - val FirstReference = - lithoMethod.let { method -> - (method.implementation!!.instructions.elementAt(lithoIndex) as ReferenceInstruction).reference as MethodReference - } + val firstReference = (instructions.elementAt(lithoIndex) as ReferenceInstruction).reference as MethodReference + val secondReference = (instructions.elementAt(lithoIndex + 2) as ReferenceInstruction).reference as FieldReference - val SecondReference = - lithoMethod.let { method -> - (method.implementation!!.instructions.elementAt(lithoIndex + 2) as ReferenceInstruction).reference as FieldReference - } - - lithoMethod.addInstructions( - 0, """ - move-object/from16 v1, v$lithoRegister1 + it.addInstructions( + 0, """ + move-object/from16 v1, v$stringRegister invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object v1 - move-object/from16 v2, v$lithoRegister2 - iget-object v2, v2, $lithoMethodThirdParam->b:Ljava/nio/ByteBuffer; + move-object/from16 v2, v$dummyRegister + iget-object v2, v2, $parameter->b:Ljava/nio/ByteBuffer; invoke-static {v1, v2}, $ADS_PATH/ExtendedLithoFilterPatch;->InflatedLithoView(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z move-result v3 if-eqz v3, :do_not_block move-object/from16 v0, p1 - invoke-static {v0}, $FirstReference + invoke-static {v0}, $firstReference move-result-object v0 - iget-object v0, v0, ${SecondReference.definingClass}->${SecondReference.name}:${SecondReference.type} + iget-object v0, v0, ${secondReference.definingClass}->${secondReference.name}:${secondReference.type} return-object v0 - """, listOf(ExternalLabel("do_not_block", lithoMethod.instruction(0))) - ) + """, listOf(ExternalLabel("do_not_block", it.instruction(0))) + ) + } ?: return LithoFingerprint.toErrorResult() return PatchResultSuccess() } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/materialyou/patch/MaterialYouPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/materialyou/patch/MaterialYouPatch.kt index 1c025e84f..e841340a2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/materialyou/patch/MaterialYouPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/materialyou/patch/MaterialYouPatch.kt @@ -4,16 +4,16 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.theme.bytecode.GeneralThemePatch -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.patches.youtube.misc.theme.bytecode.patch.GeneralThemePatch +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils.copyXmlNode import java.nio.file.Files import java.nio.file.StandardCopyOption @@ -63,7 +63,7 @@ class MaterialYouPatch : ResourcePatch { "resources".copyXmlNode( context.xmlEditor[sourcePath], relativePath - ).also {}.close() + ) /* add settings diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastContextFetchFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastContextFetchFingerprint.kt index 56e84979e..374f60776 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastContextFetchFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastContextFetchFingerprint.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.microg.bytecode.fingerprints + import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object CastContextFetchFingerprint : MethodFingerprint( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleFingerprint.kt index ee652df6f..cc20f77ed 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleFingerprint.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.microg.bytecode.fingerprints + import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object CastDynamiteModuleFingerprint : MethodFingerprint( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleV2Fingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleV2Fingerprint.kt index f4645919e..9a45803b0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleV2Fingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/CastDynamiteModuleV2Fingerprint.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.microg.bytecode.fingerprints + import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object CastDynamiteModuleV2Fingerprint : MethodFingerprint( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/IntegrityCheckFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/IntegrityCheckFingerprint.kt deleted file mode 100644 index 56a595c58..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/IntegrityCheckFingerprint.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.patches.youtube.misc.microg.bytecode.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags - -object IntegrityCheckFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L"), - strings = listOf("This should never happen.", "GooglePlayServicesUtil", "Google Play Store signature invalid.") -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/PrimeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/PrimeFingerprint.kt index e29bc088a..488fb6aa5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/PrimeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/fingerprints/PrimeFingerprint.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.microg.bytecode.fingerprints + import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object PrimeFingerprint : MethodFingerprint( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/patch/MicroGBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/patch/MicroGBytecodePatch.kt index 9dc757470..a1c8042ef 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/patch/MicroGBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/bytecode/patch/MicroGBytecodePatch.kt @@ -7,14 +7,14 @@ 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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.layout.player.castbutton.resource.patch.HideCastButtonPatch import app.revanced.patches.youtube.misc.clientspoof.resource.patch.ClientSpoofPatch import app.revanced.patches.youtube.misc.microg.bytecode.fingerprints.* import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.bytecode.BytecodeHelper -import app.revanced.shared.util.microg.MicroGBytecodeHelper +import app.revanced.util.bytecode.BytecodeHelper +import app.revanced.util.microg.MicroGBytecodeHelper @Name("microg-support-bytecode-patch") @DependsOn( @@ -32,7 +32,6 @@ class MicroGBytecodePatch : BytecodePatch( CastDynamiteModuleFingerprint, CastDynamiteModuleV2Fingerprint, GooglePlayUtilityFingerprint, - IntegrityCheckFingerprint, PrimeFingerprint, ServiceCheckFingerprint ) @@ -55,7 +54,6 @@ class MicroGBytecodePatch : BytecodePatch( "$packageName" ), listOf( - IntegrityCheckFingerprint, ServiceCheckFingerprint, GooglePlayUtilityFingerprint, CastDynamiteModuleFingerprint, diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/resource/patch/MicroGPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/resource/patch/MicroGPatch.kt index 7c9a1f7fa..5bf22ec90 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/resource/patch/MicroGPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/resource/patch/MicroGPatch.kt @@ -9,16 +9,16 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.misc.microg.bytecode.patch.MicroGBytecodePatch import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.microg.MicroGManifestHelper -import app.revanced.shared.util.microg.MicroGResourceHelper -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.microg.MicroGManifestHelper +import app.revanced.util.microg.MicroGResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("microg-support") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/bytecode/patch/MinimizedPlaybackBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/bytecode/patch/MinimizedPlaybackBytecodePatch.kt index c6ded94b7..758fba4ae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/bytecode/patch/MinimizedPlaybackBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/bytecode/patch/MinimizedPlaybackBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.minimizedplayback.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -13,12 +14,11 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.minimizedplayback.bytecode.fingerprints.* import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MISC_PATH +import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.reference.MethodReference diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/resource/patch/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/resource/patch/MinimizedPlaybackPatch.kt index 4139f60e0..ad30e6fef 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/resource/patch/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/resource/patch/MinimizedPlaybackPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.minimizedplayback.bytecode.patch.MinimizedPlaybackBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-minimized-playback") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/bytecode/patch/OpenLinksDirectlyBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/bytecode/patch/OpenLinksDirectlyBytecodePatch.kt index 8882b018a..d2cf7463f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/bytecode/patch/OpenLinksDirectlyBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/bytecode/patch/OpenLinksDirectlyBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.openlinksdirectly.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,10 +9,9 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.openlinksdirectly.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.MISC_PATH +import app.revanced.util.integrations.Constants.MISC_PATH import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.formats.Instruction35c diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/resource/patch/OpenLinksDirectlyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/resource/patch/OpenLinksDirectlyPatch.kt index 076558b36..94fc00e21 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/resource/patch/OpenLinksDirectlyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/resource/patch/OpenLinksDirectlyPatch.kt @@ -4,19 +4,19 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.openlinksdirectly.bytecode.patch.OpenLinksDirectlyBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("enable-open-links-directly") -@Description("Bypass URL redirects (youtube.com/redirect) when opening links in video descriptions.") +@Description("Skips over redirection URLs to external links.") @DependsOn( [ OpenLinksDirectlyBytecodePatch::class, diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/OptimizeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/OptimizeResourcePatch.kt index 64d662311..d369d301d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/OptimizeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/OptimizeResourcePatch.kt @@ -9,10 +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.misc.optimize.patch.RedundantResourcePatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("optimize-resource") @@ -22,7 +21,7 @@ import app.revanced.shared.util.resources.ResourceHelper SettingsPatch::class ] ) -@Description("Removes duplicate resources and adds missing translation files from YouTube.") +@Description("Removes duplicate resources from YouTube.") @YouTubeCompatibility @Version("0.0.1") class OptimizeResourcePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/RedundantResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/RedundantResourcePatch.kt index 1db1e1ba6..d85846bea 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/RedundantResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/optimize/patch/RedundantResourcePatch.kt @@ -7,14 +7,13 @@ 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.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceUtils -import app.revanced.shared.util.resources.ResourceUtils.copyResources +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources import java.io.File import java.nio.file.Files import java.nio.file.Path import java.nio.file.StandardCopyOption -import java.util.Comparator @Name("remove-duplicate-resource-patch") @Description("Removes duplicate resources from YouTube.") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/bytecode/patch/PiPNotificationBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/bytecode/patch/PiPNotificationBytecodePatch.kt index affea76b5..4a0cf15ae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/bytecode/patch/PiPNotificationBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/bytecode/patch/PiPNotificationBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.pipnotification.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -7,9 +8,8 @@ import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.pipnotification.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult @Name("hide-pip-notification-bytecode-patch") @YouTubeCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/resource/patch/PiPNotificationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/resource/patch/PiPNotificationPatch.kt index f821129ec..22163da2f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/resource/patch/PiPNotificationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/pipnotification/resource/patch/PiPNotificationPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.pipnotification.bytecode.patch.PiPNotificationBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-pip-notification") diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/LiveChatFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playerbutton/fingerprints/LiveChatFingerprint.kt similarity index 89% rename from src/main/kotlin/app/revanced/shared/fingerprints/LiveChatFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/playerbutton/fingerprints/LiveChatFingerprint.kt index 65a7072db..8bc1b9139 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/LiveChatFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playerbutton/fingerprints/LiveChatFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.youtube.misc.playerbutton.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch diff --git a/src/main/kotlin/app/revanced/shared/patches/playerbutton/PlayerButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playerbutton/patch/PlayerButtonPatch.kt similarity index 88% rename from src/main/kotlin/app/revanced/shared/patches/playerbutton/PlayerButtonPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/playerbutton/patch/PlayerButtonPatch.kt index 4b98cd165..9f84bcd90 100644 --- a/src/main/kotlin/app/revanced/shared/patches/playerbutton/PlayerButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playerbutton/patch/PlayerButtonPatch.kt @@ -1,5 +1,7 @@ -package app.revanced.shared.patches.playerbutton +package app.revanced.patches.youtube.misc.playerbutton.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,12 +11,10 @@ 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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.playerbutton.fingerprints.LiveChatFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.LiveChatFingerprint -import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT +import app.revanced.util.integrations.Constants.PLAYER_LAYOUT import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21c import org.jf.dexlib2.builder.instruction.BuilderInstruction35c diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playerbuttonoverlay/patch/PlayerButtonOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playerbuttonoverlay/patch/PlayerButtonOverlayPatch.kt index bedfd35d2..f9a19fe20 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playerbuttonoverlay/patch/PlayerButtonOverlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playerbuttonoverlay/patch/PlayerButtonOverlayPatch.kt @@ -1,18 +1,18 @@ package app.revanced.patches.youtube.misc.playerbuttonoverlay.patch +import app.revanced.extensions.doRecursively 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.doRecursively -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt index 99c450631..7ef635eee 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.playercontrols.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -8,14 +9,13 @@ import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.instruction import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult -import app.revanced.patcher.patch.annotations.DependsOn 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playercontrols.fingerprints.* import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("player-controls-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt index b73842c43..99df76d3e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/patch/PlayerOverlaysHookPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.playeroverlay.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -8,10 +9,9 @@ import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playeroverlay.fingerprint.PlayerOverlaysOnFinishInflateFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.UTILS_PATH +import app.revanced.util.integrations.Constants.UTILS_PATH @Name("player-overlays-hook") @Description("Hook for adding custom overlays to the video player.") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt index 8cdd7553a..82c07f616 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/patch/PlayerTypeHookPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.playertype.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -8,10 +9,9 @@ import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playertype.fingerprint.UpdatePlayerTypeFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.UTILS_PATH +import app.revanced.util.integrations.Constants.UTILS_PATH @Name("player-type-hook") @Description("Hook to get the current player type of WatchWhileActivity") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt index 00440bbc8..7f51467a2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt @@ -7,8 +7,8 @@ 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.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch @Name("shared-resource-id") @DependsOn([ResourceMappingPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/bytecode/patch/ReturnYouTubeDislikeBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/bytecode/patch/ReturnYouTubeDislikeBytecodePatch.kt index a4f42066e..75dee919f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/bytecode/patch/ReturnYouTubeDislikeBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/bytecode/patch/ReturnYouTubeDislikeBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.returnyoutubedislike.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -12,11 +13,10 @@ import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.returnyoutubedislike.bytecode.fingerprints.* import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.UTILS_PATH +import app.revanced.util.integrations.Constants.UTILS_PATH import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("return-youtube-dislike-bytecode-patch") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/ReturnYouTubeDislikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/patch/ReturnYouTubeDislikePatch.kt similarity index 92% rename from src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/ReturnYouTubeDislikePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/patch/ReturnYouTubeDislikePatch.kt index df251a46f..119b9c302 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/ReturnYouTubeDislikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/returnyoutubedislike/resource/patch/ReturnYouTubeDislikePatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.returnyoutubedislike.bytecode.patch.ReturnYouTubeDislikeBytecodePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("return-youtube-dislike") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsBytecodePatch.kt index fff62693b..a2bb0c9ae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsBytecodePatch.kt @@ -1,5 +1,8 @@ package app.revanced.patches.youtube.misc.settings.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.injectTheme +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,15 +11,12 @@ 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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectTheme -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import app.revanced.shared.util.integrations.Constants.INTEGRATIONS_PATH +import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsPatch.kt index 7c65fa97b..007b3dc76 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsPatch.kt @@ -8,15 +8,15 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions +import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsBytecodePatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.patches.settings.AbstractSettingsResourcePatch -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils -import app.revanced.shared.util.resources.ResourceUtils.copyResources +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/AppendTimeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/AppendTimeFingerprint.kt deleted file mode 100644 index 6b77cad89..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/AppendTimeFingerprint.kt +++ /dev/null @@ -1,29 +0,0 @@ -package app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints - -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 AppendTimeFingerprint : MethodFingerprint( - "V", - AccessFlags.PUBLIC or AccessFlags.FINAL, - listOf("L", "L", "L"), - listOf( - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.CHECK_CAST, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT, - Opcode.IF_NEZ, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.CHECK_CAST, - Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID - ) -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/NextGenWatchLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/NextGenWatchLayoutFingerprint.kt index 7b38f4b89..62d57d9d2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/NextGenWatchLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/NextGenWatchLayoutFingerprint.kt @@ -4,6 +4,6 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import org.jf.dexlib2.util.MethodUtil object NextGenWatchLayoutFingerprint : MethodFingerprint( - "V", // constructors return void, in favour of speed of matching, this fingerprint has been added - customFingerprint = { methodDef -> MethodUtil.isConstructor(methodDef) && methodDef.parameterTypes.size == 3 && methodDef.definingClass.endsWith("NextGenWatchLayout;") } + returnType = "V", // constructors return void, in favour of speed of matching, this fingerprint has been added + customFingerprint = { MethodUtil.isConstructor(it) && it.parameterTypes.size == 3 && it.definingClass.endsWith("NextGenWatchLayout;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/PlayerOverlaysLayoutInitFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/PlayerOverlaysLayoutInitFingerprint.kt index c9ab025be..a3cf9e138 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/PlayerOverlaysLayoutInitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/fingerprints/PlayerOverlaysLayoutInitFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object PlayerOverlaysLayoutInitFingerprint : MethodFingerprint( - customFingerprint = { methodDef -> methodDef.returnType.endsWith("YouTubePlayerOverlaysLayout;") } + customFingerprint = { it.returnType.endsWith("YouTubePlayerOverlaysLayout;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt index 09aa8dfce..9b34295a8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt @@ -4,25 +4,25 @@ import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstruction -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch -import app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints.* -import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.timebar.HookTimebarPatch -import app.revanced.shared.util.bytecode.BytecodeHelper +import app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints.* +import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch +import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch +import app.revanced.util.bytecode.BytecodeHelper +import org.jf.dexlib2.Opcode +import org.jf.dexlib2.builder.BuilderInstruction import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction +import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction35c -import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.MethodReference -import org.jf.dexlib2.Opcode @Name("sponsorblock-bytecode-patch") @DependsOn( @@ -37,7 +37,6 @@ import org.jf.dexlib2.Opcode class SponsorBlockBytecodePatch : BytecodePatch( listOf( NextGenWatchLayoutFingerprint, - AppendTimeFingerprint, PlayerOverlaysLayoutInitFingerprint ) ) { @@ -51,9 +50,8 @@ class SponsorBlockBytecodePatch : BytecodePatch( /* Seekbar drawing */ - insertResult = HookTimebarPatch.SetTimbarFingerprintResult - insertMethod = insertResult.mutableMethod - val insertInstructions = insertMethod.implementation!!.instructions + insertMethod = HookTimebarPatch.setTimebarMethod + insertInstructions = insertMethod.implementation!!.instructions /* Get the instance of the seekbar rectangle @@ -117,10 +115,10 @@ class SponsorBlockBytecodePatch : BytecodePatch( Voting & Shield button */ - arrayOf("ShieldButton", "VotingButton").forEach { button -> - PlayerControlsBytecodePatch.initializeSB("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/$button;") - PlayerControlsBytecodePatch.injectVisibility("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/$button;") - PlayerControlsBytecodePatch.injectVisibilityNegated("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/$button;") + arrayOf("ShieldButton", "VotingButton").forEach { + PlayerControlsBytecodePatch.initializeSB("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/$it;") + PlayerControlsBytecodePatch.injectVisibility("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/$it;") + PlayerControlsBytecodePatch.injectVisibilityNegated("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/$it;") } // set SegmentHelperLayout.context to the player layout instance @@ -143,8 +141,8 @@ class SponsorBlockBytecodePatch : BytecodePatch( const val INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR = "$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/PlayerController;" - lateinit var insertResult: MethodFingerprintResult lateinit var insertMethod: MutableMethod + lateinit var insertInstructions: List /** * Adds an invoke-static instruction, called with the new id when the video changes diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt index 0509724cf..abafe7d2d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.misc.sponsorblock.bytecode.patch +import app.revanced.extensions.findMutableMethodOf +import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,10 +10,8 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt index 50b14155c..81254e589 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt @@ -4,19 +4,19 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.sponsorblock.bytecode.patch.SponsorBlockBytecodePatch import app.revanced.patches.youtube.misc.sponsorblock.bytecode.patch.SponsorBlockSecondaryBytecodePatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils -import app.revanced.shared.util.resources.ResourceUtils.copyResources -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources +import app.revanced.util.resources.ResourceUtils.copyXmlNode @Patch @Name("sponsorblock") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt index 42bb4151b..cdf53c691 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/fingerprint/SwipeRefreshLayoutFingerprint.kt @@ -15,7 +15,5 @@ object SwipeRefreshLayoutFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.RETURN ), - customFingerprint = { methodDef -> - methodDef.definingClass == "Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;" - } + customFingerprint = { it.definingClass == "Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/patch/SwipeRefreshPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/patch/SwipeRefreshPatch.kt index 5c8eb73a1..4c3789024 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/patch/SwipeRefreshPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/swiperefresh/patch/SwipeRefreshPatch.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.patches.youtube.misc.swiperefresh.fingerprint.SwipeRefreshLayoutFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.extensions.toErrorResult import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("enable-swipe-refresh") diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/LithoThemeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/fingerprints/LithoThemeFingerprint.kt similarity index 57% rename from src/main/kotlin/app/revanced/shared/fingerprints/LithoThemeFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/fingerprints/LithoThemeFingerprint.kt index 46ea41d2d..7fd71fe87 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/LithoThemeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/fingerprints/LithoThemeFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.youtube.misc.theme.bytecode.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint @@ -10,20 +10,10 @@ object LithoThemeFingerprint : MethodFingerprint( access = AccessFlags.PROTECTED or AccessFlags.FINAL, parameters = listOf("L"), opcodes = listOf( - Opcode.APUT, - Opcode.NEW_INSTANCE, - Opcode.INVOKE_DIRECT, - Opcode.IGET_OBJECT, - Opcode.SGET_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.IPUT_OBJECT, - Opcode.IGET, - Opcode.IF_EQZ, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT, Opcode.IF_NEZ, Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.RETURN_VOID - ) + ), + customFingerprint = { it.name == "onBoundsChange" } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/patch/GeneralThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/patch/GeneralThemePatch.kt new file mode 100644 index 000000000..fafcbd5ea --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/bytecode/patch/GeneralThemePatch.kt @@ -0,0 +1,45 @@ +package app.revanced.patches.youtube.misc.theme.bytecode.patch + +import app.revanced.extensions.toErrorResult +import app.revanced.patcher.annotation.Name +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.addInstructions +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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.theme.bytecode.fingerprints.LithoThemeFingerprint +import app.revanced.patches.youtube.misc.theme.resource.patch.GeneralThemeResourcePatch +import app.revanced.util.integrations.Constants.UTILS_PATH +import org.jf.dexlib2.iface.instruction.formats.Instruction35c + +@Name("general-theme") +@DependsOn([GeneralThemeResourcePatch::class]) +@YouTubeCompatibility +@Version("0.0.1") +class GeneralThemePatch : BytecodePatch( + listOf( + LithoThemeFingerprint + ) +) { + override fun execute(context: BytecodeContext): PatchResult { + + LithoThemeFingerprint.result?.let { + with (it.mutableMethod) { + val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1 + val register = (implementation!!.instructions[insertIndex] as Instruction35c).registerD + + addInstructions( + insertIndex, """ + invoke-static { v$register }, $UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I + move-result v$register + """ + ) + } + } ?: return LithoThemeFingerprint.toErrorResult() + + return PatchResultSuccess() + } +} diff --git a/src/main/kotlin/app/revanced/shared/patches/theme/resource/GeneralThemeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/resource/patch/GeneralThemeResourcePatch.kt similarity index 98% rename from src/main/kotlin/app/revanced/shared/patches/theme/resource/GeneralThemeResourcePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/theme/resource/patch/GeneralThemeResourcePatch.kt index 1e784b028..d856bd609 100644 --- a/src/main/kotlin/app/revanced/shared/patches/theme/resource/GeneralThemeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/resource/patch/GeneralThemeResourcePatch.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.patches.theme.resource +package app.revanced.patches.youtube.misc.theme.resource.patch import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/theme/patch/ThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/resource/patch/ThemePatch.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/misc/theme/patch/ThemePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/theme/resource/patch/ThemePatch.kt index 216f46b9c..8d7fc801a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/theme/patch/ThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/theme/resource/patch/ThemePatch.kt @@ -1,19 +1,19 @@ -package app.revanced.patches.youtube.misc.theme.patch +package app.revanced.patches.youtube.misc.theme.resource.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.patches.theme.bytecode.GeneralThemePatch -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.patches.youtube.misc.theme.bytecode.patch.GeneralThemePatch +import app.revanced.util.resources.ResourceHelper import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/PivotBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt similarity index 59% rename from src/main/kotlin/app/revanced/shared/fingerprints/PivotBarFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt index d7085ca76..b65994d87 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/PivotBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt @@ -1,15 +1,17 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.youtube.misc.timebar.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.WideLiteralInstruction +import org.jf.dexlib2.Opcode -object PivotBarFingerprint : MethodFingerprint( +object EmptyColorFingerprint : MethodFingerprint( + returnType = "V", + opcodes = listOf(Opcode.DIV_LONG_2ADDR), customFingerprint = { methodDef -> methodDef.implementation?.instructions?.any { it.opcode.ordinal == Opcode.CONST.ordinal && - (it as WideLiteralInstruction).wideLiteral == SharedResourcdIdPatch.imageOnlyTabId + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.emptycolorLabelId } == true } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/OnDrawFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/OnDrawFingerprint.kt similarity index 88% rename from src/main/kotlin/app/revanced/shared/fingerprints/OnDrawFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/OnDrawFingerprint.kt index a02020a0f..4934dd92f 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/OnDrawFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/OnDrawFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.youtube.misc.timebar.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt new file mode 100644 index 000000000..ec8eacbf4 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt @@ -0,0 +1,43 @@ +package app.revanced.patches.youtube.misc.timebar.patch + +import app.revanced.extensions.toErrorResult +import app.revanced.patcher.annotation.Name +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.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.patcher.patch.annotations.DependsOn +import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch +import app.revanced.patches.youtube.misc.timebar.fingerprints.* + +@Name("hook-timebar-patch") +@DependsOn([SharedResourcdIdPatch::class]) +@YouTubeCompatibility +@Version("0.0.1") +class HookTimebarPatch : BytecodePatch( + listOf( + EmptyColorFingerprint + ) +) { + override fun execute(context: BytecodeContext): PatchResult { + + EmptyColorFingerprint.result?.let { parentResult -> + emptyColorMethod = parentResult.mutableMethod + OnDrawFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let { + setTimebarMethod = it + } ?: return OnDrawFingerprint.toErrorResult() + } ?: return EmptyColorFingerprint.toErrorResult() + + + return PatchResultSuccess() + } + + internal companion object { + lateinit var emptyColorMethod: MutableMethod + lateinit var setTimebarMethod: MutableMethod + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/fingerprints/TooltipContentViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/fingerprints/TooltipContentViewFingerprint.kt index d4c498c73..b7763e575 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/fingerprints/TooltipContentViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/fingerprints/TooltipContentViewFingerprint.kt @@ -12,9 +12,9 @@ object TooltipContentViewFingerprint : MethodFingerprint( access = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.tooltipLabelId + methodDef.implementation?.instructions?.any { + it.opcode.ordinal == Opcode.CONST.ordinal && + (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.tooltipLabelId } == true } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/patch/TooltipContentViewBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/patch/TooltipContentViewBytecodePatch.kt index 27b380ef0..860e09147 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/patch/TooltipContentViewBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/bytecode/patch/TooltipContentViewBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.tooltip.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -8,10 +9,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch import app.revanced.patches.youtube.misc.tooltip.bytecode.fingerprints.TooltipContentViewFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult @Name("hide-tooltip-content-bytecode-patch") @DependsOn([SharedResourcdIdPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/resource/patch/TooltipContentViewPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/resource/patch/TooltipContentViewPatch.kt index e93dc4a4e..39ede06b3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/resource/patch/TooltipContentViewPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/tooltip/resource/patch/TooltipContentViewPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.misc.tooltip.bytecode.patch.TooltipContentViewBytecodePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.patches.youtube.misc.tooltip.bytecode.patch.TooltipContentViewBytecodePatch +import app.revanced.util.resources.ResourceHelper @Patch @Name("hide-tooltip-content") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/translations/patch/TranslationsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/translations/patch/TranslationsPatch.kt index e09fb6def..905863743 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/translations/patch/TranslationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/translations/patch/TranslationsPatch.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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceHelper @Patch @Name("translations") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/legacy/patch/LegacyVideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/legacy/patch/LegacyVideoIdPatch.kt index b1ca41eac..90d01a327 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/legacy/patch/LegacyVideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/legacy/patch/LegacyVideoIdPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.videoid.legacy.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -9,9 +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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.videoid.legacy.fingerprint.LegacyVideoIdFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("video-id-hook-legacy") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt index 18dad5537..fd3f01f7c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/MainstreamVideoIdFingerprint.kt @@ -10,15 +10,6 @@ object MainstreamVideoIdFingerprint : MethodFingerprint( access = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), opcodes = listOf( - Opcode.IF_EQZ, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT_OBJECT, - Opcode.IF_EQZ, - Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerFingerprint.kt index 5938548a5..3b956b42e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerFingerprint.kt @@ -3,8 +3,8 @@ package app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object PlayerControllerFingerprint : MethodFingerprint( - customFingerprint = { methodDef -> - methodDef.definingClass == "Lapp/revanced/integrations/sponsorblock/PlayerController;" - && methodDef.name == "setSponsorBarRect" + customFingerprint = { + it.definingClass == "Lapp/revanced/integrations/sponsorblock/PlayerController;" + && it.name == "setSponsorBarRect" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerSetTimeReferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerSetTimeReferenceFingerprint.kt index a63a695aa..3af0e0aab 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerSetTimeReferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/PlayerControllerSetTimeReferenceFingerprint.kt @@ -4,6 +4,9 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import org.jf.dexlib2.Opcode object PlayerControllerSetTimeReferenceFingerprint : MethodFingerprint( - opcodes = listOf(Opcode.INVOKE_DIRECT_RANGE, Opcode.IGET_OBJECT), + opcodes = listOf( + Opcode.INVOKE_DIRECT_RANGE, + Opcode.IGET_OBJECT + ), strings = listOf("Media progress reported outside media playback: ") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/TimebarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/TimebarFingerprint.kt similarity index 85% rename from src/main/kotlin/app/revanced/shared/fingerprints/TimebarFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/TimebarFingerprint.kt index fc8cd57d3..664b8ce6c 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/TimebarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/fingerprint/TimebarFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt index af5f1168c..9e00aa09d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.videoid.mainstream.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -13,12 +14,11 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch +import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch import app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.patches.timebar.HookTimebarPatch -import app.revanced.shared.util.integrations.Constants.VIDEO_PATH +import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.MutableMethodImplementation @@ -49,6 +49,7 @@ class MainstreamVideoIdPatch : BytecodePatch( PlayerInitFingerprint, RepeatListenerFingerprint, SeekFingerprint, + TimebarFingerprint, VideoTimeFingerprint, VideoTimeParentFingerprint ) @@ -124,11 +125,11 @@ class MainstreamVideoIdPatch : BytecodePatch( } ?: return PlayerControllerSetTimeReferenceFingerprint.toErrorResult() - with (HookTimebarPatch.EmptyColorFingerprintResult.mutableMethod) { + with (HookTimebarPatch.emptyColorMethod) { + val timebarResult = TimebarFingerprint.result ?: return TimebarFingerprint.toErrorResult() + val timebarInstructions = timebarResult.method.implementation!!.instructions val methodReference = - HookTimebarPatch.TimbarFingerprintResult.method.let { - (it.implementation!!.instructions.elementAt(2) as ReferenceInstruction).reference as MethodReference - } + (timebarInstructions.elementAt(2) as ReferenceInstruction).reference as MethodReference val instructions = implementation!!.instructions diff --git a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipebrightnessinhdr/bytecode/patch/SwipeGestureBrightnessInHDRPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipebrightnessinhdr/bytecode/patch/SwipeGestureBrightnessInHDRPatch.kt index b3dabbb7e..dc068e89c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/swipe/swipebrightnessinhdr/bytecode/patch/SwipeGestureBrightnessInHDRPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/swipe/swipebrightnessinhdr/bytecode/patch/SwipeGestureBrightnessInHDRPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,10 +10,9 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.fingerprints.HDRVideoFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.SWIPE_PATH +import app.revanced.util.integrations.Constants.SWIPE_PATH @Name("enable-swipe-gesture-brightness-in-hdr-patch") @YouTubeCompatibility 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 c4e67fb04..2671a8b00 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 @@ -3,8 +3,7 @@ package app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object SwipeControlsHostActivityFingerprint : MethodFingerprint( - customFingerprint = { methodDef -> - methodDef.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;" - && methodDef.name == "" + customFingerprint = { it.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;" + && it.name == "" } ) 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 cb654b60a..ae538e593 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 @@ -3,8 +3,8 @@ package app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object WatchWhileActivityFingerprint : MethodFingerprint( - customFingerprint = { methodDef -> - methodDef.definingClass.endsWith("WatchWhileActivity;") - && methodDef.name == "" + customFingerprint = { + it.definingClass.endsWith("WatchWhileActivity;") + && it.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 d3680e7ed..1eb7af9a0 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 @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.swipe.swipecontrols.bytecode.patch +import app.revanced.extensions.toErrorResult +import app.revanced.extensions.transformMethods import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -9,12 +11,10 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints.SwipeControlsHostActivityFingerprint import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints.WatchWhileActivityFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.extensions.transformMethods 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 70eb4a1fd..a50ae391a 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 @@ -4,18 +4,18 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.patch.SwipeControlsBytecodePatch -import app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.patch.SwipeGestureBrightnessInHDRPatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils -import app.revanced.shared.util.resources.ResourceUtils.copyResources +import app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.patch.SwipeGestureBrightnessInHDRPatch +import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.patch.SwipeControlsBytecodePatch +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources @Patch @Name("swipe-controls") diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/fingerprints/VideoSpeedEntriesFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/fingerprints/VideoSpeedEntriesFingerprint.kt index 7393d537b..74e50f91b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/fingerprints/VideoSpeedEntriesFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/fingerprints/VideoSpeedEntriesFingerprint.kt @@ -5,7 +5,7 @@ import org.jf.dexlib2.Opcode object VideoSpeedEntriesFingerprint : MethodFingerprint( opcodes = listOf(Opcode.FILL_ARRAY_DATA), - customFingerprint = { methodDef -> - methodDef.definingClass.endsWith("VideoSpeedEntries;") && methodDef.name == "" + customFingerprint = { + it.definingClass.endsWith("VideoSpeedEntries;") && it.name == "" } ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/patch/CustomVideoSpeedBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/patch/CustomVideoSpeedBytecodePatch.kt index b8e8b9f92..871df1000 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/patch/CustomVideoSpeedBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/bytecode/patch/CustomVideoSpeedBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.video.customspeed.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -12,11 +13,10 @@ import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.video.customspeed.bytecode.fingerprints.* -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.integrations.Constants.VIDEO_PATH +import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.builder.instruction.BuilderArrayPayload import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/resource/patch/CustomVideoSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/resource/patch/CustomVideoSpeedPatch.kt index ec0ed6dc7..aa91a06eb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/resource/patch/CustomVideoSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/customspeed/resource/patch/CustomVideoSpeedPatch.kt @@ -10,12 +10,12 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.video.customspeed.bytecode.patch.CustomVideoSpeedBytecodePatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.patches.options.PatchOptions -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils.copyXmlNode @Patch @Name("custom-video-speed") diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/bytecode/patch/VideoQualityBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/bytecode/patch/VideoQualityBytecodePatch.kt index 511adf2bb..cf2f2f409 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/bytecode/patch/VideoQualityBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/bytecode/patch/VideoQualityBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.video.quality.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -10,13 +11,12 @@ 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.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch import app.revanced.patches.youtube.video.quality.bytecode.fingerprints.VideoQualityReferenceFingerprint import app.revanced.patches.youtube.video.quality.bytecode.fingerprints.VideoQualitySetterFingerprint import app.revanced.patches.youtube.video.quality.bytecode.fingerprints.VideoUserQualityChangeFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.integrations.Constants.VIDEO_PATH +import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.FieldReference diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/resource/patch/VideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/resource/patch/VideoQualityPatch.kt index ebf23b3db..c5124dc4b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/resource/patch/VideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/resource/patch/VideoQualityPatch.kt @@ -4,16 +4,16 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.video.quality.bytecode.patch.VideoQualityBytecodePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper -import app.revanced.shared.util.resources.ResourceUtils.copyXmlNode +import app.revanced.patches.youtube.video.quality.bytecode.patch.VideoQualityBytecodePatch +import app.revanced.util.resources.ResourceHelper +import app.revanced.util.resources.ResourceUtils.copyXmlNode @Patch @Name("default-video-quality") diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/bytecode/patch/VideoSpeedBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/bytecode/patch/VideoSpeedBytecodePatch.kt index fa40ff7b1..d8c826505 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/bytecode/patch/VideoSpeedBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/bytecode/patch/VideoSpeedBytecodePatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.video.speed.bytecode.patch +import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext @@ -13,14 +14,11 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.util.smali.toInstructions +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch -import app.revanced.patches.youtube.video.speed.bytecode.fingerprints.VideoSpeedChangedFingerprint -import app.revanced.patches.youtube.video.speed.bytecode.fingerprints.VideoSpeedParentFingerprint -import app.revanced.patches.youtube.video.speed.bytecode.fingerprints.VideoSpeedSetterFingerprint -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.util.bytecode.BytecodeHelper -import app.revanced.shared.util.integrations.Constants.VIDEO_PATH +import app.revanced.patches.youtube.video.speed.bytecode.fingerprints.* +import app.revanced.util.bytecode.BytecodeHelper +import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/resource/patch/VideoSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/resource/patch/VideoSpeedPatch.kt index 2ad144767..433a6e7a4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/resource/patch/VideoSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/resource/patch/VideoSpeedPatch.kt @@ -4,15 +4,15 @@ 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.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.video.speed.bytecode.patch.VideoSpeedBytecodePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper +import app.revanced.patches.youtube.video.speed.bytecode.patch.VideoSpeedBytecodePatch +import app.revanced.util.resources.ResourceHelper @Patch @Name("default-video-speed") diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/EmptyColorFingerprint.kt b/src/main/kotlin/app/revanced/shared/fingerprints/EmptyColorFingerprint.kt deleted file mode 100644 index 5e9614a4f..000000000 --- a/src/main/kotlin/app/revanced/shared/fingerprints/EmptyColorFingerprint.kt +++ /dev/null @@ -1,17 +0,0 @@ -package app.revanced.shared.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import org.jf.dexlib2.iface.instruction.WideLiteralInstruction -import org.jf.dexlib2.Opcode - -object EmptyColorFingerprint : MethodFingerprint( - returnType = "V", - opcodes = listOf(Opcode.DIV_LONG_2ADDR), - customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { instruction -> - instruction.opcode.ordinal == Opcode.CONST.ordinal && - (instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.emptycolorLabelId - } == true - } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/shared/patches/theme/bytecode/GeneralThemePatch.kt b/src/main/kotlin/app/revanced/shared/patches/theme/bytecode/GeneralThemePatch.kt deleted file mode 100644 index 906bcbbce..000000000 --- a/src/main/kotlin/app/revanced/shared/patches/theme/bytecode/GeneralThemePatch.kt +++ /dev/null @@ -1,38 +0,0 @@ -package app.revanced.shared.patches.theme.bytecode - -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.fingerprints.LithoThemeFingerprint -import app.revanced.shared.patches.theme.resource.GeneralThemeResourcePatch -import app.revanced.shared.util.integrations.Constants.UTILS_PATH - -@Name("general-theme") -@DependsOn([GeneralThemeResourcePatch::class]) -@YouTubeCompatibility -@Version("0.0.1") -class GeneralThemePatch : BytecodePatch( - listOf( - LithoThemeFingerprint - ) -) { - override fun execute(context: BytecodeContext): PatchResult { - val result = LithoThemeFingerprint.result!! - val method = result.mutableMethod - val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1 - - method.addInstructions( - patchIndex, """ - invoke-static {p1}, $UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I - move-result p1 - """ - ) - return PatchResultSuccess() - } -} diff --git a/src/main/kotlin/app/revanced/shared/patches/timebar/HookTimebarPatch.kt b/src/main/kotlin/app/revanced/shared/patches/timebar/HookTimebarPatch.kt deleted file mode 100644 index 463731d4a..000000000 --- a/src/main/kotlin/app/revanced/shared/patches/timebar/HookTimebarPatch.kt +++ /dev/null @@ -1,45 +0,0 @@ -package app.revanced.shared.patches.timebar - -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.toErrorResult -import app.revanced.shared.fingerprints.EmptyColorFingerprint -import app.revanced.shared.fingerprints.OnDrawFingerprint -import app.revanced.shared.fingerprints.TimebarFingerprint - -@Name("hook-timebar-patch") -@DependsOn([SharedResourcdIdPatch::class]) -@YouTubeCompatibility -@Version("0.0.1") -class HookTimebarPatch : BytecodePatch( - listOf( - EmptyColorFingerprint, - TimebarFingerprint - ) -) { - override fun execute(context: BytecodeContext): PatchResult { - EmptyColorFingerprintResult = EmptyColorFingerprint.result ?: return EmptyColorFingerprint.toErrorResult() - - OnDrawFingerprint.resolve(context, EmptyColorFingerprintResult.classDef) - SetTimbarFingerprintResult = OnDrawFingerprint.result ?: return OnDrawFingerprint.toErrorResult() - - TimbarFingerprintResult = TimebarFingerprint.result ?: return TimebarFingerprint.toErrorResult() - - return PatchResultSuccess() - } - - internal companion object { - lateinit var EmptyColorFingerprintResult: MethodFingerprintResult - lateinit var SetTimbarFingerprintResult: MethodFingerprintResult - lateinit var TimbarFingerprintResult: MethodFingerprintResult - } -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/shared/util/bytecode/BytecodeHelper.kt b/src/main/kotlin/app/revanced/util/bytecode/BytecodeHelper.kt similarity index 91% rename from src/main/kotlin/app/revanced/shared/util/bytecode/BytecodeHelper.kt rename to src/main/kotlin/app/revanced/util/bytecode/BytecodeHelper.kt index 2d1989026..b109fadbf 100644 --- a/src/main/kotlin/app/revanced/shared/util/bytecode/BytecodeHelper.kt +++ b/src/main/kotlin/app/revanced/util/bytecode/BytecodeHelper.kt @@ -1,10 +1,9 @@ -package app.revanced.shared.util.bytecode +package app.revanced.util.bytecode import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.shared.util.integrations.Constants.UTILS_PATH -import org.jf.dexlib2.Opcode +import app.revanced.util.integrations.Constants.UTILS_PATH internal object BytecodeHelper { diff --git a/src/main/kotlin/app/revanced/shared/util/integrations/Constants.kt b/src/main/kotlin/app/revanced/util/integrations/Constants.kt similarity index 95% rename from src/main/kotlin/app/revanced/shared/util/integrations/Constants.kt rename to src/main/kotlin/app/revanced/util/integrations/Constants.kt index 3066f66ab..5a929e95d 100644 --- a/src/main/kotlin/app/revanced/shared/util/integrations/Constants.kt +++ b/src/main/kotlin/app/revanced/util/integrations/Constants.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.integrations +package app.revanced.util.integrations internal object Constants { const val INTEGRATIONS_PATH = "Lapp/revanced/integrations" diff --git a/src/main/kotlin/app/revanced/shared/util/microg/Constants.kt b/src/main/kotlin/app/revanced/util/microg/Constants.kt similarity index 99% rename from src/main/kotlin/app/revanced/shared/util/microg/Constants.kt rename to src/main/kotlin/app/revanced/util/microg/Constants.kt index c1087db09..912b97561 100644 --- a/src/main/kotlin/app/revanced/shared/util/microg/Constants.kt +++ b/src/main/kotlin/app/revanced/util/microg/Constants.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.microg +package app.revanced.util.microg /** * constants for microG builds with signature spoofing diff --git a/src/main/kotlin/app/revanced/shared/util/microg/MicroGBytecodeHelper.kt b/src/main/kotlin/app/revanced/util/microg/MicroGBytecodeHelper.kt similarity index 97% rename from src/main/kotlin/app/revanced/shared/util/microg/MicroGBytecodeHelper.kt rename to src/main/kotlin/app/revanced/util/microg/MicroGBytecodeHelper.kt index 40e662c0a..b4b4038cb 100644 --- a/src/main/kotlin/app/revanced/shared/util/microg/MicroGBytecodeHelper.kt +++ b/src/main/kotlin/app/revanced/util/microg/MicroGBytecodeHelper.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.microg +package app.revanced.util.microg import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.addInstruction @@ -7,10 +7,10 @@ import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.shared.util.microg.Constants.ACTIONS -import app.revanced.shared.util.microg.Constants.AUTHORITIES -import app.revanced.shared.util.microg.Constants.MICROG_VENDOR -import app.revanced.shared.util.microg.Constants.PERMISSIONS +import app.revanced.util.microg.Constants.ACTIONS +import app.revanced.util.microg.Constants.AUTHORITIES +import app.revanced.util.microg.Constants.MICROG_VENDOR +import app.revanced.util.microg.Constants.PERMISSIONS import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21c import org.jf.dexlib2.iface.instruction.formats.Instruction21c diff --git a/src/main/kotlin/app/revanced/shared/util/microg/MicroGManifestHelper.kt b/src/main/kotlin/app/revanced/util/microg/MicroGManifestHelper.kt similarity index 85% rename from src/main/kotlin/app/revanced/shared/util/microg/MicroGManifestHelper.kt rename to src/main/kotlin/app/revanced/util/microg/MicroGManifestHelper.kt index 2cef816ac..003fa00e3 100644 --- a/src/main/kotlin/app/revanced/shared/util/microg/MicroGManifestHelper.kt +++ b/src/main/kotlin/app/revanced/util/microg/MicroGManifestHelper.kt @@ -1,10 +1,10 @@ -package app.revanced.shared.util.microg +package app.revanced.util.microg import app.revanced.patcher.data.ResourceContext -import app.revanced.shared.util.microg.Constants.META_GMS_PACKAGE_NAME -import app.revanced.shared.util.microg.Constants.META_SPOOFED_PACKAGE_NAME -import app.revanced.shared.util.microg.Constants.META_SPOOFED_PACKAGE_SIGNATURE -import app.revanced.shared.util.microg.Constants.MICROG_VENDOR +import app.revanced.util.microg.Constants.META_GMS_PACKAGE_NAME +import app.revanced.util.microg.Constants.META_SPOOFED_PACKAGE_NAME +import app.revanced.util.microg.Constants.META_SPOOFED_PACKAGE_SIGNATURE +import app.revanced.util.microg.Constants.MICROG_VENDOR import org.w3c.dom.Element import org.w3c.dom.Node diff --git a/src/main/kotlin/app/revanced/shared/util/microg/MicroGResourceHelper.kt b/src/main/kotlin/app/revanced/util/microg/MicroGResourceHelper.kt similarity index 97% rename from src/main/kotlin/app/revanced/shared/util/microg/MicroGResourceHelper.kt rename to src/main/kotlin/app/revanced/util/microg/MicroGResourceHelper.kt index ebcc724c0..f5c033c8e 100644 --- a/src/main/kotlin/app/revanced/shared/util/microg/MicroGResourceHelper.kt +++ b/src/main/kotlin/app/revanced/util/microg/MicroGResourceHelper.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.microg +package app.revanced.util.microg import app.revanced.patcher.data.ResourceContext diff --git a/src/main/kotlin/app/revanced/shared/util/pivotbar/InjectionUtils.kt b/src/main/kotlin/app/revanced/util/pivotbar/InjectionUtils.kt similarity index 96% rename from src/main/kotlin/app/revanced/shared/util/pivotbar/InjectionUtils.kt rename to src/main/kotlin/app/revanced/util/pivotbar/InjectionUtils.kt index da5155561..8f3a5da38 100644 --- a/src/main/kotlin/app/revanced/shared/util/pivotbar/InjectionUtils.kt +++ b/src/main/kotlin/app/revanced/util/pivotbar/InjectionUtils.kt @@ -1,10 +1,10 @@ -package app.revanced.shared.util.pivotbar +package app.revanced.util.pivotbar import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.instruction import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.Opcode.MOVE_RESULT_OBJECT +import org.jf.dexlib2.iface.instruction.OneRegisterInstruction internal object InjectionUtils { const val REGISTER_TEMPLATE_REPLACEMENT: String = "REGISTER_INDEX" diff --git a/src/main/kotlin/app/revanced/shared/util/resources/IconHelper.kt b/src/main/kotlin/app/revanced/util/resources/IconHelper.kt similarity index 99% rename from src/main/kotlin/app/revanced/shared/util/resources/IconHelper.kt rename to src/main/kotlin/app/revanced/util/resources/IconHelper.kt index cd93ec44a..92e7dc0a7 100644 --- a/src/main/kotlin/app/revanced/shared/util/resources/IconHelper.kt +++ b/src/main/kotlin/app/revanced/util/resources/IconHelper.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.resources +package app.revanced.util.resources import app.revanced.patcher.data.ResourceContext import java.nio.file.Files diff --git a/src/main/kotlin/app/revanced/shared/util/resources/ResourceHelper.kt b/src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt similarity index 99% rename from src/main/kotlin/app/revanced/shared/util/resources/ResourceHelper.kt rename to src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt index eb47afbc1..48c524e7f 100644 --- a/src/main/kotlin/app/revanced/shared/util/resources/ResourceHelper.kt +++ b/src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.resources +package app.revanced.util.resources import app.revanced.patcher.data.ResourceContext import java.nio.file.Files diff --git a/src/main/kotlin/app/revanced/shared/util/resources/ResourceUtils.kt b/src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt similarity index 98% rename from src/main/kotlin/app/revanced/shared/util/resources/ResourceUtils.kt rename to src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt index 229690cbc..230720840 100644 --- a/src/main/kotlin/app/revanced/shared/util/resources/ResourceUtils.kt +++ b/src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.util.resources +package app.revanced.util.resources import app.revanced.patcher.data.DomFileEditor import app.revanced.patcher.data.ResourceContext