From 9ac558dd2b11d3040573746e8e4e1f4a7802c360 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 2 Mar 2024 23:53:59 +0100 Subject: [PATCH 01/15] chore: Lint code This commit also changes the API, but these changes are considered fixes. --- api/revanced-patches.api | 8 +-- .../connectivity/wifi/spoof/SpoofWifiPatch.kt | 11 ++-- .../all/misc/transformation/MethodCall.kt | 28 +++++----- .../RemoveCaptureRestrictionPatch.kt | 13 ++--- .../RemoveScreenshotRestrictionPatch.kt | 23 ++++---- .../sim/spoof/SpoofSimCountryPatch.kt | 35 ++++++------- .../backdrops/misc/pro/ProUnlockPatch.kt | 11 ++-- .../pro/fingerprints/ProUnlockFingerprint.kt | 10 ++-- .../patches/candylinkvpn/UnlockProPatch.kt | 10 ++-- .../IsPremiumPurchasedFingerprint.kt | 6 +-- .../root/BypassRootChecksPatch.kt | 8 +-- .../root/fingerprints/CheckRootFingerprint.kt | 4 +- .../facebook/ads/story/HideStoryAdsPatch.kt | 6 +-- .../fingerprints/AdsInsertionFingerprint.kt | 2 +- .../fingerprints/FieldMethodFingerprint.kt | 2 +- .../bootloader/BootloaderDetectionPatch.kt | 9 ++-- .../fingerprints/BootStateFingerprint.kt | 4 +- .../fingerprints/CreateKeyFingerprint.kt | 2 +- .../detection/root/RootDetectionPatch.kt | 8 +-- .../fingerprints/RootDetectionFingerprint.kt | 4 +- .../restrictions/RemoveDeviceRestrictions.kt | 6 +-- .../OnApplicationCreateFingerprint.kt | 2 +- .../patches/hexeditor/ad/DisableAdsPatch.kt | 8 +-- .../ad/fingerprints/PrimaryAdsFingerprint.kt | 4 +- .../iconpackstudio/misc/pro/UnlockProPatch.kt | 6 +-- .../pro/fingerprints/CheckProFingerprint.kt | 2 +- .../detection/root/RootDetectionPatch.kt | 6 +-- .../AttestationSupportedCheckFingerprint.kt | 4 +- .../BootloaderCheckFingerprint.kt | 4 +- .../root/fingerprints/RootCheckFingerprint.kt | 4 +- .../signature/SpoofSignaturePatch.kt | 26 +++++----- .../fingerprints/SpoofSignatureFingerprint.kt | 2 +- .../{InshortsAdsPatch.kt => HideAdsPatch.kt} | 8 +-- .../ad/fingerprints/InshortsAdsFingerprint.kt | 4 +- .../ads/timeline/HideTimelineAdsPatch.kt | 18 ++++--- .../timeline/fingerprints/MediaFingerprint.kt | 2 +- .../ads/GenericMediaAdFingerprint.kt | 4 +- .../fingerprints/ads/MediaAdFingerprint.kt | 6 +-- .../ads/PaidPartnershipAdFingerprint.kt | 6 +-- .../fingerprints/ads/ShoppingAdFingerprint.kt | 4 +- .../patches/irplus/ad/RemoveAdsPatch.kt | 7 ++- .../ad/fingerprints/IrplusAdsFingerprint.kt | 4 +- .../misc/login/DisableMandatoryLoginPatch.kt | 8 +-- .../fingerprints/IsLoggedInFingerprint.kt | 4 +- .../misc/premium/UnlockPremiumPatch.kt | 12 ++--- .../fingerprints/HasPurchasedFingerprint.kt | 2 +- .../license/LicenseValidationPatch.kt | 8 +-- .../LicenseValidationFingerprint.kt | 4 +- .../signature/SignatureVerificationPatch.kt | 8 +-- .../VerifySignatureFingerprint.kt | 6 +-- .../misc/pro/UnlockProVersionPatch.kt | 24 +++++---- .../fingerprints/IsFreeVersionFingerprint.kt | 4 +- .../fingerprints/LoadInboxAdsFingerprint.kt | 5 +- .../ads/inbox/patch/HideInboxAdsPatch.kt | 7 ++- .../SendTypingIndicatorFingerprint.kt | 6 +-- ...itchMessangeInputEmojiButtonFingerprint.kt | 6 +-- .../DisableSwitchingEmojiToStickerPatch.kt | 8 +-- .../patch/DisableTypingIndicatorPatch.kt | 8 +-- .../patches/moneymanager/UnlockProPatch.kt | 12 ++--- .../fingerprints/UnlockProFingerprint.kt | 6 +-- .../music/ad/video/MusicVideoAdsPatch.kt | 6 +-- ...ShowMusicVideoAdsConstructorFingerprint.kt | 11 ++-- .../ShowMusicVideoAdsFingerprint.kt | 9 ++-- .../music/audio/codecs/CodecsUnlockPatch.kt | 20 +++---- .../AllCodecsReferenceFingerprint.kt | 15 +++--- .../fingerprints/CodecsLockFingerprint.kt | 11 ++-- .../exclusiveaudio/ExclusiveAudioPatch.kt | 12 ++--- .../AllowExclusiveAudioPlaybackFingerprint.kt | 8 +-- .../permanentrepeat/PermanentRepeatPatch.kt | 8 +-- .../fingerprints/RepeatTrackFingerprint.kt | 4 +- .../permanentshuffle/PermanentShufflePatch.kt | 9 ++-- .../fingerprints/DisableShuffleFingerprint.kt | 4 +- .../compactheader/CompactHeaderPatch.kt | 11 ++-- .../CompactHeaderConstructorFingerprint.kt | 9 ++-- .../MinimizedPlaybackPatch.kt | 7 ++- .../MinimizedPlaybackManagerFingerprint.kt | 2 +- .../layout/premium/HideGetPremiumPatch.kt | 6 +-- .../fingerprints/HideGetPremiumFingerprint.kt | 9 ++-- .../HideGetPremiumParentFingerprint.kt | 7 ++- .../upgradebutton/RemoveUpgradeButtonPatch.kt | 22 ++++---- .../PivotBarConstructorFingerprint.kt | 9 ++-- .../BypassCertificateChecksPatch.kt | 10 ++-- .../CheckCertificateFingerprint.kt | 4 +- .../music/misc/gms/GmsCoreSupportPatch.kt | 6 +-- .../misc/gms/GmsCoreSupportResourcePatch.kt | 2 +- .../CastDynamiteModuleFingerprint.kt | 5 +- .../CastDynamiteModuleV2Fingerprint.kt | 5 +- .../GooglePlayUtilityFingerprint.kt | 6 +-- .../fingerprints/PrimeMethodFingerprint.kt | 5 +- .../ApplicationInitFingerprint.kt | 2 +- .../backgroundplay/BackgroundPlayPatch.kt | 12 ++--- .../BackgroundPlaybackDisableFingerprint.kt | 14 ++--- .../myexpenses/misc/pro/UnlockProPatch.kt | 7 ++- .../pro/fingerprints/IsEnabledFingerprint.kt | 2 +- .../patches/myfitnesspal/ads/HideAdsPatch.kt | 8 +-- .../IsPremiumUseCaseImplFingerprint.kt | 2 +- ...avigateToNativePremiumUpsellFingerprint.kt | 2 +- .../nfctoolsse/misc/pro/UnlockProPatch.kt | 10 ++-- .../IsLicenseRegisteredFingerprint.kt | 4 +- .../patches/nyx/misc/pro/UnlockProPatch.kt | 12 ++--- .../pro/fingerprints/CheckProFingerprint.kt | 2 +- .../detection/deviceid/SpoofDeviceIdPatch.kt | 12 ++--- .../fingerprints/GetDeviceIdFingerprint.kt | 4 +- .../signature/SignatureDetectionPatch.kt | 4 +- .../fingerprints/CheckSignatureFingerprint.kt | 4 +- .../misc/annoyances/HideUpdatePopupPatch.kt | 8 +-- .../unlock/bookpoint/EnableBookpointPatch.kt | 8 +-- .../IsBookpointEnabledFingerprint.kt | 6 +-- .../misc/unlock/plus/UnlockPlusPatch.kt | 12 ++--- .../fingerprints/IsPlusUnlockedFingerprint.kt | 9 ++-- .../patches/pixiv/ads/HideAdsPatch.kt | 8 +-- .../fingerprints/IsNotPremiumFingerprint.kt | 5 +- .../reddit/ad/comments/HideCommentAdsPatch.kt | 9 ++-- .../fingerprints/HideCommentAdsFingerprint.kt | 2 +- .../patches/reddit/ad/general/HideAdsPatch.kt | 5 +- .../fingerprints/NewAdPostFingerprint.kt | 2 +- .../customclients/BaseSpoofClientPatch.kt | 14 ++--- .../patches/reddit/customclients/Constants.kt | 4 +- .../baconreader/api/SpoofClientPatch.kt | 7 ++- .../GetAuthorizationUrlFingerprint.kt | 4 +- .../fingerprints/GetClientIdFingerprint.kt | 4 +- .../fingerprints/RequestTokenFingerprint.kt | 2 +- .../boostforreddit/api/SpoofClientPatch.kt | 5 +- .../fingerprints/GetClientIdFingerprint.kt | 4 +- .../LoginActivityOnCreateFingerprint.kt | 6 +-- .../infinityforreddit/api/SpoofClientPatch.kt | 2 +- .../api/fingerprints/APIUtilsFingerprint.kt | 4 +- .../AbstractClientIdFingerprint.kt | 0 .../GetHttpBasicAuthHeaderFingerprint.kt | 0 .../LoginActivityOnCreateFingerprint.kt | 0 .../StartSubscriptionActivityFingerprint.kt | 4 +- .../joeyforreddit/ads/DisableAdsPatch.kt | 8 +-- .../fingerprints/IsAdFreeUserFingerprint.kt | 4 +- .../joeyforreddit/api/SpoofClientPatch.kt | 9 ++-- .../fingerprints/GetClientIdFingerprint.kt | 12 ++--- .../piracy/DisablePiracyDetectionPatch.kt | 6 +-- .../PiracyDetectionFingerprint.kt | 12 ++--- .../redditisfun/api/SpoofClientPatch.kt | 9 ++-- .../fingerprints/BaseClientIdFingerprint.kt | 2 +- .../BasicAuthorizationFingerprint.kt | 2 +- .../BuildAuthorizationStringFingerprint.kt | 4 +- .../fingerprints/GetUserAgentFingerprint.kt | 4 +- .../relayforreddit/api/SpoofClientPatch.kt | 17 +++--- .../fingerprints/BaseClientIdFingerprint.kt | 2 +- .../GetLoggedInBearerTokenFingerprint.kt | 2 +- .../GetLoggedOutBearerTokenFingerprint.kt | 2 +- .../GetRefreshTokenFingerprint.kt | 2 +- .../LoginActivityClientIdFingerprint.kt | 2 +- .../RedditCheckDisableAPIFingerprint.kt | 4 +- .../SetRemoteConfigFingerprint.kt | 4 +- .../slide/api/SpoofClientPatch.kt | 7 ++- .../fingerprints/GetClientIdFingerprint.kt | 22 ++++---- .../syncforreddit/ads/DisableAdsPatch.kt | 8 +-- .../fingerprints/IsAdsEnabledFingerprint.kt | 4 +- .../DisableSyncForLemmyBottomSheetPatch.kt | 11 ++-- .../MainActivityOnCreateFingerprint.kt | 4 +- .../syncforreddit/api/SpoofClientPatch.kt | 13 +++-- .../GetAuthorizationStringFingerprint.kt | 4 +- .../fingerprints/GetBearerTokenFingerprint.kt | 4 +- .../fingerprints/ImgurImageAPIFingerprint.kt | 4 +- .../fingerprints/LoadBrowserURLFingerprint.kt | 4 +- .../PiracyDetectionFingerprint.kt | 6 +-- .../syncforreddit/fix/slink/FixSLinksPatch.kt | 8 +-- .../LinkHelperOpenLinkFingerprint.kt | 4 +- .../DisableScreenshotPopupPatch.kt | 4 +- .../DisableScreenshotPopupFingerprint.kt | 9 ++-- .../premiumicon/UnlockPremiumIconPatch.kt | 7 ++- .../HasPremiumIconAccessFingerprint.kt | 4 +- .../tracking/url/SanitizeUrlQueryPatch.kt | 10 ++-- .../ShareLinkFormatterFingerprint.kt | 4 +- .../RemoveDebuggingDetectionPatch.kt | 8 +-- .../DebuggingDetectionFingerprint.kt | 2 +- .../detection/root/RootDetectionPatch.kt | 4 +- .../fingerprints/RootDetectionFingerprint.kt | 2 +- .../CastContextFetchFingerprint.kt | 5 +- .../fix/verticalscroll/VerticalScrollPatch.kt | 6 +-- .../CanScrollVerticallyFingerprint.kt | 3 +- .../misc/gms/BaseGmsCoreSupportPatch.kt | 29 ++++++----- .../fingerprints/GmsCoreSupportFingerprint.kt | 2 +- .../settings/preference/BasePreference.kt | 4 +- .../misc/settings/preference/InputType.kt | 2 +- .../settings/preference/IntentPreference.kt | 12 +++-- .../settings/preference/ListPreference.kt | 10 ++-- .../preference/NonInteractivePreference.kt | 2 +- .../settings/preference/PreferenceCategory.kt | 2 +- .../misc/settings/preference/SummaryType.kt | 6 ++- .../settings/preference/SwitchPreference.kt | 2 +- .../settings/preference/TextPreference.kt | 2 +- .../filesize/RemoveFileSizeLimitPatch.kt | 7 ++- .../fingerprints/OnReadyFingerprint.kt | 4 +- .../patches/songpal/badge/BadgeTabPatch.kt | 9 ++-- .../badge/RemoveNotificationBadgePatch.kt | 4 +- .../fingerprints/CreateTabsFingerprint.kt | 2 +- .../ShowNotificationFingerprint.kt | 2 +- .../spotify/lite/ondemand/OnDemandPatch.kt | 4 +- .../fingerprints/OnDemandFingerprint.kt | 6 +-- .../spotify/navbar/PremiumNavbarTabPatch.kt | 8 +-- .../fingerprints/AddNavBarItemFingerprint.kt | 8 +-- .../subscription/UnlockSubscriptionPatch.kt | 4 +- .../fingerprints/GetSubscribedFingerprint.kt | 2 +- .../DisableSubscriptionSuggestionsPatch.kt | 40 +++++++------- .../fingerprints/GetModulesFingerprint.kt | 2 +- ...lockThemePatch.kt => UnlockThemesPatch.kt} | 8 +-- .../CheckLockedThemesFingerprint.kt | 2 +- .../fingerprints/SetThemeFingerprint.kt | 2 +- .../tiktok/feedfilter/FeedFilterPatch.kt | 12 ++--- .../FeedApiServiceLIZFingerprint.kt | 4 +- ...ePatch.kt => RememberClearDisplayPatch.kt} | 12 ++--- .../OnClearDisplayEventFingerprint.kt | 4 +- .../OnRenderFirstFrameFingerprint.kt | 4 +- .../interaction/downloads/DownloadsPatch.kt | 24 ++++----- .../fingerprints/ACLCommonShareFingerprint.kt | 6 +-- .../ACLCommonShareFingerprint2.kt | 6 +-- .../ACLCommonShareFingerprint3.kt | 6 +-- .../DownloadPathParentFingerprint.kt | 10 ++-- .../interaction/seekbar/ShowSeekbarPatch.kt | 12 ++--- .../SetSeekBarShowTypeFingerprint.kt | 4 +- .../ShouldShowSeekBarFingerprint.kt | 4 +- .../interaction/speed/PlaybackSpeedPatch.kt | 16 +++--- .../speed/fingerprints/GetSpeedFingerprint.kt | 4 +- .../OnRenderFirstFrameFingerprint.kt | 2 +- .../speed/fingerprints/SetSpeedFingerprint.kt | 4 +- .../misc/integrations/IntegrationsPatch.kt | 4 +- .../fingerprints/InitFingerprint.kt | 6 +-- .../DisableLoginRequirementPatch.kt | 12 ++--- .../MandatoryLoginServiceFingerprint.kt | 6 +-- .../MandatoryLoginServiceFingerprint2.kt | 6 +-- .../login/fixgoogle/FixGoogleLoginPatch.kt | 12 ++--- .../GoogleAuthAvailableFingerprint.kt | 4 +- .../GoogleOneTapAuthAvailableFingerprint.kt | 4 +- .../tiktok/misc/settings/SettingsPatch.kt | 26 +++++----- ...sonalizationActivityOnCreateFingerprint.kt | 6 +-- .../AddSettingsEntryFingerprint.kt | 6 +-- .../fingerprints/SettingsEntryFingerprint.kt | 6 +-- .../SettingsEntryInfoFingerprint.kt | 6 +-- .../SettingsStatusLoadFingerprint.kt | 6 +-- .../revanced/patches/trakt/UnlockProPatch.kt | 11 ++-- .../trakt/fingerprints/IsVIPEPFingerprint.kt | 4 +- .../trakt/fingerprints/IsVIPFingerprint.kt | 4 +- .../fingerprints/RemoteUserFingerprint.kt | 4 +- .../fingerprints/BrightnessFingerprint.kt | 8 +-- .../lockscreen/patch/ShowOnLockscreenPatch.kt | 23 ++++---- .../DisableBlogNotificationReminderPatch.kt | 10 ++-- .../IsBlogNotifyEnabledFingerprint.kt | 2 +- .../popups/DisableGiftMessagePopupPatch.kt | 8 +-- .../ShowGiftMessagePopupFingerprint.kt | 4 +- .../featureflags/OverrideFeatureFlagsPatch.kt | 14 ++--- .../GetFeatureValueFingerprint.kt | 6 +-- .../timelinefilter/TimelineFilterPatch.kt | 15 +++--- .../PostsResponseConstructorFingerprint.kt | 2 +- .../TimelineConstructorFingerprint.kt | 5 +- .../TimelineFilterIntegrationFingerprint.kt | 6 +-- .../patches/twitch/ad/audio/AudioAdsPatch.kt | 6 +-- .../AudioAdsPresenterPlayFingerprint.kt | 5 +- .../twitch/ad/embedded/EmbeddedAdsPatch.kt | 10 ++-- .../CreateUsherClientFingerprint.kt | 4 +- .../twitch/ad/shared/util/BaseAdPatch.kt | 9 ++-- .../patches/twitch/ad/video/VideoAdsPatch.kt | 52 ++++++++++++------- .../CheckAdEligibilityLambdaFingerprint.kt | 8 +-- .../ContentConfigShowAdsFingerprint.kt | 4 +- .../GetReadyToShowAdFingerprint.kt | 4 +- .../antidelete/ShowDeletedMessagesPatch.kt | 21 ++++---- .../ChatUtilCreateDeletedSpanFingerprint.kt | 4 +- ...etedMessageClickableSpanCtorFingerprint.kt | 7 +-- .../SetHasModAccessFingerprint.kt | 5 +- .../autoclaim/AutoClaimChannelPointsPatch.kt | 8 +-- ...nityPointsButtonViewDelegateFingerprint.kt | 8 +-- .../patches/twitch/debug/DebugModePatch.kt | 12 ++--- .../IsDebugConfigEnabledFingerprint.kt | 4 +- .../IsOmVerificationEnabledFingerprint.kt | 4 +- .../ShouldShowDebugOptionsFingerprint.kt | 4 +- .../misc/integrations/IntegrationsPatch.kt | 2 +- .../fingerprints/InitFingerprint.kt | 6 +-- .../twitch/misc/settings/SettingsPatch.kt | 47 +++++++++-------- .../misc/settings/SettingsResourcePatch.kt | 2 +- .../MenuGroupsOnClickFingerprint.kt | 6 +-- .../MenuGroupsUpdatedFingerprint.kt | 6 +-- .../SettingsActivityOnCreateFingerprint.kt | 4 +- .../SettingsMenuItemEnumFingerprint.kt | 2 +- .../ConstructMediaOptionsSheetFingerprint.kt | 3 +- ...wnloadVideoUpsellBottomSheetFingerprint.kt | 2 +- .../layout/viewcount/HideViewCountPatch.kt | 7 ++- .../ViewCountsEnabledFingerprint.kt | 2 +- .../twitter/misc/hook/json/JsonHookPatch.kt | 27 +++++----- .../fingerprints/JsonHookPatchFingerprint.kt | 6 +-- .../JsonInputStreamFingerprint.kt | 11 ++-- .../fingerprints/LoganSquareFingerprint.kt | 4 +- .../HideRecommendedUsersPatch.kt | 6 +-- .../RevCatSubscriptionFingerprint.kt | 4 +- .../firebasegetcert/FirebaseGetCertPatch.kt | 18 +++---- ...rint.kt => GetMessagingCertFingerprint.kt} | 6 +-- ...t.kt => GetRegistrationCertFingerprint.kt} | 8 +-- .../misc/promocode/PromoCodeUnlockPatch.kt | 8 +-- .../PromoCodeUnlockFingerprint.kt | 16 +++--- .../windyapp/misc/unlockpro/UnlockProPatch.kt | 8 +-- .../fingerprints/CheckProFingerprint.kt | 2 +- .../ad/general/HideAdsResourcePatch.kt | 6 +-- .../ad/getpremium/HideGetPremiumPatch.kt | 15 +++--- .../fingerprints/GetPremiumViewFingerprint.kt | 10 ++-- .../patches/youtube/ad/video/VideoAdsPatch.kt | 19 +++---- .../fingerprints/LoadVideoAdsFingerprint.kt | 5 +- .../copyvideourl/CopyVideoUrlResourcePatch.kt | 15 +++--- .../RemoveViewerDiscretionDialogPatch.kt | 19 +++---- .../fingerprints/CreateDialogFingerprint.kt | 4 +- .../DisablePreciseSeekingGesturePatch.kt | 18 +++---- .../seekbar/EnableSeekbarTappingPatch.kt | 21 ++++---- .../seekbar/EnableSlideToSeekPatch.kt | 20 +++---- .../DoubleSpeedSeekNoticeFingerprint.kt | 4 +- .../fingerprints/IsSwipingUpFingerprint.kt | 6 +-- .../OnTouchEventHandlerFingerprint.kt | 4 +- .../fingerprints/SeekbarTappingFingerprint.kt | 5 +- .../fingerprints/SlideToSeekFingerprint.kt | 4 +- .../SwipeControlsBytecodePatch.kt | 18 +++---- .../SwipeControlsHostActivityFingerprint.kt | 2 +- .../layout/autocaptions/AutoCaptionsPatch.kt | 17 +++--- .../StartVideoInformerFingerprint.kt | 6 +-- .../SubtitleButtonControllerFingerprint.kt | 4 +- .../fingerprints/SubtitleTrackFingerprint.kt | 9 ++-- .../layout/buttons/action/HideButtonsPatch.kt | 14 ++--- .../autoplay/HideAutoplayButtonPatch.kt | 18 +++---- .../captions/HideCaptionsButtonPatch.kt | 16 +++--- .../buttons/cast/HideCastButtonPatch.kt | 2 +- .../ResolvePivotBarFingerprintsPatch.kt | 15 +++--- .../AddCreateButtonViewFingerprint.kt | 4 +- .../InitializeButtonsFingerprint.kt | 4 +- .../PivotBarButtonsViewFingerprint.kt | 4 +- .../PivotBarConstructorFingerprint.kt | 4 +- .../PivotBarCreateButtonViewFingerprint.kt | 6 +-- .../fingerprints/PivotBarEnumFingerprint.kt | 4 +- .../navigation/utils/InjectionUtils.kt | 2 +- .../player/hide/HidePlayerButtonsPatch.kt | 16 +++--- ...layerControlsVisibilityModelFingerprint.kt | 4 +- .../layout/hide/albumcards/AlbumCardsPatch.kt | 20 +++---- .../albumcards/AlbumCardsResourcePatch.kt | 6 +-- .../fingerprints/AlbumCardsFingerprint.kt | 4 +- .../hide/breakingnews/BreakingNewsPatch.kt | 18 +++---- .../breakingnews/BreakingNewsResourcePatch.kt | 6 +-- .../fingerprints/BreakingNewsFingerprint.kt | 4 +- .../layout/hide/comments/CommentsPatch.kt | 16 +++--- .../crowdfundingbox/CrowdfundingBoxPatch.kt | 14 ++--- .../CrowdfundingBoxResourcePatch.kt | 6 +-- .../CrowdfundingBoxFingerprint.kt | 4 +- .../endscreencards/HideEndscreenCardsPatch.kt | 18 +++---- .../HideEndscreenCardsResourcePatch.kt | 6 +-- .../fingerprints/LayoutCircleFingerprint.kt | 4 +- .../fingerprints/LayoutIconFingerprint.kt | 4 +- .../fingerprints/LayoutVideoFingerprint.kt | 4 +- .../hide/filterbar/HideFilterBarPatch.kt | 18 +++---- .../filterbar/HideFilterBarResourcePatch.kt | 6 +-- .../FilterBarHeightFingerprint.kt | 6 +-- .../RelatedChipCloudFingerprint.kt | 6 +-- .../SearchResultsChipBarFingerprint.kt | 6 +-- .../HideFloatingMicrophoneButtonPatch.kt | 14 ++--- ...deFloatingMicrophoneButtonResourcePatch.kt | 6 +-- ...ShowFloatingMicrophoneButtonFingerprint.kt | 6 +-- .../DisableFullscreenAmbientModePatch.kt | 17 +++--- .../InitializeAmbientModeFingerprint.kt | 4 +- .../ParseElementFromBufferFingerprint.kt | 6 +-- .../fingerprints/PlayerOverlayFingerprint.kt | 4 +- .../fingerprints/ShowWatermarkFingerprint.kt | 6 ++- .../hide/infocards/HideInfoCardsPatch.kt | 31 +++++------ .../infocards/HideInfocardsResourcePatch.kt | 6 +-- .../InfocardsIncognitoFingerprint.kt | 4 +- .../InfocardsIncognitoParentFingerprint.kt | 2 +- .../InfocardsMethodCallFingerprint.kt | 4 +- .../loadmorebutton/HideLoadMoreButtonPatch.kt | 14 ++--- .../HideLoadMoreButtonResourcePatch.kt | 8 +-- .../HideLoadMoreButtonFingerprint.kt | 6 +-- .../HidePlayerFlyoutMenuPatch.kt | 15 +++--- .../DisableRollingNumberAnimationPatch.kt | 19 +++---- .../layout/hide/seekbar/HideSeekbarPatch.kt | 19 +++---- .../hide/shorts/HideShortsComponentsPatch.kt | 40 +++++++------- .../HideShortsComponentsResourcePatch.kt | 4 +- .../BottomNavigationBarFingerprint.kt | 4 +- .../CreateShortsButtonsFingerprint.kt | 4 +- .../ReelConstructorFingerprint.kt | 8 +-- .../RenderBottomNavigationBarFingerprint.kt | 4 +- ...derBottomNavigationBarParentFingerprint.kt | 4 +- .../SetPivotBarVisibilityFingerprint.kt | 6 +-- .../SetPivotBarVisibilityParentFingerprint.kt | 4 +- .../DisableSuggestedVideoEndScreenPatch.kt | 17 +++--- ...bleSuggestedVideoEndScreenResourcePatch.kt | 6 +-- .../CreateEndScreenViewFingerprint.kt | 8 +-- .../layout/hide/time/HideTimestampPatch.kt | 21 ++++---- .../fingerprints/TimeCounterFingerprint.kt | 6 +-- .../panels/popup/PlayerPopupPanelsPatch.kt | 17 +++--- .../EngagementPanelControllerFingerprint.kt | 6 +-- .../CustomPlayerOverlayOpacityPatch.kt | 10 ++-- ...CustomPlayerOverlayOpacityResourcePatch.kt | 4 +- .../CreatePlayerOverviewFingerprint.kt | 8 +-- .../ReturnYouTubeDislikePatch.kt | 43 ++++++++------- .../ReturnYouTubeDislikeResourcePatch.kt | 8 +-- .../ConversionContextFingerprint.kt | 6 +-- .../fingerprints/DislikeFingerprint.kt | 4 +- .../DislikesOldLayoutTextViewFingerprint.kt | 4 +- .../fingerprints/LikeFingerprint.kt | 4 +- .../fingerprints/RemoveLikeFingerprint.kt | 4 +- ...ingNumberMeasureAnimatedTextFingerprint.kt | 6 +-- ...lingNumberMeasureStaticLabelFingerprint.kt | 6 +-- ...mberMeasureStaticLabelParentFingerprint.kt | 4 +- .../RollingNumberSetterFingerprint.kt | 6 +-- .../RollingNumberTextViewFingerprint.kt | 8 +-- .../fingerprints/ShortsTextViewFingerprint.kt | 12 ++--- .../TextComponentConstructorFingerprint.kt | 4 +- .../TextComponentDataFingerprint.kt | 6 +-- .../TextComponentLookupFingerprint.kt | 4 +- .../layout/searchbar/WideSearchbarPatch.kt | 22 ++++---- .../CreateSearchSuggestionsFingerprint.kt | 6 +-- .../SetWordmarkHeaderFingerprint.kt | 4 +- .../RestoreOldSeekbarThumbnailsPatch.kt | 17 +++--- .../seekbar/SeekbarColorBytecodePatch.kt | 12 ++--- .../FullscreenSeekbarThumbnailsFingerprint.kt | 4 +- .../PlayerSeekbarColorFingerprint.kt | 10 ++-- .../SetSeekbarClickedColorFingerprint.kt | 4 +- .../ShortsSeekbarColorFingerprint.kt | 2 +- .../sponsorblock/SponsorBlockBytecodePatch.kt | 48 +++++++++-------- .../sponsorblock/SponsorBlockResourcePatch.kt | 2 +- .../fingerprints/AppendTimeFingerprint.kt | 6 +-- .../ControlsOverlayFingerprint.kt | 6 +-- .../RectangleFieldInvalidatorFingerprint.kt | 5 +- .../spoofappversion/SpoofAppVersionPatch.kt | 19 +++---- .../SpoofAppVersionFingerprint.kt | 9 ++-- .../layout/startpage/ChangeStartPagePatch.kt | 14 ++--- .../fingerprints/StartActivityFingerprint.kt | 2 +- .../DisableResumingShortsOnStartupPatch.kt | 23 ++++---- .../UserWasInShortsFingerprint.kt | 2 +- .../layout/tablet/EnableTabletLayoutPatch.kt | 10 ++-- .../fingerprints/GetFormFactorFingerprint.kt | 6 +-- .../tabletminiplayer/TabletMiniPlayerPatch.kt | 22 ++++---- ...erDimensionsCalculatorParentFingerprint.kt | 4 +- .../MiniPlayerOverrideFingerprint.kt | 4 +- .../MiniPlayerOverrideNoContextFingerprint.kt | 5 +- ...PlayerResponseModelSizeCheckFingerprint.kt | 4 +- .../layout/theme/LithoColorHookPatch.kt | 16 +++--- .../layout/theme/ThemeBytecodePatch.kt | 20 +++---- .../fingerprints/LithoThemeFingerprint.kt | 6 +-- .../UseGradientLoadingScreenFingerprint.kt | 4 +- .../MessageDigestImageUrlFingerprint.kt | 4 +- .../MessageDigestImageUrlParentFingerprint.kt | 4 +- .../fingerprints/cronet/RequestFingerprint.kt | 4 +- .../request/callback/OnFailureFingerprint.kt | 6 +-- .../callback/OnResponseStartedFingerprint.kt | 8 +-- .../callback/OnSucceededFingerprint.kt | 6 +-- .../misc/announcements/AnnouncementsPatch.kt | 9 ++-- .../misc/autorepeat/AutoRepeatPatch.kt | 36 ++++++------- .../fingerprints/AutoRepeatFingerprint.kt | 4 +- .../AutoRepeatParentFingerprint.kt | 6 +-- .../bottomsheet/hook/BottomSheetHookPatch.kt | 0 .../hook/BottomSheetHookResourcePatch.kt | 0 .../CreateBottomSheetFingerprint.kt | 0 .../spoof/SpoofDeviceDimensionsPatch.kt | 18 +++---- ...eviceDimensionsModelToStringFingerprint.kt | 2 +- .../FixBackToExitGesturePatch.kt | 25 +++++---- .../fingerprints/OnBackPressedFingerprint.kt | 14 ++--- .../RecyclerViewScrollingFingerprint.kt | 4 +- .../RecyclerViewTopScrollingFingerprint.kt | 9 ++-- ...cyclerViewTopScrollingParentFingerprint.kt | 4 +- .../misc/fix/playback/ClientSpoofPatch.kt | 24 ++++----- ...ayerResponseModelImplGeneralFingerprint.kt | 8 +-- ...rResponseModelImplLiveStreamFingerprint.kt | 6 +-- ...nseModelImplRecommendedLevelFingerprint.kt | 8 +-- .../ScrubbedPreviewLayoutFingerprint.kt | 4 +- ...dererDecoderRecommendedLevelFingerprint.kt | 4 +- ...toryboardRendererDecoderSpecFingerprint.kt | 2 +- .../StoryboardThumbnailFingerprint.kt | 2 +- .../StoryboardThumbnailParentFingerprint.kt | 2 +- .../UserAgentHeaderBuilderFingerprint.kt | 2 +- .../patches/youtube/misc/gms/Constants.kt | 2 +- .../youtube/misc/gms/GmsCoreSupportPatch.kt | 16 +++--- .../misc/gms/GmsCoreSupportResourcePatch.kt | 7 ++- .../CastDynamiteModuleFingerprint.kt | 5 +- .../CastDynamiteModuleV2Fingerprint.kt | 5 +- .../GooglePlayUtilityFingerprint.kt | 4 +- .../fingerprints/PrimeMethodFingerprint.kt | 5 +- .../fingerprints/ServiceCheckFingerprint.kt | 4 +- .../APIPlayerServiceFingerprint.kt | 4 +- .../ApplicationInitFingerprint.kt | 2 +- ...mbeddedPlayerControlsOverlayFingerprint.kt | 4 +- .../fingerprints/EmbeddedPlayerFingerprint.kt | 4 +- .../RemoteEmbedFragmentFingerprint.kt | 4 +- .../RemoteEmbeddedPlayerFingerprint.kt | 4 +- .../StandalonePlayerActivityFingerprint.kt | 6 +-- .../misc/links/BypassURLRedirectsPatch.kt | 22 ++++---- .../misc/links/OpenLinksExternallyPatch.kt | 22 ++++---- .../fingerprints/ABUriParserFingerprint.kt | 6 +-- .../fingerprints/HTTPUriParserFingerprint.kt | 6 +-- .../misc/litho/filter/LithoFilterPatch.kt | 24 +++++---- .../ComponentContextParserFingerprint.kt | 4 +- .../EmptyComponentBuilderFingerprint.kt | 4 +- .../ProtobufBufferReferenceFingerprint.kt | 6 +-- .../ReadComponentIdentifierFingerprint.kt | 6 +-- .../misc/microg/MicroGBytecodePatch.kt | 0 .../CastContextFetchFingerprint.kt | 0 .../MinimizedPlaybackPatch.kt | 24 ++++----- ...izedPlaybackPolicyControllerFingerprint.kt | 4 +- .../MinimizedPlaybackManagerFingerprint.kt | 6 +-- .../MinimizedPlaybackSettingsFingerprint.kt | 2 +- ...imizedPlaybackSettingsParentFingerprint.kt | 2 +- .../PlayerControlsBytecodePatch.kt | 15 +++--- .../BottomControlsInflateFingerprint.kt | 6 +-- .../PlayerControlsVisibilityFingerprint.kt | 4 +- .../playeroverlay/PlayerOverlaysHookPatch.kt | 17 +++--- ...layerOverlaysOnFinishInflateFingerprint.kt | 3 +- .../misc/playertype/PlayerTypeHookPatch.kt | 10 ++-- .../fingerprint/PlayerTypeFingerprint.kt | 4 +- .../fingerprint/VideoStateFingerprint.kt | 4 +- .../RemoveTrackingQueryParameterPatch.kt | 27 +++++----- .../fingerprints/CopyTextFingerprint.kt | 6 +-- .../SystemShareSheetFingerprint.kt | 6 +-- .../YouTubeShareSheetFingerprint.kt | 4 +- .../hook/RecyclerViewTreeHookPatch.kt | 11 ++-- .../RecyclerViewTreeObserverFingerprint.kt | 6 +-- .../youtube/misc/settings/SettingsPatch.kt | 2 + .../LicenseActivityOnCreateFingerprint.kt | 4 +- .../fingerprints/SetThemeFingerprint.kt | 2 +- .../misc/zoomhaptics/ZoomHapticsPatch.kt | 10 ++-- .../fingerprints/ZoomHapticsFingerprint.kt | 6 +-- .../LayoutConstructorFingerprint.kt | 4 +- .../fingerprints/MainActivityFingerprint.kt | 8 +-- ...umberTextViewAnimationUpdateFingerprint.kt | 4 +- .../shared/fingerprints/SeekbarFingerprint.kt | 5 +- .../fingerprints/SeekbarOnDrawFingerprint.kt | 4 +- .../video/hdrbrightness/HDRBrightnessPatch.kt | 17 +++--- .../fingerprints/HDRBrightnessFingerprint.kt | 2 +- .../information/VideoInformationPatch.kt | 29 ++++++----- .../CreateVideoPlayerSeekbarFingerprint.kt | 5 +- .../OnPlaybackSpeedItemClickFingerprint.kt | 6 +-- ...erControllerSetTimeReferenceFingerprint.kt | 6 +-- .../fingerprints/PlayerInitFingerprint.kt | 5 +- .../fingerprints/SeekFingerprint.kt | 5 +- .../fingerprints/VideoLengthFingerprint.kt | 8 ++- .../PlayerResponseMethodHookPatch.kt | 13 ++--- .../PlayerParameterBuilderFingerprint.kt | 6 +-- .../quality/RememberVideoQualityPatch.kt | 33 ++++++------ .../NewVideoQualityChangedFingerprint.kt | 4 +- ...dexMethodClassFieldReferenceFingerprint.kt | 4 +- ...ideoQualityItemOnClickParentFingerprint.kt | 4 +- .../VideoQualitySetterFingerprint.kt | 2 +- .../speed/custom/CustomPlaybackSpeedPatch.kt | 29 ++++++----- .../CustomPlaybackSpeedResourcePatch.kt | 2 +- .../GetOldPlaybackSpeedsFingerprint.kt | 2 +- .../ShowOldPlaybackSpeedMenuFingerprint.kt | 2 +- ...laybackSpeedMenuIntegrationsFingerprint.kt | 2 +- .../SpeedArrayGeneratorFingerprint.kt | 2 +- .../remember/RememberPlaybackSpeedPatch.kt | 15 +++--- ...nitializePlaybackSpeedValuesFingerprint.kt | 4 +- .../youtube/video/videoid/VideoIdPatch.kt | 17 +++--- .../videoid/fingerprint/VideoIdFingerprint.kt | 2 +- .../RestoreOldVideoQualityMenuPatch.kt | 22 ++++---- ...RestoreOldVideoQualityMenuResourcePatch.kt | 4 +- .../VideoQualityMenuViewInflateFingerprint.kt | 6 +-- .../youtubevanced/ad/general/HideAdsPatch.kt | 10 ++-- .../fingerprints/ContainsAdFingerprint.kt | 8 +-- .../misc/unlockpremium/UnlockPremiumPatch.kt | 10 ++-- .../fingerprints/IsPremiumFingerprint.kt | 2 +- .../YukaUserConstructorFingerprint.kt | 4 +- .../kotlin/app/revanced/util/BytecodeUtils.kt | 38 +++++++------- .../util/microg/MicroGBytecodeHelper.kt | 0 .../util/microg/MicroGResourceHelper.kt | 0 .../util/patch/LiteralValueFingerprint.kt | 8 +-- .../revanced/util/resource/ArrayResource.kt | 10 ++-- .../revanced/util/resource/BaseResource.kt | 4 +- .../revanced/util/resource/StringResource.kt | 3 +- 563 files changed, 2281 insertions(+), 2207 deletions(-) rename src/main/kotlin/app/revanced/patches/inshorts/ad/{InshortsAdsPatch.kt => HideAdsPatch.kt} (88%) delete mode 100644 src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/AbstractClientIdFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/GetHttpBasicAuthHeaderFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt rename src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/{UnlockThemePatch.kt => UnlockThemesPatch.kt} (90%) rename src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/{RememberClearModePatch.kt => RememberClearDisplayPatch.kt} (94%) rename src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/{GetCertMessagingFingerprint.kt => GetMessagingCertFingerprint.kt} (89%) rename src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/{GetCertRegistrationFingerprint.kt => GetRegistrationCertFingerprint.kt} (72%) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/BottomSheetHookPatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/BottomSheetHookResourcePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/fingerprints/CreateBottomSheetFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/microg/MicroGBytecodePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/microg/fingerprints/CastContextFetchFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/util/microg/MicroGBytecodeHelper.kt delete mode 100644 src/main/kotlin/app/revanced/util/microg/MicroGResourceHelper.kt diff --git a/api/revanced-patches.api b/api/revanced-patches.api index f0d4cd1a33..dd26567291 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -314,8 +314,8 @@ public final class app/revanced/patches/music/interaction/permanentrepeat/Perman public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/music/interaction/permanentshuffle/PermanentShuffleTogglePatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/music/interaction/permanentshuffle/PermanentShuffleTogglePatch; +public final class app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } @@ -894,8 +894,8 @@ public final class app/revanced/patches/strava/upselling/DisableSubscriptionSugg public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/ticktick/misc/themeunlock/UnlockProPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/ticktick/misc/themeunlock/UnlockProPatch; +public final class app/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } diff --git a/src/main/kotlin/app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch.kt b/src/main/kotlin/app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch.kt index 3f79c29e9f..73fa0d7e19 100644 --- a/src/main/kotlin/app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch.kt +++ b/src/main/kotlin/app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch.kt @@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction name = "Spoof Wi-Fi connection", description = "Spoofs an existing Wi-Fi connection.", use = false, - requiresIntegrations = true + requiresIntegrations = true, ) @Suppress("unused") object SpoofWifiPatch : BaseTransformInstructionsPatch() { @@ -25,12 +25,12 @@ object SpoofWifiPatch : BaseTransformInstructionsPatch() { classDef: ClassDef, method: Method, instruction: Instruction, - instructionIndex: Int + instructionIndex: Int, ) = filterMapInstruction35c( INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX, classDef, instruction, - instructionIndex + instructionIndex, ) override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) { @@ -38,14 +38,13 @@ object SpoofWifiPatch : BaseTransformInstructionsPatch() { methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex) } - // Information about method calls we want to replace private enum class MethodCall( override val definedClassName: String, override val methodName: String, override val methodParams: Array, override val returnType: String, - ): IMethodCall { + ) : IMethodCall { GetSystemService1( "Landroid/content/Context;", "getSystemService", @@ -201,6 +200,6 @@ object SpoofWifiPatch : BaseTransformInstructionsPatch() { "unregisterNetworkCallback", arrayOf("Landroid/app/PendingIntent;"), "V", - ); + ), } } diff --git a/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt b/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt index 5736ff247e..5b9a1d7526 100644 --- a/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt +++ b/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt @@ -33,48 +33,50 @@ interface IMethodCall { definingClassDescriptor: String, method: MutableMethod, instruction: Instruction35c, - instructionIndex: Int + instructionIndex: Int, ) { val registers = arrayOf( instruction.registerC, instruction.registerD, instruction.registerE, instruction.registerF, - instruction.registerG + instruction.registerG, ) val argsNum = methodParams.size + 1 // + 1 for instance of definedClassName if (argsNum > registers.size) { // should never happen, but just to be sure (also for the future) a safety check throw RuntimeException( - "Not enough registers for ${definedClassName}#${methodName}: " + - "Required $argsNum registers, but only got ${registers.size}." + "Not enough registers for $definedClassName#$methodName: " + + "Required $argsNum registers, but only got ${registers.size}.", ) } - val args = registers.take(argsNum).joinToString(separator = ", ") { reg -> "v${reg}" } + val args = registers.take(argsNum).joinToString(separator = ", ") { reg -> "v$reg" } val replacementMethodDefinition = - "${methodName}(${definedClassName}${methodParams.joinToString(separator = "")})${returnType}" + "$methodName(${definedClassName}${methodParams.joinToString(separator = "")})$returnType" method.replaceInstruction( instructionIndex, - "invoke-static { $args }, ${definingClassDescriptor}->${replacementMethodDefinition}" + "invoke-static { $args }, $definingClassDescriptor->$replacementMethodDefinition", ) } } -inline fun fromMethodReference(methodReference: MethodReference) +inline fun fromMethodReference( + methodReference: MethodReference, +) where E : Enum, E : IMethodCall = enumValues().firstOrNull { search -> - search.definedClassName == methodReference.definingClass - && search.methodName == methodReference.name - && methodReference.parameterTypes.toTypedArray().contentEquals(search.methodParams) - && search.returnType == methodReference.returnType + search.definedClassName == methodReference.definingClass && + search.methodName == methodReference.name && + methodReference.parameterTypes.toTypedArray().contentEquals(search.methodParams) && + search.returnType == methodReference.returnType } inline fun filterMapInstruction35c( integrationsClassDescriptorPrefix: String, classDef: ClassDef, instruction: Instruction, - instructionIndex: Int + instructionIndex: Int, ): Instruction35cInfo? where E : Enum, E : IMethodCall { if (classDef.type.startsWith(integrationsClassDescriptorPrefix)) { // avoid infinite recursion diff --git a/src/main/kotlin/app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch.kt b/src/main/kotlin/app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch.kt index b3afc3d6eb..9ca09020cd 100644 --- a/src/main/kotlin/app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch.kt @@ -15,20 +15,21 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction description = "Removes the restriction of capturing audio from apps that normally wouldn't allow it.", dependencies = [RemoveCaptureRestrictionResourcePatch::class], use = false, - requiresIntegrations = true + requiresIntegrations = true, ) @Suppress("unused") object RemoveCaptureRestrictionPatch : BaseTransformInstructionsPatch() { private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/integrations/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch" private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;" + // Information about method calls we want to replace enum class MethodCall( override val definedClassName: String, override val methodName: String, override val methodParams: Array, - override val returnType: String - ): IMethodCall { + override val returnType: String, + ) : IMethodCall { SetAllowedCapturePolicySingle( "Landroid/media/AudioAttributes\$Builder;", "setAllowedCapturePolicy", @@ -40,19 +41,19 @@ object RemoveCaptureRestrictionPatch : BaseTransformInstructionsPatch( INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX, classDef, instruction, - instructionIndex + instructionIndex, ) override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) { diff --git a/src/main/kotlin/app/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch.kt b/src/main/kotlin/app/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch.kt index 0667ed0f57..cfc90cd8ab 100644 --- a/src/main/kotlin/app/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch.kt @@ -24,7 +24,7 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference @Suppress("unused") object RemoveScreenshotRestrictionPatch : BaseTransformInstructionsPatch() { private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = - "Lapp/revanced/integrations/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch" + "Lapp/revanced/integrations/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch" private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;" override fun execute(context: BytecodeContext) { @@ -36,12 +36,12 @@ object RemoveScreenshotRestrictionPatch : BaseTransformInstructionsPatch( INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX, classDef, instruction, - instructionIndex + instructionIndex, ) override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) { @@ -54,8 +54,8 @@ object RemoveScreenshotRestrictionPatch : BaseTransformInstructionsPatch, - override val returnType: String - ): IMethodCall { + override val returnType: String, + ) : IMethodCall { AddFlags( "Landroid/view/Window;", "addFlags", @@ -67,7 +67,7 @@ object RemoveScreenshotRestrictionPatch : BaseTransformInstructionsPatch? { if (instruction.opcode != Opcode.IPUT) { return null @@ -85,9 +85,10 @@ private class ModifyLayoutParamsFlags : BaseTransformInstructionsPatch>( title, "ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.", false, - validator = { it: String? -> it == null || it.uppercase() in countries.values } + validator = { it: String? -> it == null || it.uppercase() in countries.values }, ) override fun filterMap( classDef: ClassDef, method: Method, instruction: Instruction, - instructionIndex: Int + instructionIndex: Int, ): Pair? { if (instruction !is ReferenceInstruction) return null @@ -73,12 +72,12 @@ object SpoofSimCountryPatch : BaseTransformInstructionsPatch>( override fun transform( mutableMethod: MutableMethod, - entry: Pair + entry: Pair, ) = transformMethodCall(entry, mutableMethod) private fun transformMethodCall( entry: Pair, - mutableMethod: MutableMethod + mutableMethod: MutableMethod, ) { val (instructionIndex, methodCallValue) = entry @@ -86,28 +85,28 @@ object SpoofSimCountryPatch : BaseTransformInstructionsPatch>( mutableMethod.replaceInstruction( instructionIndex + 1, - "const-string v$register, \"$methodCallValue\"" + "const-string v$register, \"$methodCallValue\"", ) } private enum class MethodCall( - val reference: MethodReference + val reference: MethodReference, ) { NetworkCountryIso( ImmutableMethodReference( - "Landroid/telephony/TelephonyManager;", - "getNetworkCountryIso", - emptyList(), - "Ljava/lang/String;" - ) + "Landroid/telephony/TelephonyManager;", + "getNetworkCountryIso", + emptyList(), + "Ljava/lang/String;", + ), ), SimCountryIso( ImmutableMethodReference( - "Landroid/telephony/TelephonyManager;", - "getSimCountryIso", - emptyList(), - "Ljava/lang/String;" - ) - ) + "Landroid/telephony/TelephonyManager;", + "getSimCountryIso", + emptyList(), + "Ljava/lang/String;", + ), + ), } } diff --git a/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/ProUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/ProUnlockPatch.kt index d6351172f0..dd16c4c69d 100644 --- a/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/ProUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/ProUnlockPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.backdrops.misc.pro -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -8,15 +7,16 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Pro unlock", - compatiblePackages = [CompatiblePackage("com.backdrops.wallpapers", ["4.52"])] + compatiblePackages = [CompatiblePackage("com.backdrops.wallpapers", ["4.52"])], ) @Suppress("unused") object ProUnlockPatch : BytecodePatch( - setOf(ProUnlockFingerprint) + setOf(ProUnlockFingerprint), ) { override fun execute(context: BytecodeContext) { ProUnlockFingerprint.result?.let { result -> @@ -28,10 +28,9 @@ object ProUnlockPatch : BytecodePatch( result.scanResult.patternScanResult!!.endIndex, """ const/4 v$register, 0x1 - """ + """, ) } - } ?: throw ProUnlockFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/fingerprints/ProUnlockFingerprint.kt b/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/fingerprints/ProUnlockFingerprint.kt index 8be75daff4..f1a615be8c 100644 --- a/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/fingerprints/ProUnlockFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/backdrops/misc/pro/fingerprints/ProUnlockFingerprint.kt @@ -9,10 +9,10 @@ internal object ProUnlockFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT, - Opcode.IF_EQZ + Opcode.IF_EQZ, ), customFingerprint = { methodDef, _ -> - methodDef.definingClass == "Lcom/backdrops/wallpapers/data/local/DatabaseHandlerIAB;" - && methodDef.name == "lambda\$existPurchase\$0" - } -) \ No newline at end of file + methodDef.definingClass == "Lcom/backdrops/wallpapers/data/local/DatabaseHandlerIAB;" && + methodDef.name == "lambda\$existPurchase\$0" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/candylinkvpn/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/candylinkvpn/UnlockProPatch.kt index 3a878ddf7c..15f85dc29c 100644 --- a/src/main/kotlin/app/revanced/patches/candylinkvpn/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/candylinkvpn/UnlockProPatch.kt @@ -1,20 +1,20 @@ package app.revanced.patches.candylinkvpn -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.candylinkvpn.fingerprints.IsPremiumPurchasedFingerprint +import app.revanced.util.exception @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("com.candylink.openvpn")] + compatiblePackages = [CompatiblePackage("com.candylink.openvpn")], ) @Suppress("unused") object UnlockProPatch : BytecodePatch( - setOf(IsPremiumPurchasedFingerprint) + setOf(IsPremiumPurchasedFingerprint), ) { override fun execute(context: BytecodeContext) { IsPremiumPurchasedFingerprint.result?.mutableMethod?.addInstructions( @@ -22,7 +22,7 @@ object UnlockProPatch : BytecodePatch( """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw IsPremiumPurchasedFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/candylinkvpn/fingerprints/IsPremiumPurchasedFingerprint.kt b/src/main/kotlin/app/revanced/patches/candylinkvpn/fingerprints/IsPremiumPurchasedFingerprint.kt index b53b85af8d..00242d7c58 100644 --- a/src/main/kotlin/app/revanced/patches/candylinkvpn/fingerprints/IsPremiumPurchasedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/candylinkvpn/fingerprints/IsPremiumPurchasedFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object IsPremiumPurchasedFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PreferenceProvider;") && - methodDef.name == "isPremiumPurchased" - } -) \ No newline at end of file + methodDef.name == "isPremiumPurchased" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt index 41d5adfcc3..1d37b1093c 100644 --- a/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt +++ b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt @@ -1,24 +1,24 @@ package app.revanced.patches.cieid.restrictions.root -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.cieid.restrictions.root.fingerprints.CheckRootFingerprint +import app.revanced.util.exception @Patch( name = "Bypass root checks", description = "Removes the restriction to use the app with root permissions or on a custom ROM.", - compatiblePackages = [CompatiblePackage("it.ipzs.cieid")] + compatiblePackages = [CompatiblePackage("it.ipzs.cieid")], ) @Suppress("unused") object BypassRootChecksPatch : BytecodePatch( - setOf(CheckRootFingerprint) + setOf(CheckRootFingerprint), ) { override fun execute(context: BytecodeContext) { CheckRootFingerprint.result?.mutableMethod?.addInstruction(1, "return-void") ?: throw CheckRootFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt index 76cbebf358..fcc616001c 100644 --- a/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object CheckRootFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lit/ipzs/cieid/BaseActivity;" && methodDef.name == "onResume" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt b/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt index f34b7465df..51b27d48bb 100644 --- a/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.facebook.ads.story -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch @@ -8,15 +7,16 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.facebook.ads.story.fingerprints.AdsInsertionFingerprint import app.revanced.patches.facebook.ads.story.fingerprints.FetchMoreAdsFingerprint +import app.revanced.util.exception @Patch( name = "Hide story ads", description = "Hides the ads in the Facebook app stories.", - compatiblePackages = [CompatiblePackage("com.facebook.katana")] + compatiblePackages = [CompatiblePackage("com.facebook.katana")], ) @Suppress("unused") object HideStoryAdsPatch : BytecodePatch( - setOf(FetchMoreAdsFingerprint, AdsInsertionFingerprint) + setOf(FetchMoreAdsFingerprint, AdsInsertionFingerprint), ) { override fun execute(context: BytecodeContext) = setOf(FetchMoreAdsFingerprint, AdsInsertionFingerprint).forEach { fingerprint -> diff --git a/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/AdsInsertionFingerprint.kt b/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/AdsInsertionFingerprint.kt index e57e169fe4..138d3eab6f 100644 --- a/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/AdsInsertionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/AdsInsertionFingerprint.kt @@ -1,3 +1,3 @@ package app.revanced.patches.facebook.ads.story.fingerprints -internal object AdsInsertionFingerprint : FieldMethodFingerprint(fieldValue = "AdBucketDataSourceUtil\$attemptAdsInsertion\$1") \ No newline at end of file +internal object AdsInsertionFingerprint : FieldMethodFingerprint(fieldValue = "AdBucketDataSourceUtil\$attemptAdsInsertion\$1") diff --git a/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/FieldMethodFingerprint.kt b/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/FieldMethodFingerprint.kt index 923f654c87..fa72e2f58d 100644 --- a/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/FieldMethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/facebook/ads/story/fingerprints/FieldMethodFingerprint.kt @@ -11,5 +11,5 @@ internal abstract class FieldMethodFingerprint(fieldValue: String) : MethodFinge if (field.name != "__redex_internal_original_name") return@any false (field.initialValue as? StringEncodedValue)?.value == fieldValue } - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt index c3e13bb4c6..a6ba817275 100644 --- a/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.finanzonline.detection.bootloader -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -8,16 +7,16 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.BootStateFingerprint import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.CreateKeyFingerprint - +import app.revanced.util.exception @Patch( name = "Remove bootloader detection", description = "Removes the check for an unlocked bootloader.", - compatiblePackages = [CompatiblePackage("at.gv.bmf.bmf2go")] + compatiblePackages = [CompatiblePackage("at.gv.bmf.bmf2go")], ) @Suppress("unused") object BootloaderDetectionPatch : BytecodePatch( - setOf(CreateKeyFingerprint, BootStateFingerprint) + setOf(CreateKeyFingerprint, BootStateFingerprint), ) { override fun execute(context: BytecodeContext) { arrayOf(CreateKeyFingerprint, BootStateFingerprint).forEach { fingerprint -> @@ -26,7 +25,7 @@ object BootloaderDetectionPatch : BytecodePatch( """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw fingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/BootStateFingerprint.kt b/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/BootStateFingerprint.kt index f76ab78aa9..6f3fffd062 100644 --- a/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/BootStateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/BootStateFingerprint.kt @@ -25,6 +25,6 @@ internal object BootStateFingerprint : MethodFingerprint( Opcode.IF_NE, Opcode.GOTO, Opcode.MOVE, - Opcode.RETURN - ) + Opcode.RETURN, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/CreateKeyFingerprint.kt b/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/CreateKeyFingerprint.kt index 5af1866f75..8c782ea385 100644 --- a/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/CreateKeyFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/fingerprints/CreateKeyFingerprint.kt @@ -7,5 +7,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object CreateKeyFingerprint : MethodFingerprint( "Z", accessFlags = AccessFlags.PUBLIC.value, - strings = listOf("attestation", "SHA-256", "random", "EC", "AndroidKeyStore") + strings = listOf("attestation", "SHA-256", "random", "EC", "AndroidKeyStore"), ) diff --git a/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt index c03c73abdc..af43f14eb5 100644 --- a/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt @@ -1,21 +1,21 @@ package app.revanced.patches.finanzonline.detection.root -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.finanzonline.detection.root.fingerprints.RootDetectionFingerprint +import app.revanced.util.exception @Patch( name = "Remove root detection", description = "Removes the check for root permissions.", - compatiblePackages = [CompatiblePackage("at.gv.bmf.bmf2go")] + compatiblePackages = [CompatiblePackage("at.gv.bmf.bmf2go")], ) @Suppress("unused") object RootDetectionPatch : BytecodePatch( - setOf(RootDetectionFingerprint) + setOf(RootDetectionFingerprint), ) { override fun execute(context: BytecodeContext) { RootDetectionFingerprint.result?.mutableMethod?.addInstructions( @@ -23,7 +23,7 @@ object RootDetectionPatch : BytecodePatch( """ sget-object v0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean; return-object v0 - """ + """, ) ?: throw RootDetectionFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/fingerprints/RootDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/fingerprints/RootDetectionFingerprint.kt index 50c7f76a8e..1b74f29354 100644 --- a/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/fingerprints/RootDetectionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/fingerprints/RootDetectionFingerprint.kt @@ -17,6 +17,6 @@ internal object RootDetectionFingerprint : MethodFingerprint( Opcode.MOVE_RESULT, Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, - Opcode.RETURN_OBJECT - ) + Opcode.RETURN_OBJECT, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt b/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt index da0c9ac0d7..35c4ae5545 100644 --- a/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt +++ b/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt @@ -1,6 +1,5 @@ package app.revanced.patches.googlerecorder.restrictions -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,16 +8,17 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.googlerecorder.restrictions.fingerprints.OnApplicationCreateFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Remove device restrictions", description = "Removes restrictions from using the app on any device. Requires mounting patched app over original.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.recorder")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.recorder")], ) @Suppress("unused") object RemoveDeviceRestrictions : BytecodePatch( - setOf(OnApplicationCreateFingerprint) + setOf(OnApplicationCreateFingerprint), ) { override fun execute(context: BytecodeContext) { OnApplicationCreateFingerprint.result?.let { diff --git a/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/fingerprints/OnApplicationCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/fingerprints/OnApplicationCreateFingerprint.kt index 13494fe2d1..6d0c7e5f3b 100644 --- a/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/fingerprints/OnApplicationCreateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/fingerprints/OnApplicationCreateFingerprint.kt @@ -8,5 +8,5 @@ internal object OnApplicationCreateFingerprint : MethodFingerprint( if (methodDef.name != "onCreate") return@custom false classDef.type.endsWith("RecorderApplication;") - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt b/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt index b0f092002d..e717d23f62 100644 --- a/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt @@ -1,26 +1,26 @@ package app.revanced.patches.hexeditor.ad -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint +import app.revanced.util.exception @Patch( name = "Disable ads", - compatiblePackages = [CompatiblePackage("com.myprog.hexedit")] + compatiblePackages = [CompatiblePackage("com.myprog.hexedit")], ) @Suppress("unused") object DisableAdsPatch : BytecodePatch( - setOf(PrimaryAdsFingerprint) + setOf(PrimaryAdsFingerprint), ) { override fun execute(context: BytecodeContext) = PrimaryAdsFingerprint.result?.mutableMethod?.replaceInstructions( 0, """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw PrimaryAdsFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/hexeditor/ad/fingerprints/PrimaryAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/hexeditor/ad/fingerprints/PrimaryAdsFingerprint.kt index 317b676d54..a38d01115a 100644 --- a/src/main/kotlin/app/revanced/patches/hexeditor/ad/fingerprints/PrimaryAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/hexeditor/ad/fingerprints/PrimaryAdsFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object PrimaryAdsFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PreferencesHelper;") && methodDef.name == "isAdsDisabled" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt index 4077d9a816..c4e826bb6c 100644 --- a/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt @@ -9,11 +9,11 @@ import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerp @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio", ["2.2 build 016"])] + compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio", ["2.2 build 016"])], ) @Suppress("unused") object UnlockProPatch : BytecodePatch( - setOf(CheckProFingerprint) + setOf(CheckProFingerprint), ) { override fun execute(context: BytecodeContext) { val method = CheckProFingerprint.result!!.mutableMethod @@ -22,7 +22,7 @@ object UnlockProPatch : BytecodePatch( """ const/4 v0, 0x1 return v0 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/fingerprints/CheckProFingerprint.kt b/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/fingerprints/CheckProFingerprint.kt index 84b8a7ecaf..134b05104e 100644 --- a/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/fingerprints/CheckProFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/fingerprints/CheckProFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object CheckProFingerprint : MethodFingerprint( "Z", - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("IPSPurchaseRepository;")} + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("IPSPurchaseRepository;") }, ) diff --git a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt index 2b720d3b21..4ef7701b05 100644 --- a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt @@ -12,15 +12,15 @@ import app.revanced.util.returnEarly @Patch( name = "Remove root detection", description = "Removes the check for root permissions and unlocked bootloader.", - compatiblePackages = [CompatiblePackage("at.gv.oe.app")] + compatiblePackages = [CompatiblePackage("at.gv.oe.app")], ) @Suppress("unused") object RootDetectionPatch : BytecodePatch( - setOf(AttestationSupportedCheckFingerprint, BootloaderCheckFingerprint, RootCheckFingerprint) + setOf(AttestationSupportedCheckFingerprint, BootloaderCheckFingerprint, RootCheckFingerprint), ) { override fun execute(context: BytecodeContext) = listOf( AttestationSupportedCheckFingerprint, BootloaderCheckFingerprint, - RootCheckFingerprint + RootCheckFingerprint, ).returnEarly(true) } diff --git a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/AttestationSupportedCheckFingerprint.kt b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/AttestationSupportedCheckFingerprint.kt index a03115d395..cd5efa2153 100644 --- a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/AttestationSupportedCheckFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/AttestationSupportedCheckFingerprint.kt @@ -8,6 +8,6 @@ internal object AttestationSupportedCheckFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, customFingerprint = { methodDef, _ -> methodDef.name == "attestationSupportCheck" && - methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") - } + methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") + }, ) diff --git a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/BootloaderCheckFingerprint.kt b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/BootloaderCheckFingerprint.kt index f400d85335..5d8c157e3c 100644 --- a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/BootloaderCheckFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/BootloaderCheckFingerprint.kt @@ -8,6 +8,6 @@ internal object BootloaderCheckFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, customFingerprint = { methodDef, _ -> methodDef.name == "bootloaderCheck" && - methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") - } + methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") + }, ) diff --git a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/RootCheckFingerprint.kt b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/RootCheckFingerprint.kt index 5a36bcbd43..f3f48848e2 100644 --- a/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/RootCheckFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/idaustria/detection/root/fingerprints/RootCheckFingerprint.kt @@ -8,6 +8,6 @@ internal object RootCheckFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, customFingerprint = { methodDef, _ -> methodDef.name == "rootCheck" && - methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") - } + methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") + }, ) diff --git a/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt b/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt index ae427b7441..93cc781389 100644 --- a/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt @@ -10,24 +10,24 @@ import app.revanced.patches.idaustria.detection.signature.fingerprints.SpoofSign @Patch( name = "Spoof signature", description = "Spoofs the signature of the app.", - compatiblePackages = [CompatiblePackage("at.gv.oe.app")] + compatiblePackages = [CompatiblePackage("at.gv.oe.app")], ) @Suppress("unused") object SpoofSignaturePatch : BytecodePatch( - setOf(SpoofSignatureFingerprint) + setOf(SpoofSignatureFingerprint), ) { private const val EXPECTED_SIGNATURE = "OpenSSLRSAPublicKey{modulus=ac3e6fd6050aa7e0d6010ae58190404cd89a56935b44f6fee" + - "067c149768320026e10b24799a1339e414605e448e3f264444a327b9ae292be2b62ad567dd1800dbed4a88f718a33dc6db6b" + - "f5178aa41aa0efff8a3409f5ca95dbfccd92c7b4298966df806ea7a0204a00f0e745f6d9f13bdf24f3df715d7b62c1600906" + - "15de1c8a956b9286764985a3b3c060963c435fb9481a5543aaf0671fc2dba6c5c2b17d1ef1d85137f14dc9bbdf3490288087" + - "324cd48341cce64fabf6a9b55d1a7bf23b2fcdff451fd85bf0c7feb0a5e884d7c5c078e413149566a12a686e6efa70ae5161" + - "a0201307692834cda336c55157fef125e67c01c1359886f94742105596b42a790404bbcda5dad6a65f115aaff5e45ef3c28b" + - "2316ff6cef07aa49a45aa58c07bf258051b13ef449ccb37a3679afd5cfb9132f70bb9d931a937897544f90c3bcc80ed012e9" + - "f6ba020b8cdc23f8c29ac092b88f0e370ff9434e4f0f359e614ae0868dc526fa41e4b7596533e8d10279b66e923ecd9f0b20" + - "0def55be2c1f6f9c72c92fb45d7e0a9ac571cb38f0a9a37bb33ea06f223fde8c7a92e8c47769e386f9799776e8f110c21df2" + - "77ef1be61b2c01ebdabddcbf53cc4b6fd9a3c445606ee77b3758162c80ad8f8137b3c6864e92db904807dcb2be9d7717dd21" + - "bf42c121d620ddfb7914f7a95c713d9e1c1b7bdb4a03d618e40cf7e9e235c0b5687e03b7ab3,publicExponent=10001}" + "067c149768320026e10b24799a1339e414605e448e3f264444a327b9ae292be2b62ad567dd1800dbed4a88f718a33dc6db6b" + + "f5178aa41aa0efff8a3409f5ca95dbfccd92c7b4298966df806ea7a0204a00f0e745f6d9f13bdf24f3df715d7b62c1600906" + + "15de1c8a956b9286764985a3b3c060963c435fb9481a5543aaf0671fc2dba6c5c2b17d1ef1d85137f14dc9bbdf3490288087" + + "324cd48341cce64fabf6a9b55d1a7bf23b2fcdff451fd85bf0c7feb0a5e884d7c5c078e413149566a12a686e6efa70ae5161" + + "a0201307692834cda336c55157fef125e67c01c1359886f94742105596b42a790404bbcda5dad6a65f115aaff5e45ef3c28b" + + "2316ff6cef07aa49a45aa58c07bf258051b13ef449ccb37a3679afd5cfb9132f70bb9d931a937897544f90c3bcc80ed012e9" + + "f6ba020b8cdc23f8c29ac092b88f0e370ff9434e4f0f359e614ae0868dc526fa41e4b7596533e8d10279b66e923ecd9f0b20" + + "0def55be2c1f6f9c72c92fb45d7e0a9ac571cb38f0a9a37bb33ea06f223fde8c7a92e8c47769e386f9799776e8f110c21df2" + + "77ef1be61b2c01ebdabddcbf53cc4b6fd9a3c445606ee77b3758162c80ad8f8137b3c6864e92db904807dcb2be9d7717dd21" + + "bf42c121d620ddfb7914f7a95c713d9e1c1b7bdb4a03d618e40cf7e9e235c0b5687e03b7ab3,publicExponent=10001}" override fun execute(context: BytecodeContext) { SpoofSignatureFingerprint.result!!.mutableMethod.addInstructions( @@ -35,7 +35,7 @@ object SpoofSignaturePatch : BytecodePatch( """ const-string v0, "$EXPECTED_SIGNATURE" return-object v0 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/fingerprints/SpoofSignatureFingerprint.kt b/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/fingerprints/SpoofSignatureFingerprint.kt index 13c5b1fb81..559cd07384 100644 --- a/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/fingerprints/SpoofSignatureFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/fingerprints/SpoofSignatureFingerprint.kt @@ -9,5 +9,5 @@ internal object SpoofSignatureFingerprint : MethodFingerprint( accessFlags = AccessFlags.PRIVATE.value, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/SL2Step1Task;") && methodDef.name == "getPubKey" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt b/src/main/kotlin/app/revanced/patches/inshorts/ad/HideAdsPatch.kt similarity index 88% rename from src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt rename to src/main/kotlin/app/revanced/patches/inshorts/ad/HideAdsPatch.kt index 75c051e64b..ef36028d2c 100644 --- a/src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/inshorts/ad/HideAdsPatch.kt @@ -1,20 +1,20 @@ package app.revanced.patches.inshorts.ad -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.inshorts.ad.fingerprints.InshortsAdsFingerprint +import app.revanced.util.exception @Patch( name = "Hide ads", - compatiblePackages = [CompatiblePackage("com.nis.app")] + compatiblePackages = [CompatiblePackage("com.nis.app")], ) @Suppress("unused") object HideAdsPatch : BytecodePatch( - setOf(InshortsAdsFingerprint) + setOf(InshortsAdsFingerprint), ) { override fun execute(context: BytecodeContext) { InshortsAdsFingerprint.result?.let { result -> @@ -23,7 +23,7 @@ object HideAdsPatch : BytecodePatch( 0, """ return-void - """ + """, ) } } ?: throw InshortsAdsFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/inshorts/ad/fingerprints/InshortsAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/inshorts/ad/fingerprints/InshortsAdsFingerprint.kt index 51930848a7..5a02efea30 100644 --- a/src/main/kotlin/app/revanced/patches/inshorts/ad/fingerprints/InshortsAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/inshorts/ad/fingerprints/InshortsAdsFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object InshortsAdsFingerprint : MethodFingerprint( "V", - strings = listOf("GoogleAdLoader","exception in requestAd"), -) \ No newline at end of file + strings = listOf("GoogleAdLoader", "exception in requestAd"), +) diff --git a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/HideTimelineAdsPatch.kt b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/HideTimelineAdsPatch.kt index fdae0ddba5..4a154ce720 100644 --- a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/HideTimelineAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/HideTimelineAdsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.instagram.patches.ads.timeline -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -15,21 +14,23 @@ import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.Gene import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.MediaAdFingerprint import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.PaidPartnershipAdFingerprint import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.ShoppingAdFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Hide timeline ads", description = "Removes ads from the timeline.", - compatiblePackages = [CompatiblePackage("com.instagram.android", ["275.0.0.27.98"])] + compatiblePackages = [CompatiblePackage("com.instagram.android", ["275.0.0.27.98"])], ) @Suppress("unused") object HideTimelineAdsPatch : BytecodePatch( setOf( ShowAdFingerprint, MediaFingerprint, - PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes. - ) + // Unlike the other ads this one is resolved from all classes. + PaidPartnershipAdFingerprint, + ), ) { override fun execute(context: BytecodeContext) { // region Resolve required methods to check for ads. @@ -80,8 +81,9 @@ object HideTimelineAdsPatch : BytecodePatch( checkForAdInstructions, ExternalLabel( returnFalseLabel, - mutableMethod.getInstruction(mutableMethod.implementation!!.instructions.size - 2 /* return false = ad */) - ) + // return false = ad + mutableMethod.getInstruction(mutableMethod.implementation!!.instructions.size - 2), + ), ) // endregion @@ -92,11 +94,11 @@ object HideTimelineAdsPatch : BytecodePatch( addInstructionsWithLabels( jumpIndex + 1, "if-nez v$freeRegister, :start_check", - ExternalLabel("start_check", getInstruction(insertIndex)) + ExternalLabel("start_check", getInstruction(insertIndex)), ) }.removeInstruction(jumpIndex) // endregion } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/MediaFingerprint.kt b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/MediaFingerprint.kt index 9959811d84..e709216396 100644 --- a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/MediaFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/MediaFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.instagram.patches.ads.timeline.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint internal object MediaFingerprint : MethodFingerprint( - strings = listOf("force_overlay", "Media#updateFields", "live_reels_metadata") + strings = listOf("force_overlay", "Media#updateFields", "live_reels_metadata"), ) diff --git a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/GenericMediaAdFingerprint.kt b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/GenericMediaAdFingerprint.kt index 8a2d75b487..6e6caabd2f 100644 --- a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/GenericMediaAdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/GenericMediaAdFingerprint.kt @@ -12,7 +12,7 @@ internal object GenericMediaAdFingerprint : MediaAdFingerprint( Opcode.IF_EQZ, Opcode.CONST_4, Opcode.RETURN, - ) + ), ) { override fun toString() = result!!.method.toString() -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/MediaAdFingerprint.kt b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/MediaAdFingerprint.kt index 11f21b3fb8..1429716192 100644 --- a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/MediaAdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/MediaAdFingerprint.kt @@ -12,13 +12,13 @@ internal abstract class MediaAdFingerprint( accessFlags: Int? = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters: Iterable? = listOf(), opcodes: Iterable?, - customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null + customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null, ) : MethodFingerprint( returnType, accessFlags, parameters, opcodes, - customFingerprint = customFingerprint + customFingerprint = customFingerprint, ) { abstract override fun toString(): String -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/PaidPartnershipAdFingerprint.kt b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/PaidPartnershipAdFingerprint.kt index 2a39002278..082ab54b5c 100644 --- a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/PaidPartnershipAdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/PaidPartnershipAdFingerprint.kt @@ -12,11 +12,11 @@ internal object PaidPartnershipAdFingerprint : MediaAdFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.IPUT_BOOLEAN, - Opcode.IPUT_BOOLEAN + Opcode.IPUT_BOOLEAN, ), customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("ClipsEditMetadataController;") - } + }, ) { override fun toString() = result!!.let { val adCheckIndex = it.scanResult.patternScanResult!!.startIndex @@ -26,4 +26,4 @@ internal object PaidPartnershipAdFingerprint : MediaAdFingerprint( adCheckMethod.toString() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/ShoppingAdFingerprint.kt b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/ShoppingAdFingerprint.kt index 9dd1232c9e..b1f9e40872 100644 --- a/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/ShoppingAdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/ShoppingAdFingerprint.kt @@ -15,7 +15,7 @@ internal object ShoppingAdFingerprint : MediaAdFingerprint( Opcode.MOVE_RESULT, Opcode.XOR_INT_LIT8, Opcode.IF_EQZ, - ) + ), ) { override fun toString() = result!!.method.toString() -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt b/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt index d9750df4c2..2ce9ebad75 100644 --- a/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt @@ -7,14 +7,13 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.irplus.ad.fingerprints.IrplusAdsFingerprint - @Patch( name = "Remove ads", - compatiblePackages = [CompatiblePackage("net.binarymode.android.irplus")] + compatiblePackages = [CompatiblePackage("net.binarymode.android.irplus")], ) @Suppress("unused") object RemoveAdsPatch : BytecodePatch( - setOf(IrplusAdsFingerprint) + setOf(IrplusAdsFingerprint), ) { override fun execute(context: BytecodeContext) { val method = IrplusAdsFingerprint.result!!.mutableMethod @@ -23,4 +22,4 @@ object RemoveAdsPatch : BytecodePatch( // the view which holds the advertisement is removed. method.addInstruction(0, "const/4 p2, 0x0") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/irplus/ad/fingerprints/IrplusAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/irplus/ad/fingerprints/IrplusAdsFingerprint.kt index 6279dc3b4e..a0f6d26ba9 100644 --- a/src/main/kotlin/app/revanced/patches/irplus/ad/fingerprints/IrplusAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/irplus/ad/fingerprints/IrplusAdsFingerprint.kt @@ -8,5 +8,5 @@ internal object IrplusAdsFingerprint : MethodFingerprint( "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "Z"), - strings = listOf("TAGGED") -) \ No newline at end of file + strings = listOf("TAGGED"), +) diff --git a/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt b/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt index d286f3f8f1..f4f0a4d21e 100644 --- a/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt +++ b/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt @@ -1,20 +1,20 @@ package app.revanced.patches.lightroom.misc.login -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.lightroom.misc.login.fingerprints.IsLoggedInFingerprint +import app.revanced.util.exception @Patch( name = "Disable mandatory login", - compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")] + compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")], ) @Suppress("unused") object DisableMandatoryLoginPatch : BytecodePatch( - setOf(IsLoggedInFingerprint) + setOf(IsLoggedInFingerprint), ) { override fun execute(context: BytecodeContext) { IsLoggedInFingerprint.result?.mutableMethod?.apply { @@ -23,4 +23,4 @@ object DisableMandatoryLoginPatch : BytecodePatch( replaceInstruction(index, "const/4 v0, 0x1") } ?: throw IsLoggedInFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/lightroom/misc/login/fingerprints/IsLoggedInFingerprint.kt b/src/main/kotlin/app/revanced/patches/lightroom/misc/login/fingerprints/IsLoggedInFingerprint.kt index f89406060b..8eaffa3b27 100644 --- a/src/main/kotlin/app/revanced/patches/lightroom/misc/login/fingerprints/IsLoggedInFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/lightroom/misc/login/fingerprints/IsLoggedInFingerprint.kt @@ -14,6 +14,6 @@ internal object IsLoggedInFingerprint : MethodFingerprint( Opcode.SGET_OBJECT, Opcode.IF_NE, Opcode.CONST_4, - Opcode.GOTO - ) + Opcode.GOTO, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt index 084837ff0d..d74a7ef804 100644 --- a/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt @@ -1,24 +1,24 @@ package app.revanced.patches.lightroom.misc.premium -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.lightroom.misc.premium.fingerprints.HasPurchasedFingerprint +import app.revanced.util.exception @Patch( name = "Unlock premium", - compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")] + compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")], ) @Suppress("unused") object UnlockPremiumPatch : BytecodePatch( - setOf(HasPurchasedFingerprint) -){ + setOf(HasPurchasedFingerprint), +) { override fun execute(context: BytecodeContext) { - // Set hasPremium = true. + // Set hasPremium = true. HasPurchasedFingerprint.result?.mutableMethod?.replaceInstruction(2, "const/4 v2, 0x1") ?: throw HasPurchasedFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/fingerprints/HasPurchasedFingerprint.kt b/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/fingerprints/HasPurchasedFingerprint.kt index 1b32fe8636..15ac3d9f0e 100644 --- a/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/fingerprints/HasPurchasedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/fingerprints/HasPurchasedFingerprint.kt @@ -14,5 +14,5 @@ internal object HasPurchasedFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.CONST_4, Opcode.CONST_4, - ) + ), ) diff --git a/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt b/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt index 2ab5f04476..d5974d4315 100644 --- a/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt @@ -1,15 +1,15 @@ package app.revanced.patches.memegenerator.detection.license -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.memegenerator.detection.license.fingerprints.LicenseValidationFingerprint +import app.revanced.util.exception @Patch(description = "Disables Firebase license validation.") object LicenseValidationPatch : BytecodePatch( - setOf(LicenseValidationFingerprint) + setOf(LicenseValidationFingerprint), ) { override fun execute(context: BytecodeContext) { LicenseValidationFingerprint.result?.apply { @@ -18,8 +18,8 @@ object LicenseValidationPatch : BytecodePatch( """ const/4 p0, 0x1 return p0 - """ + """, ) } ?: throw LicenseValidationFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/fingerprints/LicenseValidationFingerprint.kt b/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/fingerprints/LicenseValidationFingerprint.kt index e5cfaae6f9..5582fd5a55 100644 --- a/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/fingerprints/LicenseValidationFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/fingerprints/LicenseValidationFingerprint.kt @@ -19,6 +19,6 @@ internal object LicenseValidationFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.RETURN, Opcode.CONST_4, - Opcode.RETURN - ) + Opcode.RETURN, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt b/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt index 736649ba28..24b857d17e 100644 --- a/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt @@ -1,15 +1,15 @@ package app.revanced.patches.memegenerator.detection.signature -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.memegenerator.detection.signature.fingerprints.VerifySignatureFingerprint +import app.revanced.util.exception @Patch(description = "Disables detection of incorrect signature.") object SignatureVerificationPatch : BytecodePatch( - setOf(VerifySignatureFingerprint) + setOf(VerifySignatureFingerprint), ) { override fun execute(context: BytecodeContext) { VerifySignatureFingerprint.result?.apply { @@ -18,8 +18,8 @@ object SignatureVerificationPatch : BytecodePatch( """ const/4 p0, 0x1 return p0 - """ + """, ) } ?: throw VerifySignatureFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/fingerprints/VerifySignatureFingerprint.kt b/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/fingerprints/VerifySignatureFingerprint.kt index b77fd051fd..569ab85650 100644 --- a/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/fingerprints/VerifySignatureFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/fingerprints/VerifySignatureFingerprint.kt @@ -1,8 +1,8 @@ package app.revanced.patches.memegenerator.detection.signature.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -30,6 +30,6 @@ internal object VerifySignatureFingerprint : MethodFingerprint( Opcode.IF_EQZ, Opcode.CONST_4, Opcode.RETURN, - Opcode.ADD_INT_LIT8 + Opcode.ADD_INT_LIT8, ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt b/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt index 28b9638f6c..d64bf2a2bb 100644 --- a/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.memegenerator.misc.pro -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch @@ -9,36 +8,39 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.memegenerator.detection.license.LicenseValidationPatch import app.revanced.patches.memegenerator.detection.signature.SignatureVerificationPatch import app.revanced.patches.memegenerator.misc.pro.fingerprints.IsFreeVersionFingerprint +import app.revanced.util.exception @Patch( name = "Unlock pro", dependencies = [ SignatureVerificationPatch::class, - LicenseValidationPatch::class + LicenseValidationPatch::class, ], compatiblePackages = [ CompatiblePackage( - "com.zombodroid.MemeGenerator", [ + "com.zombodroid.MemeGenerator", + [ "4.6364", "4.6370", "4.6375", - "4.6377" - ] - ) - ] + "4.6377", + ], + ), + ], ) @Suppress("unused") object UnlockProVersionPatch : BytecodePatch( - setOf(IsFreeVersionFingerprint) + setOf(IsFreeVersionFingerprint), ) { override fun execute(context: BytecodeContext) { IsFreeVersionFingerprint.result?.apply { - mutableMethod.replaceInstructions(0, + mutableMethod.replaceInstructions( + 0, """ sget-object p0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean; return-object p0 - """ + """, ) } ?: throw IsFreeVersionFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/fingerprints/IsFreeVersionFingerprint.kt b/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/fingerprints/IsFreeVersionFingerprint.kt index b3a3aa2c70..3aa632344c 100644 --- a/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/fingerprints/IsFreeVersionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/fingerprints/IsFreeVersionFingerprint.kt @@ -17,6 +17,6 @@ internal object IsFreeVersionFingerprint : MethodFingerprint( Opcode.CONST_STRING, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - Opcode.IF_EQZ - ) + Opcode.IF_EQZ, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt index 9c45dc97aa..f4fb934903 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt @@ -8,11 +8,10 @@ internal object LoadInboxAdsFingerprint : MethodFingerprint( returnType = "V", strings = listOf( "ads_load_begin", - "inbox_ads_fetch_start" + "inbox_ads_fetch_start", ), accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/facebook/messaging/business/inboxads/plugins/inboxads/itemsupplier/InboxAdsItemSupplierImplementation;" - } + }, ) - diff --git a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt index c512ca9806..d4b874a8c6 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt @@ -1,21 +1,21 @@ package app.revanced.patches.messenger.ads.inbox.patch -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint +import app.revanced.util.exception @Patch( name = "Hide inbox ads", description = "Hides ads in inbox.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object HideInboxAdsPatch : BytecodePatch( - setOf(LoadInboxAdsFingerprint) + setOf(LoadInboxAdsFingerprint), ) { override fun execute(context: BytecodeContext) { LoadInboxAdsFingerprint.result?.mutableMethod?.apply { @@ -23,4 +23,3 @@ object HideInboxAdsPatch : BytecodePatch( } ?: throw LoadInboxAdsFingerprint.exception } } - diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SendTypingIndicatorFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SendTypingIndicatorFingerprint.kt index 2376575bc6..abc85561a2 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SendTypingIndicatorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SendTypingIndicatorFingerprint.kt @@ -8,8 +8,8 @@ internal object SendTypingIndicatorFingerprint : MethodFingerprint( parameters = listOf(), customFingerprint = { methodDef, classDef -> methodDef.name == "run" && classDef.fields.any { - it.name == "__redex_internal_original_name" - && (it.initialValue as? DexBackedStringEncodedValue)?.value == "ConversationTypingContext\$sendActiveStateRunnable\$1" + it.name == "__redex_internal_original_name" && + (it.initialValue as? DexBackedStringEncodedValue)?.value == "ConversationTypingContext\$sendActiveStateRunnable\$1" } - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SwitchMessangeInputEmojiButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SwitchMessangeInputEmojiButtonFingerprint.kt index 0184a9a017..10be05f61c 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SwitchMessangeInputEmojiButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/fingerprints/SwitchMessangeInputEmojiButtonFingerprint.kt @@ -13,6 +13,6 @@ internal object SwitchMessangeInputEmojiButtonFingerprint : MethodFingerprint( Opcode.CONST_STRING, Opcode.GOTO, Opcode.CONST_STRING, - Opcode.GOTO - ) -) \ No newline at end of file + Opcode.GOTO, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt index 19e445fdad..e184fb1611 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.messenger.inputfield.patch -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction @@ -8,16 +7,17 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Disable switching emoji to sticker", description = "Disables switching from emoji to sticker search mode in message input field.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object DisableSwitchingEmojiToStickerPatch : BytecodePatch( - setOf(SwitchMessangeInputEmojiButtonFingerprint) + setOf(SwitchMessangeInputEmojiButtonFingerprint), ) { override fun execute(context: BytecodeContext) { SwitchMessangeInputEmojiButtonFingerprint.result?.let { @@ -28,7 +28,7 @@ object DisableSwitchingEmojiToStickerPatch : BytecodePatch( replaceInstruction( setStringIndex, - "const-string v$targetRegister, \"expression\"" + "const-string v$targetRegister, \"expression\"", ) } } ?: throw SwitchMessangeInputEmojiButtonFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt index 5bdbb50c12..6b07d9538d 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt @@ -1,22 +1,22 @@ package app.revanced.patches.messenger.inputfield.patch -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint +import app.revanced.util.exception @Patch( name = "Disable typing indicator", description = "Disables the indicator while typing a message.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object DisableTypingIndicatorPatch : BytecodePatch( - setOf(SendTypingIndicatorFingerprint) -){ + setOf(SendTypingIndicatorFingerprint), +) { override fun execute(context: BytecodeContext) { SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") ?: throw SendTypingIndicatorFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/moneymanager/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/moneymanager/UnlockProPatch.kt index 0f5afa70c4..1c01ca0aa9 100644 --- a/src/main/kotlin/app/revanced/patches/moneymanager/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/moneymanager/UnlockProPatch.kt @@ -9,19 +9,19 @@ import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("com.ithebk.expensemanager")] + compatiblePackages = [CompatiblePackage("com.ithebk.expensemanager")], ) @Suppress("unused") object UnlockProPatch : BytecodePatch( - setOf(UnlockProFingerprint) -){ + setOf(UnlockProFingerprint), +) { override fun execute(context: BytecodeContext) { - UnlockProFingerprint.result!!.mutableMethod.addInstructions( + UnlockProFingerprint.result!!.mutableMethod.addInstructions( 0, """ const/4 v0, 0x1 return v0 - """ + """, ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt b/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt index 087b2af565..4786f75b37 100644 --- a/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt @@ -11,9 +11,9 @@ internal object UnlockProFingerprint : MethodFingerprint( parameters = listOf("L"), opcodes = listOf( Opcode.IGET_BOOLEAN, - Opcode.RETURN + Opcode.RETURN, ), customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("MainActivity;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/MusicVideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/MusicVideoAdsPatch.kt index e2f1978e83..2065fc229a 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/MusicVideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/MusicVideoAdsPatch.kt @@ -11,11 +11,11 @@ import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerp @Patch( name = "Music video ads", description = "Removes ads in the music player.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object MusicVideoAdsPatch : BytecodePatch( - setOf(ShowMusicVideoAdsConstructorFingerprint) + setOf(ShowMusicVideoAdsConstructorFingerprint), ) { override fun execute(context: BytecodeContext) { ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef) @@ -26,7 +26,7 @@ object MusicVideoAdsPatch : BytecodePatch( result.scanResult.patternScanResult!!.startIndex, """ const/4 p1, 0x0 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsConstructorFingerprint.kt index 1a1b9be84d..03e202fa9d 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsConstructorFingerprint.kt @@ -1,13 +1,16 @@ package app.revanced.patches.music.ad.video.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. internal object ShowMusicVideoAdsConstructorFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf( + "V", + AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, + listOf("L", "L", "L"), + listOf( Opcode.INVOKE_DIRECT, Opcode.NEW_INSTANCE, Opcode.INVOKE_DIRECT, @@ -22,6 +25,6 @@ internal object ShowMusicVideoAdsConstructorFingerprint : MethodFingerprint( Opcode.IPUT_OBJECT, Opcode.CONST_4, Opcode.IPUT_BOOLEAN, - Opcode.RETURN_VOID - ) + Opcode.RETURN_VOID, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsFingerprint.kt index 952b866dcc..be5491bb14 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsFingerprint.kt @@ -6,9 +6,12 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object ShowMusicVideoAdsFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), listOf( + "V", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf("Z"), + listOf( Opcode.IPUT_BOOLEAN, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID - ) + Opcode.RETURN_VOID, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt index 35fa977a27..a155113b47 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt @@ -12,11 +12,11 @@ import com.android.tools.smali.dexlib2.Opcode @Patch( name = "Codecs unlock", description = "Adds more audio codec options. The new audio codecs usually result in better audio quality.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object CodecsUnlockPatch : BytecodePatch( - setOf(CodecsLockFingerprint, AllCodecsReferenceFingerprint) + setOf(CodecsLockFingerprint, AllCodecsReferenceFingerprint), ) { override fun execute(context: BytecodeContext) { val codecsLockResult = CodecsLockFingerprint.result!! @@ -25,13 +25,13 @@ object CodecsUnlockPatch : BytecodePatch( val scanResultStartIndex = codecsLockResult.scanResult.patternScanResult!!.startIndex val instructionIndex = scanResultStartIndex + - if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) { - // for 5.16.xx and lower - -3 - } else { - // since 5.17.xx - -2 - } + if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) { + // for 5.16.xx and lower + -3 + } else { + // since 5.17.xx + -2 + } val allCodecsResult = AllCodecsReferenceFingerprint.result!! val allCodecsMethod = @@ -41,7 +41,7 @@ object CodecsUnlockPatch : BytecodePatch( implementation.replaceInstruction( instructionIndex, - "invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction() + "invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction(), ) } } diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/AllCodecsReferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/AllCodecsReferenceFingerprint.kt index 4b7bc37372..a96174ebaf 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/AllCodecsReferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/AllCodecsReferenceFingerprint.kt @@ -1,15 +1,17 @@ package app.revanced.patches.music.audio.codecs.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode - @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. internal object AllCodecsReferenceFingerprint : MethodFingerprint( - "J", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf( + "J", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf("L"), + listOf( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_STATIC, @@ -47,6 +49,7 @@ internal object AllCodecsReferenceFingerprint : MethodFingerprint( Opcode.MOVE_EXCEPTION, Opcode.INVOKE_SUPER, Opcode.MOVE_RESULT_WIDE, - Opcode.RETURN_WIDE - ), listOf("itag") -) \ No newline at end of file + Opcode.RETURN_WIDE, + ), + listOf("itag"), +) diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt index fb007dc3a1..b328210e30 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt @@ -1,15 +1,16 @@ package app.revanced.patches.music.audio.codecs.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode - @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. internal object CodecsLockFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.STATIC, opcodes = listOf( + "L", + AccessFlags.PUBLIC or AccessFlags.STATIC, + opcodes = listOf( Opcode.INVOKE_DIRECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, @@ -23,7 +24,7 @@ internal object CodecsLockFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_OBJECT + Opcode.RETURN_OBJECT, ), - strings = listOf("eac3_supported") + strings = listOf("eac3_supported"), ) diff --git a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/ExclusiveAudioPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/ExclusiveAudioPatch.kt index 8955c77cc5..5875a311e7 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/ExclusiveAudioPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/ExclusiveAudioPatch.kt @@ -1,31 +1,31 @@ package app.revanced.patches.music.audio.exclusiveaudio -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint +import app.revanced.util.exception @Patch( name = "Exclusive audio playback", description = "Enables the option to play audio without video.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object ExclusiveAudioPatch : BytecodePatch( - setOf(AllowExclusiveAudioPlaybackFingerprint) + setOf(AllowExclusiveAudioPlaybackFingerprint), ) { override fun execute(context: BytecodeContext) { AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply { addInstructions( 0, - """ + """ const/4 v0, 0x1 return v0 - """ + """, ) } ?: throw AllowExclusiveAudioPlaybackFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/fingerprints/AllowExclusiveAudioPlaybackFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/fingerprints/AllowExclusiveAudioPlaybackFingerprint.kt index c86f794272..daee11d5d8 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/fingerprints/AllowExclusiveAudioPlaybackFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/fingerprints/AllowExclusiveAudioPlaybackFingerprint.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -internal object AllowExclusiveAudioPlaybackFingerprint: MethodFingerprint( +internal object AllowExclusiveAudioPlaybackFingerprint : MethodFingerprint( "Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), @@ -20,6 +20,6 @@ internal object AllowExclusiveAudioPlaybackFingerprint: MethodFingerprint( Opcode.GOTO, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - Opcode.RETURN - ) -) \ No newline at end of file + Opcode.RETURN, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt index 257f43eef8..65bbe0a201 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.music.interaction.permanentrepeat -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,16 +8,17 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.interaction.permanentrepeat.fingerprints.RepeatTrackFingerprint +import app.revanced.util.exception @Patch( name = "Permanent repeat", description = "Permanently remember your repeating preference even if the playlist ends or another track is played.", compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], - use = false + use = false, ) @Suppress("unused") object PermanentRepeatPatch : BytecodePatch( - setOf(RepeatTrackFingerprint) + setOf(RepeatTrackFingerprint), ) { override fun execute(context: BytecodeContext) { RepeatTrackFingerprint.result?.let { @@ -29,7 +29,7 @@ object PermanentRepeatPatch : BytecodePatch( addInstructionsWithLabels( startIndex, "goto :repeat", - ExternalLabel("repeat", getInstruction(repeatIndex)) + ExternalLabel("repeat", getInstruction(repeatIndex)), ) } } ?: throw RepeatTrackFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt index 4567f0fe78..1cca52c062 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt @@ -17,6 +17,6 @@ internal object RepeatTrackFingerprint : MethodFingerprint( Opcode.SGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - Opcode.IF_NEZ - ) + Opcode.IF_NEZ, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt index 70eb16a6b4..3fc9b3fda8 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt @@ -1,23 +1,22 @@ package app.revanced.patches.music.interaction.permanentshuffle -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint - +import app.revanced.util.exception @Patch( name = "Permanent shuffle", description = "Permanently remember your shuffle preference " + - "even if the playlist ends or another track is played.", + "even if the playlist ends or another track is played.", compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], - use = false + use = false, ) @Suppress("unused") -object PermanentShuffleTogglePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) { +object PermanentShufflePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) { override fun execute(context: BytecodeContext) { DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") ?: throw DisableShuffleFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/fingerprints/DisableShuffleFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/fingerprints/DisableShuffleFingerprint.kt index b358905602..f2e23e25bc 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/fingerprints/DisableShuffleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/fingerprints/DisableShuffleFingerprint.kt @@ -15,6 +15,6 @@ internal object DisableShuffleFingerprint : MethodFingerprint( Opcode.SGET_OBJECT, Opcode.IPUT_OBJECT, Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL - ) + Opcode.INVOKE_VIRTUAL, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/CompactHeaderPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/CompactHeaderPatch.kt index ec67f2d687..459a62bef9 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/CompactHeaderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/CompactHeaderPatch.kt @@ -12,11 +12,11 @@ import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x name = "Compact header", description = "Hides the music category bar at the top of the homepage.", compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], - use = false + use = false, ) @Suppress("unused") object CompactHeaderPatch : BytecodePatch( - setOf(CompactHeaderConstructorFingerprint) + setOf(CompactHeaderConstructorFingerprint), ) { override fun execute(context: BytecodeContext) { val result = CompactHeaderConstructorFingerprint.result!! @@ -25,10 +25,11 @@ object CompactHeaderPatch : BytecodePatch( val insertIndex = result.scanResult.patternScanResult!!.endIndex val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA method.addInstructions( - insertIndex, """ - const/16 v2, 0x8 - invoke-virtual {v${register}, v2}, Landroid/view/View;->setVisibility(I)V + insertIndex, """ + const/16 v2, 0x8 + invoke-virtual {v$register, v2}, Landroid/view/View;->setVisibility(I)V + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/fingerprints/CompactHeaderConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/fingerprints/CompactHeaderConstructorFingerprint.kt index 98587cc93b..c6c3888a4d 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/fingerprints/CompactHeaderConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/fingerprints/CompactHeaderConstructorFingerprint.kt @@ -6,7 +6,10 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object CompactHeaderConstructorFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L"), listOf( + "V", + AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, + listOf("L", "L", "L", "L", "L"), + listOf( Opcode.INVOKE_DIRECT, Opcode.IPUT_OBJECT, Opcode.IPUT_OBJECT, @@ -18,6 +21,6 @@ internal object CompactHeaderConstructorFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST - ) + Opcode.CHECK_CAST, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt index 2b692d2628..beb9d30f4a 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt @@ -1,18 +1,17 @@ package app.revanced.patches.music.layout.minimizedplayback -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint - +import app.revanced.util.exception @Patch( name = "Minimized playback music", description = "Enables minimized playback on Kids music.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object MinimizedPlaybackPatch : BytecodePatch(setOf(MinimizedPlaybackManagerFingerprint)) { @@ -21,6 +20,6 @@ object MinimizedPlaybackPatch : BytecodePatch(setOf(MinimizedPlaybackManagerFing 0, """ return-void - """ + """, ) ?: throw MinimizedPlaybackManagerFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt index bfa47932d1..f4775805eb 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt @@ -22,5 +22,5 @@ internal object MinimizedPlaybackManagerFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.IF_NE, Opcode.IPUT_BOOLEAN, - ) + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt index ac7827ff1e..da41d1b357 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumPare @Patch( name = "Hide get premium", description = "Removes all \"Get Premium\" evidences from the avatar menu.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object HideGetPremiumPatch : BytecodePatch(setOf(HideGetPremiumParentFingerprint)) { @@ -27,7 +27,7 @@ object HideGetPremiumPatch : BytecodePatch(setOf(HideGetPremiumParentFingerprint startIndex, """ const/4 v1, 0x0 - """ + """, ) val result = HideGetPremiumFingerprint.result!! @@ -36,7 +36,7 @@ object HideGetPremiumPatch : BytecodePatch(setOf(HideGetPremiumParentFingerprint startIndex, """ const/16 v0, 0x8 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt index 6a29e7add9..d126285425 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt @@ -6,11 +6,14 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object HideGetPremiumFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( + "V", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf(), + listOf( Opcode.IF_NEZ, Opcode.CONST_16, Opcode.GOTO, Opcode.NOP, - Opcode.INVOKE_VIRTUAL - ) + Opcode.INVOKE_VIRTUAL, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumParentFingerprint.kt index 3463fcfcd3..9e41ac7820 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumParentFingerprint.kt @@ -6,14 +6,17 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object HideGetPremiumParentFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( + "V", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf(), + listOf( Opcode.IGET_BOOLEAN, Opcode.CONST_4, Opcode.IF_EQZ, Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_STATIC + Opcode.INVOKE_STATIC, ), listOf("FEmusic_history"), ) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt index 7cd39e17d9..2f61db745f 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt @@ -12,15 +12,14 @@ import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c - @Patch( name = "Remove upgrade button", description = "Removes the upgrade tab from the pivot bar.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object RemoveUpgradeButtonPatch : BytecodePatch( - setOf(PivotBarConstructorFingerprint) + setOf(PivotBarConstructorFingerprint), ) { override fun execute(context: BytecodeContext) { val result = PivotBarConstructorFingerprint.result!! @@ -39,19 +38,20 @@ object RemoveUpgradeButtonPatch : BytecodePatch( iput-object v0, v$register, $pivotBarElementFieldRef """.toInstructions().toMutableList() - val endIndex = result.scanResult.patternScanResult!!.endIndex // replace the instruction to retain the label at given index implementation.replaceInstruction( - endIndex - 1, instructionList[0] // invoke-interface + endIndex - 1, + instructionList[0], // invoke-interface ) // do not forget to remove this instruction since we added it already instructionList.removeFirst() val exitInstruction = instructionList.last() // iput-object implementation.addInstruction( - endIndex, exitInstruction + endIndex, + exitInstruction, ) // do not forget to remove this instruction since we added it already instructionList.removeLast() @@ -60,12 +60,16 @@ object RemoveUpgradeButtonPatch : BytecodePatch( instructionList.add( 2, // if-le BuilderInstruction22t( - Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(endIndex) - ) + Opcode.IF_LE, + 1, + 2, + implementation.newLabelForIndex(endIndex), + ), ) implementation.addInstructions( - endIndex, instructionList + endIndex, + instructionList, ) } } diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt index 36ec43f58d..f8e6d6d3f4 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt @@ -1,12 +1,11 @@ package app.revanced.patches.music.layout.upgradebutton.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode - @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. internal object PivotBarConstructorFingerprint : MethodFingerprint( "V", @@ -57,6 +56,6 @@ internal object PivotBarConstructorFingerprint : MethodFingerprint( Opcode.GOTO, Opcode.NOP, Opcode.IPUT_OBJECT, - Opcode.RETURN_VOID - ) -) \ No newline at end of file + Opcode.RETURN_VOID, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt index a06203de57..4127dde7f8 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt @@ -1,28 +1,28 @@ package app.revanced.patches.music.misc.androidauto -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificateFingerprint - +import app.revanced.util.exception @Patch( name = "Bypass certificate checks", description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object BypassCertificateChecksPatch : BytecodePatch(setOf(CheckCertificateFingerprint)) { override fun execute(context: BytecodeContext) { CheckCertificateFingerprint.result?.apply { mutableMethod.addInstructions( - 0, """ + 0, + """ const/4 v0, 0x1 return v0 - """ + """, ) } ?: throw CheckCertificateFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/fingerprints/CheckCertificateFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/fingerprints/CheckCertificateFingerprint.kt index 8059a0dcd4..f45ec54b84 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/fingerprints/CheckCertificateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/fingerprints/CheckCertificateFingerprint.kt @@ -8,5 +8,5 @@ internal object CheckCertificateFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, returnType = "Z", parameters = listOf("Ljava/lang/String;"), - strings = listOf("X509", "Failed to get certificate.") -) \ No newline at end of file + strings = listOf("X509", "Failed to get certificate."), +) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt index 5bb8e2a454..8ad6d4a194 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt @@ -4,10 +4,10 @@ import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption import app.revanced.patches.music.misc.gms.fingerprints.* -import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint import app.revanced.patches.music.misc.integrations.IntegrationsPatch -import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch +import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint +import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch @Suppress("unused") object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( @@ -32,7 +32,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( CastDynamiteModuleV2Fingerprint, CastContextFetchFingerprint, PrimeMethodFingerprint, - ) + ), ) { override val gmsCoreVendor by gmsCoreVendorOption } diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch.kt index 5daa421cab..dbb8fc024b 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch.kt @@ -7,5 +7,5 @@ import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportResourcePatch object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch( fromPackageName = MUSIC_PACKAGE_NAME, toPackageName = REVANCED_MUSIC_PACKAGE_NAME, - spoofedPackageSignature = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875" + spoofedPackageSignature = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875", ) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt index c1c8ec8cc8..62ec3ee12e 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.music.misc.gms.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object CastDynamiteModuleFingerprint : MethodFingerprint( - strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl") -) \ No newline at end of file + strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl"), +) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt index 0249a98136..f92d800304 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.music.misc.gms.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object CastDynamiteModuleV2Fingerprint : MethodFingerprint( - strings = listOf("Failed to load module via V2: ") -) \ No newline at end of file + strings = listOf("Failed to load module via V2: "), +) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt index 45b49b3450..a1c466c7fd 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt @@ -13,6 +13,6 @@ internal object GooglePlayUtilityFingerprint : MethodFingerprint( "MetadataValueReader", "GooglePlayServicesUtil", "com.android.vending", - "android.hardware.type.embedded" - ) -) \ No newline at end of file + "android.hardware.type.embedded", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/PrimeMethodFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/PrimeMethodFingerprint.kt index 2f54a019ac..74b8671482 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/PrimeMethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/PrimeMethodFingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.music.misc.gms.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object PrimeMethodFingerprint : MethodFingerprint( - strings = listOf("com.google.android.GoogleCamera", "com.android.vending") -) \ No newline at end of file + strings = listOf("com.google.android.GoogleCamera", "com.android.vending"), +) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/ApplicationInitFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/ApplicationInitFingerprint.kt index d825b4e8d3..4e34e8bbcf 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/ApplicationInitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/integrations/fingerprints/ApplicationInitFingerprint.kt @@ -12,7 +12,7 @@ internal object ApplicationInitFingerprint : IntegrationsFingerprint( Opcode.INVOKE_STATIC, Opcode.NEW_INSTANCE, Opcode.INVOKE_DIRECT, - Opcode.INVOKE_VIRTUAL + Opcode.INVOKE_VIRTUAL, ), strings = listOf("activity"), customFingerprint = { methodDef, _ -> methodDef.name == "onCreate" }, diff --git a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch.kt b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch.kt index 5850528f9d..79bed85310 100644 --- a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch.kt @@ -1,26 +1,26 @@ package app.revanced.patches.music.premium.backgroundplay -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint - +import app.revanced.util.exception @Patch( name = "Background play", description = "Enables playing music in the background.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object BackgroundPlayPatch : BytecodePatch(setOf(BackgroundPlaybackDisableFingerprint)) { override fun execute(context: BytecodeContext) = BackgroundPlaybackDisableFingerprint.result?.mutableMethod?.addInstructions( - 0, """ + 0, + """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw BackgroundPlaybackDisableFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/fingerprints/BackgroundPlaybackDisableFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/fingerprints/BackgroundPlaybackDisableFingerprint.kt index 68779590a7..5444ebd024 100644 --- a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/fingerprints/BackgroundPlaybackDisableFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/fingerprints/BackgroundPlaybackDisableFingerprint.kt @@ -1,15 +1,17 @@ package app.revanced.patches.music.premium.backgroundplay.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode - @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. internal object BackgroundPlaybackDisableFingerprint : MethodFingerprint( - "Z", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L"), listOf( + "Z", + AccessFlags.PUBLIC or AccessFlags.STATIC, + listOf("L"), + listOf( Opcode.CONST_4, Opcode.IF_EQZ, Opcode.IGET, @@ -38,6 +40,6 @@ internal object BackgroundPlaybackDisableFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.RETURN, Opcode.RETURN, - Opcode.RETURN - ) -) \ No newline at end of file + Opcode.RETURN, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt index c52bef3de0..54cc608f7f 100644 --- a/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.myexpenses.misc.pro -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.myexpenses.misc.pro.fingerprints.IsEnabledFingerprint +import app.revanced.util.exception @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("org.totschnig.myexpenses", ["3.4.9"])] + compatiblePackages = [CompatiblePackage("org.totschnig.myexpenses", ["3.4.9"])], ) @Suppress("unused") object UnlockProPatch : BytecodePatch(setOf(IsEnabledFingerprint)) { @@ -19,7 +19,6 @@ object UnlockProPatch : BytecodePatch(setOf(IsEnabledFingerprint)) { """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw IsEnabledFingerprint.exception - } diff --git a/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/fingerprints/IsEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/fingerprints/IsEnabledFingerprint.kt index 6aba37ff9f..94c38d6498 100644 --- a/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/fingerprints/IsEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/fingerprints/IsEnabledFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object IsEnabledFingerprint : MethodFingerprint( "Z", - strings = listOf("feature", "feature.licenceStatus") + strings = listOf("feature", "feature.licenceStatus"), ) diff --git a/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt index 855b486ba2..936140e48d 100644 --- a/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt @@ -12,11 +12,11 @@ import app.revanced.util.exception @Patch( name = "Hide ads", description = "Hides most of the ads across the app.", - compatiblePackages = [CompatiblePackage("com.myfitnesspal.android")] + compatiblePackages = [CompatiblePackage("com.myfitnesspal.android")], ) @Suppress("unused") object HideAdsPatch : BytecodePatch( - setOf(IsPremiumUseCaseImplFingerprint, MainActivityNavigateToNativePremiumUpsellFingerprint) + setOf(IsPremiumUseCaseImplFingerprint, MainActivityNavigateToNativePremiumUpsellFingerprint), ) { override fun execute(context: BytecodeContext) { // Overwrite the premium status specifically for ads. @@ -25,14 +25,14 @@ object HideAdsPatch : BytecodePatch( """ sget-object v0, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean; return-object v0 - """ + """, ) ?: throw IsPremiumUseCaseImplFingerprint.exception // Prevent the premium upsell dialog from showing when the main activity is launched. // In other places that are premium-only the dialog will still show. MainActivityNavigateToNativePremiumUpsellFingerprint.result?.mutableMethod?.replaceInstructions( 0, - "return-void" + "return-void", ) ?: throw MainActivityNavigateToNativePremiumUpsellFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/IsPremiumUseCaseImplFingerprint.kt b/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/IsPremiumUseCaseImplFingerprint.kt index 0f6e50e778..4b668620fe 100644 --- a/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/IsPremiumUseCaseImplFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/IsPremiumUseCaseImplFingerprint.kt @@ -7,5 +7,5 @@ object IsPremiumUseCaseImplFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, customFingerprint = { methodDef, classDef -> classDef.type.endsWith("IsPremiumUseCaseImpl;") && methodDef.name == "doWork" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/MainActivityNavigateToNativePremiumUpsellFingerprint.kt b/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/MainActivityNavigateToNativePremiumUpsellFingerprint.kt index 42cfb88c3c..df0c18ed69 100644 --- a/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/MainActivityNavigateToNativePremiumUpsellFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/fingerprints/MainActivityNavigateToNativePremiumUpsellFingerprint.kt @@ -9,5 +9,5 @@ object MainActivityNavigateToNativePremiumUpsellFingerprint : MethodFingerprint( accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, customFingerprint = { methodDef, classDef -> classDef.type.endsWith("MainActivity;") && methodDef.name == "navigateToNativePremiumUpsell" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/UnlockProPatch.kt index 630192ed52..380a9a1c77 100644 --- a/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/UnlockProPatch.kt @@ -1,25 +1,25 @@ package app.revanced.patches.nfctoolsse.misc.pro -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.nfctoolsse.misc.pro.fingerprints.IsLicenseRegisteredFingerprint - +import app.revanced.util.exception @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("com.wakdev.apps.nfctools.se")] + compatiblePackages = [CompatiblePackage("com.wakdev.apps.nfctools.se")], ) @Suppress("unused") object UnlockProPatch : BytecodePatch(setOf(IsLicenseRegisteredFingerprint)) { override fun execute(context: BytecodeContext) = IsLicenseRegisteredFingerprint.result?.mutableMethod ?.addInstructions( - 0, """ + 0, + """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw IsLicenseRegisteredFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/fingerprints/IsLicenseRegisteredFingerprint.kt b/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/fingerprints/IsLicenseRegisteredFingerprint.kt index 372b7be07e..4478db4992 100644 --- a/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/fingerprints/IsLicenseRegisteredFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/nfctoolsse/misc/pro/fingerprints/IsLicenseRegisteredFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object IsLicenseRegisteredFingerprint : MethodFingerprint( returnType = "Z", accessFlags = AccessFlags.PUBLIC.value, - strings = listOf("kLicenseCheck") -) \ No newline at end of file + strings = listOf("kLicenseCheck"), +) diff --git a/src/main/kotlin/app/revanced/patches/nyx/misc/pro/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/nyx/misc/pro/UnlockProPatch.kt index 1d496d1294..18f2b0c2cb 100644 --- a/src/main/kotlin/app/revanced/patches/nyx/misc/pro/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/nyx/misc/pro/UnlockProPatch.kt @@ -1,24 +1,24 @@ package app.revanced.patches.nyx.misc.pro -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.nyx.misc.pro.fingerprints.CheckProFingerprint +import app.revanced.util.exception @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("com.awedea.nyx", ["2.2.7"])] + compatiblePackages = [CompatiblePackage("com.awedea.nyx", ["2.2.7"])], ) @Suppress("unused") object UnlockProPatch : BytecodePatch(setOf(CheckProFingerprint)) { override fun execute(context: BytecodeContext) = CheckProFingerprint.result?.mutableMethod?.addInstructions( - 0, - """ + 0, + """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw CheckProFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/nyx/misc/pro/fingerprints/CheckProFingerprint.kt b/src/main/kotlin/app/revanced/patches/nyx/misc/pro/fingerprints/CheckProFingerprint.kt index f5318ef82f..0131cf69c6 100644 --- a/src/main/kotlin/app/revanced/patches/nyx/misc/pro/fingerprints/CheckProFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/nyx/misc/pro/fingerprints/CheckProFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object CheckProFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("BillingManager;") && methodDef.name == "isProVersion" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt index d1c97cdeca..dbd299d504 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.photomath.detection.deviceid -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch @@ -8,23 +7,24 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.photomath.detection.deviceid.fingerprints.GetDeviceIdFingerprint import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch +import app.revanced.util.exception import kotlin.random.Random @Patch( name = "Spoof device ID", description = "Spoofs device ID to mitigate manual bans by developers.", dependencies = [SignatureDetectionPatch::class], - compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])] + compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])], ) @Suppress("unused") object SpoofDeviceIdPatch : BytecodePatch( - setOf(GetDeviceIdFingerprint) -){ + setOf(GetDeviceIdFingerprint), +) { override fun execute(context: BytecodeContext) = GetDeviceIdFingerprint.result?.mutableMethod?.replaceInstructions( 0, """ const-string v0, "${Random.nextLong().toString(16)}" return-object v0 - """ + """, ) ?: throw GetDeviceIdFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/fingerprints/GetDeviceIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/fingerprints/GetDeviceIdFingerprint.kt index ef3e29f68b..fc19ddc622 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/fingerprints/GetDeviceIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/fingerprints/GetDeviceIdFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object GetDeviceIdFingerprint : MethodFingerprint( returnType = "Ljava/lang/String;", strings = listOf("androidId", "android_id"), - parameters = listOf() -) \ No newline at end of file + parameters = listOf(), +) diff --git a/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt index c752badd30..a623e32856 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.photomath.detection.signature -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch(description = "Disables detection of incorrect signature.") object SignatureDetectionPatch : BytecodePatch( - setOf(CheckSignatureFingerprint) + setOf(CheckSignatureFingerprint), ) { override fun execute(context: BytecodeContext) { CheckSignatureFingerprint.result?.apply { diff --git a/src/main/kotlin/app/revanced/patches/photomath/detection/signature/fingerprints/CheckSignatureFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/detection/signature/fingerprints/CheckSignatureFingerprint.kt index 97c42de2bb..2422f71215 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/detection/signature/fingerprints/CheckSignatureFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/detection/signature/fingerprints/CheckSignatureFingerprint.kt @@ -6,7 +6,7 @@ import com.android.tools.smali.dexlib2.Opcode internal object CheckSignatureFingerprint : MethodFingerprint( strings = listOf( "packageInfo.signatures", - "currentSignature" + "currentSignature", ), opcodes = listOf( Opcode.CONST_STRING, @@ -18,5 +18,5 @@ internal object CheckSignatureFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, - ) + ), ) diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt index 1475559073..f3d1c0f368 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt @@ -13,14 +13,14 @@ import app.revanced.util.exception name = "Hide update popup", description = "Prevents the update popup from showing up.", dependencies = [SignatureDetectionPatch::class], - compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])] + compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])], ) @Suppress("unused") object HideUpdatePopupPatch : BytecodePatch( - setOf(HideUpdatePopupFingerprint) + setOf(HideUpdatePopupFingerprint), ) { override fun execute(context: BytecodeContext) = HideUpdatePopupFingerprint.result?.mutableMethod?.addInstructions( 2, // Insert after the null check. - "return-void" + "return-void", ) ?: throw HideUpdatePopupFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt index 6d12d0e296..0602d2e8a3 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt @@ -1,15 +1,15 @@ package app.revanced.patches.photomath.misc.unlock.bookpoint -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.photomath.misc.unlock.bookpoint.fingerprints.IsBookpointEnabledFingerprint +import app.revanced.util.exception @Patch(description = "Enables textbook access") internal object EnableBookpointPatch : BytecodePatch( - setOf(IsBookpointEnabledFingerprint) + setOf(IsBookpointEnabledFingerprint), ) { override fun execute(context: BytecodeContext) = IsBookpointEnabledFingerprint.result?.mutableMethod?.replaceInstructions( @@ -17,6 +17,6 @@ internal object EnableBookpointPatch : BytecodePatch( """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw IsBookpointEnabledFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt index e5ae3c2daf..52e4751ba2 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt @@ -12,6 +12,6 @@ internal object IsBookpointEnabledFingerprint : MethodFingerprint( "NoGeoData", "NoCountryInGeo", "RemoteConfig", - "GeoRCMismatch" - ) -) \ No newline at end of file + "GeoRCMismatch", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt index 8895696cd8..42af774a41 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.photomath.misc.unlock.plus -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -9,21 +8,22 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch import app.revanced.patches.photomath.misc.unlock.bookpoint.EnableBookpointPatch import app.revanced.patches.photomath.misc.unlock.plus.fingerprints.IsPlusUnlockedFingerprint +import app.revanced.util.exception @Patch( name = "Unlock plus", dependencies = [SignatureDetectionPatch::class, EnableBookpointPatch::class], - compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])] + compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])], ) @Suppress("unused") object UnlockPlusPatch : BytecodePatch( - setOf(IsPlusUnlockedFingerprint) -){ + setOf(IsPlusUnlockedFingerprint), +) { override fun execute(context: BytecodeContext) = IsPlusUnlockedFingerprint.result?.mutableMethod?.addInstructions( 0, """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw IsPlusUnlockedFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt index 2ab140b1d9..4a03e9941b 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt @@ -8,9 +8,10 @@ internal object IsPlusUnlockedFingerprint : MethodFingerprint( returnType = "Z", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, strings = listOf( - "genius" + "genius", ), customFingerprint = { - methodDef, _ -> methodDef.definingClass.endsWith("/User;") - } -) \ No newline at end of file + methodDef, _ -> + methodDef.definingClass.endsWith("/User;") + }, +) diff --git a/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt index b0479749ce..77910a8202 100644 --- a/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.pixiv.ads -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint +import app.revanced.util.exception @Patch( name = "Hide ads", - compatiblePackages = [CompatiblePackage("jp.pxv.android")] + compatiblePackages = [CompatiblePackage("jp.pxv.android")], ) @Suppress("unused") object HideAdsPatch : BytecodePatch(setOf(IsNotPremiumFingerprint)) { @@ -23,6 +23,6 @@ object HideAdsPatch : BytecodePatch(setOf(IsNotPremiumFingerprint)) { """ const/4 v0, 0x0 return v0 - """ + """, ) ?: throw IsNotPremiumFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/pixiv/ads/fingerprints/IsNotPremiumFingerprint.kt b/src/main/kotlin/app/revanced/patches/pixiv/ads/fingerprints/IsNotPremiumFingerprint.kt index 6618af0ed7..c4eb1968ad 100644 --- a/src/main/kotlin/app/revanced/patches/pixiv/ads/fingerprints/IsNotPremiumFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/pixiv/ads/fingerprints/IsNotPremiumFingerprint.kt @@ -4,7 +4,6 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags - internal object IsNotPremiumFingerprint : MethodFingerprint( "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, @@ -17,5 +16,5 @@ internal object IsNotPremiumFingerprint : MethodFingerprint( classDef.virtualMethods.first().let { isNotPremiumMethod -> isNotPremiumMethod.parameterTypes.size == 0 && isNotPremiumMethod.returnType == "Z" } - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt index fa1ad21a8a..13ba80d72a 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt @@ -1,22 +1,23 @@ package app.revanced.patches.reddit.ad.comments -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint +import app.revanced.util.exception @Patch(description = "Removes ads in the comments.") object HideCommentAdsPatch : BytecodePatch( - setOf(HideCommentAdsFingerprint) + setOf(HideCommentAdsFingerprint), ) { // Returns a blank object instead of the comment ad. override fun execute(context: BytecodeContext) = HideCommentAdsFingerprint.result?.mutableMethod?.addInstructions( - 0, """ + 0, + """ new-instance v0, Ljava/lang/Object; invoke-direct {v0}, Ljava/lang/Object;->()V return-object v0 - """ + """, ) ?: throw HideCommentAdsFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt index b6ce15145a..718d6d63a2 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/ad/comments/fingerprints/HideCommentAdsFingerprint.kt @@ -6,7 +6,7 @@ internal object HideCommentAdsFingerprint : MethodFingerprint( strings = listOf( "link", // CommentPageRepository is not returning a link object - "is not returning a link object" + "is not returning a link object", ), customFingerprint = { _, classDef -> classDef.sourceFile == "PostDetailPresenter.kt" diff --git a/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt index 02465c9054..17eec9333c 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt @@ -16,7 +16,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference - @Patch( name = "Hide ads", dependencies = [HideBannerPatch::class, HideCommentAdsPatch::class], @@ -27,7 +26,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference object HideAdsPatch : BytecodePatch(setOf(AdPostFingerprint, NewAdPostFingerprint)) { private const val FILTER_METHOD_DESCRIPTOR = "Lapp/revanced/integrations/reddit/patches/FilterPromotedLinksPatch;" + - "->filterChildren(Ljava/lang/Iterable;)Ljava/util/List;" + "->filterChildren(Ljava/lang/Iterable;)Ljava/util/List;" override fun execute(context: BytecodeContext) { // region Filter promoted ads (does not work in popular or latest feed) @@ -52,7 +51,7 @@ object HideAdsPatch : BytecodePatch(setOf(AdPostFingerprint, NewAdPostFingerprin invoke-static {v$itemsRegister}, $FILTER_METHOD_DESCRIPTOR move-result-object v0 iput-object v0, v$listInstanceRegister, ${castedInstruction.reference} - """ + """, ) } diff --git a/src/main/kotlin/app/revanced/patches/reddit/ad/general/fingerprints/NewAdPostFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/ad/general/fingerprints/NewAdPostFingerprint.kt index 2f37b8a71d..2886e583b8 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/ad/general/fingerprints/NewAdPostFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/ad/general/fingerprints/NewAdPostFingerprint.kt @@ -7,4 +7,4 @@ internal object NewAdPostFingerprint : MethodFingerprint( opcodes = listOf(Opcode.INVOKE_VIRTUAL), strings = listOf("chain", "feedElement"), customFingerprint = { _, classDef -> classDef.sourceFile == "AdElementConverter.kt" }, -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/BaseSpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/BaseSpoofClientPatch.kt index 0a7c3e752e..cb0243280c 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/BaseSpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/BaseSpoofClientPatch.kt @@ -24,7 +24,7 @@ abstract class BaseSpoofClientPatch( miscellaneousFingerprints.let(::addAll) }, compatiblePackages = compatiblePackages, - dependencies = dependencies + dependencies = dependencies, ) { var clientId by stringPatchOption( "client-id", @@ -32,15 +32,15 @@ abstract class BaseSpoofClientPatch( null, "OAuth client ID", "The Reddit OAuth client ID. " + - "You can get your client ID from https://www.reddit.com/prefs/apps. " + - "The application type has to be \"Installed app\" " + - "and the redirect URI has to be set to \"$redirectUri\".", - true + "You can get your client ID from https://www.reddit.com/prefs/apps. " + + "The application type has to be \"Installed app\" " + + "and the redirect URI has to be set to \"$redirectUri\".", + true, ) override fun execute(context: BytecodeContext) { fun Set.executePatch( - patch: Set.(BytecodeContext) -> Unit + patch: Set.(BytecodeContext) -> Unit, ) = this.map { it.result ?: throw it.exception }.toSet().patch(context) clientIdFingerprints.executePatch { patchClientId(context) } @@ -72,4 +72,4 @@ abstract class BaseSpoofClientPatch( * @param context The current [BytecodeContext]. */ open fun Set.patchMiscellaneous(context: BytecodeContext) {} -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/Constants.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/Constants.kt index 6891a97a8e..25f2245f73 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/Constants.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/Constants.kt @@ -2,5 +2,5 @@ package app.revanced.patches.reddit.customclients object Constants { const val OAUTH_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " + - "Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60" -} \ No newline at end of file + "Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60" +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt index befc582bc7..4c4a9c2beb 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt @@ -9,15 +9,14 @@ import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.Ge import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.RequestTokenFingerprint import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction - @Suppress("unused") object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "http://baconreader.com/auth", clientIdFingerprints = setOf(GetAuthorizationUrlFingerprint, RequestTokenFingerprint), compatiblePackages = setOf( CompatiblePackage("com.onelouder.baconreader"), - CompatiblePackage("com.onelouder.baconreader.premium") - ) + CompatiblePackage("com.onelouder.baconreader.premium"), + ), ) { override fun Set.patchClientId(context: BytecodeContext) { fun MethodFingerprintResult.patch(replacementString: String) { @@ -27,7 +26,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( val clientIdRegister = getInstruction(clientIdIndex).registerA replaceInstruction( clientIdIndex, - "const-string v$clientIdRegister, \"$replacementString\"" + "const-string v$clientIdRegister, \"$replacementString\"", ) } } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetAuthorizationUrlFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetAuthorizationUrlFingerprint.kt index 8a0f5dc78a..0c796f8eda 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetAuthorizationUrlFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetAuthorizationUrlFingerprint.kt @@ -2,6 +2,6 @@ package app.revanced.patches.reddit.customclients.baconreader.api.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint -internal object GetAuthorizationUrlFingerprint: MethodFingerprint( +internal object GetAuthorizationUrlFingerprint : MethodFingerprint( strings = listOf("client_id=zACVn0dSFGdWqQ"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetClientIdFingerprint.kt index e974c19f4a..3444de6a90 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/GetClientIdFingerprint.kt @@ -8,5 +8,5 @@ internal object GetClientIdFingerprint : MethodFingerprint( if (!classDef.type.endsWith("RedditOAuth;")) return@custom false methodDef.name == "getAuthorizeUrl" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/RequestTokenFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/RequestTokenFingerprint.kt index 2aa46db9c5..2bae73cbc9 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/RequestTokenFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/fingerprints/RequestTokenFingerprint.kt @@ -4,4 +4,4 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object RequestTokenFingerprint : MethodFingerprint( strings = listOf("zACVn0dSFGdWqQ", "kDm2tYpu9DqyWFFyPlNcXGEni4k"), // App ID and secret. -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt index e7a76441ff..2caf076007 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt @@ -7,13 +7,12 @@ import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.LoginActivityOnCreateFingerprint - @Suppress("unused") object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "http://rubenmayayo.com", clientIdFingerprints = setOf(GetClientIdFingerprint), userAgentFingerprints = setOf(LoginActivityOnCreateFingerprint), - compatiblePackages = setOf(CompatiblePackage("com.rubenmayayo.reddit")) + compatiblePackages = setOf(CompatiblePackage("com.rubenmayayo.reddit")), ) { override fun Set.patchClientId(context: BytecodeContext) { first().mutableMethod.addInstructions( @@ -21,7 +20,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( """ const-string v0, "$clientId" return-object v0 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/GetClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/GetClientIdFingerprint.kt index 8f85cd7beb..7c791f68c8 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/GetClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/GetClientIdFingerprint.kt @@ -7,5 +7,5 @@ internal object GetClientIdFingerprint : MethodFingerprint( if (!classDef.type.endsWith("Credentials;")) return@custom false methodDef.name == "getClientId" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt index be328cdbee..47e91b203b 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt @@ -6,9 +6,9 @@ import com.android.tools.smali.dexlib2.Opcode internal object LoginActivityOnCreateFingerprint : MethodFingerprint( opcodes = listOf( Opcode.MOVE_RESULT_OBJECT, - Opcode.CONST_4 + Opcode.CONST_4, ), customFingerprint = { method, classDef -> method.name == "onCreate" && classDef.type.endsWith("LoginActivity;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt index 0565bfefa7..371b53d153 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt @@ -15,7 +15,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "infinity://localhost", clientIdFingerprints = setOf(APIUtilsFingerprint), - compatiblePackages = setOf(CompatiblePackage("ml.docilealligator.infinityforreddit")) + compatiblePackages = setOf(CompatiblePackage("ml.docilealligator.infinityforreddit")), ) { override fun Set.patchClientId(context: BytecodeContext) { first().mutableClass.methods.apply { diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/APIUtilsFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/APIUtilsFingerprint.kt index c309b4dd53..42d535534a 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/APIUtilsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/APIUtilsFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerpr import app.revanced.patcher.fingerprint.MethodFingerprint internal object APIUtilsFingerprint : MethodFingerprint( - strings = listOf("native-lib") -) \ No newline at end of file + strings = listOf("native-lib"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/AbstractClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/AbstractClientIdFingerprint.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/GetHttpBasicAuthHeaderFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/GetHttpBasicAuthHeaderFingerprint.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt index c8adebfe5c..5d3a921f70 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.reddit.customclients.infinityforreddit.subscription import app.revanced.util.patch.LiteralValueFingerprint internal object StartSubscriptionActivityFingerprint : LiteralValueFingerprint( - literalSupplier = { 0x10008000 } // Intent start flag only used in the subscription activity -) \ No newline at end of file + literalSupplier = { 0x10008000 }, // Intent start flag only used in the subscription activity +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt index 6dc76ed0cf..ec63872854 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.ads -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -8,11 +7,12 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.customclients.joeyforreddit.ads.fingerprints.IsAdFreeUserFingerprint import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.DisablePiracyDetectionPatch +import app.revanced.util.exception @Patch( name = "Disable ads", dependencies = [DisablePiracyDetectionPatch::class], - compatiblePackages = [CompatiblePackage("o.o.joey")] + compatiblePackages = [CompatiblePackage("o.o.joey")], ) @Suppress("unused") object DisableAdsPatch : BytecodePatch(setOf(IsAdFreeUserFingerprint)) { @@ -22,7 +22,7 @@ object DisableAdsPatch : BytecodePatch(setOf(IsAdFreeUserFingerprint)) { """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw IsAdFreeUserFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/fingerprints/IsAdFreeUserFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/fingerprints/IsAdFreeUserFingerprint.kt index 46a01b11bc..a5ae5b42be 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/fingerprints/IsAdFreeUserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/fingerprints/IsAdFreeUserFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object IsAdFreeUserFingerprint : MethodFingerprint( returnType = "Z", accessFlags = AccessFlags.PUBLIC.value, - strings = listOf("AD_FREE_USER") -) \ No newline at end of file + strings = listOf("AD_FREE_USER"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt index 7826956909..e314dfed08 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt @@ -7,7 +7,6 @@ import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch import app.revanced.patches.reddit.customclients.joeyforreddit.api.fingerprints.GetClientIdFingerprint import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.DisablePiracyDetectionPatch - @Suppress("unused") object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "https://127.0.0.1:65023/authorize_callback", @@ -15,9 +14,9 @@ object SpoofClientPatch : BaseSpoofClientPatch( compatiblePackages = setOf( CompatiblePackage("o.o.joey"), CompatiblePackage("o.o.joey.pro"), - CompatiblePackage("o.o.joey.dev") + CompatiblePackage("o.o.joey.dev"), ), - dependencies = setOf(DisablePiracyDetectionPatch::class) + dependencies = setOf(DisablePiracyDetectionPatch::class), ) { override fun Set.patchClientId(context: BytecodeContext) { first().mutableMethod.addInstructions( @@ -25,7 +24,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( """ const-string v0, "$clientId" return-object v0 - """ + """, ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/fingerprints/GetClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/fingerprints/GetClientIdFingerprint.kt index 480db1426a..1d475cdd67 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/fingerprints/GetClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/fingerprints/GetClientIdFingerprint.kt @@ -1,20 +1,20 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.api.fingerprints import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -import app.revanced.patcher.fingerprint.MethodFingerprint internal object GetClientIdFingerprint : MethodFingerprint( returnType = "L", accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, opcodes = listOf( - Opcode.CONST, // R.string.valuable_cid - Opcode.INVOKE_STATIC, // StringMaster.decrypt + Opcode.CONST, // R.string.valuable_cid + Opcode.INVOKE_STATIC, // StringMaster.decrypt Opcode.MOVE_RESULT_OBJECT, - Opcode.RETURN_OBJECT + Opcode.RETURN_OBJECT, ), customFingerprint = custom@{ _, classDef -> classDef.sourceFile == "AuthUtility.java" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt index e2a60686ef..16284456cf 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt @@ -1,10 +1,10 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint +import app.revanced.util.exception object DisablePiracyDetectionPatch : BytecodePatch(setOf(PiracyDetectionFingerprint)) { override fun execute(context: BytecodeContext) { @@ -12,7 +12,7 @@ object DisablePiracyDetectionPatch : BytecodePatch(setOf(PiracyDetectionFingerpr 0, """ return-void - """ + """, ) ?: throw PiracyDetectionFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt index a6ba8806f6..f6aad8bbd0 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt @@ -9,14 +9,14 @@ internal object PiracyDetectionFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PRIVATE or AccessFlags.STATIC, opcodes = listOf( - Opcode.NEW_INSTANCE, // new PiracyDetectionRunnable() + Opcode.NEW_INSTANCE, // new PiracyDetectionRunnable() Opcode.CONST_16, Opcode.CONST_WIDE_16, - Opcode.INVOKE_DIRECT, // (..) - Opcode.INVOKE_VIRTUAL, // run() - Opcode.RETURN_VOID + Opcode.INVOKE_DIRECT, // (..) + Opcode.INVOKE_VIRTUAL, // run() + Opcode.RETURN_VOID, ), customFingerprint = custom@{ _, classDef -> classDef.type.endsWith("ProcessLifeCyleListener;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt index ab110821ec..8c77758f93 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt @@ -12,7 +12,6 @@ import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.Bu import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.GetUserAgentFingerprint import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction - @Suppress("unused") object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "redditisfun://auth", @@ -20,8 +19,8 @@ object SpoofClientPatch : BaseSpoofClientPatch( userAgentFingerprints = setOf(GetUserAgentFingerprint), compatiblePackages = setOf( CompatiblePackage("com.andrewshu.android.reddit"), - CompatiblePackage("com.andrewshu.android.redditdonation") - ) + CompatiblePackage("com.andrewshu.android.redditdonation"), + ), ) { override fun Set.patchClientId(context: BytecodeContext) { /** @@ -59,7 +58,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( """ const-string v0, "$userAgent" return-object v0 - """ + """, ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BaseClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BaseClientIdFingerprint.kt index 108b4f97d0..2d446cd2db 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BaseClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BaseClientIdFingerprint.kt @@ -4,4 +4,4 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal abstract class BaseClientIdFingerprint(string: String) : MethodFingerprint( strings = listOfNotNull("yyOCBp.RHJhDKd", string), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BasicAuthorizationFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BasicAuthorizationFingerprint.kt index 30aacd6fd1..d4b585f049 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BasicAuthorizationFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/fingerprints/BasicAuthorizationFingerprint.kt @@ -2,4 +2,4 @@ package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints internal object BasicAuthorizationFingerprint : BaseClientIdFingerprint( string = "fJOxVwBUyo*=f:.patchClientId(context: BytecodeContext) { forEach { @@ -39,7 +38,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( it.mutableMethod.replaceInstruction( clientIdIndex, - "const-string v$clientIdRegister, \"$clientId\"" + "const-string v$clientIdRegister, \"$clientId\"", ) } } @@ -59,10 +58,10 @@ object SpoofClientPatch : BaseSpoofClientPatch( checkIsOAuthRequestIndex, BuilderInstruction10t( Opcode.GOTO, - returnNextChain - ) + returnNextChain, + ), ) } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/BaseClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/BaseClientIdFingerprint.kt index 1740e5cdb2..020e72370d 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/BaseClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/BaseClientIdFingerprint.kt @@ -4,4 +4,4 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal abstract class BaseClientIdFingerprint(string: String) : MethodFingerprint( strings = listOfNotNull("dj-xCIZQYiLbEg", string), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedInBearerTokenFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedInBearerTokenFingerprint.kt index 9df86a2762..15e65d499c 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedInBearerTokenFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedInBearerTokenFingerprint.kt @@ -1,3 +1,3 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints -internal object GetLoggedInBearerTokenFingerprint : BaseClientIdFingerprint("authorization_code") \ No newline at end of file +internal object GetLoggedInBearerTokenFingerprint : BaseClientIdFingerprint("authorization_code") diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedOutBearerTokenFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedOutBearerTokenFingerprint.kt index fd31bfcd0a..1c82dfe83e 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedOutBearerTokenFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetLoggedOutBearerTokenFingerprint.kt @@ -1,3 +1,3 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints -internal object GetLoggedOutBearerTokenFingerprint : BaseClientIdFingerprint("https://oauth.reddit.com/grants/installed_client") \ No newline at end of file +internal object GetLoggedOutBearerTokenFingerprint : BaseClientIdFingerprint("https://oauth.reddit.com/grants/installed_client") diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetRefreshTokenFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetRefreshTokenFingerprint.kt index a2fcbeb75b..453eb31016 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetRefreshTokenFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/GetRefreshTokenFingerprint.kt @@ -1,3 +1,3 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints -internal object GetRefreshTokenFingerprint : BaseClientIdFingerprint("refresh_token") \ No newline at end of file +internal object GetRefreshTokenFingerprint : BaseClientIdFingerprint("refresh_token") diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/LoginActivityClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/LoginActivityClientIdFingerprint.kt index b94e4ce132..4fc838dc15 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/LoginActivityClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/LoginActivityClientIdFingerprint.kt @@ -1,3 +1,3 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints -internal object LoginActivityClientIdFingerprint : BaseClientIdFingerprint("&duration=permanent") \ No newline at end of file +internal object LoginActivityClientIdFingerprint : BaseClientIdFingerprint("&duration=permanent") diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/RedditCheckDisableAPIFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/RedditCheckDisableAPIFingerprint.kt index 1889580f71..3e72f9bab2 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/RedditCheckDisableAPIFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/RedditCheckDisableAPIFingerprint.kt @@ -5,5 +5,5 @@ import com.android.tools.smali.dexlib2.Opcode internal object RedditCheckDisableAPIFingerprint : MethodFingerprint( strings = listOf("Reddit Disabled"), - opcodes = listOf(Opcode.IF_EQZ) -) \ No newline at end of file + opcodes = listOf(Opcode.IF_EQZ), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/SetRemoteConfigFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/SetRemoteConfigFingerprint.kt index 981613337f..53cae2f40f 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/SetRemoteConfigFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/fingerprints/SetRemoteConfigFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SetRemoteConfigFingerprint : MethodFingerprint( strings = listOf("reddit_oauth_url"), - parameters = listOf("Lcom/google/firebase/remoteconfig/FirebaseRemoteConfig;") -) \ No newline at end of file + parameters = listOf("Lcom/google/firebase/remoteconfig/FirebaseRemoteConfig;"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt index e49bf1b513..adc56e88f9 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt @@ -6,20 +6,19 @@ import app.revanced.patcher.fingerprint.MethodFingerprintResult import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint - @Suppress("unused") object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "http://www.ccrama.me", clientIdFingerprints = setOf(GetClientIdFingerprint), - compatiblePackages = setOf(CompatiblePackage("me.ccrama.redditslide")) + compatiblePackages = setOf(CompatiblePackage("me.ccrama.redditslide")), ) { override fun Set.patchClientId(context: BytecodeContext) { first().mutableMethod.addInstructions( 0, - """ + """ const-string v0, "$clientId" return-object v0 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/fingerprints/GetClientIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/fingerprints/GetClientIdFingerprint.kt index 31b28b4003..73492f5aab 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/fingerprints/GetClientIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/fingerprints/GetClientIdFingerprint.kt @@ -1,11 +1,11 @@ -package app.revanced.patches.reddit.customclients.slide.api.fingerprints - -import app.revanced.patcher.fingerprint.MethodFingerprint - -internal object GetClientIdFingerprint : MethodFingerprint( - customFingerprint = custom@{ methodDef, classDef -> - if (!classDef.type.endsWith("Credentials;")) return@custom false - - methodDef.name == "getClientId" - } -) \ No newline at end of file +package app.revanced.patches.reddit.customclients.slide.api.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +internal object GetClientIdFingerprint : MethodFingerprint( + customFingerprint = custom@{ methodDef, classDef -> + if (!classDef.type.endsWith("Credentials;")) return@custom false + + methodDef.name == "getClientId" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch.kt index 75c57b646a..a8ed2045e8 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.reddit.customclients.syncforreddit.ads -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -8,11 +7,12 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.customclients.syncforreddit.ads.fingerprints.IsAdsEnabledFingerprint import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch +import app.revanced.util.exception @Patch( name = "Disable ads", dependencies = [DisablePiracyDetectionPatch::class], - compatiblePackages = [CompatiblePackage("com.laurencedawson.reddit_sync")] + compatiblePackages = [CompatiblePackage("com.laurencedawson.reddit_sync")], ) @Suppress("unused") object DisableAdsPatch : BytecodePatch(setOf(IsAdsEnabledFingerprint)) { @@ -23,8 +23,8 @@ object DisableAdsPatch : BytecodePatch(setOf(IsAdsEnabledFingerprint)) { """ const/4 v0, 0x0 return v0 - """ + """, ) } ?: throw IsAdsEnabledFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/fingerprints/IsAdsEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/fingerprints/IsAdsEnabledFingerprint.kt index 2c15da4edc..97526fb628 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/fingerprints/IsAdsEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/fingerprints/IsAdsEnabledFingerprint.kt @@ -7,5 +7,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object IsAdsEnabledFingerprint : MethodFingerprint( returnType = "Z", accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, - strings = listOf("SyncIapHelper") -) \ No newline at end of file + strings = listOf("SyncIapHelper"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt index 7f161a16cc..a39b18218f 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt @@ -1,13 +1,12 @@ package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreateFingerprint - +import app.revanced.util.exception @Patch( name = "Disable Sync for Lemmy bottom sheet", @@ -15,8 +14,8 @@ import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startu compatiblePackages = [ CompatiblePackage("com.laurencedawson.reddit_sync", ["v23.06.30-13:39"]), CompatiblePackage("com.laurencedawson.reddit_sync.pro"), // Version unknown. - CompatiblePackage("com.laurencedawson.reddit_sync.dev") // Version unknown. - ] + CompatiblePackage("com.laurencedawson.reddit_sync.dev"), // Version unknown. + ], ) @Suppress("unused") object DisableSyncForLemmyBottomSheetPatch : BytecodePatch(setOf(MainActivityOnCreateFingerprint)) { @@ -25,6 +24,6 @@ object DisableSyncForLemmyBottomSheetPatch : BytecodePatch(setOf(MainActivityOnC val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1 removeInstruction(showBottomSheetIndex) - } ?: throw MainActivityOnCreateFingerprint.exception + } ?: throw MainActivityOnCreateFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/fingerprints/MainActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/fingerprints/MainActivityOnCreateFingerprint.kt index 887df3cc7a..84940f0eb1 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/fingerprints/MainActivityOnCreateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/fingerprints/MainActivityOnCreateFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object MainActivityOnCreateFingerprint : MethodFingerprint( customFingerprint = custom@{ method, classDef -> classDef.type.endsWith("MainActivity;") && method.name == "onCreate" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt index ce058a5c44..9f47eac70e 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt @@ -17,7 +17,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference import java.util.* - @Suppress("unused") object SpoofClientPatch : BaseSpoofClientPatch( redirectUri = "http://redditsync/auth", @@ -27,9 +26,9 @@ object SpoofClientPatch : BaseSpoofClientPatch( compatiblePackages = setOf( CompatiblePackage("com.laurencedawson.reddit_sync"), CompatiblePackage("com.laurencedawson.reddit_sync.pro"), - CompatiblePackage("com.laurencedawson.reddit_sync.dev") + CompatiblePackage("com.laurencedawson.reddit_sync.dev"), ), - dependencies = setOf(DisablePiracyDetectionPatch::class) + dependencies = setOf(DisablePiracyDetectionPatch::class), ) { override fun Set.patchClientId(context: BytecodeContext) { forEach { fingerprintResult -> @@ -41,7 +40,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( """ const-string v0, "Basic $auth" return-object v0 - """ + """, ) } ?: throw GetBearerTokenFingerprint.exception }.let { @@ -54,12 +53,12 @@ object SpoofClientPatch : BaseSpoofClientPatch( val newAuthorizationUrl = reference.string.replace( "client_id=.*?&".toRegex(), - "client_id=$clientId&" + "client_id=$clientId&", ) replaceInstruction( occurrenceIndex, - "const-string v$targetRegister, \"$newAuthorizationUrl\"" + "const-string v$targetRegister, \"$newAuthorizationUrl\"", ) } } @@ -72,7 +71,7 @@ object SpoofClientPatch : BaseSpoofClientPatch( it.mutableMethod.replaceInstruction( apiUrlIndex, - "const-string v1, \"https://api.imgur.com/3/image\"" + "const-string v1, \"https://api.imgur.com/3/image\"", ) } } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetAuthorizationStringFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetAuthorizationStringFingerprint.kt index 391d21b38d..35893b732f 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetAuthorizationStringFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetAuthorizationStringFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint internal object GetAuthorizationStringFingerprint : MethodFingerprint( - strings = listOf("authorize.compact?client_id") -) \ No newline at end of file + strings = listOf("authorize.compact?client_id"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetBearerTokenFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetBearerTokenFingerprint.kt index 937e616516..9145c511b4 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetBearerTokenFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/GetBearerTokenFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint internal object GetBearerTokenFingerprint : MethodFingerprint( - strings = listOf("Basic") -) \ No newline at end of file + strings = listOf("Basic"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt index 2815d84c7a..ea1aada89c 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ImgurImageAPIFingerprint : MethodFingerprint( strings = listOf( "https://imgur-apiv3.p.rapidapi.com/3/image", - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/LoadBrowserURLFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/LoadBrowserURLFingerprint.kt index 7673c92ba5..7e774e39c4 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/LoadBrowserURLFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/LoadBrowserURLFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.Opcode internal object LoadBrowserURLFingerprint : MethodFingerprint( parameters = listOf("Landroid/view/View;", "Landroid/os/Bundle;"), opcodes = listOf(Opcode.CONST_4), - strings = listOf("CustomInterface") -) \ No newline at end of file + strings = listOf("CustomInterface"), +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt index f7cbc87716..c914214722 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt @@ -14,7 +14,7 @@ internal object PiracyDetectionFingerprint : MethodFingerprint( Opcode.INVOKE_DIRECT, Opcode.NEW_INSTANCE, Opcode.INVOKE_DIRECT, - Opcode.INVOKE_VIRTUAL + Opcode.INVOKE_VIRTUAL, ), customFingerprint = { method, _ -> method.implementation?.instructions?.any { @@ -24,5 +24,5 @@ internal object PiracyDetectionFingerprint : MethodFingerprint( reference.toString() == "Lcom/github/javiersantos/piracychecker/PiracyChecker;" } ?: false - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch.kt index 09fa4e3703..d814fdacb1 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch.kt @@ -14,12 +14,12 @@ import app.revanced.util.exception compatiblePackages = [ CompatiblePackage("com.laurencedawson.reddit_sync"), CompatiblePackage("com.laurencedawson.reddit_sync.pro"), - CompatiblePackage("com.laurencedawson.reddit_sync.dev") + CompatiblePackage("com.laurencedawson.reddit_sync.dev"), ], - requiresIntegrations = true + requiresIntegrations = true, ) object FixSLinksPatch : BytecodePatch( - setOf(LinkHelperOpenLinkFingerprint) + setOf(LinkHelperOpenLinkFingerprint), ) { override fun execute(context: BytecodeContext) = LinkHelperOpenLinkFingerprint.result?.mutableMethod?.addInstructions( @@ -27,6 +27,6 @@ object FixSLinksPatch : BytecodePatch( """ invoke-static { p3 }, Lapp/revanced/integrations/syncforreddit/FixSLinksPatch;->resolveSLink(Ljava/lang/String;)Ljava/lang/String; move-result-object p3 - """ + """, ) ?: throw LinkHelperOpenLinkFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/fingerprints/LinkHelperOpenLinkFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/fingerprints/LinkHelperOpenLinkFingerprint.kt index a84de6b21a..fddeec6c8a 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/fingerprints/LinkHelperOpenLinkFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/fingerprints/LinkHelperOpenLinkFingerprint.kt @@ -2,6 +2,6 @@ package app.revanced.patches.reddit.customclients.syncforreddit.fix.slink.finger import app.revanced.patcher.fingerprint.MethodFingerprint -internal object LinkHelperOpenLinkFingerprint: MethodFingerprint( - strings = listOf("Link title: ") +internal object LinkHelperOpenLinkFingerprint : MethodFingerprint( + strings = listOf("Link title: "), ) diff --git a/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt index b7dabcfc74..757bb8c4de 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.reddit.layout.disablescreenshotpopup -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints.DisableScreenshotPopupFingerprint +import app.revanced.util.exception @Patch( name = "Disable screenshot popup", description = "Disables the popup that shows up when taking a screenshot.", - compatiblePackages = [CompatiblePackage("com.reddit.frontpage")] + compatiblePackages = [CompatiblePackage("com.reddit.frontpage")], ) @Suppress("unused") object DisableScreenshotPopupPatch : BytecodePatch(setOf(DisableScreenshotPopupFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/fingerprints/DisableScreenshotPopupFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/fingerprints/DisableScreenshotPopupFingerprint.kt index 95ef4d8730..9ccab78540 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/fingerprints/DisableScreenshotPopupFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/fingerprints/DisableScreenshotPopupFingerprint.kt @@ -6,9 +6,10 @@ internal object DisableScreenshotPopupFingerprint : MethodFingerprint( "V", parameters = listOf("Landroidx/compose/runtime/", "I"), customFingerprint = custom@{ methodDef, classDef -> - if (!classDef.type.endsWith("\$ScreenshotTakenBannerKt\$lambda-1\$1;")) - return@custom false + if (!classDef.type.endsWith("\$ScreenshotTakenBannerKt\$lambda-1\$1;")) { + return@custom false + } methodDef.name == "invoke" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt index ee2ad4c9f8..14ac66b588 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt @@ -1,17 +1,16 @@ package app.revanced.patches.reddit.layout.premiumicon -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.layout.premiumicon.fingerprints.HasPremiumIconAccessFingerprint - +import app.revanced.util.exception @Patch( name = "Unlock premium Reddit icons", - compatiblePackages = [CompatiblePackage("com.reddit.frontpage")] + compatiblePackages = [CompatiblePackage("com.reddit.frontpage")], ) @Suppress("unused") object UnlockPremiumIconPatch : BytecodePatch(setOf(HasPremiumIconAccessFingerprint)) { @@ -21,7 +20,7 @@ object UnlockPremiumIconPatch : BytecodePatch(setOf(HasPremiumIconAccessFingerpr """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw HasPremiumIconAccessFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/fingerprints/HasPremiumIconAccessFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/fingerprints/HasPremiumIconAccessFingerprint.kt index 19b4b295d8..c56f9f9d2a 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/fingerprints/HasPremiumIconAccessFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/fingerprints/HasPremiumIconAccessFingerprint.kt @@ -6,5 +6,5 @@ internal object HasPremiumIconAccessFingerprint : MethodFingerprint( "Z", customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("MyAccount;") && methodDef.name == "isPremiumSubscriber" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt index da5979aa37..7d007b12a0 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt @@ -1,26 +1,24 @@ package app.revanced.patches.reddit.misc.tracking.url -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.reddit.misc.tracking.url.fingerprints.ShareLinkFormatterFingerprint - +import app.revanced.util.exception @Patch( name = "Sanitize sharing links", description = "Removes (tracking) query parameters from the URLs when sharing links.", - compatiblePackages = [CompatiblePackage("com.reddit.frontpage")] + compatiblePackages = [CompatiblePackage("com.reddit.frontpage")], ) @Suppress("unused") object SanitizeUrlQueryPatch : BytecodePatch(setOf(ShareLinkFormatterFingerprint)) { override fun execute(context: BytecodeContext) { - ShareLinkFormatterFingerprint.result?.mutableMethod?.addInstructions( 0, - "return-object p0" + "return-object p0", ) ?: throw ShareLinkFormatterFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/fingerprints/ShareLinkFormatterFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/fingerprints/ShareLinkFormatterFingerprint.kt index 710dbb4587..6b98b4c267 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/fingerprints/ShareLinkFormatterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/fingerprints/ShareLinkFormatterFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ShareLinkFormatterFingerprint : MethodFingerprint( customFingerprint = { methodDef, classDef -> methodDef.definingClass.startsWith("Lcom/reddit/sharing/") && classDef.sourceFile == "UrlUtil.kt" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/RemoveDebuggingDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/RemoveDebuggingDetectionPatch.kt index 600abb3434..f7ae64f870 100644 --- a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/RemoveDebuggingDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/RemoveDebuggingDetectionPatch.kt @@ -1,22 +1,22 @@ package app.revanced.patches.scbeasy.detection.debugging -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.scbeasy.detection.debugging.fingerprints.DebuggingDetectionFingerprint +import app.revanced.util.exception @Patch( use = false, name = "Remove debugging detection", description = "Removes the USB and wireless debugging checks.", - compatiblePackages = [CompatiblePackage("com.scb.phone")] + compatiblePackages = [CompatiblePackage("com.scb.phone")], ) @Suppress("unused") object RemoveDebuggingDetectionPatch : BytecodePatch( - setOf(DebuggingDetectionFingerprint) + setOf(DebuggingDetectionFingerprint), ) { override fun execute(context: BytecodeContext) { DebuggingDetectionFingerprint.result?.mutableMethod?.addInstructions( @@ -24,7 +24,7 @@ object RemoveDebuggingDetectionPatch : BytecodePatch( """ const/4 v0, 0x0 return v0 - """ + """, ) ?: throw DebuggingDetectionFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt index 8012b007ff..971afdd7d3 100644 --- a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object DebuggingDetectionFingerprint : MethodFingerprint( returnType = "Z", - strings = listOf("adb_enabled") + strings = listOf("adb_enabled"), ) diff --git a/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt index 7414ef1769..334e4318cc 100644 --- a/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt @@ -10,11 +10,11 @@ import app.revanced.patches.serviceportalbund.detection.root.fingerprints.RootDe @Patch( name = "Remove root detection", description = "Removes the check for root permissions and unlocked bootloader.", - compatiblePackages = [CompatiblePackage("at.gv.bka.serviceportal")] + compatiblePackages = [CompatiblePackage("at.gv.bka.serviceportal")], ) @Suppress("unused") object RootDetectionPatch : BytecodePatch( - setOf(RootDetectionFingerprint) + setOf(RootDetectionFingerprint), ) { override fun execute(context: BytecodeContext) = RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void") diff --git a/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt index 8673ffa750..dbb9f0d93f 100644 --- a/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt @@ -8,5 +8,5 @@ internal object RootDetectionFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/shared/fingerprints/CastContextFetchFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/CastContextFetchFingerprint.kt index 6553ef4210..332f41f01d 100644 --- a/src/main/kotlin/app/revanced/patches/shared/fingerprints/CastContextFetchFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/CastContextFetchFingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.shared.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object CastContextFetchFingerprint : MethodFingerprint( - strings = listOf("Error fetching CastContext.") -) \ No newline at end of file + strings = listOf("Error fetching CastContext."), +) diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt index 5956b1558e..e51c39d683 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.shared.misc.fix.verticalscroll -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.shared.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch(description = "Fixes issues with refreshing the feed when the first component is of type EmptyComponent.") object VerticalScrollPatch : BytecodePatch( - setOf(CanScrollVerticallyFingerprint) + setOf(CanScrollVerticallyFingerprint), ) { override fun execute(context: BytecodeContext) { CanScrollVerticallyFingerprint.result?.let { @@ -22,7 +22,7 @@ object VerticalScrollPatch : BytecodePatch( val insertIndex = moveResultIndex + 1 addInstruction( insertIndex, - "const/4 v$moveResultRegister, 0x0" + "const/4 v$moveResultRegister, 0x0", ) } } ?: throw CanScrollVerticallyFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/fingerprints/CanScrollVerticallyFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/fingerprints/CanScrollVerticallyFingerprint.kt index 7bd11b5084..64d4907743 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/fingerprints/CanScrollVerticallyFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/fingerprints/CanScrollVerticallyFingerprint.kt @@ -1,6 +1,5 @@ package app.revanced.patches.shared.misc.fix.verticalscroll.fingerprints - import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags @@ -16,5 +15,5 @@ internal object CanScrollVerticallyFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, ), - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") }, ) diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt index 5c118db6ac..71cf283f7f 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt @@ -53,15 +53,15 @@ abstract class BaseGmsCoreSupportPatch( ) : BytecodePatch( name = "GmsCore support", description = "Allows patched Google apps to run without root and under a different package name " + - "by using GmsCore instead of Google Play Services.", + "by using GmsCore instead of Google Play Services.", dependencies = setOf( ChangePackageNamePatch::class, gmsCoreSupportResourcePatch::class, - integrationsPatchDependency + integrationsPatchDependency, ) + dependencies, compatiblePackages = compatiblePackages, fingerprints = setOf(GmsCoreSupportFingerprint, mainActivityOnCreateFingerprint) + fingerprints, - requiresIntegrations = true + requiresIntegrations = true, ) { init { // Manually register all options of the resource patch so that they are visible in the patch API. @@ -77,7 +77,7 @@ abstract class BaseGmsCoreSupportPatch( val transformations = arrayOf( ::commonTransform, ::contentUrisTransform, - packageNameTransform(fromPackageName, packageName) + packageNameTransform(fromPackageName, packageName), ) context.transformStringReferences transform@{ string -> transformations.forEach { transform -> @@ -96,7 +96,7 @@ abstract class BaseGmsCoreSupportPatch( // Check the availability of GmsCore. mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstruction( 1, // Hack to not disturb other patches (such as the integrations patch). - "invoke-static {}, Lapp/revanced/integrations/youtube/patches/GmsCoreSupport;->checkAvailability()V" + "invoke-static {}, Lapp/revanced/integrations/youtube/patches/GmsCoreSupport;->checkAvailability()V", ) ?: throw mainActivityOnCreateFingerprint.exception // Change the vendor of GmsCore in ReVanced Integrations. @@ -130,8 +130,8 @@ abstract class BaseGmsCoreSupportPatch( BuilderInstruction21c( Opcode.CONST_STRING, instruction.registerA, - ImmutableStringReference(transformedString) - ) + ImmutableStringReference(transformedString), + ), ) } } @@ -145,7 +145,8 @@ abstract class BaseGmsCoreSupportPatch( "com.google.android.gms", in PERMISSIONS, in ACTIONS, - in AUTHORITIES -> referencedString.replace("com.google", gmsCoreVendor!!) + in AUTHORITIES, + -> referencedString.replace("com.google", gmsCoreVendor!!) // No vendor prefix for whatever reason... "subscribedfeeds" -> "$gmsCoreVendor.subscribedfeeds" @@ -161,7 +162,7 @@ abstract class BaseGmsCoreSupportPatch( if (str.startsWith(uriPrefix)) { return str.replace( uriPrefix, - "content://${authority.replace("com.google", gmsCoreVendor!!)}" + "content://${authority.replace("com.google", gmsCoreVendor!!)}", ) } } @@ -174,13 +175,13 @@ abstract class BaseGmsCoreSupportPatch( } return null - } private fun packageNameTransform(fromPackageName: String, toPackageName: String): (String) -> String? = { string -> when (string) { "$fromPackageName.SuggestionsProvider", - "$fromPackageName.fileprovider" -> string.replace(fromPackageName, toPackageName) + "$fromPackageName.fileprovider", + -> string.replace(fromPackageName, toPackageName) else -> null } @@ -293,7 +294,7 @@ abstract class BaseGmsCoreSupportPatch( "com.google.android.gms.gmscompliance.service.START", "com.google.android.gms.oss.licenses.service.START", "com.google.android.gms.safetynet.service.START", - "com.google.android.gms.tapandpay.service.BIND" + "com.google.android.gms.tapandpay.service.BIND", ) /** @@ -314,9 +315,9 @@ abstract class BaseGmsCoreSupportPatch( "com.google.android.gms.fonts", // phenotype - "com.google.android.gms.phenotype" + "com.google.android.gms.phenotype", ) } // endregion -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint.kt index 79be107f90..b75addcd38 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object GmsCoreSupportFingerprint : MethodFingerprint( customFingerprint = { _, classDef -> classDef.type.endsWith("GmsCoreSupport;") - } + }, ) { const val GET_GMS_CORE_VENDOR_METHOD_NAME = "getGmsCoreVendor" } diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreference.kt index 509d0eea36..6c66e5d902 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreference.kt @@ -17,7 +17,7 @@ abstract class BasePreference( val key: String? = null, val titleKey: String = "${key}_title", val summaryKey: String? = "${key}_summary", - val tag: String + val tag: String, ) { /** * Serialize preference element to XML. @@ -31,7 +31,7 @@ abstract class BasePreference( open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element = ownerDocument.createElement(tag).apply { key?.let { setAttribute("android:key", it) } - setAttribute("android:title", "@string/${titleKey}") + setAttribute("android:title", "@string/$titleKey") summaryKey?.let { addSummary(it) } } diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/InputType.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/InputType.kt index e5142d92ee..daf5626b62 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/InputType.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/InputType.kt @@ -5,4 +5,4 @@ enum class InputType(val type: String) { TEXT_CAP_CHARACTERS("textCapCharacters"), TEXT_MULTI_LINE("textMultiLine"), NUMBER("number"), -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/IntentPreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/IntentPreference.kt index dbc109ae86..cff6e32c91 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/IntentPreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/IntentPreference.kt @@ -22,11 +22,13 @@ class IntentPreference( override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) = super.serialize(ownerDocument, resourceCallback).apply { - appendChild(ownerDocument.createElement("intent").also { intentNode -> - intentNode.setAttribute("android:data", intent.data) - intentNode.setAttribute("android:targetClass", intent.targetClass) - intentNode.setAttribute("android:targetPackage", intent.targetPackageSupplier()) - }) + appendChild( + ownerDocument.createElement("intent").also { intentNode -> + intentNode.setAttribute("android:data", intent.data) + intentNode.setAttribute("android:targetClass", intent.targetClass) + intentNode.setAttribute("android:targetPackage", intent.targetPackageSupplier()) + }, + ) } override fun equals(other: Any?): Boolean { diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/ListPreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/ListPreference.kt index e0338d29c7..b6920fc958 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/ListPreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/ListPreference.kt @@ -21,7 +21,7 @@ class ListPreference( summaryKey: String? = "${key}_summary", tag: String = "ListPreference", val entriesKey: String? = "${key}_entries", - val entryValuesKey: String? = "${key}_entry_values" + val entryValuesKey: String? = "${key}_entry_values", ) : BasePreference(key, titleKey, summaryKey, tag) { var entries: ArrayResource? = null private set @@ -44,7 +44,7 @@ class ListPreference( summaryKey: String? = "${key}_summary", tag: String = "ListPreference", entries: ArrayResource, - entryValues: ArrayResource + entryValues: ArrayResource, ) : this(key, titleKey, summaryKey, tag, entries.name, entryValues.name) { this.entries = entries this.entryValues = entryValues @@ -58,15 +58,15 @@ class ListPreference( entriesArrayName?.let { setAttribute( "android:entries", - "@array/$it" + "@array/$it", ) } entryValuesArrayName?.let { setAttribute( "android:entryValues", - "@array/$it" + "@array/$it", ) } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt index f9525f92a9..982db441f0 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt @@ -18,7 +18,7 @@ class NonInteractivePreference( key: String, summaryKey: String? = "${key}_summary", tag: String = "Preference", - val selectable: Boolean = false + val selectable: Boolean = false, ) : BasePreference(null, "${key}_title", summaryKey, tag) { override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) = diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/PreferenceCategory.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/PreferenceCategory.kt index 67e82208f2..77b12bb472 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/PreferenceCategory.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/PreferenceCategory.kt @@ -16,7 +16,7 @@ open class PreferenceCategory( key: String? = null, titleKey: String = "${key}_title", tag: String = "PreferenceCategory", - val preferences: Set + val preferences: Set, ) : BasePreference(key, titleKey, null, tag) { override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) = diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SummaryType.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SummaryType.kt index ccf547b223..15b33b97a7 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SummaryType.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SummaryType.kt @@ -1,5 +1,7 @@ package app.revanced.patches.shared.misc.settings.preference enum class SummaryType(val type: String) { - DEFAULT("summary"), ON("summaryOn"), OFF("summaryOff") -} \ No newline at end of file + DEFAULT("summary"), + ON("summaryOn"), + OFF("summaryOff"), +} diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SwitchPreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SwitchPreference.kt index e09d813a36..583769c2ca 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SwitchPreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/SwitchPreference.kt @@ -18,7 +18,7 @@ class SwitchPreference( titleKey: String = "${key}_title", tag: String = "SwitchPreference", val summaryOnKey: String = "${key}_summary_on", - val summaryOffKey: String = "${key}_summary_off" + val summaryOffKey: String = "${key}_summary_off", ) : BasePreference(key, titleKey, null, tag) { override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) = super.serialize(ownerDocument, resourceCallback).apply { diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/TextPreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/TextPreference.kt index d329a91778..c29c10ebb3 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/TextPreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/TextPreference.kt @@ -18,7 +18,7 @@ class TextPreference( titleKey: String = "${key}_title", summaryKey: String? = "${key}_summary", tag: String = "app.revanced.integrations.shared.settings.preference.ResettableEditTextPreference", - val inputType: InputType = InputType.TEXT + val inputType: InputType = InputType.TEXT, ) : BasePreference(key, titleKey, summaryKey, tag) { override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) = diff --git a/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt b/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt index e042ec0098..955116d978 100644 --- a/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt +++ b/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.solidexplorer2.functionality.filesize -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction @@ -8,13 +7,13 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.solidexplorer2.functionality.filesize.fingerprints.OnReadyFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.ThreeRegisterInstruction - @Patch( name = "Remove file size limit", description = "Allows opening files larger than 2 MB in the text editor.", - compatiblePackages = [CompatiblePackage("pl.solidexplorer2")] + compatiblePackages = [CompatiblePackage("pl.solidexplorer2")], ) @Suppress("unused") object RemoveFileSizeLimitPatch : BytecodePatch(setOf(OnReadyFingerprint)) { @@ -22,6 +21,6 @@ object RemoveFileSizeLimitPatch : BytecodePatch(setOf(OnReadyFingerprint)) { val cmpIndex = result.scanResult.patternScanResult!!.startIndex + 1 val cmpResultRegister = result.mutableMethod.getInstruction(cmpIndex).registerA - result.mutableMethod.replaceInstruction(cmpIndex, "const/4 v${cmpResultRegister}, 0x0") + result.mutableMethod.replaceInstruction(cmpIndex, "const/4 v$cmpResultRegister, 0x0") } ?: throw OnReadyFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/fingerprints/OnReadyFingerprint.kt b/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/fingerprints/OnReadyFingerprint.kt index 6117badb3d..c1c9529af7 100644 --- a/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/fingerprints/OnReadyFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/fingerprints/OnReadyFingerprint.kt @@ -11,5 +11,5 @@ internal object OnReadyFingerprint : MethodFingerprint( ), customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lpl/solidexplorer/plugins/texteditor/TextEditor;" && methodDef.name == "onReady" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt b/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt index c32a7b0971..ca3a20005a 100644 --- a/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt +++ b/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.songpal.badge -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions @@ -8,11 +7,12 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.songpal.badge.fingerprints.CreateTabsFingerprint +import app.revanced.util.exception @Patch( name = "Remove badge tab", description = "Removes the badge tab from the activity tab.", - compatiblePackages = [CompatiblePackage("com.sony.songpal.mdr")] + compatiblePackages = [CompatiblePackage("com.sony.songpal.mdr")], ) object BadgeTabPatch : BytecodePatch(setOf(CreateTabsFingerprint)) { const val ACTIVITY_TAB_DESCRIPTOR = "Ljp/co/sony/vim/framework/ui/yourheadphones/YhContract\$Tab;" @@ -35,7 +35,7 @@ object BadgeTabPatch : BytecodePatch(setOf(CreateTabsFingerprint)) { const/4 v$indexRegister, $index sget-object v$arrayItemRegister, $ACTIVITY_TAB_DESCRIPTOR->$tab:$ACTIVITY_TAB_DESCRIPTOR aput-object v$arrayItemRegister, v$arrayRegister, v$indexRegister - """ + """, ) } @@ -47,9 +47,8 @@ object BadgeTabPatch : BytecodePatch(setOf(CreateTabsFingerprint)) { """ const/4 v$arrayRegister, ${arrayTabs.size} new-array v$arrayRegister, v$arrayRegister, [$ACTIVITY_TAB_DESCRIPTOR - """ + """, ) - } ?: throw CreateTabsFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt b/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt index f1dc8b7d2e..cf6a979216 100644 --- a/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt +++ b/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.songpal.badge -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.songpal.badge.fingerprints.ShowNotificationFingerprint +import app.revanced.util.exception @Patch( name = "Remove notification badge", description = "Removes the red notification badge from the activity tab.", - compatiblePackages = [CompatiblePackage("com.sony.songpal.mdr", ["10.1.0"])] + compatiblePackages = [CompatiblePackage("com.sony.songpal.mdr", ["10.1.0"])], ) @Suppress("unused") object RemoveNotificationBadgePatch : BytecodePatch(setOf(ShowNotificationFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/CreateTabsFingerprint.kt b/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/CreateTabsFingerprint.kt index 94639c4511..baabff8033 100644 --- a/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/CreateTabsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/CreateTabsFingerprint.kt @@ -22,5 +22,5 @@ internal object CreateTabsFingerprint : MethodFingerprint( if (reference.returnType != "[${BadgeTabPatch.ACTIVITY_TAB_DESCRIPTOR}") return@any false true } ?: false - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt b/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt index 016f7a88b8..b43853bb7d 100644 --- a/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt @@ -26,7 +26,7 @@ internal object ShowNotificationFingerprint : MethodFingerprint( } true } ?: false - } + }, ) { val expectedReference = ImmutableMethodReference( "Lcom/google/android/material/bottomnavigation/BottomNavigationView;", diff --git a/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/OnDemandPatch.kt b/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/OnDemandPatch.kt index 5e82eb2e09..b14c9670d3 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/OnDemandPatch.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/OnDemandPatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.spotify.lite.ondemand -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.spotify.lite.ondemand.fingerprints.OnDemandFingerprint +import app.revanced.util.exception @Patch( name = "Enable on demand", description = "Enables listening to songs on-demand, allowing to play any song from playlists, albums or artists without limitations. This does not remove ads.", - compatiblePackages = [CompatiblePackage("com.spotify.lite")] + compatiblePackages = [CompatiblePackage("com.spotify.lite")], ) @Suppress("unused") object OnDemandPatch : BytecodePatch(setOf(OnDemandFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/fingerprints/OnDemandFingerprint.kt b/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/fingerprints/OnDemandFingerprint.kt index a67c34e1a2..d67dd31043 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/fingerprints/OnDemandFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/lite/ondemand/fingerprints/OnDemandFingerprint.kt @@ -1,7 +1,7 @@ package app.revanced.patches.spotify.lite.ondemand.fingerprints -import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import com.android.tools.smali.dexlib2.Opcode @FuzzyPatternScanMethod(2) @@ -20,6 +20,6 @@ internal object OnDemandFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.IPUT, - Opcode.RETURN_OBJECT - ) + Opcode.RETURN_OBJECT, + ), ) diff --git a/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabPatch.kt b/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabPatch.kt index 5b2ad2f4c4..557b4f2e85 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabPatch.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabPatch.kt @@ -1,22 +1,22 @@ package app.revanced.patches.spotify.navbar -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.spotify.navbar.fingerprints.AddNavBarItemFingerprint +import app.revanced.util.exception @Patch( name = "Hide premium navbar", description = "Removes the premium tab from the navbar.", dependencies = [PremiumNavbarTabResourcePatch::class], - compatiblePackages = [CompatiblePackage("com.spotify.music")] + compatiblePackages = [CompatiblePackage("com.spotify.music")], ) @Suppress("unused") object PremiumNavbarTabPatch : BytecodePatch( - setOf(AddNavBarItemFingerprint) + setOf(AddNavBarItemFingerprint), ) { // If the navigation bar item is the premium tab, do not add it. override fun execute(context: BytecodeContext) = AddNavBarItemFingerprint.result?.mutableMethod?.addInstructions( @@ -27,6 +27,6 @@ object PremiumNavbarTabPatch : BytecodePatch( return-void :continue nop - """ + """, ) ?: throw AddNavBarItemFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/spotify/navbar/fingerprints/AddNavBarItemFingerprint.kt b/src/main/kotlin/app/revanced/patches/spotify/navbar/fingerprints/AddNavBarItemFingerprint.kt index 74e296e124..f103b9d15c 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/navbar/fingerprints/AddNavBarItemFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/navbar/fingerprints/AddNavBarItemFingerprint.kt @@ -6,7 +6,7 @@ import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags internal object AddNavBarItemFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - literalSupplier = { PremiumNavbarTabResourcePatch.showBottomNavigationItemsTextId }, -) \ No newline at end of file + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + literalSupplier = { PremiumNavbarTabResourcePatch.showBottomNavigationItemsTextId }, +) diff --git a/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt b/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt index 173abd9988..e482ad39d9 100644 --- a/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt @@ -1,17 +1,17 @@ package app.revanced.patches.strava.subscription -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.strava.subscription.fingerprints.GetSubscribedFingerprint +import app.revanced.util.exception @Patch( name = "Unlock subscription features", description = "Unlocks \"Routes\", \"Matched Runs\" and \"Segment Efforts\".", - compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])] + compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])], ) @Suppress("unused") object UnlockSubscriptionPatch : BytecodePatch(setOf(GetSubscribedFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/strava/subscription/fingerprints/GetSubscribedFingerprint.kt b/src/main/kotlin/app/revanced/patches/strava/subscription/fingerprints/GetSubscribedFingerprint.kt index 9d025a6af6..20a32302b5 100644 --- a/src/main/kotlin/app/revanced/patches/strava/subscription/fingerprints/GetSubscribedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/strava/subscription/fingerprints/GetSubscribedFingerprint.kt @@ -7,5 +7,5 @@ internal object GetSubscribedFingerprint : MethodFingerprint( opcodes = listOf(Opcode.IGET_BOOLEAN), customFingerprint = { methodDef, classDef -> classDef.type.endsWith("/SubscriptionDetailResponse;") && methodDef.name == "getSubscribed" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt b/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt index 222e6bf4c1..42d06ca390 100644 --- a/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.strava.upselling -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction @@ -9,17 +8,18 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patches.strava.upselling.fingerprints.GetModulesFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.immutable.ImmutableMethod @Patch( name = "Disable subscription suggestions", - compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])] + compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])], ) @Suppress("unused") object DisableSubscriptionSuggestionsPatch : BytecodePatch( - setOf(GetModulesFingerprint) + setOf(GetModulesFingerprint), ) { private const val HELPER_METHOD_NAME = "getModulesIfNotUpselling" private const val PAGE_SUFFIX = "_upsell" @@ -30,18 +30,19 @@ object DisableSubscriptionSuggestionsPatch : BytecodePatch( val originalMethod = result.mutableMethod val returnType = originalMethod.returnType - result.mutableClass.methods.add(ImmutableMethod( - className, - HELPER_METHOD_NAME, - emptyList(), - returnType, - AccessFlags.PRIVATE.value, - null, - null, - MutableMethodImplementation(3) - ).toMutable().apply { - addInstructions( - """ + result.mutableClass.methods.add( + ImmutableMethod( + className, + HELPER_METHOD_NAME, + emptyList(), + returnType, + AccessFlags.PRIVATE.value, + null, + null, + MutableMethodImplementation(3), + ).toMutable().apply { + addInstructions( + """ iget-object v0, p0, $className->page:Ljava/lang/String; const-string v1, "$PAGE_SUFFIX" invoke-virtual {v0, v1}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z @@ -53,9 +54,10 @@ object DisableSubscriptionSuggestionsPatch : BytecodePatch( :$LABEL iget-object v0, p0, $className->modules:Ljava/util/List; return-object v0 - """ - ) - }) + """, + ) + }, + ) val getModulesIndex = result.scanResult.patternScanResult!!.startIndex with(originalMethod) { @@ -65,7 +67,7 @@ object DisableSubscriptionSuggestionsPatch : BytecodePatch( """ invoke-direct {p0}, $className->$HELPER_METHOD_NAME()$returnType move-result-object v0 - """ + """, ) } } ?: throw GetModulesFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/strava/upselling/fingerprints/GetModulesFingerprint.kt b/src/main/kotlin/app/revanced/patches/strava/upselling/fingerprints/GetModulesFingerprint.kt index 5d4ff59598..d3591af20b 100644 --- a/src/main/kotlin/app/revanced/patches/strava/upselling/fingerprints/GetModulesFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/strava/upselling/fingerprints/GetModulesFingerprint.kt @@ -7,5 +7,5 @@ internal object GetModulesFingerprint : MethodFingerprint( opcodes = listOf(Opcode.IGET_OBJECT), customFingerprint = { methodDef, classDef -> classDef.type.endsWith("/GenericLayoutEntry;") && methodDef.name == "getModules" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt b/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch.kt similarity index 90% rename from src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt rename to src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch.kt index e39cd0777a..0706b3608d 100644 --- a/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch.kt @@ -12,10 +12,10 @@ import app.revanced.patches.ticktick.misc.themeunlock.fingerprints.SetThemeFinge @Patch( name = "Unlock themes", description = "Unlocks all themes that are inaccessible until a certain level is reached.", - compatiblePackages = [CompatiblePackage("com.ticktick.task")] + compatiblePackages = [CompatiblePackage("com.ticktick.task")], ) @Suppress("unused") -object UnlockProPatch : BytecodePatch(setOf(CheckLockedThemesFingerprint, SetThemeFingerprint)) { +object UnlockThemesPatch : BytecodePatch(setOf(CheckLockedThemesFingerprint, SetThemeFingerprint)) { override fun execute(context: BytecodeContext) { val lockedThemesMethod = CheckLockedThemesFingerprint.result!!.mutableMethod lockedThemesMethod.addInstructions( @@ -23,9 +23,9 @@ object UnlockProPatch : BytecodePatch(setOf(CheckLockedThemesFingerprint, SetThe """ const/4 v0, 0x0 return v0 - """ + """, ) - + val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod setThemeMethod.removeInstructions(0, 10) } diff --git a/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/CheckLockedThemesFingerprint.kt b/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/CheckLockedThemesFingerprint.kt index fcf7e056f6..eaabe3b18d 100644 --- a/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/CheckLockedThemesFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/CheckLockedThemesFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object CheckLockedThemesFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("Theme;") && methodDef.name == "isLockedTheme" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/SetThemeFingerprint.kt b/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/SetThemeFingerprint.kt index d54b61ed92..7351190e09 100644 --- a/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/SetThemeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/fingerprints/SetThemeFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SetThemeFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("ThemePreviewActivity;") && methodDef.name == "lambda\$updateUserBtn\$1" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt index 35a6f77fea..630f851cb4 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt @@ -17,16 +17,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Feed filter", description = "Removes ads, livestreams, stories, image videos " + - "and videos with a specific amount of views or likes from the feed.", + "and videos with a specific amount of views or likes from the feed.", dependencies = [IntegrationsPatch::class, SettingsPatch::class], compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]), - CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]) - ] + CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]), + ], ) @Suppress("unused") object FeedFilterPatch : BytecodePatch( - setOf(FeedApiServiceLIZFingerprint, SettingsStatusLoadFingerprint) + setOf(FeedApiServiceLIZFingerprint, SettingsStatusLoadFingerprint), ) { override fun execute(context: BytecodeContext) { FeedApiServiceLIZFingerprint.result?.mutableMethod?.apply { @@ -36,13 +36,13 @@ object FeedFilterPatch : BytecodePatch( addInstruction( returnFeedItemInstruction.location.index, "invoke-static { v$feedItemsRegister }, " + - "Lapp/revanced/integrations/tiktok/feedfilter/FeedItemsFilter;->filter(Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;)V" + "Lapp/revanced/integrations/tiktok/feedfilter/FeedItemsFilter;->filter(Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;)V", ) } ?: throw FeedApiServiceLIZFingerprint.exception SettingsStatusLoadFingerprint.result?.mutableMethod?.addInstruction( 0, - "invoke-static {}, Lapp/revanced/integrations/tiktok/settings/SettingsStatus;->enableFeedFilter()V" + "invoke-static {}, Lapp/revanced/integrations/tiktok/settings/SettingsStatus;->enableFeedFilter()V", ) ?: throw SettingsStatusLoadFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/fingerprints/FeedApiServiceLIZFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/fingerprints/FeedApiServiceLIZFingerprint.kt index 1872ea4854..657a340491 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/fingerprints/FeedApiServiceLIZFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/fingerprints/FeedApiServiceLIZFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object FeedApiServiceLIZFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/FeedApiService;") && methodDef.name == "fetchFeedList" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt similarity index 94% rename from src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt rename to src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt index 7399e0b568..456e47ccdc 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt @@ -20,15 +20,15 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c description = "Remembers the clear display configurations in between videos.", compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]), - CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]) - ] + CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]), + ], ) @Suppress("unused") object RememberClearDisplayPatch : BytecodePatch( setOf( OnClearDisplayEventFingerprint, - OnRenderFirstFrameFingerprint - ) + OnRenderFirstFrameFingerprint, + ), ) { override fun execute(context: BytecodeContext) { OnClearDisplayEventFingerprint.result?.mutableMethod?.let { @@ -40,7 +40,7 @@ object RememberClearDisplayPatch : BytecodePatch( it.addInstructions( isEnabledIndex, "invoke-static { v$isEnabledRegister }, " + - "Lapp/revanced/integrations/tiktok/cleardisplay/RememberClearDisplayPatch;->rememberClearDisplayState(Z)V" + "Lapp/revanced/integrations/tiktok/cleardisplay/RememberClearDisplayPatch;->rememberClearDisplayState(Z)V", ) // endregion @@ -69,7 +69,7 @@ object RememberClearDisplayPatch : BytecodePatch( invoke-direct { v0, v1, v2, v3 }, $clearDisplayEventClass->(ILjava/lang/String;Z)V invoke-virtual { v0 }, $clearDisplayEventClass->post()Lcom/ss/android/ugc/governance/eventbus/IEvent; """, - ExternalLabel("clear_display_disabled", getInstruction(0)) + ExternalLabel("clear_display_disabled", getInstruction(0)), ) } ?: throw OnRenderFirstFrameFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnClearDisplayEventFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnClearDisplayEventFingerprint.kt index 9d48cc33ff..9dafb84e0d 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnClearDisplayEventFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnClearDisplayEventFingerprint.kt @@ -6,5 +6,5 @@ internal object OnClearDisplayEventFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> // Internally the feature is called "Clear mode". methodDef.definingClass.endsWith("/ClearModePanelComponent;") && methodDef.name == "onClearModeEvent" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnRenderFirstFrameFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnRenderFirstFrameFingerprint.kt index d9e5a15ed0..af7b585ce5 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnRenderFirstFrameFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/fingerprints/OnRenderFirstFrameFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object OnRenderFirstFrameFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/BaseListFragmentPanel;") && methodDef.name == "onRenderFirstFrame" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt index 59b08b0ffd..b9b3be404a 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt @@ -29,8 +29,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference dependencies = [IntegrationsPatch::class, SettingsPatch::class], compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]), - CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]) - ] + CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]), + ], ) @Suppress("unused") object DownloadsPatch : BytecodePatch( @@ -39,8 +39,8 @@ object DownloadsPatch : BytecodePatch( ACLCommonShareFingerprint2, ACLCommonShareFingerprint3, DownloadPathParentFingerprint, - SettingsStatusLoadFingerprint - ) + SettingsStatusLoadFingerprint, + ), ) { override fun execute(context: BytecodeContext) { fun MethodFingerprint.getMethod() = result?.mutableMethod ?: throw exception @@ -52,7 +52,7 @@ object DownloadsPatch : BytecodePatch( """ const/4 v0, 0x0 return v0 - """ + """, ) }, ACLCommonShareFingerprint2 to { @@ -61,7 +61,7 @@ object DownloadsPatch : BytecodePatch( """ const/4 v0, 0x2 return v0 - """ + """, ) }, // Download videos without watermark. @@ -76,7 +76,7 @@ object DownloadsPatch : BytecodePatch( return v0 :noremovewatermark nop - """ + """, ) }, // Change the download path patch. @@ -92,7 +92,7 @@ object DownloadsPatch : BytecodePatch( } val secondIndex = downloadUriMethod.indexOfFirstInstruction { opcode == Opcode.INVOKE_STATIC && ((this as Instruction35c).reference as MethodReference).returnType.contains( - "Uri" + "Uri", ) } @@ -101,7 +101,7 @@ object DownloadsPatch : BytecodePatch( """ invoke-static {}, Lapp/revanced/integrations/tiktok/download/DownloadsPatch;->getDownloadPath()Ljava/lang/String; move-result-object v0 - """ + """, ) downloadUriMethod.addInstructions( @@ -109,15 +109,15 @@ object DownloadsPatch : BytecodePatch( """ invoke-static {}, Lapp/revanced/integrations/tiktok/download/DownloadsPatch;->getDownloadPath()Ljava/lang/String; move-result-object v0 - """ + """, ) }, SettingsStatusLoadFingerprint to { addInstruction( 0, - "invoke-static {}, Lapp/revanced/integrations/tiktok/settings/SettingsStatus;->enableDownload()V" + "invoke-static {}, Lapp/revanced/integrations/tiktok/settings/SettingsStatus;->enableDownload()V", ) - } + }, ).forEach { (fingerprint, patch) -> fingerprint.getMethod().patch() } diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint.kt index 1a71c4e725..70b2ba3c86 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint.kt @@ -9,6 +9,6 @@ internal object ACLCommonShareFingerprint : MethodFingerprint( AccessFlags.PUBLIC or AccessFlags.FINAL, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/ACLCommonShare;") && - methodDef.name == "getCode" - } -) \ No newline at end of file + methodDef.name == "getCode" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint2.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint2.kt index f58de3305e..e6b4c27c29 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint2.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint2.kt @@ -9,6 +9,6 @@ internal object ACLCommonShareFingerprint2 : MethodFingerprint( AccessFlags.PUBLIC or AccessFlags.FINAL, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/ACLCommonShare;") && - methodDef.name == "getShowType" - } -) \ No newline at end of file + methodDef.name == "getShowType" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint3.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint3.kt index 2c6fd0970a..94d4ea9f96 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint3.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/ACLCommonShareFingerprint3.kt @@ -9,6 +9,6 @@ internal object ACLCommonShareFingerprint3 : MethodFingerprint( AccessFlags.PUBLIC or AccessFlags.FINAL, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/ACLCommonShare;") && - methodDef.name == "getTranscode" - } -) \ No newline at end of file + methodDef.name == "getTranscode" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/DownloadPathParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/DownloadPathParentFingerprint.kt index 53f41dc20d..f6c59ed234 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/DownloadPathParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/fingerprints/DownloadPathParentFingerprint.kt @@ -9,16 +9,16 @@ internal object DownloadPathParentFingerprint : MethodFingerprint( "L", AccessFlags.PUBLIC or AccessFlags.STATIC, strings = listOf( - "video/mp4" + "video/mp4", ), parameters = listOf( "L", - "L" + "L", ), opcodes = listOf( Opcode.CONST_STRING, Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, - Opcode.RETURN_OBJECT - ) -) \ No newline at end of file + Opcode.RETURN_OBJECT, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt index ec0005858f..494c194645 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.tiktok.interaction.seekbar -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -8,14 +7,15 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.ShouldShowSeekBarFingerprint +import app.revanced.util.exception @Patch( name = "Show seekbar", description = "Shows progress bar for all video.", compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill"), - CompatiblePackage("com.zhiliaoapp.musically") - ] + CompatiblePackage("com.zhiliaoapp.musically"), + ], ) @Suppress("unused") object ShowSeekbarPatch : BytecodePatch(setOf(SetSeekBarShowTypeFingerprint, ShouldShowSeekBarFingerprint)) { @@ -26,7 +26,7 @@ object ShowSeekbarPatch : BytecodePatch(setOf(SetSeekBarShowTypeFingerprint, Sho """ const/4 v0, 0x1 return v0 - """ + """, ) } SetSeekBarShowTypeFingerprint.result?.mutableMethod?.apply { @@ -36,8 +36,8 @@ object ShowSeekbarPatch : BytecodePatch(setOf(SetSeekBarShowTypeFingerprint, Sho 0, """ const/16 v$typeRegister, 0x64 - """ + """, ) } ?: throw SetSeekBarShowTypeFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/SetSeekBarShowTypeFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/SetSeekBarShowTypeFingerprint.kt index bf0f292534..c40648cd85 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/SetSeekBarShowTypeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/SetSeekBarShowTypeFingerprint.kt @@ -4,6 +4,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SetSeekBarShowTypeFingerprint : MethodFingerprint( strings = listOf( - "seekbar show type change, change to:" + "seekbar show type change, change to:", ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt index 9f9d43546e..4e965aacfe 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt @@ -4,6 +4,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ShouldShowSeekBarFingerprint : MethodFingerprint( strings = listOf( - "can not show seekbar, state: 1, not in resume" + "can not show seekbar, state: 1, not in resume", ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt index 35c477539b..ff0d7846d6 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt @@ -20,19 +20,19 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference @Patch( name = "Playback speed", description = "Enables the playback speed option for all videos and " + - "retains the speed configurations in between videos.", + "retains the speed configurations in between videos.", compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]), - CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]) - ] + CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]), + ], ) @Suppress("unused") object PlaybackSpeedPatch : BytecodePatch( setOf( GetSpeedFingerprint, OnRenderFirstFrameFingerprint, - SetSpeedFingerprint - ) + SetSpeedFingerprint, + ), ) { override fun execute(context: BytecodeContext) { SetSpeedFingerprint.result?.let { onVideoSwiped -> @@ -44,7 +44,7 @@ object PlaybackSpeedPatch : BytecodePatch( addInstruction( injectIndex, "invoke-static { v$register }," + - " Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V" + " Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V", ) } ?: throw GetSpeedFingerprint.exception @@ -66,7 +66,7 @@ object PlaybackSpeedPatch : BytecodePatch( invoke-static {}, Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F move-result-object v2 invoke-static { v0, v1, v2 }, ${onVideoSwiped.method} - """ + """, ) ?: throw OnRenderFirstFrameFingerprint.exception // Force enable the playback speed option for all videos. @@ -75,7 +75,7 @@ object PlaybackSpeedPatch : BytecodePatch( """ const/4 v0, 0x1 return v0 - """ + """, ) ?: throw PatchException("Failed to force enable the playback speed option.") } ?: throw SetSpeedFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/GetSpeedFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/GetSpeedFingerprint.kt index f9845d4dc7..fddae7ce30 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/GetSpeedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/GetSpeedFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object GetSpeedFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/BaseListFragmentPanel;") && methodDef.name == "onFeedSpeedSelectedEvent" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/OnRenderFirstFrameFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/OnRenderFirstFrameFingerprint.kt index 59f930efea..f7471a44da 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/OnRenderFirstFrameFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/OnRenderFirstFrameFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object OnRenderFirstFrameFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/BaseListFragmentPanel;") && methodDef.name == "onRenderFirstFrame" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/SetSpeedFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/SetSpeedFingerprint.kt index 97e566b97a..6c86203327 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/SetSpeedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/fingerprints/SetSpeedFingerprint.kt @@ -10,7 +10,7 @@ internal object SetSpeedFingerprint : MethodFingerprint( parameters = listOf( "Ljava/lang/String;", "Lcom/ss/android/ugc/aweme/feed/model/Aweme;", - "F" + "F", ), - strings = listOf("enterFrom") + strings = listOf("enterFrom"), ) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/IntegrationsPatch.kt index 775a674773..bd252de4a6 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/IntegrationsPatch.kt @@ -6,5 +6,5 @@ import app.revanced.patches.tiktok.misc.integrations.fingerprints.InitFingerprin @Patch(requiresIntegrations = true) object IntegrationsPatch : BaseIntegrationsPatch( - setOf(InitFingerprint) -) \ No newline at end of file + setOf(InitFingerprint), +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt index f61e36bc12..06414494be 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.Integ internal object InitFingerprint : IntegrationsFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/AwemeHostApplication;") && - methodDef.name == "onCreate" - } -) \ No newline at end of file + methodDef.name == "onCreate" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt index 33f4ec770c..e780842a23 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt @@ -12,17 +12,17 @@ import app.revanced.patches.tiktok.misc.login.disablerequirement.fingerprints.Ma name = "Disable login requirement", compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill"), - CompatiblePackage("com.zhiliaoapp.musically") - ] + CompatiblePackage("com.zhiliaoapp.musically"), + ], ) @Suppress("unused") object DisableLoginRequirementPatch : BytecodePatch( - setOf(MandatoryLoginServiceFingerprint, MandatoryLoginServiceFingerprint2) + setOf(MandatoryLoginServiceFingerprint, MandatoryLoginServiceFingerprint2), ) { override fun execute(context: BytecodeContext) { listOf( MandatoryLoginServiceFingerprint, - MandatoryLoginServiceFingerprint2 + MandatoryLoginServiceFingerprint2, ).forEach { fingerprint -> val method = fingerprint.result!!.mutableMethod method.addInstructions( @@ -30,8 +30,8 @@ object DisableLoginRequirementPatch : BytecodePatch( """ const/4 v0, 0x0 return v0 - """ + """, ) } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint.kt index ec5a8efea7..9a848e1d2e 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint.kt @@ -4,6 +4,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object MandatoryLoginServiceFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/MandatoryLoginService;") && - methodDef.name == "enableForcedLogin" - } -) \ No newline at end of file + methodDef.name == "enableForcedLogin" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint2.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint2.kt index 3a3f3107be..1d823b4158 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint2.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/fingerprints/MandatoryLoginServiceFingerprint2.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object MandatoryLoginServiceFingerprint2 : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/MandatoryLoginService;") && - methodDef.name == "shouldShowForcedLogin" - } -) \ No newline at end of file + methodDef.name == "shouldShowForcedLogin" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt index 13f595ed19..c89fe61572 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt @@ -13,17 +13,17 @@ import app.revanced.patches.tiktok.misc.login.fixgoogle.fingerprints.GoogleOneTa description = "Allows logging in with a Google account.", compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill"), - CompatiblePackage("com.zhiliaoapp.musically") - ] + CompatiblePackage("com.zhiliaoapp.musically"), + ], ) @Suppress("unused") object FixGoogleLoginPatch : BytecodePatch( - setOf(GoogleOneTapAuthAvailableFingerprint, GoogleAuthAvailableFingerprint) + setOf(GoogleOneTapAuthAvailableFingerprint, GoogleAuthAvailableFingerprint), ) { override fun execute(context: BytecodeContext) { listOf( GoogleOneTapAuthAvailableFingerprint, - GoogleAuthAvailableFingerprint + GoogleAuthAvailableFingerprint, ).forEach { with(it.result!!.mutableMethod) { addInstructions( @@ -31,9 +31,9 @@ object FixGoogleLoginPatch : BytecodePatch( """ const/4 v0, 0x0 return v0 - """ + """, ) } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleAuthAvailableFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleAuthAvailableFingerprint.kt index 8c60ee89f5..63867ffc93 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleAuthAvailableFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleAuthAvailableFingerprint.kt @@ -10,5 +10,5 @@ internal object GoogleAuthAvailableFingerprint : MethodFingerprint( parameters = listOf(), customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/bytedance/lobby/google/GoogleAuth;" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleOneTapAuthAvailableFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleOneTapAuthAvailableFingerprint.kt index 5644e7e419..c54a193ef7 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleOneTapAuthAvailableFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/fingerprints/GoogleOneTapAuthAvailableFingerprint.kt @@ -10,5 +10,5 @@ internal object GoogleOneTapAuthAvailableFingerprint : MethodFingerprint( parameters = listOf(), customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/bytedance/lobby/google/GoogleOneTapAuth;" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt index f3d5a2b0af..46b6e24add 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt @@ -25,8 +25,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference dependencies = [IntegrationsPatch::class], compatiblePackages = [ CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]), - CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]) - ] + CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]), + ], ) object SettingsPatch : BytecodePatch( setOf( @@ -34,21 +34,21 @@ object SettingsPatch : BytecodePatch( AddSettingsEntryFingerprint, SettingsEntryFingerprint, SettingsEntryInfoFingerprint, - ) + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/tiktok/settings/AdPersonalizationActivityHook;" private const val INITIALIZE_SETTINGS_METHOD_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR->initialize(" + - "Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" + - ")Z" + "Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" + + ")Z" private const val CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR->createSettingsEntry(" + - "Ljava/lang/String;" + - "Ljava/lang/String;" + - ")Ljava/lang/Object;" + "Ljava/lang/String;" + + "Ljava/lang/String;" + + ")Ljava/lang/Object;" override fun execute(context: BytecodeContext) { // Find the class name of classes which construct a settings entry @@ -70,8 +70,8 @@ object SettingsPatch : BytecodePatch( markIndex + 2, listOf( getUnitManager, - addEntry - ) + addEntry, + ), ) addInstructions( @@ -81,7 +81,7 @@ object SettingsPatch : BytecodePatch( const-string v1, "$settingsButtonInfoClass" invoke-static {v0, v1}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR move-result-object v0 - """ + """, ) } ?: throw AddSettingsEntryFingerprint.exception @@ -102,7 +102,7 @@ object SettingsPatch : BytecodePatch( if-eqz v$usableRegister, :do_not_open return-void """, - ExternalLabel("do_not_open", getInstruction(initializeSettingsIndex)) + ExternalLabel("do_not_open", getInstruction(initializeSettingsIndex)), ) } ?: throw AdPersonalizationActivityOnCreateFingerprint.exception } @@ -110,4 +110,4 @@ object SettingsPatch : BytecodePatch( private fun String.toClassName(): String { return substring(1, this.length - 1).replace("/", ".") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AdPersonalizationActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AdPersonalizationActivityOnCreateFingerprint.kt index deccbaadc5..57c0d919ff 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AdPersonalizationActivityOnCreateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AdPersonalizationActivityOnCreateFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object AdPersonalizationActivityOnCreateFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/AdPersonalizationActivity;") && - methodDef.name == "onCreate" - } -) \ No newline at end of file + methodDef.name == "onCreate" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AddSettingsEntryFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AddSettingsEntryFingerprint.kt index be2a1fc318..af64b454b9 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AddSettingsEntryFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/AddSettingsEntryFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object AddSettingsEntryFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/SettingNewVersionFragment;") && - methodDef.name == "initUnitManger" - } -) \ No newline at end of file + methodDef.name == "initUnitManger" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryFingerprint.kt index 0b7d89df6b..1a0ff0ba12 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryFingerprint.kt @@ -4,6 +4,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SettingsEntryFingerprint : MethodFingerprint( strings = listOf( - "pls pass item or extends the EventUnit" - ) -) \ No newline at end of file + "pls pass item or extends the EventUnit", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryInfoFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryInfoFingerprint.kt index 5ccfc4a4db..2ca646d23f 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryInfoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsEntryInfoFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SettingsEntryInfoFingerprint : MethodFingerprint( strings = listOf( "ExposeItem(title=", - ", icon=" - ) -) \ No newline at end of file + ", icon=", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsStatusLoadFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsStatusLoadFingerprint.kt index b689e785e8..e6b5d1cf42 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsStatusLoadFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/fingerprints/SettingsStatusLoadFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SettingsStatusLoadFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("Lapp/revanced/integrations/tiktok/settings/SettingsStatus;") && - methodDef.name == "load" - } -) \ No newline at end of file + methodDef.name == "load" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt index d3bfc2ae60..24e4fe07de 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.trakt -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -9,14 +8,15 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.trakt.fingerprints.IsVIPEPFingerprint import app.revanced.patches.trakt.fingerprints.IsVIPFingerprint import app.revanced.patches.trakt.fingerprints.RemoteUserFingerprint +import app.revanced.util.exception @Patch( name = "Unlock pro", - compatiblePackages = [CompatiblePackage("tv.trakt.trakt", ["1.1.1"])] + compatiblePackages = [CompatiblePackage("tv.trakt.trakt", ["1.1.1"])], ) @Suppress("unused") object UnlockProPatch : BytecodePatch( - setOf(RemoteUserFingerprint) + setOf(RemoteUserFingerprint), ) { private const val RETURN_TRUE_INSTRUCTIONS = """ @@ -30,8 +30,9 @@ object UnlockProPatch : BytecodePatch( RemoteUserFingerprint.result?.classDef?.let { remoteUserClass -> arrayOf(IsVIPFingerprint, IsVIPEPFingerprint).onEach { fingerprint -> // Resolve both fingerprints on the same class. - if (!fingerprint.resolve(context, remoteUserClass)) + if (!fingerprint.resolve(context, remoteUserClass)) { throw fingerprint.exception + } }.forEach { fingerprint -> // Return true for both VIP check methods. fingerprint.result?.mutableMethod?.addInstructions(0, RETURN_TRUE_INSTRUCTIONS) @@ -39,4 +40,4 @@ object UnlockProPatch : BytecodePatch( } } ?: throw RemoteUserFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt index b4ade95bd0..17713e581f 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt @@ -7,5 +7,5 @@ internal object IsVIPEPFingerprint : MethodFingerprint( if (!methodDef.definingClass.endsWith("RemoteUser;")) return@custom false methodDef.name == "isVIPEP" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt index 251a264b14..edb40c4863 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt @@ -7,5 +7,5 @@ internal object IsVIPFingerprint : MethodFingerprint( if (!methodDef.definingClass.endsWith("RemoteUser;")) return@custom false methodDef.name == "isVIP" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt index b46e2387cf..75d2524f4c 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object RemoteUserFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("RemoteUser;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/fingerprints/BrightnessFingerprint.kt b/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/fingerprints/BrightnessFingerprint.kt index a055790964..d106438cd4 100644 --- a/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/fingerprints/BrightnessFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/fingerprints/BrightnessFingerprint.kt @@ -8,8 +8,8 @@ internal object BrightnessFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, parameters = listOf(), customFingerprint = { method, classDef -> - method.name == "run" - && method.definingClass.contains("/ScreenPlugin\$") - && classDef.fields.any { it.type == "Ljava/lang/Float;" } - } + method.name == "run" && + method.definingClass.contains("/ScreenPlugin\$") && + classDef.fields.any { it.type == "Ljava/lang/Float;" } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/patch/ShowOnLockscreenPatch.kt b/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/patch/ShowOnLockscreenPatch.kt index 368879cfab..f19c3c2fa4 100644 --- a/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/patch/ShowOnLockscreenPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/patch/ShowOnLockscreenPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.tudortmund.lockscreen.patch -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.tudortmund.lockscreen.fingerprints.BrightnessFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c @@ -19,11 +19,11 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference name = "Show on lockscreen", description = "Shows student id and student ticket on lockscreen.", compatiblePackages = [CompatiblePackage("de.tudortmund.app")], - requiresIntegrations = true + requiresIntegrations = true, ) @Suppress("unused") object ShowOnLockscreenPatch : BytecodePatch( - setOf(BrightnessFingerprint) + setOf(BrightnessFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/tudortmund/lockscreen/ShowOnLockscreenPatch;" @@ -45,14 +45,16 @@ object ShowOnLockscreenPatch : BytecodePatch( // Gets the index of that instruction and the register of the Activity. val (windowIndex, activityRegister) = implementation!!.instructions.withIndex() .firstNotNullOf { (index, instruction) -> - if (instruction.opcode != Opcode.INVOKE_VIRTUAL) + if (instruction.opcode != Opcode.INVOKE_VIRTUAL) { return@firstNotNullOf null + } val invokeInstruction = instruction as Instruction35c val methodRef = invokeInstruction.reference as MethodReference - if (methodRef.name != "getWindow" || methodRef.returnType != "Landroid/view/Window;") + if (methodRef.name != "getWindow" || methodRef.returnType != "Landroid/view/Window;") { return@firstNotNullOf null + } Pair(index, invokeInstruction.registerC) } @@ -64,10 +66,10 @@ object ShowOnLockscreenPatch : BytecodePatch( replaceInstruction( windowIndex, "invoke-static { v$activityRegister, v$brightnessRegister }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->" + - "getWindow" + - "(Landroidx/appcompat/app/AppCompatActivity;F)" + - "Landroid/view/Window;" + "$INTEGRATIONS_CLASS_DESCRIPTOR->" + + "getWindow" + + "(Landroidx/appcompat/app/AppCompatActivity;F)" + + "Landroid/view/Window;", ) // Normally, the brightness is loaded into a register after the getWindow call. @@ -79,11 +81,10 @@ object ShowOnLockscreenPatch : BytecodePatch( """ invoke-virtual { v$brightnessRegister }, Ljava/lang/Float;->floatValue()F move-result v$brightnessRegister - """ + """, ) addInstruction(windowIndex, brightnessInstruction) - } ?: throw BrightnessFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt index 5150a0f5c7..2d81de7ab5 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt @@ -1,21 +1,21 @@ package app.revanced.patches.tumblr.annoyances.notifications -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.tumblr.annoyances.notifications.fingerprints.IsBlogNotifyEnabledFingerprint +import app.revanced.util.exception @Patch( name = "Disable blog notification reminder", description = "Disables the reminder to enable notifications for blogs you visit.", - compatiblePackages = [CompatiblePackage("com.tumblr")] + compatiblePackages = [CompatiblePackage("com.tumblr")], ) @Suppress("unused") object DisableBlogNotificationReminderPatch : BytecodePatch( - setOf(IsBlogNotifyEnabledFingerprint) + setOf(IsBlogNotifyEnabledFingerprint), ) { override fun execute(context: BytecodeContext) = IsBlogNotifyEnabledFingerprint.result?.mutableMethod?.addInstructions( @@ -24,6 +24,6 @@ object DisableBlogNotificationReminderPatch : BytecodePatch( # Return false for BlogNotifyCtaDialog.isEnabled() method. const/4 v0, 0x0 return v0 - """ + """, ) ?: throw IsBlogNotifyEnabledFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/fingerprints/IsBlogNotifyEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/fingerprints/IsBlogNotifyEnabledFingerprint.kt index 55b67f2fa8..4ccff37be4 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/fingerprints/IsBlogNotifyEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/fingerprints/IsBlogNotifyEnabledFingerprint.kt @@ -6,4 +6,4 @@ import app.revanced.patcher.fingerprint.MethodFingerprint // It shows whenever you visit a certain blog for the second time and disables itself // if it was shown a total of 3 times (stored in app storage). // This targets the BlogNotifyCtaDialog.isEnabled() method to let it always return false. -internal object IsBlogNotifyEnabledFingerprint : MethodFingerprint(strings = listOf("isEnabled --> ", "blog_notify_enabled")) \ No newline at end of file +internal object IsBlogNotifyEnabledFingerprint : MethodFingerprint(strings = listOf("isEnabled --> ", "blog_notify_enabled")) diff --git a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt index debc95b324..685f6af367 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt @@ -1,23 +1,23 @@ package app.revanced.patches.tumblr.annoyances.popups -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.tumblr.annoyances.popups.fingerprints.ShowGiftMessagePopupFingerprint +import app.revanced.util.exception @Patch( name = "Disable gift message popup", description = "Disables the popup suggesting to buy TumblrMart items for other people.", - compatiblePackages = [CompatiblePackage("com.tumblr")] + compatiblePackages = [CompatiblePackage("com.tumblr")], ) @Suppress("unused") object DisableGiftMessagePopupPatch : BytecodePatch( - setOf(ShowGiftMessagePopupFingerprint) + setOf(ShowGiftMessagePopupFingerprint), ) { override fun execute(context: BytecodeContext) = ShowGiftMessagePopupFingerprint.result?.mutableMethod?.addInstructions(0, "return-void") ?: throw ShowGiftMessagePopupFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt index c65cd0291c..3ca9e3681e 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint // This method is responsible for loading and displaying the visual Layout of the Gift Message Popup. internal object ShowGiftMessagePopupFingerprint : MethodFingerprint( strings = listOf("activity", "anchorView"), - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("GiftMessagePopup;") } -) \ No newline at end of file + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("GiftMessagePopup;") }, +) diff --git a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt index 267ab358a9..f9e2d51288 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.tumblr.featureflags -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patches.tumblr.featureflags.fingerprints.GetFeatureValueFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.immutable.ImmutableMethod @@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter @Patch(description = "Forcibly set the value of A/B testing features of your choice.") object OverrideFeatureFlagsPatch : BytecodePatch( - setOf(GetFeatureValueFingerprint) + setOf(GetFeatureValueFingerprint), ) { /** * Override a feature flag with a value. @@ -40,7 +40,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch( AccessFlags.PUBLIC or AccessFlags.FINAL, null, null, - MutableMethodImplementation(4) + MutableMethodImplementation(4), ).toMutable().apply { // This is the equivalent of // String featureName = feature.toString() @@ -60,7 +60,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch( # If none of the overrides returned a value, we should return null const/4 v0, 0x0 return-object v0 - """ + """, ) }.also { helperMethod -> it.mutableClass.methods.add(helperMethod) @@ -85,7 +85,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch( # If our override helper returned null, we let the function continue normally :is_null nop - """ + """, ) val helperInsertIndex = 2 @@ -109,8 +109,8 @@ object OverrideFeatureFlagsPatch : BytecodePatch( # Else we just continue... :no_override nop - """ + """, ) } } ?: throw GetFeatureValueFingerprint.exception -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt index d0274125d1..e51d9b3386 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt @@ -17,7 +17,7 @@ internal object GetFeatureValueFingerprint : MethodFingerprint( opcodes = listOf( Opcode.IF_EQZ, Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT + Opcode.MOVE_RESULT, ), - customFingerprint = { method, _ -> method.definingClass == "Lcom/tumblr/configuration/Configuration;" } -) \ No newline at end of file + customFingerprint = { method, _ -> method.definingClass == "Lcom/tumblr/configuration/Configuration;" }, +) diff --git a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/TimelineFilterPatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/TimelineFilterPatch.kt index 4c41805026..7a289bfb73 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/TimelineFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/TimelineFilterPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.tumblr.timelinefilter -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels @@ -11,11 +10,12 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.tumblr.timelinefilter.fingerprints.PostsResponseConstructorFingerprint import app.revanced.patches.tumblr.timelinefilter.fingerprints.TimelineConstructorFingerprint import app.revanced.patches.tumblr.timelinefilter.fingerprints.TimelineFilterIntegrationFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c @Patch(description = "Filter timeline objects.", requiresIntegrations = true) object TimelineFilterPatch : BytecodePatch( - setOf(TimelineConstructorFingerprint, TimelineFilterIntegrationFingerprint, PostsResponseConstructorFingerprint) + setOf(TimelineConstructorFingerprint, TimelineFilterIntegrationFingerprint, PostsResponseConstructorFingerprint), ) { /** * Add a filter to hide the given timeline object type. @@ -44,10 +44,11 @@ object TimelineFilterPatch : BytecodePatch( addObjectTypeFilter = { typeName -> // blockedObjectTypes.add({typeName}) addInstructionsWithLabels( - filterInsertIndex, """ + filterInsertIndex, + """ const-string v$stringRegister, "$typeName" invoke-virtual { v$filterListRegister, v$stringRegister }, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z - """ + """, ) } } @@ -55,13 +56,13 @@ object TimelineFilterPatch : BytecodePatch( mapOf( TimelineConstructorFingerprint to 1, - PostsResponseConstructorFingerprint to 2 + PostsResponseConstructorFingerprint to 2, ).forEach { (fingerprint, timelineObjectsRegister) -> fingerprint.result?.mutableMethod?.addInstructions( 0, "invoke-static {p$timelineObjectsRegister}, " + - "Lapp/revanced/integrations/tumblr/patches/TimelineFilterPatch;->" + - "filterTimeline(Ljava/util/List;)V" + "Lapp/revanced/integrations/tumblr/patches/TimelineFilterPatch;->" + + "filterTimeline(Ljava/util/List;)V", ) ?: throw fingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/PostsResponseConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/PostsResponseConstructorFingerprint.kt index 0969e59b40..5198647f91 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/PostsResponseConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/PostsResponseConstructorFingerprint.kt @@ -9,4 +9,4 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object PostsResponseConstructorFingerprint : MethodFingerprint( accessFlags = AccessFlags.CONSTRUCTOR or AccessFlags.PUBLIC, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/PostsResponse;") && methodDef.parameters.size == 4 }, -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineConstructorFingerprint.kt index 77392950fc..fdb22f4110 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineConstructorFingerprint.kt @@ -8,5 +8,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object TimelineConstructorFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/Timeline;") && methodDef.parameters[0].type == "Ljava/util/List;" - }, strings = listOf("timelineObjectsList") -) \ No newline at end of file + }, + strings = listOf("timelineObjectsList"), +) diff --git a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineFilterIntegrationFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineFilterIntegrationFingerprint.kt index 39d5ee9462..ebfbb49110 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineFilterIntegrationFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/fingerprints/TimelineFilterIntegrationFingerprint.kt @@ -11,6 +11,6 @@ internal object TimelineFilterIntegrationFingerprint : MethodFingerprint( strings = listOf("BLOCKED_OBJECT_DUMMY"), opcodes = listOf( Opcode.CONST_STRING, // "BLOCKED_OBJECT_DUMMY" - Opcode.INVOKE_VIRTUAL // HashSet.add(^) - ) -) \ No newline at end of file + Opcode.INVOKE_VIRTUAL, // HashSet.add(^) + ), +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt index 31b398ca70..5e0a57a637 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt @@ -21,13 +21,13 @@ import app.revanced.patches.twitch.misc.settings.SettingsPatch ) @Suppress("unused") object AudioAdsPatch : BytecodePatch( - setOf(AudioAdsPresenterPlayFingerprint) + setOf(AudioAdsPresenterPlayFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences( - SwitchPreference("revanced_block_audio_ads") + SwitchPreference("revanced_block_audio_ads"), ) // Block playAds call @@ -40,7 +40,7 @@ object AudioAdsPatch : BytecodePatch( if-eqz v0, :show_audio_ads return-void """, - ExternalLabel("show_audio_ads", mutableMethod.getInstruction(0)) + ExternalLabel("show_audio_ads", mutableMethod.getInstruction(0)), ) } } diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/audio/fingerprints/AudioAdsPresenterPlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/audio/fingerprints/AudioAdsPresenterPlayFingerprint.kt index 2d65f59039..7873560cf2 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/audio/fingerprints/AudioAdsPresenterPlayFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/audio/fingerprints/AudioAdsPresenterPlayFingerprint.kt @@ -1,10 +1,9 @@ package app.revanced.patches.twitch.ad.audio.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object AudioAdsPresenterPlayFingerprint : MethodFingerprint( customFingerprint = { method, _ -> method.definingClass.endsWith("AudioAdsPlayerPresenter;") && method.name == "playAd" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt index 4dd39f59fd..0d8c603a07 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt @@ -20,19 +20,19 @@ import app.revanced.util.exception VideoAdsPatch::class, IntegrationsPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], - compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])] + compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])], ) @Suppress("unused") object EmbeddedAdsPatch : BytecodePatch( - setOf(CreateUsherClientFingerprint) + setOf(CreateUsherClientFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.ADS.SURESTREAM.addPreferences( - ListPreference("revanced_block_embedded_ads", summaryKey = null) + ListPreference("revanced_block_embedded_ads", summaryKey = null), ) val result = CreateUsherClientFingerprint.result ?: throw CreateUsherClientFingerprint.exception @@ -44,7 +44,7 @@ object EmbeddedAdsPatch : BytecodePatch( invoke-static {}, Lapp/revanced/integrations/twitch/patches/EmbeddedAdsPatch;->createRequestInterceptor()Lapp/revanced/integrations/twitch/api/RequestInterceptor; move-result-object v2 invoke-virtual {v0, v2}, Lokhttp3/OkHttpClient${"$"}Builder;->addInterceptor(Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient${"$"}Builder; - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/fingerprints/CreateUsherClientFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/fingerprints/CreateUsherClientFingerprint.kt index ad7c4eb2cc..e9f118e9f2 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/fingerprints/CreateUsherClientFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/fingerprints/CreateUsherClientFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object CreateUsherClientFingerprint : MethodFingerprint( customFingerprint = { method, _ -> method.definingClass.endsWith("Ltv/twitch/android/network/OkHttpClientFactory;") && method.name == "buildOkHttpClient" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/shared/util/BaseAdPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/shared/util/BaseAdPatch.kt index 776b338fbb..11a658cfe0 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/shared/util/BaseAdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/shared/util/BaseAdPatch.kt @@ -22,14 +22,14 @@ abstract class BaseAdPatch( protected data class ReturnMethod(val returnType: Char = 'V', val value: String = "") protected fun BytecodeContext.blockMethods(clazz: String, vararg methodNames: String, returnMethod: ReturnMethod = ReturnMethod()): Boolean { - return with(findClass(clazz)?.mutableClass) { this ?: return false this.methods.filter { methodNames.contains(it.name) }.forEach { val retInstruction = when (returnMethod.returnType) { 'V' -> "return-void" - 'Z' -> """ + 'Z' -> + """ const/4 v0, ${returnMethod.value} return v0 """ @@ -41,11 +41,10 @@ abstract class BaseAdPatch( ${createConditionInstructions("v0")} $retInstruction """, - ExternalLabel(skipLabelName, it.getInstruction(0)) + ExternalLabel(skipLabelName, it.getInstruction(0)), ) } true } } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt index c238c49152..eddb28c43a 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt @@ -21,7 +21,7 @@ import app.revanced.util.exception name = "Block video ads", description = "Blocks video ads in streams and VODs.", dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], - compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])] + compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])], ) object VideoAdsPatch : BaseAdPatch( "Lapp/revanced/integrations/twitch/patches/VideoAdsPatch;->shouldBlockVideoAds()Z", @@ -29,61 +29,73 @@ object VideoAdsPatch : BaseAdPatch( setOf( ContentConfigShowAdsFingerprint, CheckAdEligibilityLambdaFingerprint, - GetReadyToShowAdFingerprint - ) + GetReadyToShowAdFingerprint, + ), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences( - SwitchPreference("revanced_block_video_ads") + SwitchPreference("revanced_block_video_ads"), ) /* Amazon ads SDK */ context.blockMethods( "Lcom/amazon/ads/video/player/AdsManagerImpl;", - "playAds" + "playAds", ) /* Twitch ads manager */ context.blockMethods( "Ltv/twitch/android/shared/ads/VideoAdManager;", - "checkAdEligibilityAndRequestAd", "requestAd", "requestAds" + "checkAdEligibilityAndRequestAd", + "requestAd", + "requestAds", ) /* Various ad presenters */ context.blockMethods( "Ltv/twitch/android/shared/ads/AdsPlayerPresenter;", - "requestAd", "requestFirstAd", "requestFirstAdIfEligible", "requestMidroll", "requestAdFromMultiAdFormatEvent" + "requestAd", + "requestFirstAd", + "requestFirstAdIfEligible", + "requestMidroll", + "requestAdFromMultiAdFormatEvent", ) context.blockMethods( "Ltv/twitch/android/shared/ads/AdsVodPlayerPresenter;", - "requestAd", "requestFirstAd", + "requestAd", + "requestFirstAd", ) context.blockMethods( "Ltv/twitch/android/feature/theatre/ads/AdEdgeAllocationPresenter;", - "parseAdAndCheckEligibility", "requestAdsAfterEligibilityCheck", "showAd", "bindMultiAdFormatAllocation" + "parseAdAndCheckEligibility", + "requestAdsAfterEligibilityCheck", + "showAd", + "bindMultiAdFormatAllocation", ) /* A/B ad testing experiments */ context.blockMethods( "Ltv/twitch/android/provider/experiments/helpers/DisplayAdsExperimentHelper;", "areDisplayAdsEnabled", - returnMethod = ReturnMethod('Z', "0") + returnMethod = ReturnMethod('Z', "0"), ) context.blockMethods( "Ltv/twitch/android/shared/ads/tracking/MultiFormatAdsTrackingExperiment;", - "shouldUseMultiAdFormatTracker", "shouldUseVideoAdTracker", - returnMethod = ReturnMethod('Z', "0") + "shouldUseMultiAdFormatTracker", + "shouldUseVideoAdTracker", + returnMethod = ReturnMethod('Z', "0"), ) context.blockMethods( "Ltv/twitch/android/shared/ads/MultiformatAdsExperiment;", - "shouldDisableClientSideLivePreroll", "shouldDisableClientSideVodPreroll", - returnMethod = ReturnMethod('Z', "1") + "shouldDisableClientSideLivePreroll", + "shouldDisableClientSideVodPreroll", + returnMethod = ReturnMethod('Z', "1"), ) // Pretend our player is ineligible for all ads @@ -97,7 +109,7 @@ object VideoAdsPatch : BaseAdPatch( move-result-object p0 return-object p0 """, - ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)) + ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)), ) } ?: throw CheckAdEligibilityLambdaFingerprint.exception @@ -112,19 +124,21 @@ object VideoAdsPatch : BaseAdPatch( move-result-object p1 return-object p1 """, - ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)) + ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)), ) } ?: throw GetReadyToShowAdFingerprint.exception // Spoof showAds JSON field ContentConfigShowAdsFingerprint.result?.apply { - mutableMethod.addInstructions(0, """ + mutableMethod.addInstructions( + 0, + """ ${createConditionInstructions()} const/4 v0, 0 :$skipLabelName return v0 - """ + """, ) - } ?: throw ContentConfigShowAdsFingerprint.exception + } ?: throw ContentConfigShowAdsFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/CheckAdEligibilityLambdaFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/CheckAdEligibilityLambdaFingerprint.kt index fa17d9a248..732caa4e36 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/CheckAdEligibilityLambdaFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/CheckAdEligibilityLambdaFingerprint.kt @@ -6,7 +6,7 @@ internal object CheckAdEligibilityLambdaFingerprint : MethodFingerprint( returnType = "Lio/reactivex/Single;", parameters = listOf("L"), customFingerprint = { method, _ -> - method.definingClass.endsWith("/AdEligibilityFetcher;") - && method.name == "shouldRequestAd" - } -) \ No newline at end of file + method.definingClass.endsWith("/AdEligibilityFetcher;") && + method.name == "shouldRequestAd" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/ContentConfigShowAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/ContentConfigShowAdsFingerprint.kt index 56955974c2..9097c3ca0a 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/ContentConfigShowAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/ContentConfigShowAdsFingerprint.kt @@ -7,5 +7,5 @@ internal object ContentConfigShowAdsFingerprint : MethodFingerprint( parameters = listOf(), customFingerprint = { method, _ -> method.definingClass.endsWith("/ContentConfigData;") && method.name == "getShowAds" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/GetReadyToShowAdFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/GetReadyToShowAdFingerprint.kt index 4081a458ae..1d939f1469 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/GetReadyToShowAdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/ad/video/fingerprints/GetReadyToShowAdFingerprint.kt @@ -7,5 +7,5 @@ internal object GetReadyToShowAdFingerprint : MethodFingerprint( parameters = listOf("L", "L"), customFingerprint = { method, _ -> method.definingClass.endsWith("/StreamDisplayAdsPresenter;") && method.name == "getReadyToShowAdOrAbort" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt index 7cf83924be..7673dd0115 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt @@ -25,15 +25,15 @@ import app.revanced.util.exception SettingsPatch::class, AddResourcesPatch::class, ], - compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])] + compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])], ) @Suppress("unused") object ShowDeletedMessagesPatch : BytecodePatch( setOf( SetHasModAccessFingerprint, DeletedMessageClickableSpanCtorFingerprint, - ChatUtilCreateDeletedSpanFingerprint - ) + ChatUtilCreateDeletedSpanFingerprint, + ), ) { private fun createSpoilerConditionInstructions(register: String = "v0") = """ invoke-static {}, Lapp/revanced/integrations/twitch/patches/ShowDeletedMessagesPatch;->shouldUseSpoiler()Z @@ -48,27 +48,28 @@ object ShowDeletedMessagesPatch : BytecodePatch( ListPreference( key = "revanced_show_deleted_messages", summaryKey = null, - ) + ), ) - // Spoiler mode: Force set hasModAccess member to true in constructor + // Spoiler mode: Force set hasModAccess member to true in constructor. DeletedMessageClickableSpanCtorFingerprint.result?.mutableMethod?.apply { addInstructionsWithLabels( - implementation!!.instructions.lastIndex, /* place in front of return-void */ + // Right before return-void. + implementation!!.instructions.lastIndex, """ ${createSpoilerConditionInstructions()} const/4 v0, 1 iput-boolean v0, p0, $definingClass->hasModAccess:Z """, - ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex)) + ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex)), ) } ?: throw DeletedMessageClickableSpanCtorFingerprint.exception - // Spoiler mode: Disable setHasModAccess setter + // Spoiler mode: Disable setHasModAccess setter. SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") ?: throw SetHasModAccessFingerprint.exception - // Cross-out mode: Reformat span of deleted message + // Cross-out mode: Reformat span of deleted message. ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply { addInstructionsWithLabels( 0, @@ -78,7 +79,7 @@ object ShowDeletedMessagesPatch : BytecodePatch( if-eqz v0, :no_reformat return-object v0 """, - ExternalLabel("no_reformat", getInstruction(0)) + ExternalLabel("no_reformat", getInstruction(0)), ) } ?: throw ChatUtilCreateDeletedSpanFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/ChatUtilCreateDeletedSpanFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/ChatUtilCreateDeletedSpanFingerprint.kt index 5e1c735995..9027104d6b 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/ChatUtilCreateDeletedSpanFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/ChatUtilCreateDeletedSpanFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ChatUtilCreateDeletedSpanFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/ChatUtil\$Companion;") && methodDef.name == "createDeletedSpanFromChatMessageSpan" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/DeletedMessageClickableSpanCtorFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/DeletedMessageClickableSpanCtorFingerprint.kt index 049d6ca107..98700988b1 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/DeletedMessageClickableSpanCtorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/DeletedMessageClickableSpanCtorFingerprint.kt @@ -5,8 +5,9 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags internal object DeletedMessageClickableSpanCtorFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, + "V", + AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("DeletedMessageClickableSpan;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/SetHasModAccessFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/SetHasModAccessFingerprint.kt index 6ddf388fe7..57a73aee23 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/SetHasModAccessFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/fingerprints/SetHasModAccessFingerprint.kt @@ -1,10 +1,9 @@ package app.revanced.patches.twitch.chat.antidelete.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object SetHasModAccessFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("DeletedMessageClickableSpan;") && methodDef.name == "setHasModAccess" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt index 740f8cedf8..6223fcd0e3 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt @@ -17,17 +17,17 @@ import app.revanced.util.exception name = "Auto claim channel points", description = "Automatically claim Channel Points.", dependencies = [SettingsPatch::class, AddResourcesPatch::class], - compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])] + compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])], ) @Suppress("unused") object AutoClaimChannelPointsPatch : BytecodePatch( - setOf(CommunityPointsButtonViewDelegateFingerprint) + setOf(CommunityPointsButtonViewDelegateFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences( - SwitchPreference("revanced_auto_claim_channel_points") + SwitchPreference("revanced_auto_claim_channel_points"), ) CommunityPointsButtonViewDelegateFingerprint.result?.mutableMethod?.apply { @@ -44,7 +44,7 @@ object AutoClaimChannelPointsPatch : BytecodePatch( iget-object v0, p0, Ltv/twitch/android/shared/community/points/viewdelegate/CommunityPointsButtonViewDelegate;->buttonLayout:Landroid/view/ViewGroup; invoke-virtual { v0 }, Landroid/view/View;->callOnClick()Z """, - ExternalLabel("auto_claim", getInstruction(lastIndex)) + ExternalLabel("auto_claim", getInstruction(lastIndex)), ) } ?: throw CommunityPointsButtonViewDelegateFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/fingerprints/CommunityPointsButtonViewDelegateFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/fingerprints/CommunityPointsButtonViewDelegateFingerprint.kt index 621c47d9a1..14f5bc17e9 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/fingerprints/CommunityPointsButtonViewDelegateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/fingerprints/CommunityPointsButtonViewDelegateFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object CommunityPointsButtonViewDelegateFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("CommunityPointsButtonViewDelegate;") - && methodDef.name == "showClaimAvailable" - } -) \ No newline at end of file + methodDef.definingClass.endsWith("CommunityPointsButtonViewDelegate;") && + methodDef.name == "showClaimAvailable" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt b/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt index ad595c9e87..bc04f96d33 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt @@ -19,27 +19,27 @@ import app.revanced.util.exception description = "Enables Twitch's internal debugging mode.", dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [CompatiblePackage("tv.twitch.android.app")], - use = false + use = false, ) @Suppress("unused") object DebugModePatch : BytecodePatch( setOf( IsDebugConfigEnabledFingerprint, IsOmVerificationEnabledFingerprint, - ShouldShowDebugOptionsFingerprint - ) + ShouldShowDebugOptionsFingerprint, + ), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences( - SwitchPreference("revanced_twitch_debug_mode") + SwitchPreference("revanced_twitch_debug_mode"), ) listOf( IsDebugConfigEnabledFingerprint, IsOmVerificationEnabledFingerprint, - ShouldShowDebugOptionsFingerprint + ShouldShowDebugOptionsFingerprint, ).forEach { it.result?.mutableMethod?.apply { addInstructions( @@ -48,7 +48,7 @@ object DebugModePatch : BytecodePatch( invoke-static {}, Lapp/revanced/integrations/twitch/patches/DebugModePatch;->isDebugModeEnabled()Z move-result v0 return v0 - """ + """, ) } ?: throw it.exception } diff --git a/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsDebugConfigEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsDebugConfigEnabledFingerprint.kt index f4f498a6b0..104ad59278 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsDebugConfigEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsDebugConfigEnabledFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object IsDebugConfigEnabledFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/BuildConfigUtil;") && methodDef.name == "isDebugConfigEnabled" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsOmVerificationEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsOmVerificationEnabledFingerprint.kt index a8dd3e4e8b..d4e395ddfb 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsOmVerificationEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/IsOmVerificationEnabledFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object IsOmVerificationEnabledFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/BuildConfigUtil;") && methodDef.name == "isOmVerificationEnabled" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/ShouldShowDebugOptionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/ShouldShowDebugOptionsFingerprint.kt index 6e4aeda828..2fb5c2ec07 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/ShouldShowDebugOptionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/debug/fingerprints/ShouldShowDebugOptionsFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ShouldShowDebugOptionsFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/BuildConfigUtil;") && methodDef.name == "shouldShowDebugOptions" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/IntegrationsPatch.kt index 0158adc64b..0d9c94e1db 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/IntegrationsPatch.kt @@ -6,5 +6,5 @@ import app.revanced.patches.twitch.misc.integrations.fingerprints.InitFingerprin @Patch(requiresIntegrations = true) object IntegrationsPatch : BaseIntegrationsPatch( - setOf(InitFingerprint) + setOf(InitFingerprint), ) diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt index 10ca2039be..3e786a063b 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.Integ internal object InitFingerprint : IntegrationsFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/TwitchApplication;") && - methodDef.name == "onCreate" - } -) \ No newline at end of file + methodDef.name == "onCreate" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt index 719c65593d..ea98e0333f 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt @@ -12,9 +12,9 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.all.misc.resources.AddResourcesPatch +import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint @@ -31,20 +31,22 @@ import java.io.Closeable dependencies = [ IntegrationsPatch::class, SettingsResourcePatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ - CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"]) - ] + CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"]), + ], ) -object SettingsPatch : BytecodePatch( - setOf( - SettingsActivityOnCreateFingerprint, - SettingsMenuItemEnumFingerprint, - MenuGroupsUpdatedFingerprint, - MenuGroupsOnClickFingerprint - ) -), Closeable { +object SettingsPatch : + BytecodePatch( + setOf( + SettingsActivityOnCreateFingerprint, + SettingsMenuItemEnumFingerprint, + MenuGroupsUpdatedFingerprint, + MenuGroupsOnClickFingerprint, + ), + ), + Closeable { private const val REVANCED_SETTINGS_MENU_ITEM_NAME = "RevancedSettings" private const val REVANCED_SETTINGS_MENU_ITEM_ID = 0x7 private const val REVANCED_SETTINGS_MENU_ITEM_TITLE_RES = "revanced_settings" @@ -62,7 +64,7 @@ object SettingsPatch : BytecodePatch( AddResourcesPatch(this::class) PreferenceScreen.MISC.OTHER.addPreferences( - SwitchPreference("revanced_debug") + SwitchPreference("revanced_debug"), ) // Hook onCreate to handle fragment creation @@ -76,7 +78,7 @@ object SettingsPatch : BytecodePatch( if-eqz v0, :no_rv_settings_init return-void """, - ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex)) + ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex)), ) } ?: throw SettingsActivityOnCreateFingerprint.exception @@ -86,7 +88,7 @@ object SettingsPatch : BytecodePatch( REVANCED_SETTINGS_MENU_ITEM_NAME, REVANCED_SETTINGS_MENU_ITEM_ID, REVANCED_SETTINGS_MENU_ITEM_TITLE_RES, - REVANCED_SETTINGS_MENU_ITEM_ICON_RES + REVANCED_SETTINGS_MENU_ITEM_ICON_RES, ) } ?: throw SettingsMenuItemEnumFingerprint.exception @@ -98,7 +100,7 @@ object SettingsPatch : BytecodePatch( sget-object v0, $MENU_ITEM_ENUM_CLASS_DESCRIPTOR->$REVANCED_SETTINGS_MENU_ITEM_NAME:$MENU_ITEM_ENUM_CLASS_DESCRIPTOR invoke-static {p1, v0}, $ACTIVITY_HOOKS_CLASS_DESCRIPTOR->handleSettingMenuCreation(Ljava/util/List;Ljava/lang/Object;)Ljava/util/List; move-result-object p1 - """ + """, ) } ?: throw MenuGroupsUpdatedFingerprint.exception @@ -115,7 +117,7 @@ object SettingsPatch : BytecodePatch( invoke-virtual {p0, p1}, Ltv/twitch/android/core/mvp/viewdelegate/RxViewDelegate;->pushEvent(Ltv/twitch/android/core/mvp/viewdelegate/ViewDelegateEvent;)V return-void """, - ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex)) + ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex)), ) } ?: throw MenuGroupsOnClickFingerprint.exception } @@ -124,7 +126,7 @@ object SettingsPatch : BytecodePatch( name: String, value: Int, titleResourceName: String, - iconResourceName: String + iconResourceName: String, ) { // Add new static enum member field mutableClass.staticFields.add( @@ -135,8 +137,8 @@ object SettingsPatch : BytecodePatch( AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.ENUM or AccessFlags.STATIC, null, null, - null - ).toMutable() + null, + ).toMutable(), ) // Add initializer for the new enum member @@ -154,7 +156,7 @@ object SettingsPatch : BytecodePatch( const/4 v5, $value invoke-direct {v0, v4, v5, v1, v3}, $MENU_ITEM_ENUM_CLASS_DESCRIPTOR->(Ljava/lang/String;III)V sput-object v0, $MENU_ITEM_ENUM_CLASS_DESCRIPTOR->$name:$MENU_ITEM_ENUM_CLASS_DESCRIPTOR - """ + """, ) } @@ -166,6 +168,7 @@ object SettingsPatch : BytecodePatch( val CHAT = CustomScreen("revanced_chat_screen") val MISC = CustomScreen("revanced_misc_screen") + @Suppress("ktlint:standard:property-naming") internal class CustomScreen(key: String) : Screen(key) { /* Categories */ val GENERAL = CustomCategory("revanced_general_category") @@ -179,7 +182,7 @@ object SettingsPatch : BytecodePatch( return PreferenceCategory( key, preferences = preferences, - tag = "app.revanced.integrations.twitch.settings.preference.CustomPreferenceCategory" + tag = "app.revanced.integrations.twitch.settings.preference.CustomPreferenceCategory", ) } } diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsResourcePatch.kt index f547f4b77d..44e113c74a 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsResourcePatch.kt @@ -2,4 +2,4 @@ package app.revanced.patches.twitch.misc.settings import app.revanced.patches.shared.misc.settings.BaseSettingsResourcePatch -object SettingsResourcePatch : BaseSettingsResourcePatch() \ No newline at end of file +object SettingsResourcePatch : BaseSettingsResourcePatch() diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsOnClickFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsOnClickFingerprint.kt index 33962474bb..2aa3e25656 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsOnClickFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsOnClickFingerprint.kt @@ -9,7 +9,7 @@ internal object MenuGroupsOnClickFingerprint : MethodFingerprint( AccessFlags.PRIVATE or AccessFlags.STATIC or AccessFlags.FINAL, listOf("L", "L", "L"), customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("/SettingsMenuViewDelegate;") - && methodDef.name.contains("render") - } + methodDef.definingClass.endsWith("/SettingsMenuViewDelegate;") && + methodDef.name.contains("render") + }, ) diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsUpdatedFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsUpdatedFingerprint.kt index 7eba63a31c..1f047731c6 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsUpdatedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/MenuGroupsUpdatedFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object MenuGroupsUpdatedFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("/SettingsMenuPresenter\$Event\$MenuGroupsUpdated;") - && methodDef.name == "" - } + methodDef.definingClass.endsWith("/SettingsMenuPresenter\$Event\$MenuGroupsUpdated;") && + methodDef.name == "" + }, ) diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsActivityOnCreateFingerprint.kt index 5b1c637e4d..1bc63b3d9d 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsActivityOnCreateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsActivityOnCreateFingerprint.kt @@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SettingsActivityOnCreateFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/SettingsActivity;") && - methodDef.name == "onCreate" - } + methodDef.name == "onCreate" + }, ) diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsMenuItemEnumFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsMenuItemEnumFingerprint.kt index 1f9cd51dac..dd4ffd7607 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsMenuItemEnumFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/settings/fingerprints/SettingsMenuItemEnumFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SettingsMenuItemEnumFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/SettingsMenuItem;") && methodDef.name == "" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ConstructMediaOptionsSheetFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ConstructMediaOptionsSheetFingerprint.kt index 86b2a247bb..8258d874ee 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ConstructMediaOptionsSheetFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ConstructMediaOptionsSheetFingerprint.kt @@ -4,9 +4,8 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags - internal object ConstructMediaOptionsSheetFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - strings = listOf("captionsState") + strings = listOf("captionsState"), ) diff --git a/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ShowDownloadVideoUpsellBottomSheetFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ShowDownloadVideoUpsellBottomSheetFingerprint.kt index 1257d0f58e..4907a550f4 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ShowDownloadVideoUpsellBottomSheetFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/fingerprints/ShowDownloadVideoUpsellBottomSheetFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.Opcode internal object ShowDownloadVideoUpsellBottomSheetFingerprint : MethodFingerprint( returnType = "Z", strings = listOf("variantToDownload.url"), - opcodes = listOf(Opcode.IF_EQZ) + opcodes = listOf(Opcode.IF_EQZ), ) diff --git a/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt b/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt index 9951e50b5c..2ed3409e69 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.twitter.layout.viewcount - import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -13,11 +12,11 @@ import app.revanced.util.exception name = "Hide view count", description = "Hides the view count of Posts.", compatiblePackages = [CompatiblePackage("com.twitter.android")], - use = false + use = false, ) @Suppress("unused") object HideViewCountPatch : BytecodePatch( - setOf(ViewCountsEnabledFingerprint) + setOf(ViewCountsEnabledFingerprint), ) { override fun execute(context: BytecodeContext) = ViewCountsEnabledFingerprint.result?.mutableMethod?.addInstructions( @@ -25,6 +24,6 @@ object HideViewCountPatch : BytecodePatch( """ const/4 v0, 0x0 return v0 - """ + """, ) ?: throw ViewCountsEnabledFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/fingerprints/ViewCountsEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/fingerprints/ViewCountsEnabledFingerprint.kt index 3b3e7affd1..2e1e9e3dec 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/fingerprints/ViewCountsEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/fingerprints/ViewCountsEnabledFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ViewCountsEnabledFingerprint : MethodFingerprint( returnType = "Z", - strings = listOf("view_counts_public_visibility_enabled") + strings = listOf("view_counts_public_visibility_enabled"), ) diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt index d7e3687c85..a5afbaf357 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt @@ -15,11 +15,13 @@ import java.io.InvalidClassException @Patch( description = "Hooks the stream which reads JSON responses.", - requiresIntegrations = true + requiresIntegrations = true, ) -object JsonHookPatch : BytecodePatch( - setOf(LoganSquareFingerprint) -), Closeable { +object JsonHookPatch : + BytecodePatch( + setOf(LoganSquareFingerprint), + ), + Closeable { private const val JSON_HOOK_CLASS_NAMESPACE = "app/revanced/integrations/twitter/patches/hook/json" private const val JSON_HOOK_PATCH_CLASS_DESCRIPTOR = "L$JSON_HOOK_CLASS_NAMESPACE/JsonHookPatch;" private const val BASE_PATCH_CLASS_NAME = "BaseJsonHook" @@ -38,8 +40,9 @@ object JsonHookPatch : BytecodePatch( val jsonHookPatch = context.findClass { classDef -> classDef.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR } ?: throw PatchException("Could not find integrations.") - if (!it.resolve(context, jsonHookPatch.immutableClass)) + if (!it.resolve(context, jsonHookPatch.immutableClass)) { throw PatchException("Unexpected integrations.") + } }.let { hooks = JsonHookPatchHook(it) } // Conveniently find the type to hook a method in, via a named field. @@ -62,7 +65,7 @@ object JsonHookPatch : BytecodePatch( """ invoke-static { p1 }, $JSON_HOOK_PATCH_CLASS_DESCRIPTOR->parseJsonHook(Ljava/io/InputStream;)Ljava/io/InputStream; move-result-object p1 - """ + """, ) ?: throw PatchException("Could not find method to hook.") } @@ -85,8 +88,9 @@ object JsonHookPatch : BytecodePatch( if ( classDef.superclass != JSON_HOOK_CLASS_DESCRIPTOR || !classDef.fields.any { field -> field.name == "INSTANCE" } - ) throw InvalidClassException(classDef.type, "Not a hook class") - + ) { + throw InvalidClassException(classDef.type, "Not a hook class") + } } } ?: throw ClassNotFoundException("Failed to find hook class") } @@ -97,7 +101,7 @@ object JsonHookPatch : BytecodePatch( * * @param jsonHookPatchFingerprint The [JsonHookPatchFingerprint] to hook. */ - internal class JsonHookPatchHook(jsonHookPatchFingerprint: MethodFingerprint): Closeable { + internal class JsonHookPatchHook(jsonHookPatchFingerprint: MethodFingerprint) : Closeable { private val jsonHookPatchFingerprintResult = jsonHookPatchFingerprint.result!! private val jsonHookPatchIndex = jsonHookPatchFingerprintResult.scanResult.patternScanResult!!.endIndex @@ -119,7 +123,7 @@ object JsonHookPatch : BytecodePatch( """ sget-object v1, ${hook.descriptor}->INSTANCE:${hook.descriptor} invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z - """ + """, ) } @@ -137,5 +141,4 @@ object JsonHookPatch : BytecodePatch( } override fun close() = hooks.close() - -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonHookPatchFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonHookPatchFingerprint.kt index efe0a6e7c2..403944ff0a 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonHookPatchFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonHookPatchFingerprint.kt @@ -8,6 +8,6 @@ internal object JsonHookPatchFingerprint : MethodFingerprint( opcodes = listOf( Opcode.INVOKE_INTERFACE, // Add dummy hook to hooks list. // Add hooks to the hooks list. - Opcode.INVOKE_STATIC // Call buildList. - ) -) \ No newline at end of file + Opcode.INVOKE_STATIC, // Call buildList. + ), +) diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonInputStreamFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonInputStreamFingerprint.kt index b7dcb9df24..f185c1d61d 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonInputStreamFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/JsonInputStreamFingerprint.kt @@ -4,7 +4,10 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object JsonInputStreamFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> - if (methodDef.parameterTypes.size == 0) false - else methodDef.parameterTypes.first() == "Ljava/io/InputStream;" - } -) \ No newline at end of file + if (methodDef.parameterTypes.size == 0) { + false + } else { + methodDef.parameterTypes.first() == "Ljava/io/InputStream;" + } + }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/LoganSquareFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/LoganSquareFingerprint.kt index 6662d97f05..a30c89c0c6 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/LoganSquareFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/fingerprints/LoganSquareFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.twitter.misc.hook.json.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint internal object LoganSquareFingerprint : MethodFingerprint( - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("LoganSquare;") } -) \ No newline at end of file + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("LoganSquare;") }, +) diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch.kt index 1897ce0f96..7b1ef2af72 100644 --- a/src/main/kotlin/app/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch.kt @@ -8,9 +8,9 @@ import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatch @Patch( name = "Hide recommended users", dependencies = [JsonHookPatch::class], - compatiblePackages = [CompatiblePackage("com.twitter.android")] + compatiblePackages = [CompatiblePackage("com.twitter.android")], ) @Suppress("unused") object HideRecommendedUsersPatch : BaseHookPatch( - "Lapp/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook;" -) \ No newline at end of file + "Lapp/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook;", +) diff --git a/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt b/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt index 10cab31812..80adef533e 100644 --- a/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt @@ -7,5 +7,5 @@ internal object RevCatSubscriptionFingerprint : MethodFingerprint( strings = listOf("use_debug_subscription_settings"), customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/RevCatSubscriptionSettingsRepository;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt b/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt index c3e4e769d5..45d7d65abd 100644 --- a/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt +++ b/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt @@ -6,17 +6,17 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.GetMessagingCertFingerprint -import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.GetReqistrationCertFingerprint +import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.GetRegistrationCertFingerprint @Patch( description = "Spoofs the X-Android-Cert header.", - compatiblePackages = [CompatiblePackage("de.dwd.warnapp")] + compatiblePackages = [CompatiblePackage("de.dwd.warnapp")], ) object FirebaseGetCertPatch : BytecodePatch( setOf( - GetReqistrationCertFingerprint, - GetMessagingCertFingerprint - ) + GetRegistrationCertFingerprint, + GetMessagingCertFingerprint, + ), ) { override fun execute(context: BytecodeContext) { val spoofedInstruction = @@ -25,16 +25,16 @@ object FirebaseGetCertPatch : BytecodePatch( return-object v0 """ - val registrationCertMethod = GetReqistrationCertFingerprint.result!!.mutableMethod + val registrationCertMethod = GetRegistrationCertFingerprint.result!!.mutableMethod val messagingCertMethod = GetMessagingCertFingerprint.result!!.mutableMethod registrationCertMethod.addInstructions( 0, - spoofedInstruction + spoofedInstruction, ) messagingCertMethod.addInstructions( 0, - spoofedInstruction + spoofedInstruction, ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetCertMessagingFingerprint.kt b/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetMessagingCertFingerprint.kt similarity index 89% rename from src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetCertMessagingFingerprint.kt rename to src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetMessagingCertFingerprint.kt index f8b0e8dd7a..39d3a5db59 100644 --- a/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetCertMessagingFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetMessagingCertFingerprint.kt @@ -7,6 +7,6 @@ internal object GetMessagingCertFingerprint : MethodFingerprint( strings = listOf( "ContentValues", "Could not get fingerprint hash for package: ", - "No such package: " - ) -) \ No newline at end of file + "No such package: ", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetCertRegistrationFingerprint.kt b/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetRegistrationCertFingerprint.kt similarity index 72% rename from src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetCertRegistrationFingerprint.kt rename to src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetRegistrationCertFingerprint.kt index 868faf028d..18a34a2d34 100644 --- a/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetCertRegistrationFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/fingerprints/GetRegistrationCertFingerprint.kt @@ -2,11 +2,11 @@ package app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint -internal object GetReqistrationCertFingerprint : MethodFingerprint( +internal object GetRegistrationCertFingerprint : MethodFingerprint( "Ljava/lang/String;", strings = listOf( "FirebaseRemoteConfig", "Could not get fingerprint hash for package: ", - "No such package: " - ) -) \ No newline at end of file + "No such package: ", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt index 2f40f8aefa..21a5012055 100644 --- a/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt @@ -12,11 +12,11 @@ import app.revanced.patches.warnwetter.misc.promocode.fingerprints.PromoCodeUnlo name = "Promo code unlock", description = "Disables the validation of promo code. Any code will work to unlock all features.", dependencies = [FirebaseGetCertPatch::class], - compatiblePackages = [CompatiblePackage("de.dwd.warnapp")] + compatiblePackages = [CompatiblePackage("de.dwd.warnapp")], ) @Suppress("unused") object PromoCodeUnlockPatch : BytecodePatch( - setOf(PromoCodeUnlockFingerprint) + setOf(PromoCodeUnlockFingerprint), ) { override fun execute(context: BytecodeContext) { val method = PromoCodeUnlockFingerprint.result!!.mutableMethod @@ -25,7 +25,7 @@ object PromoCodeUnlockPatch : BytecodePatch( """ const/4 v0, 0x1 return v0 - """ + """, ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/fingerprints/PromoCodeUnlockFingerprint.kt b/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/fingerprints/PromoCodeUnlockFingerprint.kt index caa8b2d865..77060e27af 100644 --- a/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/fingerprints/PromoCodeUnlockFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/fingerprints/PromoCodeUnlockFingerprint.kt @@ -1,8 +1,8 @@ -package app.revanced.patches.warnwetter.misc.promocode.fingerprints -import app.revanced.patcher.fingerprint.MethodFingerprint - -internal object PromoCodeUnlockFingerprint : MethodFingerprint( - customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("PromoTokenVerification;") && methodDef.name == "isValid" - } -) \ No newline at end of file +package app.revanced.patches.warnwetter.misc.promocode.fingerprints +import app.revanced.patcher.fingerprint.MethodFingerprint + +internal object PromoCodeUnlockFingerprint : MethodFingerprint( + customFingerprint = { methodDef, _ -> + methodDef.definingClass.endsWith("PromoTokenVerification;") && methodDef.name == "isValid" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/UnlockProPatch.kt index 7bb5e121ac..3ad8dc1342 100644 --- a/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/UnlockProPatch.kt @@ -10,20 +10,20 @@ import app.revanced.patches.windyapp.misc.unlockpro.fingerprints.CheckProFingerp @Patch( name = "Unlock pro", description = "Unlocks all pro features.", - compatiblePackages = [CompatiblePackage("co.windyapp.android")] + compatiblePackages = [CompatiblePackage("co.windyapp.android")], ) @Suppress("unused") object UnlockProPatch : BytecodePatch( - setOf(CheckProFingerprint) + setOf(CheckProFingerprint), ) { override fun execute(context: BytecodeContext) { - val method = CheckProFingerprint.result!!.mutableMethod + val method = CheckProFingerprint.result!!.mutableMethod method.addInstructions( 0, """ const/16 v0, 0x1 return v0 - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/fingerprints/CheckProFingerprint.kt b/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/fingerprints/CheckProFingerprint.kt index ccf5433448..d41200ad47 100644 --- a/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/fingerprints/CheckProFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/windyapp/misc/unlockpro/fingerprints/CheckProFingerprint.kt @@ -6,5 +6,5 @@ internal object CheckProFingerprint : MethodFingerprint( "I", customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("RawUserData;") && methodDef.name == "isPro" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt index c89ba7eca5..ee0f20ac84 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch LithoFilterPatch::class, SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) object HideAdsResourcePatch : ResourcePatch() { private const val FILTER_CLASS_DESCRIPTOR = @@ -35,7 +35,7 @@ object HideAdsResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_products_banner"), SwitchPreference("revanced_hide_shopping_links"), SwitchPreference("revanced_hide_web_search_results"), - SwitchPreference("revanced_hide_merchandise_banners") + SwitchPreference("revanced_hide_merchandise_banners"), ) LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt index 5cc676ffa7..175991c2cf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt @@ -19,7 +19,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -32,10 +33,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = @@ -45,7 +46,7 @@ object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.ADS.addPreferences( - SwitchPreference("revanced_hide_get_premium") + SwitchPreference("revanced_hide_get_premium"), ) GetPremiumViewFingerprint.result?.let { @@ -69,7 +70,7 @@ object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) { :allow nop # Layout width/height is then passed to a protected class method. - """ + """, ) } } ?: throw GetPremiumViewFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/fingerprints/GetPremiumViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/fingerprints/GetPremiumViewFingerprint.kt index ca7abe1cb1..e5311c6214 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/fingerprints/GetPremiumViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/fingerprints/GetPremiumViewFingerprint.kt @@ -13,10 +13,10 @@ internal object GetPremiumViewFingerprint : MethodFingerprint( Opcode.ADD_INT_2ADDR, Opcode.ADD_INT_2ADDR, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), customFingerprint = { methodDef, _ -> - methodDef.definingClass == "Lcom/google/android/apps/youtube/app/red/presenter/CompactYpcOfferModuleView;" - && methodDef.name == "onMeasure" - } -) \ No newline at end of file + methodDef.definingClass == "Lcom/google/android/apps/youtube/app/red/presenter/CompactYpcOfferModuleView;" && + methodDef.name == "onMeasure" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt index d03c3ff2c7..2a1bda24bd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt @@ -19,7 +19,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ IntegrationsPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -37,32 +37,33 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object VideoAdsPatch : BytecodePatch( - setOf(LoadVideoAdsFingerprint) + setOf(LoadVideoAdsFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.ADS.addPreferences( - SwitchPreference("revanced_hide_video_ads") + SwitchPreference("revanced_hide_video_ads"), ) val loadVideoAdsFingerprintMethod = LoadVideoAdsFingerprint.result!!.mutableMethod loadVideoAdsFingerprintMethod.addInstructionsWithLabels( - 0, """ + 0, + """ invoke-static { }, Lapp/revanced/integrations/youtube/patches/VideoAdsPatch;->shouldShowAds()Z move-result v0 if-nez v0, :show_video_ads return-void """, - ExternalLabel("show_video_ads", loadVideoAdsFingerprintMethod.getInstruction(0)) + ExternalLabel("show_video_ads", loadVideoAdsFingerprintMethod.getInstruction(0)), ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/fingerprints/LoadVideoAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/fingerprints/LoadVideoAdsFingerprint.kt index 240886f012..710e643a5e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/fingerprints/LoadVideoAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/fingerprints/LoadVideoAdsFingerprint.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.ad.video.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object LoadVideoAdsFingerprint : MethodFingerprint( @@ -8,5 +7,5 @@ internal object LoadVideoAdsFingerprint : MethodFingerprint( "TriggerBundle doesn't have the required metadata specified by the trigger ", "Tried to enter slot with no assigned slotAdapter", "Trying to enter a slot when a slot of same type and physical position is already active. Its status: ", - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlResourcePatch.kt index 23476080b9..467cdf1acc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlResourcePatch.kt @@ -14,8 +14,8 @@ import app.revanced.util.copyResources dependencies = [ SettingsPatch::class, BottomControlsResourcePatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) internal object CopyVideoUrlResourcePatch : ResourcePatch() { override fun execute(context: ResourceContext) { @@ -23,17 +23,18 @@ internal object CopyVideoUrlResourcePatch : ResourcePatch() { SettingsPatch.PreferenceScreen.PLAYER.addPreferences( SwitchPreference("revanced_copy_video_url"), - SwitchPreference("revanced_copy_video_url_timestamp") + SwitchPreference("revanced_copy_video_url_timestamp"), ) context.copyResources( - "copyvideourl", ResourceGroup( + "copyvideourl", + ResourceGroup( resourceDirectoryName = "drawable", "revanced_yt_copy.xml", - "revanced_yt_copy_timestamp.xml" - ) + "revanced_yt_copy_timestamp.xml", + ), ) BottomControlsResourcePatch.addControls("copyvideourl") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt index 591e16bfba..f7ba49e5ef 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt @@ -17,11 +17,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( name = "Remove viewer discretion dialog", description = "Adds an option to remove the dialog that appears when opening a video that has been age-restricted " + - "by accepting it automatically. This does not bypass the age restriction.", + "by accepting it automatically. This does not bypass the age restriction.", dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -34,24 +35,24 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object RemoveViewerDiscretionDialogPatch : BytecodePatch( - setOf(CreateDialogFingerprint) + setOf(CreateDialogFingerprint), ) { private const val INTEGRATIONS_METHOD_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/RemoveViewerDiscretionDialogPatch;->" + - "confirmDialog(Landroid/app/AlertDialog;)V" + "confirmDialog(Landroid/app/AlertDialog;)V" override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_remove_viewer_discretion_dialog") + SwitchPreference("revanced_remove_viewer_discretion_dialog"), ) CreateDialogFingerprint.result?.mutableMethod?.apply { diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/fingerprints/CreateDialogFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/fingerprints/CreateDialogFingerprint.kt index 232e65e6a9..aae488a753 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/fingerprints/CreateDialogFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/fingerprints/CreateDialogFingerprint.kt @@ -17,6 +17,6 @@ internal object CreateDialogFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IPUT_OBJECT, Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL // dialog.show() - ) + Opcode.INVOKE_VIRTUAL, // dialog.show() + ), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt index a7cbd0a777..9773ebc393 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt @@ -34,24 +34,24 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object DisablePreciseSeekingGesturePatch : BytecodePatch( - setOf(IsSwipingUpFingerprint) + setOf(IsSwipingUpFingerprint), ) { private const val INTEGRATIONS_METHOD_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch;->" + - "disableGesture(Landroid/view/VelocityTracker;Landroid/view/MotionEvent;)V" + "disableGesture(Landroid/view/VelocityTracker;Landroid/view/MotionEvent;)V" override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SEEKBAR.addPreferences( - SwitchPreference("revanced_disable_precise_seeking_gesture") + SwitchPreference("revanced_disable_precise_seeking_gesture"), ) IsSwipingUpFingerprint.result?.let { @@ -64,9 +64,9 @@ object DisablePreciseSeekingGesturePatch : BytecodePatch( replaceInstruction( addMovementIndex, - "invoke-static {v$trackerRegister, v$eventRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR" + "invoke-static {v$trackerRegister, v$eventRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR", ) } } ?: throw IsSwipingUpFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt index 0b11595d67..82c7cb2dd0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt @@ -22,7 +22,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference name = "Seekbar tapping", description = "Adds an option to enable tap-to-seek on the seekbar of the video player.", dependencies = [ - IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], + IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class, + ], compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", @@ -36,23 +37,23 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object EnableSeekbarTappingPatch : BytecodePatch( setOf( OnTouchEventHandlerFingerprint, - SeekbarTappingFingerprint - ) + SeekbarTappingFingerprint, + ), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SEEKBAR.addPreferences( - SwitchPreference("revanced_seekbar_tapping") + SwitchPreference("revanced_seekbar_tapping"), ) // Find the required methods to tap the seekbar. @@ -94,9 +95,9 @@ object EnableSeekbarTappingPatch : BytecodePatch( ${oMethod.toInvokeInstructionString()} ${nMethod.toInvokeInstructionString()} """, - ExternalLabel("disabled", getInstruction(insertIndex)) + ExternalLabel("disabled", getInstruction(insertIndex)), ) } } ?: throw SeekbarTappingFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt index ec38b7e7ec..ba6bef4cfb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt @@ -32,18 +32,18 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) + "19.04.37", + ], + ), ], - use = false + use = false, ) @Suppress("unused") object EnableSlideToSeekPatch : BytecodePatch( setOf( SlideToSeekFingerprint, - DoubleSpeedSeekNoticeFingerprint - ) + DoubleSpeedSeekNoticeFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/SlideToSeekPatch;" @@ -51,14 +51,14 @@ object EnableSlideToSeekPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SEEKBAR.addPreferences( - SwitchPreference("revanced_slide_to_seek") + SwitchPreference("revanced_slide_to_seek"), ) arrayOf( // Restore the behaviour to slide to seek. SlideToSeekFingerprint, // Disable the double speed seek notice. - DoubleSpeedSeekNoticeFingerprint + DoubleSpeedSeekNoticeFingerprint, ).map { it.result ?: throw it.exception }.forEach { @@ -72,9 +72,9 @@ object EnableSlideToSeekPatch : BytecodePatch( """ invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->isSlideToSeekDisabled()Z move-result v$isEnabledRegister - """ + """, ) } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/DoubleSpeedSeekNoticeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/DoubleSpeedSeekNoticeFingerprint.kt index eee74fde59..68cefa4723 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/DoubleSpeedSeekNoticeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/DoubleSpeedSeekNoticeFingerprint.kt @@ -7,5 +7,5 @@ internal object DoubleSpeedSeekNoticeFingerprint : LiteralValueFingerprint( returnType = "Z", parameters = emptyList(), opcodes = listOf(Opcode.MOVE_RESULT), - literalSupplier = { 45411330 } -) \ No newline at end of file + literalSupplier = { 45411330 }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/IsSwipingUpFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/IsSwipingUpFingerprint.kt index 3029925adc..1407d69329 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/IsSwipingUpFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/IsSwipingUpFingerprint.kt @@ -8,6 +8,6 @@ internal object IsSwipingUpFingerprint : MethodFingerprint( parameters = listOf("Landroid/view/MotionEvent;", "J"), opcodes = listOf( Opcode.SGET_OBJECT, - Opcode.IGET_OBJECT - ) -) \ No newline at end of file + Opcode.IGET_OBJECT, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/OnTouchEventHandlerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/OnTouchEventHandlerFingerprint.kt index 8c2c47649a..1b4ecb207c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/OnTouchEventHandlerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/OnTouchEventHandlerFingerprint.kt @@ -27,5 +27,5 @@ internal object OnTouchEventHandlerFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL, // oMethodReference ), - customFingerprint = { methodDef, _ -> methodDef.name == "onTouchEvent" } -) \ No newline at end of file + customFingerprint = { methodDef, _ -> methodDef.name == "onTouchEvent" }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SeekbarTappingFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SeekbarTappingFingerprint.kt index ddb8bf47d9..5d21223c24 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SeekbarTappingFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SeekbarTappingFingerprint.kt @@ -6,7 +6,6 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction - internal object SeekbarTappingFingerprint : MethodFingerprint( returnType = "Z", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, @@ -30,5 +29,5 @@ internal object SeekbarTappingFingerprint : MethodFingerprint( // with this literal making it unique with the rest of the properties of this fingerprint. literal == Integer.MAX_VALUE } - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SlideToSeekFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SlideToSeekFingerprint.kt index b618ea50f1..3dca2c9d48 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SlideToSeekFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SlideToSeekFingerprint.kt @@ -7,5 +7,5 @@ internal object SlideToSeekFingerprint : LiteralValueFingerprint( returnType = "Z", parameters = emptyList(), opcodes = listOf(Opcode.MOVE_RESULT), - literalSupplier = { 45411329 } -) \ No newline at end of file + literalSupplier = { 45411329 }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt index 2ad39c70a0..5b7f52879b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt @@ -20,7 +20,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod dependencies = [ IntegrationsPatch::class, PlayerTypeHookPatch::class, - SwipeControlsResourcePatch::class + SwipeControlsResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -38,17 +38,17 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object SwipeControlsBytecodePatch : BytecodePatch( setOf( MainActivityFingerprint, - SwipeControlsHostActivityFingerprint - ) + SwipeControlsHostActivityFingerprint, + ), ) { override fun execute(context: BytecodeContext) { val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass @@ -70,9 +70,9 @@ object SwipeControlsBytecodePatch : BytecodePatch( accessFlags and AccessFlags.FINAL.value.inv(), annotations, hiddenApiRestrictions, - implementation + implementation, ).toMutable() } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/fingerprints/SwipeControlsHostActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/fingerprints/SwipeControlsHostActivityFingerprint.kt index a4b6100a69..c605c5427c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/fingerprints/SwipeControlsHostActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/fingerprints/SwipeControlsHostActivityFingerprint.kt @@ -9,5 +9,5 @@ internal object SwipeControlsHostActivityFingerprint : MethodFingerprint( parameters = listOf(), customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lapp/revanced/integrations/youtube/swipecontrols/SwipeControlsHostActivity;" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt index 6afc729009..543c511162 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt @@ -15,7 +15,6 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.exception - @Patch( name = "Disable auto captions", description = "Adds an option to disable captions from being automatically enabled.", @@ -36,32 +35,32 @@ import app.revanced.util.exception "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) + "19.04.37", + ], + ), ], ) @Suppress("unused") object AutoCaptionsPatch : BytecodePatch( - setOf(StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint) + setOf(StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_auto_captions") + SwitchPreference("revanced_auto_captions"), ) mapOf( StartVideoInformerFingerprint to 0, - SubtitleButtonControllerFingerprint to 1 + SubtitleButtonControllerFingerprint to 1, ).forEach { (fingerprint, enabled) -> fingerprint.result?.mutableMethod?.addInstructions( 0, """ const/4 v0, 0x$enabled sput-boolean v0, Lapp/revanced/integrations/youtube/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z - """ + """, ) ?: throw fingerprint.exception } @@ -77,7 +76,7 @@ object AutoCaptionsPatch : BytecodePatch( return v0 :auto_captions_enabled nop - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/StartVideoInformerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/StartVideoInformerFingerprint.kt index aa95f3ffd0..40415884a0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/StartVideoInformerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/StartVideoInformerFingerprint.kt @@ -10,7 +10,7 @@ internal object StartVideoInformerFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, opcodes = listOf( Opcode.INVOKE_INTERFACE, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), - strings = listOf("pc") -) \ No newline at end of file + strings = listOf("pc"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleButtonControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleButtonControllerFingerprint.kt index 6379cb6707..07ff7f7cb2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleButtonControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleButtonControllerFingerprint.kt @@ -19,5 +19,5 @@ internal object SubtitleButtonControllerFingerprint : MethodFingerprint( Opcode.CONST, Opcode.INVOKE_VIRTUAL, Opcode.IGET_OBJECT, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleTrackFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleTrackFingerprint.kt index 8efb95b5fb..0ee79722a7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleTrackFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/fingerprints/SubtitleTrackFingerprint.kt @@ -6,7 +6,10 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object SubtitleTrackFingerprint : MethodFingerprint( - "Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( + "Z", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf(), + listOf( Opcode.CONST_STRING, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, @@ -17,5 +20,5 @@ internal object SubtitleTrackFingerprint : MethodFingerprint( strings = listOf("DISABLE_CAPTIONS_OPTION"), customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("SubtitleTrack;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt index 6debdf1a9b..c7a1b85aae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ ResourceMappingPatch::class, LithoFilterPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -35,10 +35,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideButtonsPatch : ResourcePatch() { @@ -60,9 +60,9 @@ object HideButtonsPatch : ResourcePatch() { SwitchPreference("revanced_hide_thanks_button"), SwitchPreference("revanced_hide_clip_button"), SwitchPreference("revanced_hide_playlist_button"), - SwitchPreference("revanced_hide_shop_button") + SwitchPreference("revanced_hide_shop_button"), ), - ) + ), ) LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt index 5937185eae..2e5a41770c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt @@ -27,7 +27,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference IntegrationsPatch::class, SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -45,20 +45,20 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideAutoplayButtonPatch : BytecodePatch( - setOf(LayoutConstructorFingerprint) + setOf(LayoutConstructorFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_autoplay_button") + SwitchPreference("revanced_hide_autoplay_button"), ) LayoutConstructorFingerprint.result?.mutableMethod?.apply { @@ -86,8 +86,8 @@ object HideAutoplayButtonPatch : BytecodePatch( move-result v$clobberRegister if-eqz v$clobberRegister, :hidden """, - ExternalLabel("hidden", jumpInstruction) + ExternalLabel("hidden", jumpInstruction), ) } ?: throw LayoutConstructorFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt index a9f2b9f7b6..10363cb7db 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt @@ -18,7 +18,7 @@ import com.android.tools.smali.dexlib2.Opcode dependencies = [ IntegrationsPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -36,20 +36,20 @@ import com.android.tools.smali.dexlib2.Opcode "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideCaptionsButtonPatch : BytecodePatch( - setOf(SubtitleButtonControllerFingerprint) + setOf(SubtitleButtonControllerFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_captions_button") + SwitchPreference("revanced_hide_captions_button"), ) val subtitleButtonControllerMethod = SubtitleButtonControllerFingerprint.result!!.mutableMethod @@ -63,7 +63,7 @@ object HideCaptionsButtonPatch : BytecodePatch( insertIndex, """ invoke-static {v0}, Lapp/revanced/integrations/youtube/patches/HideCaptionsButtonPatch;->hideCaptionsButton(Landroid/widget/ImageView;)V - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/cast/HideCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/cast/HideCastButtonPatch.kt index aaec98701c..7235c215bc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/cast/HideCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/cast/HideCastButtonPatch.kt @@ -28,7 +28,7 @@ object HideCastButtonPatch : BytecodePatch(emptySet()) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_cast_button") + SwitchPreference("revanced_hide_cast_button"), ) val buttonClass = context.findClass("MediaRouteButton") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/ResolvePivotBarFingerprintsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/ResolvePivotBarFingerprintsPatch.kt index eacab72b45..241a656f0e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/ResolvePivotBarFingerprintsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/ResolvePivotBarFingerprintsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.buttons.navigation -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchException @@ -8,13 +7,14 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.InitializeButtonsFingerprint import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.PivotBarConstructorFingerprint +import app.revanced.util.exception @Patch( description = "Resolves necessary fingerprints.", - dependencies = [ResourceMappingPatch::class] + dependencies = [ResourceMappingPatch::class], ) internal object ResolvePivotBarFingerprintsPatch : BytecodePatch( - setOf(PivotBarConstructorFingerprint) + setOf(PivotBarConstructorFingerprint), ) { internal var imageOnlyTabResourceId: Long = -1 @@ -28,10 +28,11 @@ internal object ResolvePivotBarFingerprintsPatch : BytecodePatch( // which PivotBarConstructorFingerprint resolved to if (!InitializeButtonsFingerprint.resolve( context, - it.classDef + it.classDef, ) - ) throw InitializeButtonsFingerprint.exception + ) { + throw InitializeButtonsFingerprint.exception + } } ?: throw PivotBarConstructorFingerprint.exception } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/AddCreateButtonViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/AddCreateButtonViewFingerprint.kt index 40bf1cb8dc..fb07771e86 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/AddCreateButtonViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/AddCreateButtonViewFingerprint.kt @@ -8,5 +8,5 @@ internal object AddCreateButtonViewFingerprint : MethodFingerprint( strings = listOf( "Android Wear", ANDROID_AUTOMOTIVE_STRING, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/InitializeButtonsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/InitializeButtonsFingerprint.kt index f64015c78a..a3d8ef6907 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/InitializeButtonsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/InitializeButtonsFingerprint.kt @@ -9,5 +9,5 @@ internal object InitializeButtonsFingerprint : LiteralValueFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, returnType = "V", parameters = listOf(), - literalSupplier = { ResolvePivotBarFingerprintsPatch.imageOnlyTabResourceId } -) \ No newline at end of file + literalSupplier = { ResolvePivotBarFingerprintsPatch.imageOnlyTabResourceId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarButtonsViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarButtonsViewFingerprint.kt index 7827a4f4f4..00e5e6b6fc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarButtonsViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarButtonsViewFingerprint.kt @@ -8,5 +8,5 @@ internal object PivotBarButtonsViewFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL_RANGE, Opcode.MOVE_RESULT_OBJECT, // target reference Opcode.GOTO, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarConstructorFingerprint.kt index 37674a2bfc..1e9c38ee76 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarConstructorFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object PivotBarConstructorFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - strings = listOf("com.google.android.apps.youtube.app.endpoint.flags") -) \ No newline at end of file + strings = listOf("com.google.android.apps.youtube.app.endpoint.flags"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt index a32ee0cb71..749400c218 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt @@ -8,6 +8,6 @@ internal object PivotBarCreateButtonViewFingerprint : MethodFingerprint( Opcode.INVOKE_DIRECT_RANGE, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_STATIC - ) -) \ No newline at end of file + Opcode.INVOKE_STATIC, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarEnumFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarEnumFingerprint.kt index df40cc9eb8..1e3756c68e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarEnumFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarEnumFingerprint.kt @@ -11,5 +11,5 @@ internal object PivotBarEnumFingerprint : MethodFingerprint( Opcode.SGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/utils/InjectionUtils.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/utils/InjectionUtils.kt index f97305c12c..0240c567e0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/utils/InjectionUtils.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/utils/InjectionUtils.kt @@ -27,4 +27,4 @@ internal object InjectionUtils { hook.replace("REGISTER_INDEX", register.toString()), ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt index 7d16a8e3ae..ff5d3c18c3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt @@ -22,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc dependencies = [ IntegrationsPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -40,20 +40,20 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HidePlayerButtonsPatch : BytecodePatch( - setOf(PlayerControlsVisibilityModelFingerprint) + setOf(PlayerControlsVisibilityModelFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_player_buttons") + SwitchPreference("revanced_hide_player_buttons"), ) PlayerControlsVisibilityModelFingerprint.result?.apply { @@ -72,7 +72,7 @@ object HidePlayerButtonsPatch : BytecodePatch( invoke-static { v$hasPreviousParameterRegister }, Lapp/revanced/integrations/youtube/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z move-result v$hasPreviousParameterRegister - """ + """, ) } ?: throw PlayerControlsVisibilityModelFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/fingerprints/PlayerControlsVisibilityModelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/fingerprints/PlayerControlsVisibilityModelFingerprint.kt index 4aae5c27ed..bb1d2ba81f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/fingerprints/PlayerControlsVisibilityModelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/fingerprints/PlayerControlsVisibilityModelFingerprint.kt @@ -5,5 +5,5 @@ import com.android.tools.smali.dexlib2.Opcode internal object PlayerControlsVisibilityModelFingerprint : MethodFingerprint( opcodes = listOf(Opcode.INVOKE_DIRECT_RANGE), - strings = listOf("Missing required properties:", "hasNext", "hasPrevious") -) \ No newline at end of file + strings = listOf("Missing required properties:", "hasNext", "hasPrevious"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt index 674af6ddfc..a19bb1d2a9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.albumcards -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.albumcards.fingerprints.AlbumCardsFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction description = "Adds an option to hide album cards below artist descriptions.", dependencies = [ IntegrationsPatch::class, - AlbumCardsResourcePatch::class + AlbumCardsResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -34,14 +34,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object AlbumCardsPatch : BytecodePatch( - setOf(AlbumCardsFingerprint) + setOf(AlbumCardsFingerprint), ) { override fun execute(context: BytecodeContext) { AlbumCardsFingerprint.result?.let { @@ -54,9 +54,9 @@ object AlbumCardsPatch : BytecodePatch( addInstruction( insertIndex, "invoke-static {v$albumCardViewRegister}, " + - "Lapp/revanced/integrations/youtube/patches/HideAlbumCardsPatch;" + - "->" + - "hideAlbumCard(Landroid/view/View;)V" + "Lapp/revanced/integrations/youtube/patches/HideAlbumCardsPatch;" + + "->" + + "hideAlbumCard(Landroid/view/View;)V", ) } } ?: throw AlbumCardsFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt index 08b54204fc..a2af729500 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object AlbumCardsResourcePatch : ResourcePatch() { @@ -22,11 +22,11 @@ internal object AlbumCardsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_album_cards") + SwitchPreference("revanced_hide_album_cards"), ) albumCardId = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "album_card" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt index 6bbabdf520..b153ded420 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt @@ -16,5 +16,5 @@ internal object AlbumCardsFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - literalSupplier = { AlbumCardsResourcePatch.albumCardId } -) \ No newline at end of file + literalSupplier = { AlbumCardsResourcePatch.albumCardId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt index 0b7f0553fc..f6a6790edf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.breakingnews -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.breakingnews.fingerprints.BreakingNewsFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction description = "Adds an option to hide the breaking news shelf on the homepage tab.", dependencies = [ IntegrationsPatch::class, - BreakingNewsResourcePatch::class + BreakingNewsResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -34,14 +34,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object BreakingNewsPatch : BytecodePatch( - setOf(BreakingNewsFingerprint) + setOf(BreakingNewsFingerprint), ) { override fun execute(context: BytecodeContext) { BreakingNewsFingerprint.result?.let { @@ -59,11 +59,9 @@ object BreakingNewsPatch : BytecodePatch( Lapp/revanced/integrations/youtube/patches/HideBreakingNewsPatch; -> hideBreakingNews(Landroid/view/View;)V - """ + """, ) } - } ?: throw BreakingNewsFingerprint.exception - } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt index 81b69fe487..5f0b3186df 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object BreakingNewsResourcePatch : ResourcePatch() { @@ -22,11 +22,11 @@ internal object BreakingNewsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_breaking_news") + SwitchPreference("revanced_hide_breaking_news"), ) horizontalCardListId = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "horizontal_card_list" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt index a67ad6f05a..e73037bc79 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt @@ -16,5 +16,5 @@ internal object BreakingNewsFingerprint : LiteralValueFingerprint( Opcode.CHECK_CAST, Opcode.IPUT_OBJECT, ), - literalSupplier = { BreakingNewsResourcePatch.horizontalCardListId } -) \ No newline at end of file + literalSupplier = { BreakingNewsResourcePatch.horizontalCardListId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt index cfff7f9ee7..417c247b0a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt @@ -16,7 +16,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, LithoFilterPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -34,10 +34,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object CommentsPatch : ResourcePatch() { @@ -52,9 +52,9 @@ object CommentsPatch : ResourcePatch() { "revanced_comments_screen", preferences = setOf( SwitchPreference("revanced_hide_comments_section"), - SwitchPreference("revanced_hide_preview_comment") - ) - ) + SwitchPreference("revanced_hide_preview_comment"), + ), + ), ) LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt index 1985b5b8fc..265eb46fb8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.crowdfundingbox -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @Patch( @@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction description = "Adds an option to hide the crowdfunding box between the player and video description.", dependencies = [ IntegrationsPatch::class, - CrowdfundingBoxResourcePatch::class + CrowdfundingBoxResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -34,14 +34,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object CrowdfundingBoxPatch : BytecodePatch( - setOf(CrowdfundingBoxFingerprint) + setOf(CrowdfundingBoxFingerprint), ) { private const val INTEGRATIONS_METHOD_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V" diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt index 4e61c0953b..52ebe0cc1e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object CrowdfundingBoxResourcePatch : ResourcePatch() { @@ -22,11 +22,11 @@ internal object CrowdfundingBoxResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_crowdfunding_box") + SwitchPreference("revanced_hide_crowdfunding_box"), ) crowdfundingBoxId = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "donation_companion" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt index 465b10bfe5..4995c3d894 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt @@ -13,5 +13,5 @@ internal object CrowdfundingBoxFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IPUT_OBJECT, ), - literalSupplier = { CrowdfundingBoxResourcePatch.crowdfundingBoxId } -) \ No newline at end of file + literalSupplier = { CrowdfundingBoxResourcePatch.crowdfundingBoxId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt index 68458d25dd..05c496b6bf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.endscreencards -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -12,6 +11,7 @@ import app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints.Layo import app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints.LayoutIconFingerprint import app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints.LayoutVideoFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c @Patch( @@ -19,7 +19,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c description = "Adds an option to hide suggested video cards at the end of videos.", dependencies = [ IntegrationsPatch::class, - HideEndscreenCardsResourcePatch::class + HideEndscreenCardsResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -37,10 +37,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideEndscreenCardsPatch : BytecodePatch( @@ -48,7 +48,7 @@ object HideEndscreenCardsPatch : BytecodePatch( LayoutCircleFingerprint, LayoutIconFingerprint, LayoutVideoFingerprint, - ) + ), ) { override fun execute(context: BytecodeContext) { fun MethodFingerprint.injectHideCall() { @@ -59,7 +59,7 @@ object HideEndscreenCardsPatch : BytecodePatch( addInstruction( insertIndex, - "invoke-static { v$viewRegister }, Lapp/revanced/integrations/youtube/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V" + "invoke-static { v$viewRegister }, Lapp/revanced/integrations/youtube/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V", ) } } @@ -67,7 +67,7 @@ object HideEndscreenCardsPatch : BytecodePatch( listOf( LayoutCircleFingerprint, LayoutIconFingerprint, - LayoutVideoFingerprint + LayoutVideoFingerprint, ).forEach(MethodFingerprint::injectHideCall) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt index 13231b7bd9..b68f86f11d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object HideEndscreenCardsResourcePatch : ResourcePatch() { @@ -24,7 +24,7 @@ internal object HideEndscreenCardsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_endscreen_cards") + SwitchPreference("revanced_hide_endscreen_cards"), ) fun findEndscreenResourceId(name: String) = ResourceMappingPatch.resourceMappings.single { @@ -35,4 +35,4 @@ internal object HideEndscreenCardsResourcePatch : ResourcePatch() { layoutIcon = findEndscreenResourceId("icon") layoutVideo = findEndscreenResourceId("video") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutCircleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutCircleFingerprint.kt index 553bc61834..683b607965 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutCircleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutCircleFingerprint.kt @@ -13,5 +13,5 @@ internal object LayoutCircleFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - literalSupplier = { HideEndscreenCardsResourcePatch.layoutCircle } -) \ No newline at end of file + literalSupplier = { HideEndscreenCardsResourcePatch.layoutCircle }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutIconFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutIconFingerprint.kt index 60c751c7d1..2ac9706d6b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutIconFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutIconFingerprint.kt @@ -11,5 +11,5 @@ internal object LayoutIconFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - literalSupplier = { HideEndscreenCardsResourcePatch.layoutIcon } -) \ No newline at end of file + literalSupplier = { HideEndscreenCardsResourcePatch.layoutIcon }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutVideoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutVideoFingerprint.kt index 0b082fedb6..a9b8f5c52a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutVideoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/fingerprints/LayoutVideoFingerprint.kt @@ -13,5 +13,5 @@ internal object LayoutVideoFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - literalSupplier = { HideEndscreenCardsResourcePatch.layoutVideo } -) \ No newline at end of file + literalSupplier = { HideEndscreenCardsResourcePatch.layoutVideo }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt index 67a2e2d3a0..59db28177f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.filterbar -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -11,6 +10,7 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.FilterBarHeightFingerprint import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.RelatedChipCloudFingerprint import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.SearchResultsChipBarFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @@ -34,18 +34,18 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideFilterBarPatch : BytecodePatch( setOf( RelatedChipCloudFingerprint, SearchResultsChipBarFingerprint, - FilterBarHeightFingerprint - ) + FilterBarHeightFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/HideFilterBarPatch;" @@ -60,7 +60,7 @@ object HideFilterBarPatch : BytecodePatch( RelatedChipCloudFingerprint.patch(1) { register -> "invoke-static { v$register }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V" + "$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V" } SearchResultsChipBarFingerprint.patch(-1, -2) { register -> @@ -82,7 +82,7 @@ object HideFilterBarPatch : BytecodePatch( private fun MethodFingerprint.patch( insertIndexOffset: Int = 0, hookRegisterOffset: Int = 0, - instructions: (Int) -> String + instructions: (Int) -> String, ) = result?.let { it.mutableMethod.apply { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt index a10d22a09d..054f2eff40 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt @@ -25,8 +25,8 @@ internal object HideFilterBarResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_filter_bar_feed_in_feed"), SwitchPreference("revanced_hide_filter_bar_feed_in_search"), SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"), - ) - ) + ), + ), ) relatedChipCloudMarginId = "related_chip_cloud_reduced_margins".layoutResourceId("layout") @@ -36,4 +36,4 @@ internal object HideFilterBarResourcePatch : ResourcePatch() { private fun String.layoutResourceId(type: String = "dimen") = ResourceMappingPatch.resourceMappings.single { it.type == type && it.name == this }.id -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt index b15abf5bb9..18dcedb8ae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt @@ -13,7 +13,7 @@ internal object FilterBarHeightFingerprint : LiteralValueFingerprint( Opcode.CONST, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - Opcode.IPUT + Opcode.IPUT, ), - literalSupplier = { HideFilterBarResourcePatch.filterBarHeightId } -) \ No newline at end of file + literalSupplier = { HideFilterBarResourcePatch.filterBarHeightId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt index d9efa6c49d..b91bbd7d63 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt @@ -12,7 +12,7 @@ internal object RelatedChipCloudFingerprint : LiteralValueFingerprint( opcodes = listOf( Opcode.CONST, Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ), - literalSupplier = { HideFilterBarResourcePatch.relatedChipCloudMarginId } -) \ No newline at end of file + literalSupplier = { HideFilterBarResourcePatch.relatedChipCloudMarginId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt index ed1179ba72..7d5cc27c4a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt @@ -14,7 +14,7 @@ internal object SearchResultsChipBarFingerprint : LiteralValueFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ), - literalSupplier = { HideFilterBarResourcePatch.barContainerHeightId } -) \ No newline at end of file + literalSupplier = { HideFilterBarResourcePatch.barContainerHeightId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt index e783193519..afd47abe8e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.floatingmicrophone -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -8,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.floatingmicrophone.fingerprints.ShowFloatingMicrophoneButtonFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @Patch( @@ -30,14 +30,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideFloatingMicrophoneButtonPatch : BytecodePatch( - setOf(ShowFloatingMicrophoneButtonFingerprint) + setOf(ShowFloatingMicrophoneButtonFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/HideFloatingMicrophoneButtonPatch;" @@ -54,7 +54,7 @@ object HideFloatingMicrophoneButtonPatch : BytecodePatch( """ invoke-static {v$showButtonRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideFloatingMicrophoneButton(Z)Z move-result v$showButtonRegister - """ + """, ) } } ?: throw ShowFloatingMicrophoneButtonFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt index 7dbd6a1549..664265d9de 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt @@ -13,8 +13,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) internal object HideFloatingMicrophoneButtonResourcePatch : ResourcePatch() { internal var fabButtonId: Long = -1 @@ -23,7 +23,7 @@ internal object HideFloatingMicrophoneButtonResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_hide_floating_microphone_button") + SwitchPreference("revanced_hide_floating_microphone_button"), ) fabButtonId = ResourceMappingPatch.resourceMappings.find { it.type == "id" && it.name == "fab" }?.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt index 4abde10606..d31a191a6a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt @@ -13,7 +13,7 @@ internal object ShowFloatingMicrophoneButtonFingerprint : LiteralValueFingerprin opcodes = listOf( Opcode.IGET_BOOLEAN, Opcode.IF_EQZ, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), - literalSupplier = { HideFloatingMicrophoneButtonResourcePatch.fabButtonId } -) \ No newline at end of file + literalSupplier = { HideFloatingMicrophoneButtonResourcePatch.fabButtonId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt index caf22e8a77..1e34bd21ae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt @@ -18,7 +18,8 @@ import app.revanced.util.exception dependencies = [SettingsPatch::class, IntegrationsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.37.36", "18.38.44", "18.43.45", @@ -30,14 +31,14 @@ import app.revanced.util.exception "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object DisableFullscreenAmbientModePatch : BytecodePatch( - setOf(InitializeAmbientModeFingerprint) + setOf(InitializeAmbientModeFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/DisableFullscreenAmbientModePatch;" @@ -46,7 +47,7 @@ object DisableFullscreenAmbientModePatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_disable_fullscreen_ambient_mode") + SwitchPreference("revanced_disable_fullscreen_ambient_mode"), ) InitializeAmbientModeFingerprint.result?.let { @@ -56,7 +57,7 @@ object DisableFullscreenAmbientModePatch : BytecodePatch( addInstruction( moveIsEnabledIndex, "invoke-static { }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->enableFullScreenAmbientMode()Z" + "$INTEGRATIONS_CLASS_DESCRIPTOR->enableFullScreenAmbientMode()Z", ) } } ?: throw InitializeAmbientModeFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/fingerprints/InitializeAmbientModeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/fingerprints/InitializeAmbientModeFingerprint.kt index f5c8ddf4f8..2e02b50c08 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/fingerprints/InitializeAmbientModeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/fingerprints/InitializeAmbientModeFingerprint.kt @@ -9,5 +9,5 @@ internal object InitializeAmbientModeFingerprint : LiteralValueFingerprint( returnType = "V", accessFlags = AccessFlags.CONSTRUCTOR or AccessFlags.PUBLIC, opcodes = listOf(Opcode.MOVE_RESULT), - literalSupplier = { 45389368 } -) \ No newline at end of file + literalSupplier = { 45389368 }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt index f978acd746..0d5cddaaaa 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ParseElementFromBufferFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.Opcode internal object ParseElementFromBufferFingerprint : MethodFingerprint( - parameters = listOf("L","L","[B", "L","L"), + parameters = listOf("L", "L", "[B", "L", "L"), opcodes = listOf(Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT), - strings = listOf("Failed to parse Element") -) \ No newline at end of file + strings = listOf("Failed to parse Element"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/PlayerOverlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/PlayerOverlayFingerprint.kt index 3738d41880..76370b90d0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/PlayerOverlayFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/PlayerOverlayFingerprint.kt @@ -5,5 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags internal object PlayerOverlayFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.FINAL, strings = listOf("player_overlay_in_video_programming") + "L", + AccessFlags.PUBLIC or AccessFlags.FINAL, + strings = listOf("player_overlay_in_video_programming"), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowWatermarkFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowWatermarkFingerprint.kt index 430382140e..fa9c9b9e93 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowWatermarkFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowWatermarkFingerprint.kt @@ -5,5 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags internal object ShowWatermarkFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L") -) \ No newline at end of file + "V", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf("L", "L"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt index 1b7772aafc..604707b06f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt @@ -23,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction dependencies = [ IntegrationsPatch::class, LithoFilterPatch::class, - HideInfocardsResourcePatch::class + HideInfocardsResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -41,17 +41,17 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideInfoCardsPatch : BytecodePatch( setOf( InfocardsIncognitoParentFingerprint, InfocardsMethodCallFingerprint, - ) + ), ) { private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/HideInfoCardsFilterPatch;" @@ -62,14 +62,14 @@ object HideInfoCardsPatch : BytecodePatch( }.result!!.mutableMethod.apply { val invokeInstructionIndex = implementation!!.instructions.indexOfFirst { it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal && - ((it as ReferenceInstruction).reference.toString() == "Landroid/view/View;->setVisibility(I)V") + ((it as ReferenceInstruction).reference.toString() == "Landroid/view/View;->setVisibility(I)V") } - addInstruction( - invokeInstructionIndex, - "invoke-static {v${getInstruction(invokeInstructionIndex).registerC}}," + - " Lapp/revanced/integrations/youtube/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V" - ) + addInstruction( + invokeInstructionIndex, + "invoke-static {v${getInstruction(invokeInstructionIndex).registerC}}," + + " Lapp/revanced/integrations/youtube/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V", + ) } with(InfocardsMethodCallFingerprint.result!!) { @@ -86,12 +86,13 @@ object HideInfoCardsPatch : BytecodePatch( if-nez v$toggleRegister, :hide_info_cards """, ExternalLabel( - "hide_info_cards", hideInfoCardsCallMethod.getInstruction(invokeInterfaceIndex + 1) - ) + "hide_info_cards", + hideInfoCardsCallMethod.getInstruction(invokeInterfaceIndex + 1), + ), ) } // Info cards can also appear as litho components. LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt index 6ac2377faf..a7fc5c0e03 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) object HideInfocardsResourcePatch : ResourcePatch() { @@ -22,11 +22,11 @@ object HideInfocardsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_info_cards") + SwitchPreference("revanced_hide_info_cards"), ) drawerResourceId = ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "info_cards_drawer_header" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoFingerprint.kt index 740ec00c7b..88870eddcc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoFingerprint.kt @@ -8,5 +8,5 @@ internal object InfocardsIncognitoFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, returnType = "Ljava/lang/Boolean;", parameters = listOf("L", "J"), - strings = listOf("vibrator") -) \ No newline at end of file + strings = listOf("vibrator"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoParentFingerprint.kt index 2fabd6aa3a..7f67bdf9d7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsIncognitoParentFingerprint.kt @@ -8,4 +8,4 @@ internal object InfocardsIncognitoParentFingerprint : MethodFingerprint( "Ljava/lang/String;", AccessFlags.PUBLIC or AccessFlags.FINAL, strings = listOf("player_overlay_info_card_teaser"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsMethodCallFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsMethodCallFingerprint.kt index 370ec7d8b8..7ec60a6b7a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsMethodCallFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/fingerprints/InfocardsMethodCallFingerprint.kt @@ -11,5 +11,5 @@ internal object InfocardsMethodCallFingerprint : LiteralValueFingerprint( Opcode.INVOKE_INTERFACE, ), strings = listOf("Missing ControlsOverlayPresenter for InfoCards to work."), - literalSupplier = { HideInfocardsResourcePatch.drawerResourceId } -) \ No newline at end of file + literalSupplier = { HideInfocardsResourcePatch.drawerResourceId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt index b910c83c81..c37f64ff4f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.loadmorebutton -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -8,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.loadmorebutton.fingerprints.HideLoadMoreButtonFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -30,14 +30,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideLoadMoreButtonPatch : BytecodePatch( - setOf(HideLoadMoreButtonFingerprint) + setOf(HideLoadMoreButtonFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/HideLoadMoreButtonPatch;" @@ -53,7 +53,7 @@ object HideLoadMoreButtonPatch : BytecodePatch( addInstruction( insertIndex, "invoke-static { v$viewRegister }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V" + "$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V", ) } } ?: throw HideLoadMoreButtonFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt index 86d4734f14..3d58719039 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt @@ -12,8 +12,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) internal object HideLoadMoreButtonResourcePatch : ResourcePatch() { internal var expandButtonDownId: Long = -1 @@ -22,11 +22,11 @@ internal object HideLoadMoreButtonResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_load_more_button") + SwitchPreference("revanced_hide_load_more_button"), ) expandButtonDownId = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "expand_button_down" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt index 2433ae38b8..4c81484113 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt @@ -9,7 +9,7 @@ internal object HideLoadMoreButtonFingerprint : LiteralValueFingerprint( Opcode.CONST, Opcode.CONST_4, Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ), - literalSupplier = { HideLoadMoreButtonResourcePatch.expandButtonDownId } -) \ No newline at end of file + literalSupplier = { HideLoadMoreButtonResourcePatch.expandButtonDownId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt index bdc042ab06..ba7d78842a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt @@ -18,11 +18,12 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch LithoFilterPatch::class, PlayerTypeHookPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -35,10 +36,10 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HidePlayerFlyoutMenuPatch : ResourcePatch() { @@ -65,7 +66,7 @@ object HidePlayerFlyoutMenuPatch : ResourcePatch() { SwitchPreference("${KEY}_audio_track"), SwitchPreference("${KEY}_watch_in_vr"), ), - ) + ), ) LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt index 1e1c1d932a..24fec7a09b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt @@ -22,7 +22,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.43.45", "18.44.41", "18.45.43", @@ -32,16 +33,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object DisableRollingNumberAnimationPatch : BytecodePatch( setOf( - RollingNumberTextViewAnimationUpdateFingerprint - ) + RollingNumberTextViewAnimationUpdateFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/DisableRollingNumberAnimationsPatch;" @@ -50,7 +51,7 @@ object DisableRollingNumberAnimationPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_disable_rolling_number_animations") + SwitchPreference("revanced_disable_rolling_number_animations"), ) // Animations are disabled by preventing an Image from being applied to the text span, @@ -74,7 +75,7 @@ object DisableRollingNumberAnimationPatch : BytecodePatch( move-result v$freeRegister if-nez v$freeRegister, :disable_animations """, - ExternalLabel("disable_animations", getInstruction(blockEndIndex)) + ExternalLabel("disable_animations", getInstruction(blockEndIndex)), ) } } ?: throw RollingNumberTextViewAnimationUpdateFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt index 588367fd34..d5de59f474 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt @@ -20,11 +20,12 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint IntegrationsPatch::class, SettingsPatch::class, SeekbarColorBytecodePatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -37,21 +38,21 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideSeekbarPatch : BytecodePatch( - setOf(SeekbarFingerprint) + setOf(SeekbarFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SEEKBAR.addPreferences( SwitchPreference("revanced_hide_seekbar"), - SwitchPreference("revanced_hide_seekbar_thumbnail") + SwitchPreference("revanced_hide_seekbar_thumbnail"), ) SeekbarFingerprint.result!!.let { @@ -66,7 +67,7 @@ object HideSeekbarPatch : BytecodePatch( return-void :hide_seekbar nop - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index 32de79186c..3ce155ef55 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -1,8 +1,5 @@ package app.revanced.patches.youtube.layout.hide.shorts -import app.revanced.util.exception -import app.revanced.util.findIndexForIdResource -import app.revanced.util.injectHideViewCall import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -14,6 +11,9 @@ import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.* import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch +import app.revanced.util.exception +import app.revanced.util.findIndexForIdResource +import app.revanced.util.injectHideViewCall import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @@ -25,11 +25,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction IntegrationsPatch::class, LithoFilterPatch::class, HideShortsComponentsResourcePatch::class, - ResourceMappingPatch::class + ResourceMappingPatch::class, ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -42,10 +43,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideShortsComponentsPatch : BytecodePatch( @@ -54,8 +55,8 @@ object HideShortsComponentsPatch : BytecodePatch( ReelConstructorFingerprint, BottomNavigationBarFingerprint, RenderBottomNavigationBarParentFingerprint, - SetPivotBarVisibilityParentFingerprint - ) + SetPivotBarVisibilityParentFingerprint, + ), ) { private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/ShortsFilter;" @@ -73,7 +74,7 @@ object HideShortsComponentsPatch : BytecodePatch( insertIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, - "hideShortsShelf" + "hideShortsShelf", ) } } // Do not throw an exception if not resolved. @@ -87,7 +88,6 @@ object HideShortsComponentsPatch : BytecodePatch( ShortsButtons.entries.forEach { button -> button.injectHideCall(it.mutableMethod) } } ?: throw CreateShortsButtonsFingerprint.exception - // endregion // region Hide the Shorts buttons in newer versions of YouTube. @@ -100,8 +100,9 @@ object HideShortsComponentsPatch : BytecodePatch( // Hook to get the pivotBar view. SetPivotBarVisibilityParentFingerprint.result?.let { - if (!SetPivotBarVisibilityFingerprint.resolve(context, it.classDef)) + if (!SetPivotBarVisibilityFingerprint.resolve(context, it.classDef)) { throw SetPivotBarVisibilityFingerprint.exception + } SetPivotBarVisibilityFingerprint.result!!.let { result -> result.mutableMethod.apply { @@ -110,7 +111,7 @@ object HideShortsComponentsPatch : BytecodePatch( addInstruction( insertIndex, "sput-object v$viewRegister, $FILTER_CLASS_DESCRIPTOR->pivotBar:" + - "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;" + "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;", ) } } @@ -118,8 +119,9 @@ object HideShortsComponentsPatch : BytecodePatch( // Hook to hide the navigation bar when Shorts are being played. RenderBottomNavigationBarParentFingerprint.result?.let { - if (!RenderBottomNavigationBarFingerprint.resolve(context, it.classDef)) + if (!RenderBottomNavigationBarFingerprint.resolve(context, it.classDef)) { throw RenderBottomNavigationBarFingerprint.exception + } RenderBottomNavigationBarFingerprint.result!!.mutableMethod.apply { addInstruction(0, "invoke-static { }, $FILTER_CLASS_DESCRIPTOR->hideNavigationBar()V") @@ -136,7 +138,7 @@ object HideShortsComponentsPatch : BytecodePatch( addInstruction( insertIndex, "invoke-static { v$viewRegister }, $FILTER_CLASS_DESCRIPTOR->" + - "hideNavigationBar(Landroid/view/View;)Landroid/view/View;" + "hideNavigationBar(Landroid/view/View;)Landroid/view/View;", ) } } ?: throw BottomNavigationBarFingerprint.exception @@ -144,11 +146,11 @@ object HideShortsComponentsPatch : BytecodePatch( // endregion } - private enum class ShortsButtons(private val resourceName: String, private val methodName: String) { COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"), REMIX("reel_dyn_remix", "hideShortsRemixButton"), - SHARE("reel_dyn_share", "hideShortsShareButton"); + SHARE("reel_dyn_share", "hideShortsShareButton"), + ; fun injectHideCall(method: MutableMethod) { val referencedIndex = method.findIndexForIdResource(resourceName) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt index 83528f34bf..227cc9429c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt @@ -28,7 +28,7 @@ object HideShortsComponentsResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_shorts_info_panel"), SwitchPreference("revanced_hide_shorts_channel_bar"), SwitchPreference("revanced_hide_shorts_sound_button"), - SwitchPreference("revanced_hide_shorts_navigation_bar") + SwitchPreference("revanced_hide_shorts_navigation_bar"), ) ResourceMappingPatch.resourceMappings.find { @@ -42,4 +42,4 @@ object HideShortsComponentsResourcePatch : ResourcePatch() { it.type == "dimen" && it.name == "reel_player_right_cell_button_height" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/BottomNavigationBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/BottomNavigationBarFingerprint.kt index 12ca03fb13..aa5beef227 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/BottomNavigationBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/BottomNavigationBarFingerprint.kt @@ -19,6 +19,6 @@ internal object BottomNavigationBarFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, ), strings = listOf( - "ReelWatchPaneFragmentViewModelKey" + "ReelWatchPaneFragmentViewModelKey", ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt index 97ac691213..9bc516e2f8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt @@ -9,5 +9,5 @@ internal object CreateShortsButtonsFingerprint : LiteralValueFingerprint( accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, returnType = "V", parameters = listOf("Z", "Z", "L"), - literalSupplier = { HideShortsComponentsResourcePatch.reelPlayerRightCellButtonHeight } -) \ No newline at end of file + literalSupplier = { HideShortsComponentsResourcePatch.reelPlayerRightCellButtonHeight }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/ReelConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/ReelConstructorFingerprint.kt index dece9b3718..8e763deaec 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/ReelConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/ReelConstructorFingerprint.kt @@ -13,7 +13,7 @@ internal object ReelConstructorFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> // Cannot use LiteralValueFingerprint, because the resource id may not be present. val reelMultipleItemShelfId = HideShortsComponentsResourcePatch.reelMultipleItemShelfId - reelMultipleItemShelfId != -1L - && methodDef.containsWideLiteralInstructionValue(reelMultipleItemShelfId) - } -) \ No newline at end of file + reelMultipleItemShelfId != -1L && + methodDef.containsWideLiteralInstructionValue(reelMultipleItemShelfId) + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarFingerprint.kt index d6d74b1e83..bcca32d3f1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarFingerprint.kt @@ -15,5 +15,5 @@ internal object RenderBottomNavigationBarFingerprint : MethodFingerprint( Opcode.MOVE_EXCEPTION, Opcode.MONITOR_EXIT, Opcode.THROW, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarParentFingerprint.kt index cb606d5c31..51c74b28b8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/RenderBottomNavigationBarParentFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object RenderBottomNavigationBarParentFingerprint : MethodFingerprint( parameters = listOf("I", "I", "L", "L", "J", "L"), - strings = listOf("aa") -) \ No newline at end of file + strings = listOf("aa"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityFingerprint.kt index 51e73b5e0a..1f498b50ca 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityFingerprint.kt @@ -11,6 +11,6 @@ internal object SetPivotBarVisibilityFingerprint : MethodFingerprint( parameters = listOf("Z"), opcodes = listOf( Opcode.CHECK_CAST, - Opcode.IF_EQZ - ) -) \ No newline at end of file + Opcode.IF_EQZ, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityParentFingerprint.kt index 31bf72d85e..a8e17d895b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/SetPivotBarVisibilityParentFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object SetPivotBarVisibilityParentFingerprint : MethodFingerprint( parameters = listOf("Z"), - strings = listOf("FEnotifications_inbox") -) \ No newline at end of file + strings = listOf("FEnotifications_inbox"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt index 9b6c1a8fe4..062aacc6fc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.hide.suggestedvideoendscreen -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.hide.suggestedvideoendscreen.fingerprints.CreateEndScreenViewFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( @@ -17,7 +17,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction dependencies = [IntegrationsPatch::class, DisableSuggestedVideoEndScreenResourcePatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.37.36", "18.38.44", "18.43.45", @@ -29,14 +30,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object DisableSuggestedVideoEndScreenPatch : BytecodePatch( - setOf(CreateEndScreenViewFingerprint) + setOf(CreateEndScreenViewFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/DisableSuggestedVideoEndScreenPatch;" @@ -50,7 +51,7 @@ object DisableSuggestedVideoEndScreenPatch : BytecodePatch( addInstruction( addOnClickEventListenerIndex + 1, "invoke-static {v$viewRegister}, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->closeEndScreen(Landroid/widget/ImageView;)V" + "$INTEGRATIONS_CLASS_DESCRIPTOR->closeEndScreen(Landroid/widget/ImageView;)V", ) } } ?: throw CreateEndScreenViewFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt index 28122d1a2c..ce1100d2d6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object DisableSuggestedVideoEndScreenResourcePatch : ResourcePatch() { @@ -22,11 +22,11 @@ internal object DisableSuggestedVideoEndScreenResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_disable_suggested_video_end_screen") + SwitchPreference("revanced_disable_suggested_video_end_screen"), ) sizeAdjustableLiteAutoNavOverlay = ResourceMappingPatch.resourceMappings.single { it.type == "layout" && it.name == "size_adjustable_lite_autonav_overlay" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/fingerprints/CreateEndScreenViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/fingerprints/CreateEndScreenViewFingerprint.kt index 6e747ac7e9..91be91e56e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/fingerprints/CreateEndScreenViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/fingerprints/CreateEndScreenViewFingerprint.kt @@ -7,13 +7,13 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object CreateEndScreenViewFingerprint : LiteralValueFingerprint( - returnType= "Landroid/view/View;", + returnType = "Landroid/view/View;", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("Landroid/content/Context;"), opcodes = listOf( Opcode.INVOKE_DIRECT, Opcode.INVOKE_VIRTUAL, - Opcode.CONST + Opcode.CONST, ), - literalSupplier = { DisableSuggestedVideoEndScreenResourcePatch.sizeAdjustableLiteAutoNavOverlay } -) \ No newline at end of file + literalSupplier = { DisableSuggestedVideoEndScreenResourcePatch.sizeAdjustableLiteAutoNavOverlay }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt index 17d96a2ffb..58d4f52aee 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt @@ -18,7 +18,8 @@ import app.revanced.util.exception dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.37.36", "18.38.44", "18.43.45", @@ -30,33 +31,33 @@ import app.revanced.util.exception "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HideTimestampPatch : BytecodePatch( - setOf(TimeCounterFingerprint) + setOf(TimeCounterFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SEEKBAR.addPreferences( - SwitchPreference("revanced_hide_timestamp") + SwitchPreference("revanced_hide_timestamp"), ) TimeCounterFingerprint.result?.apply { mutableMethod.addInstructionsWithLabels( - 0, - """ + 0, + """ invoke-static { }, Lapp/revanced/integrations/youtube/patches/HideTimestampPatch;->hideTimestamp()Z move-result v0 if-eqz v0, :hide_time return-void :hide_time nop - """ + """, ) } ?: throw TimeCounterFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/fingerprints/TimeCounterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/fingerprints/TimeCounterFingerprint.kt index 86618bf63e..2a3f9c8422 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/fingerprints/TimeCounterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/fingerprints/TimeCounterFingerprint.kt @@ -20,6 +20,6 @@ internal object TimeCounterFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IGET_WIDE, Opcode.IGET_WIDE, - Opcode.SUB_LONG_2ADDR - ) -) \ No newline at end of file + Opcode.SUB_LONG_2ADDR, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt index 47760116ea..56bee2faae 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt @@ -18,7 +18,8 @@ import app.revanced.util.exception dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -31,20 +32,20 @@ import app.revanced.util.exception "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object PlayerPopupPanelsPatch : BytecodePatch( - setOf(EngagementPanelControllerFingerprint) + setOf(EngagementPanelControllerFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_player_popup_panels") + SwitchPreference("revanced_hide_player_popup_panels"), ) val engagementPanelControllerMethod = EngagementPanelControllerFingerprint @@ -61,7 +62,7 @@ object PlayerPopupPanelsPatch : BytecodePatch( return-object v0 :player_popup_panels nop - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/fingerprints/EngagementPanelControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/fingerprints/EngagementPanelControllerFingerprint.kt index 4ee031e493..c6e0ea8a7f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/fingerprints/EngagementPanelControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/fingerprints/EngagementPanelControllerFingerprint.kt @@ -9,6 +9,6 @@ internal object EngagementPanelControllerFingerprint : MethodFingerprint( accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, strings = listOf( "EngagementPanelController: cannot show EngagementPanel before EngagementPanelController.init() has been called.", - "[EngagementPanel] Cannot show EngagementPanel before EngagementPanelController.init() has been called." - ) -) \ No newline at end of file + "[EngagementPanel] Cannot show EngagementPanel before EngagementPanelController.init() has been called.", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt index fd00bf39b3..ba30375896 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt @@ -1,7 +1,5 @@ package app.revanced.patches.youtube.layout.player.overlay -import app.revanced.util.exception -import app.revanced.util.indexOfFirstWideLiteralInstructionValue import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,6 +7,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.layout.player.overlay.fingerprints.CreatePlayerOverviewFingerprint +import app.revanced.util.exception +import app.revanced.util.indexOfFirstWideLiteralInstructionValue import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -16,8 +16,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction description = "Adds an option to change the opacity of the video player background when player controls are visible.", dependencies = [CustomPlayerOverlayOpacityResourcePatch::class], compatiblePackages = [ - CompatiblePackage("com.google.android.youtube") - ] + CompatiblePackage("com.google.android.youtube"), + ], ) @Suppress("unused") object CustomPlayerOverlayOpacityPatch : BytecodePatch(setOf(CreatePlayerOverviewFingerprint)) { @@ -35,7 +35,7 @@ object CustomPlayerOverlayOpacityPatch : BytecodePatch(setOf(CreatePlayerOvervie addInstruction( insertIndex, "invoke-static { v$viewRegister }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->changeOpacity(Landroid/widget/ImageView;)V" + "$INTEGRATIONS_CLASS_DESCRIPTOR->changeOpacity(Landroid/widget/ImageView;)V", ) } } ?: throw CreatePlayerOverviewFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt index 147ccaccf4..dd426a6ff1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt @@ -10,7 +10,7 @@ import app.revanced.patches.shared.misc.settings.preference.TextPreference import app.revanced.patches.youtube.misc.settings.SettingsPatch @Patch( - dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class] + dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class], ) internal object CustomPlayerOverlayOpacityResourcePatch : ResourcePatch() { internal var scrimOverlayId = -1L @@ -19,7 +19,7 @@ internal object CustomPlayerOverlayOpacityResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - TextPreference("revanced_player_overlay_opacity", inputType = InputType.NUMBER) + TextPreference("revanced_player_overlay_opacity", inputType = InputType.NUMBER), ) scrimOverlayId = ResourceMappingPatch.resourceMappings.single { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/fingerprints/CreatePlayerOverviewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/fingerprints/CreatePlayerOverviewFingerprint.kt index 23641d6c0a..5824cfbf23 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/fingerprints/CreatePlayerOverviewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/fingerprints/CreatePlayerOverviewFingerprint.kt @@ -1,9 +1,9 @@ package app.revanced.patches.youtube.layout.player.overlay.fingerprints -import app.revanced.util.containsWideLiteralInstructionValue import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patches.youtube.layout.player.overlay.CustomPlayerOverlayOpacityResourcePatch +import app.revanced.util.containsWideLiteralInstructionValue import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -14,9 +14,9 @@ internal object CreatePlayerOverviewFingerprint : MethodFingerprint( Opcode.CONST, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST + Opcode.CHECK_CAST, ), customFingerprint = { methodDef, _ -> methodDef.containsWideLiteralInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId) - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 93b9cc0c99..a8de7bdef8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -53,16 +53,17 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.49.37", "19.01.34", "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object ReturnYouTubeDislikePatch : BytecodePatch( @@ -79,8 +80,8 @@ object ReturnYouTubeDislikePatch : BytecodePatch( RollingNumberMeasureStaticLabelParentFingerprint, RollingNumberMeasureAnimatedTextFingerprint, RollingNumberTextViewFingerprint, - RollingNumberTextViewAnimationUpdateFingerprint - ) + RollingNumberTextViewAnimationUpdateFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch;" @@ -105,7 +106,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( listOf( LikeFingerprint.toPatch(Vote.LIKE), DislikeFingerprint.toPatch(Vote.DISLIKE), - RemoveLikeFingerprint.toPatch(Vote.REMOVE_LIKE) + RemoveLikeFingerprint.toPatch(Vote.REMOVE_LIKE), ).forEach { (fingerprint, vote) -> fingerprint.result?.mutableMethod?.apply { addInstructions( @@ -113,7 +114,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( """ const/4 v0, ${vote.value} invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->sendVote(I)V - """ + """, ) } ?: throw fingerprint.exception } @@ -139,7 +140,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( val textDataClassType = TextComponentDataFingerprint.resultOrThrow().classDef.type val insertIndex = indexOfFirstInstruction { opcode == Opcode.NEW_INSTANCE && - getReference()?.type == textDataClassType + getReference()?.type == textDataClassType } if (insertIndex < 0) throw PatchException("Could not find data creation instruction") val tempRegister = getInstruction(insertIndex).registerA @@ -152,7 +153,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( .subList(insertIndex, insertIndex + 20) .find { it.opcode == Opcode.IPUT_OBJECT && - it.getReference()?.type == "Ljava/lang/CharSequence;" + it.getReference()?.type == "Ljava/lang/CharSequence;" } ?: throw PatchException("Could not find put object instruction") val charSequenceRegister = (putFieldInstruction as TwoRegisterInstruction).registerA @@ -164,7 +165,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( iget-object v$tempRegister, v$tempRegister, $conversionContextField invoke-static {v$tempRegister, v$charSequenceRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/lang/CharSequence;)Ljava/lang/CharSequence; move-result-object v$charSequenceRegister - """ + """, ) } } ?: throw TextComponentConstructorFingerprint.exception @@ -204,7 +205,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( :is_like :ryd_disabled nop - """ + """, ) } } ?: throw ShortsTextViewFingerprint.exception @@ -232,14 +233,13 @@ object ReturnYouTubeDislikePatch : BytecodePatch( addInstruction( startIndex + 4, - "invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V" + "invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V", ) } } ?: throw DislikesOldLayoutTextViewFingerprint.exception // endregion - // region Hook rolling numbers. // Do this last to allow patching old unsupported versions (if the user really wants), @@ -270,7 +270,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( invoke-static {v$conversionContextRegister, v$freeRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onRollingNumberLoaded(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; move-result-object v$freeRegister iput-object v$freeRegister, v$charSequenceInstanceRegister, $charSequenceFieldReference - """ + """, ) } } ?: throw RollingNumberSetterFingerprint.exception @@ -290,7 +290,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( """ invoke-static {p1, v$measuredTextWidthRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onRollingNumberMeasured(Ljava/lang/String;F)F move-result v$measuredTextWidthRegister - """ + """, ) } } ?: throw RollingNumberMeasureAnimatedTextFingerprint.exception @@ -308,7 +308,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( """ move-result v$freeRegister invoke-static {p1, v$freeRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onRollingNumberMeasured(Ljava/lang/String;F)F - """ + """, ) } } ?: throw RollingNumberMeasureStaticLabelFingerprint.exception @@ -327,7 +327,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( arrayOf( initiallyCreatedTextViewMethod, - realTimeUpdateTextViewMethod + realTimeUpdateTextViewMethod, ).forEach { insertMethod -> insertMethod.apply { val setTextIndex = indexOfFirstInstruction { @@ -344,14 +344,13 @@ object ReturnYouTubeDislikePatch : BytecodePatch( """ invoke-static {v$textViewRegister, v$textSpanRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->updateRollingNumber(Landroid/widget/TextView;Ljava/lang/CharSequence;)Ljava/lang/CharSequence; move-result-object v$textSpanRegister - """ + """, ) } } } ?: throw RollingNumberTextViewFingerprint.exception // endregion - } private fun MethodFingerprint.toPatch(voteKind: Vote) = VotePatch(this, voteKind) @@ -359,6 +358,6 @@ object ReturnYouTubeDislikePatch : BytecodePatch( private enum class Vote(val value: Int) { LIKE(1), DISLIKE(-1), - REMOVE_LIKE(0) + REMOVE_LIKE(0), } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt index 06226fc0cd..3a8e96e503 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt @@ -12,8 +12,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsResourcePatch @Patch( dependencies = [ SettingsPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) internal object ReturnYouTubeDislikeResourcePatch : ResourcePatch() { internal var oldUIDislikeId: Long = -1 @@ -25,11 +25,11 @@ internal object ReturnYouTubeDislikeResourcePatch : ResourcePatch() { key = "revanced_settings_screen_09", titleKey = "revanced_ryd_settings_title", summaryKey = null, - intent = SettingsPatch.newIntent("revanced_ryd_settings_intent") + intent = SettingsPatch.newIntent("revanced_ryd_settings_intent"), ) oldUIDislikeId = ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "dislike_button" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ConversionContextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ConversionContextFingerprint.kt index 75b6eb55cc..daa2f6b15d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ConversionContextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ConversionContextFingerprint.kt @@ -13,6 +13,6 @@ internal object ConversionContextFingerprint : MethodFingerprint( // 18.37.36 and after this String is: ConversionContext{containerInternal= // and before it is: ConversionContext{container= // Use a partial string to match both. - "ConversionContext{container" - ) -) \ No newline at end of file + "ConversionContext{container", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikeFingerprint.kt index 8e80cd83e5..4dac0f31a4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikeFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object DislikeFingerprint : MethodFingerprint( "V", - strings = listOf("like/dislike") -) \ No newline at end of file + strings = listOf("like/dislike"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikesOldLayoutTextViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikesOldLayoutTextViewFingerprint.kt index ef7cc5e7cd..3cf51d6ac3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikesOldLayoutTextViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/DislikesOldLayoutTextViewFingerprint.kt @@ -18,5 +18,5 @@ internal object DislikesOldLayoutTextViewFingerprint : LiteralValueFingerprint( Opcode.IF_NEZ, // textview register Opcode.GOTO, ), - literalSupplier = { ReturnYouTubeDislikeResourcePatch.oldUIDislikeId } -) \ No newline at end of file + literalSupplier = { ReturnYouTubeDislikeResourcePatch.oldUIDislikeId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/LikeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/LikeFingerprint.kt index 2803f74815..0d8ae298b3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/LikeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/LikeFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object LikeFingerprint : MethodFingerprint( "V", - strings = listOf("like/like") -) \ No newline at end of file + strings = listOf("like/like"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RemoveLikeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RemoveLikeFingerprint.kt index 01babf54e8..dd5f320fca 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RemoveLikeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RemoveLikeFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object RemoveLikeFingerprint : MethodFingerprint( "V", - strings = listOf("like/removelike") -) \ No newline at end of file + strings = listOf("like/removelike"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt index 69d0168129..3bd09c1be0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureAnimatedTextFingerprint.kt @@ -11,7 +11,7 @@ internal object RollingNumberMeasureAnimatedTextFingerprint : MethodFingerprint( parameters = listOf( "L", "Ljava/lang/String;", - "L" + "L", ), opcodes = listOf( Opcode.IGET, // First instruction of method @@ -24,5 +24,5 @@ internal object RollingNumberMeasureAnimatedTextFingerprint : MethodFingerprint( Opcode.AGET, Opcode.CONST_4, Opcode.CONST_4, // Measured text width - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt index d16b580b4b..8be246b202 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelFingerprint.kt @@ -16,6 +16,6 @@ internal object RollingNumberMeasureStaticLabelFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - Opcode.RETURN - ) -) \ No newline at end of file + Opcode.RETURN, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt index aa5229e996..15de548123 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberMeasureStaticLabelParentFingerprint.kt @@ -8,5 +8,5 @@ internal object RollingNumberMeasureStaticLabelParentFingerprint : MethodFingerp returnType = "Ljava/lang/String;", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf(), - strings = listOf("RollingNumberFontProperties{paint=") -) \ No newline at end of file + strings = listOf("RollingNumberFontProperties{paint="), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberSetterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberSetterFingerprint.kt index e79cf27292..3456006d5f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberSetterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberSetterFingerprint.kt @@ -6,7 +6,7 @@ import com.android.tools.smali.dexlib2.Opcode internal object RollingNumberSetterFingerprint : MethodFingerprint( opcodes = listOf( Opcode.INVOKE_DIRECT, - Opcode.IGET_OBJECT + Opcode.IGET_OBJECT, ), - strings = listOf("RollingNumberType required properties missing! Need updateCount, fontName, color and fontSize.") -) \ No newline at end of file + strings = listOf("RollingNumberType required properties missing! Need updateCount, fontName, color and fontSize."), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberTextViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberTextViewFingerprint.kt index 54fe00865f..761010cdf3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberTextViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/RollingNumberTextViewFingerprint.kt @@ -11,13 +11,13 @@ internal object RollingNumberTextViewFingerprint : MethodFingerprint( parameters = listOf("L", "F", "F"), opcodes = listOf( Opcode.IPUT, - null, // invoke-direct or invoke-virtual + null, // invoke-direct or invoke-virtual Opcode.IPUT_OBJECT, Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), customFingerprint = { _, classDef -> classDef.superclass == "Landroid/support/v7/widget/AppCompatTextView;" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ShortsTextViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ShortsTextViewFingerprint.kt index a326a6ced8..65564163be 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ShortsTextViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/ShortsTextViewFingerprint.kt @@ -10,13 +10,13 @@ internal object ShortsTextViewFingerprint : MethodFingerprint( returnType = "V", parameters = listOf("L", "L"), opcodes = listOf( - Opcode.INVOKE_SUPER, // first instruction of method + Opcode.INVOKE_SUPER, // first instruction of method Opcode.IF_NEZ, null, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, - Opcode.SGET_OBJECT, // insertion point, must be after constructor call to parent class + Opcode.SGET_OBJECT, // insertion point, must be after constructor call to parent class Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.CONST_4, @@ -26,7 +26,7 @@ internal object ShortsTextViewFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.IF_EQ, Opcode.RETURN_VOID, - Opcode.IGET_OBJECT, // TextView field - Opcode.IGET_BOOLEAN, // boolean field - ) -) \ No newline at end of file + Opcode.IGET_OBJECT, // TextView field + Opcode.IGET_BOOLEAN, // boolean field + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentConstructorFingerprint.kt index 1b82d14b5e..9c4b25fed8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentConstructorFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object TextComponentConstructorFingerprint : MethodFingerprint( accessFlags = AccessFlags.CONSTRUCTOR or AccessFlags.PRIVATE, - strings = listOf("TextComponent") -) \ No newline at end of file + strings = listOf("TextComponent"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentDataFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentDataFingerprint.kt index 2d70664030..79eb27d2a1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentDataFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentDataFingerprint.kt @@ -11,6 +11,6 @@ internal object TextComponentDataFingerprint : MethodFingerprint( customFingerprint = { _, classDef -> val fields = classDef.fields fields.find { it.type == "Ljava/util/BitSet;" } != null && - fields.find { it.type == "[Ljava/lang/String;" } != null - } -) \ No newline at end of file + fields.find { it.type == "[Ljava/lang/String;" } != null + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentLookupFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentLookupFingerprint.kt index b6b175ac09..45fae8a406 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentLookupFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/fingerprints/TextComponentLookupFingerprint.kt @@ -11,5 +11,5 @@ internal object TextComponentLookupFingerprint : MethodFingerprint( returnType = "L", accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL, parameters = listOf("L"), - strings = listOf("…") -) \ No newline at end of file + strings = listOf("…"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt index f981f8a569..adffd1c085 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt @@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -35,17 +36,17 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object WideSearchbarPatch : BytecodePatch( setOf( SetWordmarkHeaderFingerprint, - CreateSearchSuggestionsFingerprint - ) + CreateSearchSuggestionsFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = @@ -55,7 +56,7 @@ object WideSearchbarPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_wide_searchbar") + SwitchPreference("revanced_wide_searchbar"), ) val result = CreateSearchSuggestionsFingerprint.result ?: throw CreateSearchSuggestionsFingerprint.exception @@ -63,7 +64,7 @@ object WideSearchbarPatch : BytecodePatch( // patch methods mapOf( SetWordmarkHeaderFingerprint to 1, - CreateSearchSuggestionsFingerprint to result.scanResult.patternScanResult!!.startIndex + CreateSearchSuggestionsFingerprint to result.scanResult.patternScanResult!!.startIndex, ).forEach { (fingerprint, callIndex) -> context.walkMutable(callIndex, fingerprint).injectSearchBarHook() } @@ -81,7 +82,6 @@ object WideSearchbarPatch : BytecodePatch( toMethodWalker(it.method).nextMethod(index, true).getMethod() as MutableMethod } ?: throw fromFingerprint.exception - /** * Injects instructions required for certain methods. */ @@ -94,7 +94,7 @@ object WideSearchbarPatch : BytecodePatch( """ invoke-static {v$insertRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->enableWideSearchbar(Z)Z move-result v$insertRegister - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/CreateSearchSuggestionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/CreateSearchSuggestionsFingerprint.kt index 7c00445e1c..ec0795a7ce 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/CreateSearchSuggestionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/CreateSearchSuggestionsFingerprint.kt @@ -7,7 +7,7 @@ internal object CreateSearchSuggestionsFingerprint : MethodFingerprint( opcodes = listOf( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, - Opcode.CONST_4 + Opcode.CONST_4, ), - strings = listOf("ss_rds") -) \ No newline at end of file + strings = listOf("ss_rds"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/SetWordmarkHeaderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/SetWordmarkHeaderFingerprint.kt index bc5f29ff8e..9db01c03af 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/SetWordmarkHeaderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/fingerprints/SetWordmarkHeaderFingerprint.kt @@ -19,5 +19,5 @@ internal object SetWordmarkHeaderFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.CONST, Opcode.INVOKE_STATIC, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt index a300571e48..8ffbbdbb8c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt @@ -19,7 +19,8 @@ import app.revanced.util.exception dependencies = [IntegrationsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.37.36", "18.38.44", "18.43.45", @@ -31,14 +32,14 @@ import app.revanced.util.exception "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object RestoreOldSeekbarThumbnailsPatch : BytecodePatch( - setOf(FullscreenSeekbarThumbnailsFingerprint) + setOf(FullscreenSeekbarThumbnailsFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/RestoreOldSeekbarThumbnailsPatch;" @@ -47,7 +48,7 @@ object RestoreOldSeekbarThumbnailsPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SEEKBAR.addPreferences( - SwitchPreference("revanced_restore_old_seekbar_thumbnails") + SwitchPreference("revanced_restore_old_seekbar_thumbnails"), ) FullscreenSeekbarThumbnailsFingerprint.result?.mutableMethod?.apply { @@ -55,7 +56,7 @@ object RestoreOldSeekbarThumbnailsPatch : BytecodePatch( addInstruction( moveResultIndex, - "invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->useFullscreenSeekbarThumbnails()Z" + "invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->useFullscreenSeekbarThumbnails()Z", ) } ?: throw FullscreenSeekbarThumbnailsFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorBytecodePatch.kt index 98acf716c5..e0db68c8c1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorBytecodePatch.kt @@ -1,7 +1,5 @@ package app.revanced.patches.youtube.layout.seekbar -import app.revanced.util.exception -import app.revanced.util.indexOfFirstWideLiteralInstructionValue import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -15,16 +13,18 @@ import app.revanced.patches.youtube.layout.seekbar.fingerprints.ShortsSeekbarCol import app.revanced.patches.youtube.layout.theme.LithoColorHookPatch import app.revanced.patches.youtube.layout.theme.LithoColorHookPatch.lithoColorOverrideHook import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.util.exception +import app.revanced.util.indexOfFirstWideLiteralInstructionValue import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @Patch( description = "Hide or set a custom seekbar color", dependencies = [IntegrationsPatch::class, LithoColorHookPatch::class, SeekbarColorResourcePatch::class], - compatiblePackages = [CompatiblePackage("com.google.android.youtube")] + compatiblePackages = [CompatiblePackage("com.google.android.youtube")], ) internal object SeekbarColorBytecodePatch : BytecodePatch( - setOf(PlayerSeekbarColorFingerprint, ShortsSeekbarColorFingerprint, SetSeekbarClickedColorFingerprint) + setOf(PlayerSeekbarColorFingerprint, ShortsSeekbarColorFingerprint, SetSeekbarClickedColorFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/theme/SeekbarColorPatch;" @@ -37,7 +37,7 @@ internal object SeekbarColorBytecodePatch : BytecodePatch( """ invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getVideoPlayerSeekbarColor(I)I move-result v$colorRegister - """ + """, ) } @@ -65,7 +65,7 @@ internal object SeekbarColorBytecodePatch : BytecodePatch( """ invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getVideoPlayerSeekbarClickedColor(I)I move-result v$colorRegister - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/FullscreenSeekbarThumbnailsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/FullscreenSeekbarThumbnailsFingerprint.kt index bd056d4963..243ccc1989 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/FullscreenSeekbarThumbnailsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/FullscreenSeekbarThumbnailsFingerprint.kt @@ -8,5 +8,5 @@ internal object FullscreenSeekbarThumbnailsFingerprint : LiteralValueFingerprint returnType = "Z", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = emptyList(), - literalSupplier = { 45398577 } -) \ No newline at end of file + literalSupplier = { 45398577 }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/PlayerSeekbarColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/PlayerSeekbarColorFingerprint.kt index 77faf1213b..676f25898d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/PlayerSeekbarColorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/PlayerSeekbarColorFingerprint.kt @@ -1,15 +1,15 @@ package app.revanced.patches.youtube.layout.seekbar.fingerprints -import app.revanced.util.containsWideLiteralInstructionValue import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patches.youtube.layout.seekbar.SeekbarColorResourcePatch +import app.revanced.util.containsWideLiteralInstructionValue import com.android.tools.smali.dexlib2.AccessFlags internal object PlayerSeekbarColorFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, customFingerprint = { method, _ -> - method.containsWideLiteralInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) - && method.containsWideLiteralInstructionValue(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) - } -) \ No newline at end of file + method.containsWideLiteralInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) && + method.containsWideLiteralInstructionValue(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/SetSeekbarClickedColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/SetSeekbarClickedColorFingerprint.kt index 47877a633c..3a12fd1dbb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/SetSeekbarClickedColorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/SetSeekbarClickedColorFingerprint.kt @@ -8,5 +8,5 @@ internal object SetSeekbarClickedColorFingerprint : MethodFingerprint( strings = listOf("YOUTUBE", "PREROLL", "POSTROLL"), customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("ControlsOverlayStyle;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/ShortsSeekbarColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/ShortsSeekbarColorFingerprint.kt index 81ef82897a..f2d935b940 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/ShortsSeekbarColorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/fingerprints/ShortsSeekbarColorFingerprint.kt @@ -8,4 +8,4 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object ShortsSeekbarColorFingerprint : LiteralValueFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, literalSupplier = { SeekbarColorResourcePatch.reelTimeBarPlayedColorId }, -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt index 201dbb76f0..18b2140da6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.sponsorblock -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -25,6 +24,7 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarFingerprint import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint import app.revanced.patches.youtube.video.information.VideoInformationPatch import app.revanced.patches.youtube.video.videoid.VideoIdPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.* import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c @@ -37,16 +37,17 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference description = "Adds options to enable and configure SponsorBlock, which can skip undesired video segments such as sponsored content.", compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.48.39", "18.49.37", "19.01.34", "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) + "19.04.37", + ], + ), ], dependencies = [ IntegrationsPatch::class, @@ -56,8 +57,8 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference // Used to prevent SponsorBlock from running on Shorts because SponsorBlock does not yet support Shorts. PlayerTypeHookPatch::class, PlayerControlsBytecodePatch::class, - SponsorBlockResourcePatch::class - ] + SponsorBlockResourcePatch::class, + ], ) @Suppress("unused") object SponsorBlockBytecodePatch : BytecodePatch( @@ -65,8 +66,8 @@ object SponsorBlockBytecodePatch : BytecodePatch( SeekbarFingerprint, AppendTimeFingerprint, LayoutConstructorFingerprint, - AutoRepeatParentFingerprint - ) + AutoRepeatParentFingerprint, + ), ) { private const val INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/sponsorblock/SegmentPlaybackController;" @@ -79,8 +80,9 @@ object SponsorBlockBytecodePatch : BytecodePatch( override fun execute(context: BytecodeContext) { LayoutConstructorFingerprint.result?.let { - if (!ControlsOverlayFingerprint.resolve(context, it.classDef)) + if (!ControlsOverlayFingerprint.resolve(context, it.classDef)) { throw ControlsOverlayFingerprint.exception + } } ?: throw LayoutConstructorFingerprint.exception /* @@ -89,7 +91,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( with(VideoInformationPatch) { videoTimeHook( INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR, - "setVideoTime" + "setVideoTime", ) } @@ -117,7 +119,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( seekbarMethod.addInstruction( moveRectangleToRegisterIndex + 1, "invoke-static/range {p0 .. p0}, " + - "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarRect(Ljava/lang/Object;)V" + "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarRect(Ljava/lang/Object;)V", ) for ((index, instruction) in seekbarMethodInstructions.withIndex()) { @@ -132,7 +134,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( seekbarMethod.addInstruction( insertIndex, "invoke-static {v${invokeInstruction.registerC}}, " + - "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarThickness(I)V" + "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarThickness(I)V", ) break } @@ -150,7 +152,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( } seekbarMethod.addInstruction( i, - "invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V" + "invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V", ) break @@ -184,7 +186,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( """ invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/View;)V invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/View;)V - """ + """, ) } @@ -197,7 +199,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( """ invoke-static {p1}, $INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->changeVisibilityNegatedImmediate(Z)V invoke-static {p1}, $INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->changeVisibilityNegatedImmediate(Z)V - """.trimIndent() + """.trimIndent(), ) } } @@ -219,7 +221,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( """ invoke-static {v$targetRegister}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String; move-result-object v$targetRegister - """ + """, ) // initialize the player controller @@ -232,10 +234,10 @@ object SponsorBlockBytecodePatch : BytecodePatch( val frameLayoutRegister = (getInstruction(startIndex + 2) as OneRegisterInstruction).registerA addInstruction( startIndex + 3, - "invoke-static {v$frameLayoutRegister}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/ViewGroup;)V" + "invoke-static {v$frameLayoutRegister}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/ViewGroup;)V", ) } - } ?: throw ControlsOverlayFingerprint.exception + } ?: throw ControlsOverlayFingerprint.exception // get rectangle field name RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef) @@ -254,7 +256,8 @@ object SponsorBlockBytecodePatch : BytecodePatch( fun MutableMethod.replaceStringInstruction(index: Int, instruction: Instruction, with: String) { val register = (instruction as OneRegisterInstruction).registerA this.replaceInstruction( - index, "const-string v$register, \"$with\"" + index, + "const-string v$register, \"$with\"", ) } for ((index, it) in method.implementation!!.instructions.withIndex()) { @@ -264,13 +267,12 @@ object SponsorBlockBytecodePatch : BytecodePatch( "replaceMeWithsetSponsorBarRect" -> method.replaceStringInstruction( index, it, - rectangleFieldName + rectangleFieldName, ) } } } ?: throw PatchException("Could not find the method which contains the replaceMeWith* strings") - // The vote and create segment buttons automatically change their visibility when appropriate, // but if buttons are showing when the end of the video is reached then they will not automatically hide. // Add a hook to forcefully hide when the end of the video is reached. @@ -279,7 +281,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( it.resolve(context, AutoRepeatParentFingerprint.result!!.classDef) }.result?.mutableMethod?.addInstruction( 0, - "invoke-static {}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->endOfVideoReached()V" + "invoke-static {}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->endOfVideoReached()V", ) ?: throw AutoRepeatFingerprint.exception // TODO: isSBChannelWhitelisting implementation diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt index 6484216ce6..7c19856a2d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt @@ -29,7 +29,7 @@ internal object SponsorBlockResourcePatch : ResourcePatch() { key = "revanced_settings_screen_10", titleKey = "revanced_sb_settings_title", summaryKey = null, - intent = SettingsPatch.newIntent("revanced_sb_settings_intent") + intent = SettingsPatch.newIntent("revanced_sb_settings_intent"), ) arrayOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/AppendTimeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/AppendTimeFingerprint.kt index 921792715b..429de17ff8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/AppendTimeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/AppendTimeFingerprint.kt @@ -24,6 +24,6 @@ internal object AppendTimeFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.CHECK_CAST, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID - ) -) \ No newline at end of file + Opcode.RETURN_VOID, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/ControlsOverlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/ControlsOverlayFingerprint.kt index 9f22ba7c52..09914f4336 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/ControlsOverlayFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/ControlsOverlayFingerprint.kt @@ -19,6 +19,6 @@ internal object ControlsOverlayFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, - Opcode.NEW_INSTANCE - ) -) \ No newline at end of file + Opcode.NEW_INSTANCE, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/RectangleFieldInvalidatorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/RectangleFieldInvalidatorFingerprint.kt index c9830b66ed..3cb4913ea8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/RectangleFieldInvalidatorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/fingerprints/RectangleFieldInvalidatorFingerprint.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.sponsorblock.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.MethodReference @@ -18,5 +17,5 @@ internal object RectangleFieldInvalidatorFingerprint : MethodFingerprint( val reference = ((referenceInstruction as? ReferenceInstruction)?.reference as? MethodReference) reference?.parameterTypes?.size == 1 && reference.name == "invalidate" // the reference is the invalidate(..) method - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index eea417512e..3c092c4c63 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -17,11 +17,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Spoof app version", description = "Adds an option to trick YouTube into thinking you are running an older version of the app. " + - "This can be used to restore old UI elements and features.", + "This can be used to restore old UI elements and features.", dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -34,14 +35,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object SpoofAppVersionPatch : BytecodePatch( - setOf(SpoofAppVersionFingerprint) + setOf(SpoofAppVersionFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/spoof/SpoofAppVersionPatch;" @@ -54,7 +55,7 @@ object SpoofAppVersionPatch : BytecodePatch( ListPreference( key = "revanced_spoof_app_version_target", summaryKey = null, - ) + ), ) SpoofAppVersionFingerprint.result?.apply { @@ -67,7 +68,7 @@ object SpoofAppVersionPatch : BytecodePatch( """ invoke-static {v$buildOverrideNameRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->getYouTubeVersionOverride(Ljava/lang/String;)Ljava/lang/String; move-result-object v$buildOverrideNameRegister - """ + """, ) } ?: throw SpoofAppVersionFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/fingerprints/SpoofAppVersionFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/fingerprints/SpoofAppVersionFingerprint.kt index ebf5b4aae8..c416a93e79 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/fingerprints/SpoofAppVersionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/fingerprints/SpoofAppVersionFingerprint.kt @@ -6,7 +6,10 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object SpoofAppVersionFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L"), listOf( + "L", + AccessFlags.PUBLIC or AccessFlags.STATIC, + listOf("L"), + listOf( Opcode.IGET_OBJECT, Opcode.GOTO, Opcode.CONST_STRING, @@ -15,5 +18,5 @@ internal object SpoofAppVersionFingerprint : MethodFingerprint( // Instead of applying a bytecode patch, it might be possible to only rely on code from the integrations and // manually set the desired version string as this keyed value in the SharedPreferences. // But, this bytecode patch is simple and it works. - strings = listOf("pref_override_build_version_name") -) \ No newline at end of file + strings = listOf("pref_override_build_version_name"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt index e4f42397e4..caeed89499 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt @@ -19,13 +19,13 @@ import app.revanced.util.exception dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube" - ) - ] + "com.google.android.youtube", + ), + ], ) @Suppress("unused") object ChangeStartPagePatch : BytecodePatch( - setOf(HomeActivityFingerprint) + setOf(HomeActivityFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/ChangeStartPagePatch;" @@ -37,17 +37,17 @@ object ChangeStartPagePatch : BytecodePatch( ListPreference( key = "revanced_start_page", summaryKey = null, - ) + ), ) StartActivityFingerprint.resolve( context, - HomeActivityFingerprint.result?.classDef ?: throw HomeActivityFingerprint.exception + HomeActivityFingerprint.result?.classDef ?: throw HomeActivityFingerprint.exception, ) StartActivityFingerprint.result?.mutableMethod?.addInstruction( 0, - "invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->changeIntent(Landroid/content/Intent;)V" + "invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->changeIntent(Landroid/content/Intent;)V", ) ?: throw StartActivityFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint.kt index 7461872181..3c7e4c8d4c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint.kt @@ -4,4 +4,4 @@ import app.revanced.patcher.fingerprint.MethodFingerprint object StartActivityFingerprint : MethodFingerprint( parameters = listOf("Landroid/content/Intent;"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt index 425adf111b..6372979050 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt @@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -40,14 +41,14 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object DisableResumingShortsOnStartupPatch : BytecodePatch( - setOf(UserWasInShortsFingerprint) + setOf(UserWasInShortsFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = @@ -57,14 +58,14 @@ object DisableResumingShortsOnStartupPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.SHORTS.addPreferences( - SwitchPreference("revanced_disable_resuming_shorts_player") + SwitchPreference("revanced_disable_resuming_shorts_player"), ) UserWasInShortsFingerprint.result?.mutableMethod?.apply { val listenableInstructionIndex = indexOfFirstInstruction { opcode == Opcode.INVOKE_INTERFACE && - getReference()?.definingClass == "Lcom/google/common/util/concurrent/ListenableFuture;" && - getReference()?.name == "isDone" + getReference()?.definingClass == "Lcom/google/common/util/concurrent/ListenableFuture;" && + getReference()?.name == "isDone" } if (listenableInstructionIndex < 0) throw PatchException("Could not find instruction index") val originalInstructionRegister = getInstruction(listenableInstructionIndex).registerC @@ -73,7 +74,7 @@ object DisableResumingShortsOnStartupPatch : BytecodePatch( // Replace original instruction to preserve control flow label. replaceInstruction( listenableInstructionIndex, - "invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->disableResumingStartupShortsPlayer()Z" + "invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->disableResumingStartupShortsPlayer()Z", ) addInstructionsWithLabels( listenableInstructionIndex + 1, @@ -83,7 +84,7 @@ object DisableResumingShortsOnStartupPatch : BytecodePatch( return-void :show_startup_shorts_player invoke-interface {v$originalInstructionRegister}, Lcom/google/common/util/concurrent/ListenableFuture;->isDone()Z - """ + """, ) } ?: throw UserWasInShortsFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt index be3eef774b..374e51f05b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt @@ -9,4 +9,4 @@ object UserWasInShortsFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("Ljava/lang/Object;"), strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/EnableTabletLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/EnableTabletLayoutPatch.kt index f09c7d6947..688d7d86fa 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/EnableTabletLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/EnableTabletLayoutPatch.kt @@ -19,17 +19,17 @@ import app.revanced.util.exception name = "Enable tablet layout", description = "Adds an option to spoof the device form factor to a tablet which enables the tablet layout.", dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], - compatiblePackages = [CompatiblePackage("com.google.android.youtube")] + compatiblePackages = [CompatiblePackage("com.google.android.youtube")], ) @Suppress("unused") object EnableTabletLayoutPatch : BytecodePatch( - setOf(GetFormFactorFingerprint) + setOf(GetFormFactorFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_tablet_layout") + SwitchPreference("revanced_tablet_layout"), ) GetFormFactorFingerprint.result?.let { @@ -46,8 +46,8 @@ object EnableTabletLayoutPatch : BytecodePatch( """, ExternalLabel( "is_large_form_factor", - returnIsLargeFormFactorLabel - ) + returnIsLargeFormFactorLabel, + ), ) } } ?: GetFormFactorFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/fingerprints/GetFormFactorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/fingerprints/GetFormFactorFingerprint.kt index c7cb6d1e77..32af691df9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/fingerprints/GetFormFactorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tablet/fingerprints/GetFormFactorFingerprint.kt @@ -20,6 +20,6 @@ internal object GetFormFactorFingerprint : MethodFingerprint( Opcode.RETURN_OBJECT, Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, - Opcode.RETURN_OBJECT - ) -) \ No newline at end of file + Opcode.RETURN_OBJECT, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt index 454cced2c1..fbcdb512a9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt @@ -26,7 +26,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", arrayOf( + "com.google.android.youtube", + arrayOf( "18.32.39", "18.37.36", "18.38.44", @@ -39,24 +40,24 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ) - ) - ] + "19.04.37", + ), + ), + ], ) @Suppress("unused") object TabletMiniPlayerPatch : BytecodePatch( setOf( MiniPlayerDimensionsCalculatorParentFingerprint, MiniPlayerResponseModelSizeCheckFingerprint, - MiniPlayerOverrideFingerprint - ) + MiniPlayerOverrideFingerprint, + ), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_tablet_miniplayer") + SwitchPreference("revanced_tablet_miniplayer"), ) // First resolve the fingerprints via the parent fingerprint. @@ -73,7 +74,8 @@ object TabletMiniPlayerPatch : BytecodePatch( // Insert right before the return instruction. val secondInsertIndex = method.implementation!!.instructions.size - 1 method.insertOverride( - secondInsertIndex, parameterRegister + secondInsertIndex, + parameterRegister, /** same register used to return **/ ) @@ -125,7 +127,7 @@ object TabletMiniPlayerPatch : BytecodePatch( """ invoke-static {v$overrideRegister}, Lapp/revanced/integrations/youtube/patches/TabletMiniPlayerOverridePatch;->getTabletMiniPlayerOverride(Z)Z move-result v$overrideRegister - """ + """, ) } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt index 244bf33d0f..5bdf5404e5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt @@ -19,5 +19,5 @@ internal object MiniPlayerDimensionsCalculatorParentFingerprint : MethodFingerpr Opcode.FLOAT_TO_INT, Opcode.INVOKE_INTERFACE, Opcode.RETURN_VOID, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideFingerprint.kt index 9e80c81a2e..04d191db05 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideFingerprint.kt @@ -8,5 +8,5 @@ internal object MiniPlayerOverrideFingerprint : MethodFingerprint( returnType = "L", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), - strings = listOf("appName") -) \ No newline at end of file + strings = listOf("appName"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideNoContextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideNoContextFingerprint.kt index c6ea61f3f9..ab827f0075 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideNoContextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerOverrideNoContextFingerprint.kt @@ -6,6 +6,7 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object MiniPlayerOverrideNoContextFingerprint : MethodFingerprint( - "Z", AccessFlags.FINAL or AccessFlags.PRIVATE, + "Z", + AccessFlags.FINAL or AccessFlags.PRIVATE, opcodes = listOf(Opcode.RETURN), // anchor to insert the instruction -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerResponseModelSizeCheckFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerResponseModelSizeCheckFingerprint.kt index 4ac508edc5..d9bda3e826 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerResponseModelSizeCheckFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerResponseModelSizeCheckFingerprint.kt @@ -16,5 +16,5 @@ internal object MiniPlayerResponseModelSizeCheckFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, Opcode.IF_NEZ, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/LithoColorHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/LithoColorHookPatch.kt index 878ca9ae6e..ba54e58ee9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/LithoColorHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/LithoColorHookPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.theme -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch @@ -8,25 +7,26 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint +import app.revanced.util.exception @Patch( description = "Adds a hook to set color of Litho components.", compatiblePackages = [ CompatiblePackage("com.google.android.youtube"), - ] + ], ) internal object LithoColorHookPatch : BytecodePatch(setOf(LithoThemeFingerprint)) { - private var insertionIndex : Int = -1 - private lateinit var colorRegister : String - private lateinit var insertionMethod : MutableMethod + private var insertionIndex: Int = -1 + private lateinit var colorRegister: String + private lateinit var insertionMethod: MutableMethod - internal fun lithoColorOverrideHook(targetMethodClass: String, targetMethodName: String) { + internal fun lithoColorOverrideHook(targetMethodClass: String, targetMethodName: String) { insertionMethod.addInstructions( insertionIndex, """ invoke-static {$colorRegister}, $targetMethodClass->$targetMethodName(I)I move-result $colorRegister - """ + """, ) insertionIndex += 2 } @@ -38,4 +38,4 @@ internal object LithoColorHookPatch : BytecodePatch(setOf(LithoThemeFingerprint) insertionMethod = it.mutableMethod } ?: throw LithoThemeFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt index 3ac26ac986..de120be0ee 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt @@ -26,7 +26,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction ThemeResourcePatch::class, IntegrationsPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -43,14 +43,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object ThemeBytecodePatch : BytecodePatch( - setOf(UseGradientLoadingScreenFingerprint) + setOf(UseGradientLoadingScreenFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/theme/ThemePatch;" @@ -73,7 +73,7 @@ object ThemeBytecodePatch : BytecodePatch( "Dark green" to "#FF002905", "Dark yellow" to "#FF282900", "Dark orange" to "#FF291800", - "Dark red" to "#FF290000" + "Dark red" to "#FF290000", ), title = "Dark theme background color", description = "Can be a hex color (#AARRGGBB) or a color resource reference.", @@ -91,7 +91,7 @@ object ThemeBytecodePatch : BytecodePatch( "Light green" to "#FFCCFFCC", "Light yellow" to "#FFFDFFCC", "Light orange" to "#FFFFE6CC", - "Light red" to "#FFFFD6D6" + "Light red" to "#FFFFD6D6", ), title = "Light theme background color", description = "Can be a hex color (#AARRGGBB) or a color resource reference.", @@ -101,7 +101,7 @@ object ThemeBytecodePatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_gradient_loading_screen") + SwitchPreference("revanced_gradient_loading_screen"), ) UseGradientLoadingScreenFingerprint.result?.mutableMethod?.apply { @@ -113,7 +113,7 @@ object ThemeBytecodePatch : BytecodePatch( """ invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->gradientLoadingScreenEnabled()Z move-result v$isEnabledRegister - """ + """, ) } ?: throw UseGradientLoadingScreenFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/LithoThemeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/LithoThemeFingerprint.kt index 83b56c7ccb..f724861449 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/LithoThemeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/LithoThemeFingerprint.kt @@ -24,9 +24,9 @@ internal object LithoThemeFingerprint : MethodFingerprint( Opcode.IF_NEZ, Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), customFingerprint = { methodDef, _ -> methodDef.name == "onBoundsChange" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/UseGradientLoadingScreenFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/UseGradientLoadingScreenFingerprint.kt index 821e051b41..9248dd0ef7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/UseGradientLoadingScreenFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/UseGradientLoadingScreenFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patches.youtube.layout.theme.ThemeBytecodePatch.GRADIENT_LOA import app.revanced.util.patch.LiteralValueFingerprint internal object UseGradientLoadingScreenFingerprint : LiteralValueFingerprint( - literalSupplier = { GRADIENT_LOADING_SCREEN_AB_CONSTANT } -) \ No newline at end of file + literalSupplier = { GRADIENT_LOADING_SCREEN_AB_CONSTANT }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlFingerprint.kt index 52f9005bbe..8acc20c61b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlFingerprint.kt @@ -6,5 +6,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object MessageDigestImageUrlFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - parameters = listOf("Ljava/lang/String;", "L") -) \ No newline at end of file + parameters = listOf("Ljava/lang/String;", "L"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlParentFingerprint.kt index 44902cb06b..8146a025d4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/MessageDigestImageUrlParentFingerprint.kt @@ -6,7 +6,7 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object MessageDigestImageUrlParentFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - returnType = "Ljava/lang/String;", + returnType = "Ljava/lang/String;", parameters = listOf(), strings = listOf("@#&=*+-_.,:!?()/~'%;\$"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/RequestFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/RequestFingerprint.kt index b66ab59711..74547a3882 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/RequestFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/RequestFingerprint.kt @@ -10,7 +10,7 @@ internal object RequestFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, customFingerprint = { _, classDef -> classDef.type == IMPLEMENTATION_CLASS_NAME - } + }, ) { const val IMPLEMENTATION_CLASS_NAME = "Lorg/chromium/net/impl/CronetUrlRequest;" -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnFailureFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnFailureFingerprint.kt index 5848810e7f..a1f1084ca8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnFailureFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnFailureFingerprint.kt @@ -7,8 +7,8 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object OnFailureFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;", "Lorg/chromium/net/CronetException;"), + parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;", "Lorg/chromium/net/CronetException;"), customFingerprint = { methodDef, _ -> methodDef.name == "onFailed" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnResponseStartedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnResponseStartedFingerprint.kt index 1021d243a5..4226e0dedb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnResponseStartedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnResponseStartedFingerprint.kt @@ -8,14 +8,14 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object OnResponseStartedFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;"), + parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;"), strings = listOf( "Content-Length", "Content-Type", "identity", - "application/x-protobuf" + "application/x-protobuf", ), customFingerprint = { methodDef, _ -> methodDef.name == "onResponseStarted" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnSucceededFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnSucceededFingerprint.kt index ed8523c826..8a227fb1ec 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnSucceededFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/fingerprints/cronet/request/callback/OnSucceededFingerprint.kt @@ -7,8 +7,8 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object OnSucceededFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;"), + parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;"), customFingerprint = { methodDef, _ -> methodDef.name == "onSucceeded" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt index f7b43a2b60..693ef4c6a4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt @@ -17,11 +17,11 @@ import com.android.tools.smali.dexlib2.Opcode name = "Announcements", description = "Adds an option to show announcements from ReVanced on app startup.", compatiblePackages = [CompatiblePackage("com.google.android.youtube")], - dependencies = [SettingsPatch::class,AddResourcesPatch::class] + dependencies = [SettingsPatch::class, AddResourcesPatch::class], ) @Suppress("unused") object AnnouncementsPatch : BytecodePatch( - setOf(MainActivityFingerprint) + setOf(MainActivityFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch;" @@ -30,7 +30,7 @@ object AnnouncementsPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_announcements") + SwitchPreference("revanced_announcements"), ) val onCreateMethod = MainActivityFingerprint.result?.let { @@ -41,8 +41,7 @@ object AnnouncementsPatch : BytecodePatch( onCreateMethod.addInstructions( superCallIndex + 1, - "invoke-static { v1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->showAnnouncement(Landroid/app/Activity;)V" + "invoke-static { v1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->showAnnouncement(Landroid/app/Activity;)V", ) - } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt index f30ce32339..144a27ac73 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt @@ -14,11 +14,10 @@ import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParen import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch - @Patch( name = "Always repeat", description = "Adds an option to always repeat videos when they end.", - dependencies = [IntegrationsPatch::class,AddResourcesPatch::class], + dependencies = [IntegrationsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( "com.google.android.youtube", @@ -35,38 +34,38 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object AutoRepeatPatch : BytecodePatch( - setOf(AutoRepeatParentFingerprint) + setOf(AutoRepeatParentFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_auto_repeat") + SwitchPreference("revanced_auto_repeat"), ) - //Get Result from the ParentFingerprint which is the playMethod we need to get. + // Get Result from the ParentFingerprint which is the playMethod we need to get. val parentResult = AutoRepeatParentFingerprint.result ?: throw PatchException("ParentFingerprint did not resolve.") - //this one needs to be called when app/revanced/integrations/youtube/patches/AutoRepeatPatch;->shouldAutoRepeat() returns true + // this one needs to be called when app/revanced/integrations/youtube/patches/AutoRepeatPatch;->shouldAutoRepeat() returns true val playMethod = parentResult.mutableMethod AutoRepeatFingerprint.resolve(context, parentResult.classDef) - //String is: Laamp;->E()V + // String is: Laamp;->E()V val methodToCall = playMethod.definingClass + "->" + playMethod.name + "()V" - //This is the method we search for + // This is the method we search for val result = AutoRepeatFingerprint.result ?: throw PatchException("FingerPrint did not resolve.") val method = result.mutableMethod - //Instructions to add to the smali code + // Instructions to add to the smali code val instructions = """ invoke-static {}, Lapp/revanced/integrations/youtube/patches/AutoRepeatPatch;->shouldAutoRepeat()Z move-result v0 @@ -76,20 +75,19 @@ object AutoRepeatPatch : BytecodePatch( return-void """ - //Get the implementation so we can do a check for null and get instructions size. + // Get the implementation so we can do a check for null and get instructions size. val implementation = method.implementation ?: throw PatchException("No Method Implementation found!") - //Since addInstructions needs an index which starts counting at 0 and size starts counting at 1, - //we have to remove 1 to get the latest instruction + // Since addInstructions needs an index which starts counting at 0 and size starts counting at 1, + // we have to remove 1 to get the latest instruction val index = implementation.instructions.size - 1 - - //remove last instruction which is return-void + // remove last instruction which is return-void method.removeInstruction(index) // Add our own instructions there method.addInstructionsWithLabels(index, instructions) - //Everything worked as expected, return Success + // Everything worked as expected, return Success } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt index 9b07f4c545..a6241ff33b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt @@ -10,5 +10,5 @@ internal object AutoRepeatFingerprint : MethodFingerprint( listOf(), customFingerprint = { methodDef, _ -> methodDef.implementation!!.instructions.count() == 3 && methodDef.annotations.isEmpty() - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt index f40e16f29d..7c663b8109 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt @@ -9,6 +9,6 @@ internal object AutoRepeatParentFingerprint : MethodFingerprint( AccessFlags.PUBLIC or AccessFlags.FINAL, strings = listOf( "play() called when the player wasn't loaded.", - "play() blocked because Background Playability failed" - ) -) \ No newline at end of file + "play() blocked because Background Playability failed", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/BottomSheetHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/BottomSheetHookPatch.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/BottomSheetHookResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/BottomSheetHookResourcePatch.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/fingerprints/CreateBottomSheetFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/bottomsheet/hook/fingerprints/CreateBottomSheetFingerprint.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt index 5e871159e1..c2c381d153 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt @@ -30,14 +30,14 @@ import app.revanced.util.exception "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object SpoofDeviceDimensionsPatch : BytecodePatch( - setOf(DeviceDimensionsModelToStringFingerprint) + setOf(DeviceDimensionsModelToStringFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/spoof/SpoofDeviceDimensionsPatch;" @@ -46,7 +46,7 @@ object SpoofDeviceDimensionsPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_spoof_device_dimensions") + SwitchPreference("revanced_spoof_device_dimensions"), ) DeviceDimensionsModelToStringFingerprint.result @@ -58,13 +58,13 @@ object SpoofDeviceDimensionsPatch : BytecodePatch( 1 to "MinHeightOrWidth", // p1 = min height 2 to "MaxHeightOrWidth", // p2 = max height 3 to "MinHeightOrWidth", // p3 = min width - 4 to "MaxHeightOrWidth" // p4 = max width + 4 to "MaxHeightOrWidth", // p4 = max width ).map { (parameter, method) -> """ invoke-static { p$parameter }, $INTEGRATIONS_CLASS_DESCRIPTOR->get$method(I)I move-result p$parameter """ - }.joinToString("\n") { it } + }.joinToString("\n") { it }, ) ?: throw DeviceDimensionsModelToStringFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/fingerprints/DeviceDimensionsModelToStringFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/fingerprints/DeviceDimensionsModelToStringFingerprint.kt index fffdbb924a..5b14dd8fac 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/fingerprints/DeviceDimensionsModelToStringFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/fingerprints/DeviceDimensionsModelToStringFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object DeviceDimensionsModelToStringFingerprint : MethodFingerprint( returnType = "L", - strings = listOf("minh.", ";maxh.") + strings = listOf("minh.", ";maxh."), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt index bdd3d49690..416e4313fe 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt @@ -17,28 +17,30 @@ internal object FixBackToExitGesturePatch : BytecodePatch( setOf( RecyclerViewTopScrollingParentFingerprint, RecyclerViewScrollingFingerprint, - OnBackPressedFingerprint - ) + OnBackPressedFingerprint, + ), ) { override fun execute(context: BytecodeContext) { RecyclerViewTopScrollingFingerprint.apply { resolve( context, RecyclerViewTopScrollingParentFingerprint.result?.classDef - ?: throw RecyclerViewTopScrollingParentFingerprint.exception + ?: throw RecyclerViewTopScrollingParentFingerprint.exception, ) } mapOf( RecyclerViewTopScrollingFingerprint to IntegrationsMethod( - methodName = "onTopView" + methodName = "onTopView", ), RecyclerViewScrollingFingerprint to IntegrationsMethod( - methodName = "onScrollingViews" + methodName = "onScrollingViews", ), OnBackPressedFingerprint to IntegrationsMethod( - "p0", "onBackPressed", "Landroid/app/Activity;" - ) + "p0", + "onBackPressed", + "Landroid/app/Activity;", + ), ).forEach { (fingerprint, target) -> fingerprint.injectCall(target) } } @@ -49,7 +51,8 @@ internal object FixBackToExitGesturePatch : BytecodePatch( */ private fun MethodFingerprint.injectCall(targetMethod: IntegrationsMethod) = result?.apply { mutableMethod.addInstruction( - scanResult.patternScanResult!!.endIndex, targetMethod.toString() + scanResult.patternScanResult!!.endIndex, + targetMethod.toString(), ) } ?: throw this.exception @@ -61,9 +64,11 @@ internal object FixBackToExitGesturePatch : BytecodePatch( * @param parameterTypes The parameters of the method. */ internal data class IntegrationsMethod( - val register: String = "", val methodName: String, val parameterTypes: String = "" + val register: String = "", + val methodName: String, + val parameterTypes: String = "", ) { override fun toString() = "invoke-static {$register}, Lapp/revanced/integrations/youtube/patches/FixBackToExitGesturePatch;->$methodName($parameterTypes)V" } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt index 282122b84f..c7e08f4af4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/OnBackPressedFingerprint.kt @@ -9,12 +9,14 @@ internal object OnBackPressedFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, returnType = "V", opcodes = listOf( - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), customFingerprint = { methodDef, _ -> - (methodDef.definingClass.endsWith("MainActivity;") || + ( + methodDef.definingClass.endsWith("MainActivity;") || // Old versions of YouTube called this class "WatchWhileActivity" instead. - methodDef.definingClass.endsWith("WatchWhileActivity;")) - && methodDef.name == "onBackPressed" - } -) \ No newline at end of file + methodDef.definingClass.endsWith("WatchWhileActivity;") + ) && + methodDef.name == "onBackPressed" + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewScrollingFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewScrollingFingerprint.kt index 6e2c79d892..4ea79ed3de 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewScrollingFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewScrollingFingerprint.kt @@ -20,5 +20,5 @@ internal object RecyclerViewScrollingFingerprint : MethodFingerprint( Opcode.IF_LEZ, Opcode.IGET_OBJECT, Opcode.CONST_4, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingFingerprint.kt index ffd4ac18cd..c044c1a03b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingFingerprint.kt @@ -6,7 +6,10 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object RecyclerViewTopScrollingFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( + "V", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf(), + listOf( Opcode.IGET_OBJECT, Opcode.IF_EQZ, Opcode.IGET_OBJECT, @@ -23,5 +26,5 @@ internal object RecyclerViewTopScrollingFingerprint : MethodFingerprint( Opcode.GOTO, Opcode.IGET_OBJECT, Opcode.INVOKE_INTERFACE, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingParentFingerprint.kt index 076058bcaf..7000cb7de3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/fingerprints/RecyclerViewTopScrollingParentFingerprint.kt @@ -16,6 +16,6 @@ internal object RecyclerViewTopScrollingParentFingerprint : MethodFingerprint( Opcode.IPUT_OBJECT, Opcode.CONST_16, Opcode.INVOKE_VIRTUAL, - Opcode.NEW_INSTANCE + Opcode.NEW_INSTANCE, ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt index 9da25f79b3..a34efc1c1e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.misc.fix.playback -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -8,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.misc.fix.playback.fingerprints.UserAgentHeaderBuilderFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( @@ -16,32 +16,32 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction dependencies = [SpoofSignaturePatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.48.39", "18.49.37", "19.01.34", "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) object ClientSpoofPatch : BytecodePatch( - setOf(UserAgentHeaderBuilderFingerprint) + setOf(UserAgentHeaderBuilderFingerprint), ) { private const val ORIGINAL_PACKAGE_NAME = "com.google.android.youtube" override fun execute(context: BytecodeContext) { UserAgentHeaderBuilderFingerprint.result?.let { result -> val insertIndex = result.scanResult.patternScanResult!!.endIndex - result.mutableMethod.apply { - val packageNameRegister = getInstruction(insertIndex).registerD - - addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"") - } + result.mutableMethod.apply { + val packageNameRegister = getInstruction(insertIndex).registerD + addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"") + } } ?: throw UserAgentHeaderBuilderFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplGeneralFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplGeneralFingerprint.kt index fbf360fb8d..ab4be8915f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplGeneralFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplGeneralFingerprint.kt @@ -1,8 +1,8 @@ package app.revanced.patches.youtube.misc.fix.playback.fingerprints -import app.revanced.util.containsWideLiteralInstructionValue import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.util.containsWideLiteralInstructionValue import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -13,11 +13,11 @@ internal object PlayerResponseModelImplGeneralFingerprint : MethodFingerprint( opcodes = listOf( Opcode.RETURN_OBJECT, Opcode.CONST_4, - Opcode.RETURN_OBJECT + Opcode.RETURN_OBJECT, ), customFingerprint = handler@{ methodDef, _ -> if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false methodDef.containsWideLiteralInstructionValue(55735497) - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplLiveStreamFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplLiveStreamFingerprint.kt index 0ee384140d..fbd9b0b82b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplLiveStreamFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplLiveStreamFingerprint.kt @@ -1,8 +1,8 @@ package app.revanced.patches.youtube.misc.fix.playback.fingerprints -import app.revanced.util.containsWideLiteralInstructionValue import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.util.containsWideLiteralInstructionValue import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -13,11 +13,11 @@ internal object PlayerResponseModelImplLiveStreamFingerprint : MethodFingerprint opcodes = listOf( Opcode.RETURN_OBJECT, Opcode.CONST_4, - Opcode.RETURN_OBJECT + Opcode.RETURN_OBJECT, ), customFingerprint = handler@{ methodDef, _ -> if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false methodDef.containsWideLiteralInstructionValue(70276274) - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplRecommendedLevelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplRecommendedLevelFingerprint.kt index 9dd826bfb2..ee54d77623 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplRecommendedLevelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplRecommendedLevelFingerprint.kt @@ -1,8 +1,8 @@ package app.revanced.patches.youtube.misc.fix.playback.fingerprints -import app.revanced.util.containsWideLiteralInstructionValue import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.util.containsWideLiteralInstructionValue import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -13,11 +13,11 @@ internal object PlayerResponseModelImplRecommendedLevelFingerprint : MethodFinge opcodes = listOf( Opcode.SGET_OBJECT, Opcode.IGET, - Opcode.RETURN + Opcode.RETURN, ), customFingerprint = handler@{ methodDef, _ -> if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false methodDef.containsWideLiteralInstructionValue(55735497) - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/ScrubbedPreviewLayoutFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/ScrubbedPreviewLayoutFingerprint.kt index 2781a67161..341c5805cb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/ScrubbedPreviewLayoutFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/ScrubbedPreviewLayoutFingerprint.kt @@ -23,5 +23,5 @@ internal object ScrubbedPreviewLayoutFingerprint : LiteralValueFingerprint( Opcode.IPUT_OBJECT, // preview imageview ), // This resource is used in ~ 40 different locations, but this method has a distinct list of parameters to match to. - literalSupplier = { SpoofSignatureResourcePatch.scrubbedPreviewThumbnailResourceId } -) \ No newline at end of file + literalSupplier = { SpoofSignatureResourcePatch.scrubbedPreviewThumbnailResourceId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderRecommendedLevelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderRecommendedLevelFingerprint.kt index 32dd4b19ae..e56867eaea 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderRecommendedLevelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderRecommendedLevelFingerprint.kt @@ -17,7 +17,7 @@ internal object StoryboardRendererDecoderRecommendedLevelFingerprint : MethodFin Opcode.MOVE_RESULT_OBJECT, Opcode.IPUT_OBJECT, Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT + Opcode.MOVE_RESULT, ), - strings = listOf("#-1#") + strings = listOf("#-1#"), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderSpecFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderSpecFingerprint.kt index 5d47a9bcf9..e6c6449f3e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderSpecFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderSpecFingerprint.kt @@ -19,5 +19,5 @@ internal object StoryboardRendererDecoderSpecFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.IF_NEZ, ), - strings = listOf("#-1#") + strings = listOf("#-1#"), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailFingerprint.kt index dad3eb2919..9f3f94f2af 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailFingerprint.kt @@ -20,4 +20,4 @@ internal object StoryboardThumbnailFingerprint : MethodFingerprint( Opcode.RETURN, Opcode.RETURN, // Last instruction of method. ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailParentFingerprint.kt index 8a151246df..172001c53f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailParentFingerprint.kt @@ -14,4 +14,4 @@ internal object StoryboardThumbnailParentFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, returnType = "Landroid/graphics/Bitmap;", strings = listOf("Storyboard regionDecoder.decodeRegion exception - "), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/UserAgentHeaderBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/UserAgentHeaderBuilderFingerprint.kt index 0d593ab852..209b0b165d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/UserAgentHeaderBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/UserAgentHeaderBuilderFingerprint.kt @@ -7,4 +7,4 @@ internal object UserAgentHeaderBuilderFingerprint : MethodFingerprint( parameters = listOf("L", "L", "L"), opcodes = listOf(Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_VIRTUAL), strings = listOf("(Linux; U; Android "), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/Constants.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/Constants.kt index c532c57d4a..6548bb6039 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/Constants.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/Constants.kt @@ -3,4 +3,4 @@ package app.revanced.patches.youtube.misc.gms internal object Constants { const val YOUTUBE_PACKAGE_NAME = "com.google.android.youtube" const val REVANCED_YOUTUBE_PACKAGE_NAME = "app.revanced.android.youtube" -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt index a5be9adb6e..e8be6f56b4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt @@ -11,7 +11,6 @@ import app.revanced.patches.youtube.misc.gms.fingerprints.* import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.shared.fingerprints.HomeActivityFingerprint - @Suppress("unused") object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( fromPackageName = YOUTUBE_PACKAGE_NAME, @@ -22,27 +21,28 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( GooglePlayUtilityFingerprint, CastDynamiteModuleFingerprint, CastDynamiteModuleV2Fingerprint, - CastContextFetchFingerprint + CastContextFetchFingerprint, ), mainActivityOnCreateFingerprint = HomeActivityFingerprint, integrationsPatchDependency = IntegrationsPatch::class, dependencies = setOf( HideCastButtonPatch::class, - ClientSpoofPatch::class + ClientSpoofPatch::class, ), gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch, compatiblePackages = setOf( CompatiblePackage( - "com.google.android.youtube", setOf( + "com.google.android.youtube", + setOf( "18.48.39", "18.49.37", "19.01.34", "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ) - ) + "19.04.37", + ), + ), ), fingerprints = setOf( ServiceCheckFingerprint, @@ -51,7 +51,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( CastDynamiteModuleV2Fingerprint, CastContextFetchFingerprint, PrimeMethodFingerprint, - ) + ), ) { override val gmsCoreVendor by gmsCoreVendorOption } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch.kt index 151e1b6c60..f4803ae29a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch.kt @@ -8,12 +8,11 @@ import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_ import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME import app.revanced.patches.youtube.misc.settings.SettingsPatch - object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch( fromPackageName = YOUTUBE_PACKAGE_NAME, toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME, spoofedPackageSignature = "24bb24c05e47e0aefa68a58a766179d9b613a600", - dependencies = setOf(SettingsPatch::class, AddResourcesPatch::class) + dependencies = setOf(SettingsPatch::class, AddResourcesPatch::class), ) { override fun execute(context: ResourceContext) { AddResourcesPatch(this::class) @@ -23,8 +22,8 @@ object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch( "microg_settings", intent = IntentPreference.Intent("", "org.microg.gms.ui.SettingsActivity") { "$gmsCoreVendor.android.gms" - } - ) + }, + ), ) super.execute(context) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt index 783c093c63..966d9352ba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleFingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.youtube.misc.gms.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object CastDynamiteModuleFingerprint : MethodFingerprint( - strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl") -) \ No newline at end of file + strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt index d0a4631766..6a207bf5da 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/CastDynamiteModuleV2Fingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.youtube.misc.gms.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object CastDynamiteModuleV2Fingerprint : MethodFingerprint( - strings = listOf("Failed to load module via V2: ") -) \ No newline at end of file + strings = listOf("Failed to load module via V2: "), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt index 219602aa4e..380d263d29 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/GooglePlayUtilityFingerprint.kt @@ -8,5 +8,5 @@ internal object GooglePlayUtilityFingerprint : MethodFingerprint( returnType = "I", accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, parameters = listOf("L", "I"), - strings = listOf("This should never happen.", "MetadataValueReader", "com.google.android.gms") -) \ No newline at end of file + strings = listOf("This should never happen.", "MetadataValueReader", "com.google.android.gms"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/PrimeMethodFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/PrimeMethodFingerprint.kt index 45d39aeec7..ae91e4ccda 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/PrimeMethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/PrimeMethodFingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.youtube.misc.gms.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object PrimeMethodFingerprint : MethodFingerprint( - strings = listOf("com.google.android.GoogleCamera", "com.android.vending") -) \ No newline at end of file + strings = listOf("com.google.android.GoogleCamera", "com.android.vending"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/ServiceCheckFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/ServiceCheckFingerprint.kt index f48de5b411..806217e3eb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/ServiceCheckFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/fingerprints/ServiceCheckFingerprint.kt @@ -8,5 +8,5 @@ internal object ServiceCheckFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, parameters = listOf("L", "I"), - strings = listOf("Google Play Services not available", "GooglePlayServices not available due to error ") -) \ No newline at end of file + strings = listOf("Google Play Services not available", "GooglePlayServices not available due to error "), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/APIPlayerServiceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/APIPlayerServiceFingerprint.kt index ca4ad846e6..d73128456b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/APIPlayerServiceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/APIPlayerServiceFingerprint.kt @@ -13,5 +13,5 @@ internal object APIPlayerServiceFingerprint : IntegrationsFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/google/android/apps/youtube/embeddedplayer/service/service/jar/ApiPlayerService;" }, // Integrations context is the first method parameter. - contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size } -) \ No newline at end of file + contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ApplicationInitFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ApplicationInitFingerprint.kt index 0cc958cb8c..c078a20ff8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ApplicationInitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ApplicationInitFingerprint.kt @@ -8,4 +8,4 @@ import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.Integ internal object ApplicationInitFingerprint : IntegrationsFingerprint( strings = listOf("Application creation", "Application.onCreate"), // Integrations context is the Activity itself. -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerControlsOverlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerControlsOverlayFingerprint.kt index 1b57540675..2c96023332 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerControlsOverlayFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerControlsOverlayFingerprint.kt @@ -18,5 +18,5 @@ internal object EmbeddedPlayerControlsOverlayFingerprint : IntegrationsFingerpri methodDef.definingClass.startsWith("Lcom/google/android/apps/youtube/embeddedplayer/service/ui/overlays/controlsoverlay/remoteloaded/") }, // Integrations context is the first method parameter. - contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size } -) \ No newline at end of file + contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerFingerprint.kt index fbc2ab0dbf..b8ea147bfd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/EmbeddedPlayerFingerprint.kt @@ -16,5 +16,5 @@ internal object EmbeddedPlayerFingerprint : IntegrationsFingerprint( parameters = listOf("L", "L", "Landroid/content/Context;"), strings = listOf("android.hardware.type.television"), // String is also found in other classes // Integrations context is the third method parameter. - contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size + 2 } -) \ No newline at end of file + contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size + 2 }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbedFragmentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbedFragmentFingerprint.kt index 77eeec32dc..45c66bc827 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbedFragmentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbedFragmentFingerprint.kt @@ -15,5 +15,5 @@ internal object RemoteEmbedFragmentFingerprint : IntegrationsFingerprint( methodDef.definingClass == "Lcom/google/android/apps/youtube/embeddedplayer/service/jar/client/RemoteEmbedFragment;" }, // Integrations context is the first method parameter. - contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size } -) \ No newline at end of file + contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbeddedPlayerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbeddedPlayerFingerprint.kt index 196994f49b..775404efd2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbeddedPlayerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/RemoteEmbeddedPlayerFingerprint.kt @@ -15,5 +15,5 @@ internal object RemoteEmbeddedPlayerFingerprint : IntegrationsFingerprint( methodDef.definingClass == "Lcom/google/android/youtube/api/jar/client/RemoteEmbeddedPlayer;" }, // Integrations context is the first method parameter. - contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size } -) \ No newline at end of file + contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerActivityFingerprint.kt index 9148f5fdb5..33d14d0145 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerActivityFingerprint.kt @@ -16,8 +16,8 @@ internal object StandalonePlayerActivityFingerprint : IntegrationsFingerprint( returnType = "V", parameters = listOf("L"), customFingerprint = { methodDef, _ -> - methodDef.definingClass == "Lcom/google/android/youtube/api/StandalonePlayerActivity;" - && methodDef.name == "onCreate" + methodDef.definingClass == "Lcom/google/android/youtube/api/StandalonePlayerActivity;" && + methodDef.name == "onCreate" }, // Integrations context is the Activity itself. -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt index b140c3b50d..ab37e0e238 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt @@ -32,25 +32,25 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object BypassURLRedirectsPatch : BytecodePatch( - setOf(ABUriParserFingerprint, HTTPUriParserFingerprint) + setOf(ABUriParserFingerprint, HTTPUriParserFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_bypass_url_redirects") + SwitchPreference("revanced_bypass_url_redirects"), ) mapOf( ABUriParserFingerprint to 7, // Offset to Uri.parse. - HTTPUriParserFingerprint to 0 // Offset to Uri.parse. + HTTPUriParserFingerprint to 0, // Offset to Uri.parse. ).map { (fingerprint, offset) -> (fingerprint.result ?: throw fingerprint.exception) to offset }.forEach { (result, offset) -> @@ -61,11 +61,11 @@ object BypassURLRedirectsPatch : BytecodePatch( replaceInstruction( insertIndex, "invoke-static {v$uriStringRegister}," + - "Lapp/revanced/integrations/youtube/patches/BypassURLRedirectsPatch;" + - "->" + - "parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;" + "Lapp/revanced/integrations/youtube/patches/BypassURLRedirectsPatch;" + + "->" + + "parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;", ) } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt index a76331da6e..05c21e58da 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt @@ -36,16 +36,18 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") -object OpenLinksExternallyPatch : BaseTransformInstructionsPatch>( -) { +object OpenLinksExternallyPatch : BaseTransformInstructionsPatch>() { override fun filterMap( - classDef: ClassDef, method: Method, instruction: Instruction, instructionIndex: Int + classDef: ClassDef, + method: Method, + instruction: Instruction, + instructionIndex: Int, ): Pair? { if (instruction !is ReferenceInstruction) return null val reference = instruction.reference as? StringReference ?: return null @@ -64,7 +66,7 @@ object OpenLinksExternallyPatch : BaseTransformInstructionsPatch> """ invoke-static {v$register}, Lapp/revanced/integrations/youtube/patches/OpenLinksExternallyPatch;->getIntent(Ljava/lang/String;)Ljava/lang/String; move-result-object v$register - """ + """, ) } @@ -72,9 +74,9 @@ object OpenLinksExternallyPatch : BaseTransformInstructionsPatch> AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_external_browser") + SwitchPreference("revanced_external_browser"), ) super.execute(context) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt index 77fea68f86..ee430921d6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/ABUriParserFingerprint.kt @@ -20,10 +20,10 @@ internal object ABUriParserFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, Opcode.RETURN_OBJECT, - Opcode.CHECK_CAST + Opcode.CHECK_CAST, ), customFingerprint = { methodDef, classDef -> // This method is always called "a" because this kind of class always has a single method. methodDef.name == "a" && classDef.methods.count() == 3 - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/HTTPUriParserFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/HTTPUriParserFingerprint.kt index 66fcccaac4..e158f32510 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/HTTPUriParserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/fingerprints/HTTPUriParserFingerprint.kt @@ -11,7 +11,7 @@ internal object HTTPUriParserFingerprint : MethodFingerprint( parameters = listOf("Ljava/lang/String"), opcodes = listOf( Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ), - strings = listOf("://") -) \ No newline at end of file + strings = listOf("://"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt index e85f11c432..a9877a4911 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.misc.litho.filter -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -14,6 +13,7 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.litho.filter.fingerprints.* +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @@ -22,12 +22,14 @@ import java.io.Closeable @Patch( description = "Hooks the method which parses the bytes into a ComponentContext to filter components.", - dependencies = [IntegrationsPatch::class] + dependencies = [IntegrationsPatch::class], ) @Suppress("unused") -object LithoFilterPatch : BytecodePatch( - setOf(ComponentContextParserFingerprint, LithoFilterFingerprint, ProtobufBufferReferenceFingerprint) -), Closeable { +object LithoFilterPatch : + BytecodePatch( + setOf(ComponentContextParserFingerprint, LithoFilterFingerprint, ProtobufBufferReferenceFingerprint), + ), + Closeable { private val MethodFingerprint.patternScanResult get() = result!!.scanResult.patternScanResult!! @@ -80,7 +82,7 @@ object LithoFilterPatch : BytecodePatch( ComponentContextParserFingerprint.result?.also { arrayOf( EmptyComponentBuilderFingerprint, - ReadComponentIdentifierFingerprint + ReadComponentIdentifierFingerprint, ).forEach { fingerprint -> if (fingerprint.resolve(context, it.mutableMethod, it.mutableClass)) return@forEach throw fingerprint.exception @@ -90,8 +92,10 @@ object LithoFilterPatch : BytecodePatch( // region Pass the buffer into Integrations. ProtobufBufferReferenceFingerprint.result - ?.mutableMethod?.addInstruction(0, - " invoke-static { p2 }, $INTEGRATIONS_CLASS_DESCRIPTOR->setProtoBuffer(Ljava/nio/ByteBuffer;)V") + ?.mutableMethod?.addInstruction( + 0, + " invoke-static { p2 }, $INTEGRATIONS_CLASS_DESCRIPTOR->setProtoBuffer(Ljava/nio/ByteBuffer;)V", + ) ?: throw ProtobufBufferReferenceFingerprint.exception // endregion @@ -152,7 +156,7 @@ object LithoFilterPatch : BytecodePatch( return-object v$free2 """, // Used to jump over the instruction which block the component from being created. - ExternalLabel("unfiltered", getInstruction(insertHookIndex)) + ExternalLabel("unfiltered", getInstruction(insertHookIndex)), ) // endregion } @@ -171,7 +175,7 @@ object LithoFilterPatch : BytecodePatch( invoke-direct {v1}, $classDescriptor->()V const/16 v2, ${filterCount++} aput-object v1, v0, v2 - """ + """, ) } } ?: throw LithoFilterFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ComponentContextParserFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ComponentContextParserFingerprint.kt index e8ad437f7d..9c8a506b88 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ComponentContextParserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ComponentContextParserFingerprint.kt @@ -9,5 +9,5 @@ internal object ComponentContextParserFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.IPUT_OBJECT, ), - strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings.") -) \ No newline at end of file + strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings."), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/EmptyComponentBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/EmptyComponentBuilderFingerprint.kt index ec6a1f0c6f..2e496414d7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/EmptyComponentBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/EmptyComponentBuilderFingerprint.kt @@ -6,6 +6,6 @@ import com.android.tools.smali.dexlib2.Opcode internal object EmptyComponentBuilderFingerprint : MethodFingerprint( opcodes = listOf( Opcode.INVOKE_INTERFACE, - Opcode.INVOKE_STATIC_RANGE + Opcode.INVOKE_STATIC_RANGE, ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ProtobufBufferReferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ProtobufBufferReferenceFingerprint.kt index f72b0667ff..d7be4b8b95 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ProtobufBufferReferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ProtobufBufferReferenceFingerprint.kt @@ -13,6 +13,6 @@ internal object ProtobufBufferReferenceFingerprint : MethodFingerprint( Opcode.IPUT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, - Opcode.SUB_INT_2ADDR - ) -) \ No newline at end of file + Opcode.SUB_INT_2ADDR, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ReadComponentIdentifierFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ReadComponentIdentifierFingerprint.kt index 0a6adfda3d..b50c95f1da 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ReadComponentIdentifierFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ReadComponentIdentifierFingerprint.kt @@ -7,6 +7,6 @@ internal object ReadComponentIdentifierFingerprint : MethodFingerprint( opcodes = listOf( Opcode.IF_NEZ, null, - Opcode.MOVE_RESULT_OBJECT // Register stores the component identifier string - ) -) \ No newline at end of file + Opcode.MOVE_RESULT_OBJECT, // Register stores the component identifier string + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/MicroGBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/MicroGBytecodePatch.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/fingerprints/CastContextFetchFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/fingerprints/CastContextFetchFingerprint.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt index e83b4b4986..ea80827013 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt @@ -29,7 +29,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference PlayerTypeHookPatch::class, VideoInformationPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -41,18 +41,18 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object MinimizedPlaybackPatch : BytecodePatch( setOf( MinimizedPlaybackManagerFingerprint, MinimizedPlaybackSettingsParentFingerprint, - KidsMinimizedPlaybackPolicyControllerFingerprint - ) + KidsMinimizedPlaybackPolicyControllerFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/MinimizedPlaybackPatch;" @@ -61,7 +61,7 @@ object MinimizedPlaybackPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - NonInteractivePreference("revanced_minimized_playback") + NonInteractivePreference("revanced_minimized_playback"), ) MinimizedPlaybackManagerFingerprint.result?.apply { @@ -71,7 +71,7 @@ object MinimizedPlaybackPatch : BytecodePatch( invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->playbackIsNotShort()Z move-result v0 return v0 - """ + """, ) } ?: throw MinimizedPlaybackManagerFingerprint.exception @@ -79,7 +79,7 @@ object MinimizedPlaybackPatch : BytecodePatch( MinimizedPlaybackSettingsParentFingerprint.result ?: throw MinimizedPlaybackSettingsParentFingerprint.exception MinimizedPlaybackSettingsFingerprint.resolve( context, - MinimizedPlaybackSettingsParentFingerprint.result!!.classDef + MinimizedPlaybackSettingsParentFingerprint.result!!.classDef, ) MinimizedPlaybackSettingsFingerprint.result?.apply { val booleanCalls = method.implementation!!.instructions.withIndex() @@ -95,7 +95,7 @@ object MinimizedPlaybackPatch : BytecodePatch( invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideMinimizedPlaybackAvailable()Z move-result v0 return v0 - """ + """, ) } ?: throw MinimizedPlaybackSettingsFingerprint.exception @@ -104,7 +104,7 @@ object MinimizedPlaybackPatch : BytecodePatch( KidsMinimizedPlaybackPolicyControllerFingerprint.result?.apply { mutableMethod.addInstruction( 0, - "return-void" + "return-void", ) } ?: throw KidsMinimizedPlaybackPolicyControllerFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt index af992d609a..70037787a6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/KidsMinimizedPlaybackPolicyControllerFingerprint.kt @@ -24,11 +24,11 @@ internal object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerp Opcode.GOTO, Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), customFingerprint = { methodDef, _ -> methodDef.implementation!!.instructions.any { ((it as? NarrowLiteralInstruction)?.narrowLiteral == 5) } - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt index 2be2ec0d7f..a1b7cf6d01 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt @@ -34,6 +34,6 @@ internal object MinimizedPlaybackManagerFingerprint : MethodFingerprint( Opcode.CONST_4, Opcode.IF_EQZ, Opcode.IGET_BOOLEAN, - Opcode.IF_EQZ - ) -) \ No newline at end of file + Opcode.IF_EQZ, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt index 47c311f3a3..fe6dafe645 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsFingerprint.kt @@ -18,6 +18,6 @@ internal object MinimizedPlaybackSettingsFingerprint : MethodFingerprint( Opcode.IF_NEZ, Opcode.GOTO, Opcode.IGET_OBJECT, - Opcode.CHECK_CAST + Opcode.CHECK_CAST, ), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt index 03061183fa..48c45b8ede 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackSettingsParentFingerprint.kt @@ -11,5 +11,5 @@ internal object MinimizedPlaybackSettingsParentFingerprint : MethodFingerprint( accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, returnType = "I", parameters = listOf(), - strings = listOf("BiometricManager", "Failure in canAuthenticate(). FingerprintManager was null.") + strings = listOf("BiometricManager", "Failure in canAuthenticate(). FingerprintManager was null."), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsBytecodePatch.kt index 1cc2cfcf0f..b43a4f7b61 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsBytecodePatch.kt @@ -1,14 +1,14 @@ package app.revanced.patches.youtube.misc.playercontrols -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.fingerprint.MethodFingerprintResult import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.misc.playercontrols.fingerprints.BottomControlsInflateFingerprint import app.revanced.patches.youtube.misc.playercontrols.fingerprints.PlayerControlsVisibilityFingerprint +import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction dependencies = [BottomControlsResourcePatch::class], ) object PlayerControlsBytecodePatch : BytecodePatch( - setOf(LayoutConstructorFingerprint, BottomControlsInflateFingerprint) + setOf(LayoutConstructorFingerprint, BottomControlsInflateFingerprint), ) { lateinit var showPlayerControlsFingerprintResult: MethodFingerprintResult @@ -26,8 +26,9 @@ object PlayerControlsBytecodePatch : BytecodePatch( override fun execute(context: BytecodeContext) { LayoutConstructorFingerprint.result?.let { - if (!PlayerControlsVisibilityFingerprint.resolve(context, it.classDef)) + if (!PlayerControlsVisibilityFingerprint.resolve(context, it.classDef)) { throw LayoutConstructorFingerprint.exception + } } ?: throw LayoutConstructorFingerprint.exception showPlayerControlsFingerprintResult = PlayerControlsVisibilityFingerprint.result!! @@ -48,7 +49,7 @@ object PlayerControlsBytecodePatch : BytecodePatch( 0, """ invoke-static {p1}, $descriptor - """ + """, ) } @@ -59,7 +60,7 @@ object PlayerControlsBytecodePatch : BytecodePatch( fun initializeControl(descriptor: String) { inflateFingerprintResult.mutableMethod.addInstruction( moveToRegisterInstructionIndex + 1, - "invoke-static {v$viewRegister}, $descriptor" + "invoke-static {v$viewRegister}, $descriptor", ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt index 9480c6a1e4..eab43cd59c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/BottomControlsInflateFingerprint.kt @@ -13,7 +13,7 @@ internal object BottomControlsInflateFingerprint : LiteralValueFingerprint( opcodes = listOf( Opcode.CHECK_CAST, Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ), - literalSupplier = { BottomControlsResourcePatch.bottomUiContainerResourceId } -) \ No newline at end of file + literalSupplier = { BottomControlsResourcePatch.bottomUiContainerResourceId }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt index 672086f60d..5200a69094 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/fingerprints/PlayerControlsVisibilityFingerprint.kt @@ -7,5 +7,5 @@ import com.android.tools.smali.dexlib2.AccessFlags internal object PlayerControlsVisibilityFingerprint : MethodFingerprint( accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, returnType = "V", - parameters = listOf("Z", "Z") -) \ No newline at end of file + parameters = listOf("Z", "Z"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/PlayerOverlaysHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/PlayerOverlaysHookPatch.kt index a48cc48c91..f7f8a3b380 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/PlayerOverlaysHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/PlayerOverlaysHookPatch.kt @@ -12,21 +12,24 @@ import app.revanced.patches.youtube.misc.playeroverlay.fingerprint.PlayerOverlay description = "Hook for adding custom overlays to the video player.", dependencies = [IntegrationsPatch::class], compatiblePackages = [ - CompatiblePackage("com.google.android.youtube", [ - "18.32.39" - ]) - ] + CompatiblePackage( + "com.google.android.youtube", + [ + "18.32.39", + ], + ), + ], ) @Suppress("unused") object PlayerOverlaysHookPatch : BytecodePatch( // TODO: delete this unused outdated patch and its integration code. - setOf(PlayerOverlaysOnFinishInflateFingerprint) + setOf(PlayerOverlaysOnFinishInflateFingerprint), ) { override fun execute(context: BytecodeContext) { // hook YouTubePlayerOverlaysLayout.onFinishInflate() val method = PlayerOverlaysOnFinishInflateFingerprint.result!!.mutableMethod method.addInstruction( method.implementation!!.instructions.size - 2, - "invoke-static { p0 }, Lapp/revanced/integrations/youtube/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V" + "invoke-static { p0 }, Lapp/revanced/integrations/youtube/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V", ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt index 1d40fc3646..f66bf208c0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt @@ -1,10 +1,9 @@ package app.revanced.patches.youtube.misc.playeroverlay.fingerprint - import app.revanced.patcher.fingerprint.MethodFingerprint internal object PlayerOverlaysOnFinishInflateFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("YouTubePlayerOverlaysLayout;") && methodDef.name == "onFinishInflate" - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt index 0e239e8d08..26d09954af 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.misc.playertype -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -10,14 +9,15 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.playertype.fingerprint.PlayerTypeFingerprint import app.revanced.patches.youtube.misc.playertype.fingerprint.VideoStateFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction @Patch( description = "Hook to get the current player type and video playback state.", - dependencies = [IntegrationsPatch::class] + dependencies = [IntegrationsPatch::class], ) object PlayerTypeHookPatch : BytecodePatch( - setOf(PlayerTypeFingerprint, VideoStateFingerprint) + setOf(PlayerTypeFingerprint, VideoStateFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/PlayerTypeHookPatch;" @@ -25,7 +25,7 @@ object PlayerTypeHookPatch : BytecodePatch( override fun execute(context: BytecodeContext) { PlayerTypeFingerprint.result?.mutableMethod?.addInstruction( 0, - "invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerType(Ljava/lang/Enum;)V" + "invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerType(Ljava/lang/Enum;)V", ) ?: throw PlayerTypeFingerprint.exception VideoStateFingerprint.result?.let { @@ -38,7 +38,7 @@ object PlayerTypeHookPatch : BytecodePatch( """ iget-object v0, p1, $videoStateFieldName # copy VideoState parameter field invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->setVideoState(Ljava/lang/Enum;)V - """ + """, ) } } ?: throw VideoStateFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/PlayerTypeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/PlayerTypeFingerprint.kt index 2f1e100470..211913831a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/PlayerTypeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/PlayerTypeFingerprint.kt @@ -11,7 +11,7 @@ internal object PlayerTypeFingerprint : MethodFingerprint( parameters = listOf("L"), opcodes = listOf( Opcode.IF_NE, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/YouTubePlayerOverlaysLayout;") } + customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/YouTubePlayerOverlaysLayout;") }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/VideoStateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/VideoStateFingerprint.kt index 7df451a4a3..6b6e5fe822 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/VideoStateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/fingerprint/VideoStateFingerprint.kt @@ -17,5 +17,5 @@ internal object VideoStateFingerprint : MethodFingerprint( Opcode.IF_EQZ, Opcode.IF_EQZ, Opcode.IGET_OBJECT, // obfuscated parameter field name - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt index 06c737fe27..c811a6bfb6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt @@ -37,14 +37,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object RemoveTrackingQueryParameterPatch : BytecodePatch( - setOf(CopyTextFingerprint, SystemShareSheetFingerprint, YouTubeShareSheetFingerprint) + setOf(CopyTextFingerprint, SystemShareSheetFingerprint, YouTubeShareSheetFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/RemoveTrackingQueryParameterPatch;" @@ -52,12 +52,12 @@ object RemoveTrackingQueryParameterPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_remove_tracking_query_parameter") + SwitchPreference("revanced_remove_tracking_query_parameter"), ) fun MethodFingerprint.hook( getInsertIndex: PatternScanResult.() -> Int, - getUrlRegister: MutableMethod.(insertIndex: Int) -> Int + getUrlRegister: MutableMethod.(insertIndex: Int) -> Int, ) = result?.let { val insertIndex = it.scanResult.patternScanResult!!.getInsertIndex() val urlRegister = it.mutableMethod.getUrlRegister(insertIndex) @@ -67,19 +67,16 @@ object RemoveTrackingQueryParameterPatch : BytecodePatch( """ invoke-static {v$urlRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String; move-result-object v$urlRegister - """ + """, ) } ?: throw exception // Native YouTube share sheet. - YouTubeShareSheetFingerprint.hook(getInsertIndex = { startIndex + 1 }) - { insertIndex -> getInstruction(insertIndex - 1).registerA } + YouTubeShareSheetFingerprint.hook(getInsertIndex = { startIndex + 1 }) { insertIndex -> getInstruction(insertIndex - 1).registerA } // Native system share sheet. - SystemShareSheetFingerprint.hook(getInsertIndex = { endIndex }) - { insertIndex -> getInstruction(insertIndex - 1).registerA } + SystemShareSheetFingerprint.hook(getInsertIndex = { endIndex }) { insertIndex -> getInstruction(insertIndex - 1).registerA } - CopyTextFingerprint.hook(getInsertIndex = { startIndex + 2 }) - { insertIndex -> getInstruction(insertIndex - 2).registerA } + CopyTextFingerprint.hook(getInsertIndex = { startIndex + 2 }) { insertIndex -> getInstruction(insertIndex - 2).registerA } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/CopyTextFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/CopyTextFingerprint.kt index 1c25519511..b0ff40ece9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/CopyTextFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/CopyTextFingerprint.kt @@ -15,7 +15,7 @@ internal object CopyTextFingerprint : MethodFingerprint( Opcode.IGET_OBJECT, Opcode.IGET_OBJECT, Opcode.INVOKE_INTERFACE, - Opcode.RETURN_VOID + Opcode.RETURN_VOID, ), - strings = listOf("text/plain") -) \ No newline at end of file + strings = listOf("text/plain"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/SystemShareSheetFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/SystemShareSheetFingerprint.kt index 668f1cc30a..bccb8aac02 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/SystemShareSheetFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/SystemShareSheetFingerprint.kt @@ -8,7 +8,7 @@ internal object SystemShareSheetFingerprint : MethodFingerprint( parameters = listOf("L", "Ljava/util/Map;"), opcodes = listOf( Opcode.CHECK_CAST, - Opcode.GOTO + Opcode.GOTO, ), - strings = listOf("YTShare_Logging_Share_Intent_Endpoint_Byte_Array") -) \ No newline at end of file + strings = listOf("YTShare_Logging_Share_Intent_Endpoint_Byte_Array"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/YouTubeShareSheetFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/YouTubeShareSheetFingerprint.kt index 9183313d2e..794f69b495 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/YouTubeShareSheetFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/fingerprints/YouTubeShareSheetFingerprint.kt @@ -14,5 +14,5 @@ internal object YouTubeShareSheetFingerprint : MethodFingerprint( Opcode.GOTO, Opcode.MOVE_OBJECT, Opcode.INVOKE_VIRTUAL, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt index 9e5e4f8b87..67bf06ea6e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt @@ -1,24 +1,23 @@ package app.revanced.patches.youtube.misc.recyclerviewtree.hook -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.recyclerviewtree.hook.fingerprints.RecyclerViewTreeObserverFingerprint +import app.revanced.util.exception @Patch( - dependencies = [IntegrationsPatch::class] + dependencies = [IntegrationsPatch::class], ) internal object RecyclerViewTreeHookPatch : BytecodePatch( - setOf(RecyclerViewTreeObserverFingerprint) + setOf(RecyclerViewTreeObserverFingerprint), ) { internal lateinit var addHook: (String) -> Unit private set override fun execute(context: BytecodeContext) { - RecyclerViewTreeObserverFingerprint.result?.let { it.mutableMethod.apply { val insertIndex = it.scanResult.patternScanResult!!.startIndex @@ -27,10 +26,10 @@ internal object RecyclerViewTreeHookPatch : BytecodePatch( addHook = { classDescriptor -> addInstruction( insertIndex, - "invoke-static/range { p$recyclerViewParameter .. p$recyclerViewParameter }, $classDescriptor->onFlyoutMenuCreate(Landroid/support/v7/widget/RecyclerView;)V" + "invoke-static/range { p$recyclerViewParameter .. p$recyclerViewParameter }, $classDescriptor->onFlyoutMenuCreate(Landroid/support/v7/widget/RecyclerView;)V", ) } } } ?: throw RecyclerViewTreeObserverFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/fingerprints/RecyclerViewTreeObserverFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/fingerprints/RecyclerViewTreeObserverFingerprint.kt index f40fd09c9c..8c43947cac 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/fingerprints/RecyclerViewTreeObserverFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/fingerprints/RecyclerViewTreeObserverFingerprint.kt @@ -14,7 +14,7 @@ internal object RecyclerViewTreeObserverFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.NEW_INSTANCE, Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT + Opcode.IPUT_OBJECT, ), - strings = listOf("LithoRVSLCBinder") -) \ No newline at end of file + strings = listOf("LithoRVSLCBinder"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt index 0ada6925a6..62cb5c045e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt @@ -131,6 +131,7 @@ object SettingsPatch : key = "revanced_settings_screen_05_general", summaryKey = null, ) + // Don't sort, as related preferences are scattered apart. // Can use title sorting after PreferenceCategory support is added. val SHORTS = Screen( @@ -138,6 +139,7 @@ object SettingsPatch : summaryKey = null, sorting = Sorting.UNSORTED, ) + // Don't sort, because title sorting scatters the custom color preferences. val SEEKBAR = Screen( key = "revanced_settings_screen_07_seekbar", diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/LicenseActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/LicenseActivityOnCreateFingerprint.kt index ce3a4a7bbc..0da8db909e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/LicenseActivityOnCreateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/LicenseActivityOnCreateFingerprint.kt @@ -10,5 +10,5 @@ internal object LicenseActivityOnCreateFingerprint : MethodFingerprint( parameters = listOf("L"), customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("LicenseActivity;") && methodDef.name == "onCreate" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/SetThemeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/SetThemeFingerprint.kt index caf19d4269..96185ffbe1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/SetThemeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/fingerprints/SetThemeFingerprint.kt @@ -11,5 +11,5 @@ internal object SetThemeFingerprint : LiteralValueFingerprint( returnType = "L", parameters = listOf(), opcodes = listOf(Opcode.RETURN_OBJECT), - literalSupplier = { SettingsResourcePatch.appearanceStringId } + literalSupplier = { SettingsResourcePatch.appearanceStringId }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/ZoomHapticsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/ZoomHapticsPatch.kt index 261005b3b4..574b248525 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/ZoomHapticsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/ZoomHapticsPatch.kt @@ -16,17 +16,17 @@ import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFin name = "Disable zoom haptics", description = "Adds an option to disable haptics when zooming.", dependencies = [SettingsPatch::class, AddResourcesPatch::class], - compatiblePackages = [CompatiblePackage("com.google.android.youtube")] + compatiblePackages = [CompatiblePackage("com.google.android.youtube")], ) @Suppress("unused") object ZoomHapticsPatch : BytecodePatch( - setOf(ZoomHapticsFingerprint) + setOf(ZoomHapticsFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.MISC.addPreferences( - SwitchPreference("revanced_disable_zoom_haptics") + SwitchPreference("revanced_disable_zoom_haptics"), ) val zoomHapticsFingerprintMethod = ZoomHapticsFingerprint.result!!.mutableMethod @@ -39,7 +39,7 @@ object ZoomHapticsPatch : BytecodePatch( if-nez v0, :vibrate return-void """, - ExternalLabel("vibrate", zoomHapticsFingerprintMethod.getInstruction(0)) + ExternalLabel("vibrate", zoomHapticsFingerprintMethod.getInstruction(0)), ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/fingerprints/ZoomHapticsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/fingerprints/ZoomHapticsFingerprint.kt index 5958f84928..3750009108 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/fingerprints/ZoomHapticsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/fingerprints/ZoomHapticsFingerprint.kt @@ -3,6 +3,6 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object ZoomHapticsFingerprint : MethodFingerprint( strings = listOf( - "Failed to haptics vibrate for video zoom" - ) -) \ No newline at end of file + "Failed to haptics vibrate for video zoom", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/LayoutConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/LayoutConstructorFingerprint.kt index 7f24e99330..1b5bfc58d0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/LayoutConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/LayoutConstructorFingerprint.kt @@ -8,5 +8,5 @@ internal object LayoutConstructorFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = emptyList(), - strings = listOf("1.0x") -) \ No newline at end of file + strings = listOf("1.0x"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt index f7573bd5de..1774f43fcd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/MainActivityFingerprint.kt @@ -8,8 +8,8 @@ internal object MainActivityFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, parameters = listOf(), customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("MainActivity;") - // Old versions of YouTube called this class "WatchWhileActivity" instead. - || methodDef.definingClass.endsWith("WatchWhileActivity;") - } + methodDef.definingClass.endsWith("MainActivity;") || + // Old versions of YouTube called this class "WatchWhileActivity" instead. + methodDef.definingClass.endsWith("WatchWhileActivity;") + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/RollingNumberTextViewAnimationUpdateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/RollingNumberTextViewAnimationUpdateFingerprint.kt index 14b224eea9..2385b04101 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/RollingNumberTextViewAnimationUpdateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/RollingNumberTextViewAnimationUpdateFingerprint.kt @@ -26,5 +26,5 @@ internal object RollingNumberTextViewAnimationUpdateFingerprint : MethodFingerpr ), customFingerprint = { _, classDef -> classDef.superclass == "Landroid/support/v7/widget/AppCompatTextView;" - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarFingerprint.kt index a6cbe72e7e..096de00535 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarFingerprint.kt @@ -1,9 +1,8 @@ package app.revanced.patches.youtube.shared.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object SeekbarFingerprint : MethodFingerprint( "V", - strings = listOf("timed_markers_width") -) \ No newline at end of file + strings = listOf("timed_markers_width"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarOnDrawFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarOnDrawFingerprint.kt index 61ee24ff99..54fefd6c44 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarOnDrawFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shared/fingerprints/SeekbarOnDrawFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.youtube.shared.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint internal object SeekbarOnDrawFingerprint : MethodFingerprint( - customFingerprint = { methodDef, _ -> methodDef.name == "onDraw" } -) \ No newline at end of file + customFingerprint = { methodDef, _ -> methodDef.name == "onDraw" }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt index cb255b32c8..1c5f61d2e2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt @@ -20,7 +20,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -33,20 +34,20 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object HDRBrightnessPatch : BytecodePatch( - setOf(HDRBrightnessFingerprint) + setOf(HDRBrightnessFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.VIDEO.addPreferences( - SwitchPreference("revanced_hdr_auto_brightness") + SwitchPreference("revanced_hdr_auto_brightness"), ) val method = HDRBrightnessFingerprint.result!!.mutableMethod @@ -64,7 +65,7 @@ object HDRBrightnessPatch : BytecodePatch( """ invoke-static {v$register}, Lapp/revanced/integrations/youtube/patches/HDRAutoBrightnessPatch;->getHDRBrightness(F)F move-result v$register - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/fingerprints/HDRBrightnessFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/fingerprints/HDRBrightnessFingerprint.kt index 3be7354ae3..8c82e3b9c8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/fingerprints/HDRBrightnessFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/fingerprints/HDRBrightnessFingerprint.kt @@ -7,4 +7,4 @@ internal object HDRBrightnessFingerprint : MethodFingerprint( "V", opcodes = listOf(Opcode.CMPL_FLOAT), strings = listOf("c.SettingNotFound;", "screen_brightness", "android.mediaview"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index 36d0066c6f..a088653e46 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -27,15 +27,15 @@ import com.android.tools.smali.dexlib2.util.MethodUtil @Patch( description = "Hooks YouTube to get information about the current playing video.", - dependencies = [IntegrationsPatch::class, VideoIdPatch::class, PlayerResponseMethodHookPatch::class] + dependencies = [IntegrationsPatch::class, VideoIdPatch::class, PlayerResponseMethodHookPatch::class], ) object VideoInformationPatch : BytecodePatch( setOf( PlayerInitFingerprint, CreateVideoPlayerSeekbarFingerprint, PlayerControllerSetTimeReferenceFingerprint, - OnPlaybackSpeedItemClickFingerprint - ) + OnPlaybackSpeedItemClickFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/VideoInformation;" @@ -71,8 +71,9 @@ object VideoInformationPatch : BytecodePatch( listOf(ImmutableMethodParameter("J", null, "time")), "Z", AccessFlags.PUBLIC or AccessFlags.FINAL, - null, null, - MutableMethodImplementation(4) + null, + null, + MutableMethodImplementation(4), ).toMutable() // get enum type for the seek helper method @@ -86,7 +87,7 @@ object VideoInformationPatch : BytecodePatch( invoke-virtual {p0, p1, p2, v0}, ${seekFingerprintResultMethod.definingClass}->${seekFingerprintResultMethod.name}(J$seekSourceEnumType)Z move-result p1 return p1 - """ + """, ) // add the seekTo method to the class for the integrations to call @@ -103,7 +104,7 @@ object VideoInformationPatch : BytecodePatch( addInstruction( videoLengthMethodResult.scanResult.patternScanResult!!.endIndex, - "invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, $INTEGRATIONS_CLASS_DESCRIPTOR->setVideoLength(J)V" + "invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, $INTEGRATIONS_CLASS_DESCRIPTOR->setVideoLength(J)V", ) } } @@ -115,11 +116,13 @@ object VideoInformationPatch : BytecodePatch( VideoIdPatch.hookVideoId(videoIdMethodDescriptor) VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor) VideoIdPatch.hookPlayerResponseVideoId( - "$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V") + "$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V", + ) // Call before any other video id hooks, // so they can use VideoInformation and check if the video id is for a Short. PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.ProtoBufferParameterBeforeVideoId( - "$INTEGRATIONS_CLASS_DESCRIPTOR->newPlayerResponseSignature(Ljava/lang/String;Z)Ljava/lang/String;") + "$INTEGRATIONS_CLASS_DESCRIPTOR->newPlayerResponseSignature(Ljava/lang/String;Z)Ljava/lang/String;", + ) /* * Set the video time method @@ -177,7 +180,7 @@ object VideoInformationPatch : BytecodePatch( playerInitMethod.insert( playerInitInsertIndex++, "v0", - "$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V" + "$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V", ) /** @@ -190,7 +193,7 @@ object VideoInformationPatch : BytecodePatch( internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) = timeMethod.insertTimeHook( timeInitInsertIndex++, - "$targetMethodClass->$targetMethodName(J)V" + "$targetMethodClass->$targetMethodName(J)V", ) private fun getReference(instructions: List, offset: Int, opcode: Opcode) = @@ -203,6 +206,6 @@ object VideoInformationPatch : BytecodePatch( internal fun userSelectedPlaybackSpeedHook(targetMethodClass: String, targetMethodName: String) = speedSelectionInsertMethod.addInstruction( speedSelectionInsertIndex++, - "invoke-static {v$speedSelectionValueRegister}, $targetMethodClass->$targetMethodName(F)V" + "invoke-static {v$speedSelectionValueRegister}, $targetMethodClass->$targetMethodName(F)V", ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/CreateVideoPlayerSeekbarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/CreateVideoPlayerSeekbarFingerprint.kt index 6c16caf53f..a40275ad08 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/CreateVideoPlayerSeekbarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/CreateVideoPlayerSeekbarFingerprint.kt @@ -1,9 +1,8 @@ package app.revanced.patches.youtube.video.information.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object CreateVideoPlayerSeekbarFingerprint : MethodFingerprint( "V", - strings = listOf("timed_markers_width") -) \ No newline at end of file + strings = listOf("timed_markers_width"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/OnPlaybackSpeedItemClickFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/OnPlaybackSpeedItemClickFingerprint.kt index 249d659b91..1ad3af2a7a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/OnPlaybackSpeedItemClickFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/OnPlaybackSpeedItemClickFingerprint.kt @@ -14,7 +14,7 @@ internal object OnPlaybackSpeedItemClickFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> methodDef.name == "onItemClick" && methodDef.implementation?.instructions?.find { it.opcode == Opcode.IGET_OBJECT && - it.getReference()!!.type == "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;" + it.getReference()!!.type == "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;" } != null - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerControllerSetTimeReferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerControllerSetTimeReferenceFingerprint.kt index 220e8f999b..01329643a7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerControllerSetTimeReferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerControllerSetTimeReferenceFingerprint.kt @@ -1,11 +1,9 @@ package app.revanced.patches.youtube.video.information.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint - import com.android.tools.smali.dexlib2.Opcode internal object PlayerControllerSetTimeReferenceFingerprint : MethodFingerprint( opcodes = listOf(Opcode.INVOKE_DIRECT_RANGE, Opcode.IGET_OBJECT), - strings = listOf("Media progress reported outside media playback: ") -) \ No newline at end of file + strings = listOf("Media progress reported outside media playback: "), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerInitFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerInitFingerprint.kt index e5b4835dc3..f80ff10851 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerInitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/PlayerInitFingerprint.kt @@ -1,10 +1,9 @@ package app.revanced.patches.youtube.video.information.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object PlayerInitFingerprint : MethodFingerprint( strings = listOf( - "playVideo called on player response with no videoStreamingData." + "playVideo called on player response with no videoStreamingData.", ), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/SeekFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/SeekFingerprint.kt index 5747810e52..3fe26e7b11 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/SeekFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/SeekFingerprint.kt @@ -1,8 +1,7 @@ package app.revanced.patches.youtube.video.information.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint internal object SeekFingerprint : MethodFingerprint( - strings = listOf("Attempting to seek during an ad") -) \ No newline at end of file + strings = listOf("Attempting to seek during an ad"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/VideoLengthFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/VideoLengthFingerprint.kt index 20fde9692c..11e9864b5a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/VideoLengthFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/fingerprints/VideoLengthFingerprint.kt @@ -1,8 +1,6 @@ package app.revanced.patches.youtube.video.information.fingerprints - import app.revanced.patcher.fingerprint.MethodFingerprint - import com.android.tools.smali.dexlib2.Opcode internal object VideoLengthFingerprint : MethodFingerprint( @@ -18,6 +16,6 @@ internal object VideoLengthFingerprint : MethodFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_WIDE, Opcode.CONST_4, - Opcode.INVOKE_VIRTUAL - ) -) \ No newline at end of file + Opcode.INVOKE_VIRTUAL, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt index 135779eec2..68dbd670d4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.video.playerresponse -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -9,6 +8,7 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.video.playerresponse.fingerprint.PlayerParameterBuilderFingerprint +import app.revanced.util.exception import java.io.Closeable @Patch( @@ -41,7 +41,8 @@ object PlayerResponseMethodHookPatch : override fun close() { fun hookVideoId(hook: Hook) { playerResponseMethod.addInstruction( - 0, "invoke-static {v$REGISTER_VIDEO_ID, v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING}, $hook" + 0, + "invoke-static {v$REGISTER_VIDEO_ID, v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING}, $hook", ) numberOfInstructionsAdded++ } @@ -52,7 +53,7 @@ object PlayerResponseMethodHookPatch : """ invoke-static {v$REGISTER_PROTO_BUFFER, v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING}, $hook move-result-object v$REGISTER_PROTO_BUFFER - """ + """, ) numberOfInstructionsAdded += 2 } @@ -70,7 +71,8 @@ object PlayerResponseMethodHookPatch : // On some app targets the method has too many registers pushing the parameters past v15. // Move the parameters to 4-bit registers so they can be passed to integrations. playerResponseMethod.addInstructions( - 0, """ + 0, + """ move-object/from16 v$REGISTER_VIDEO_ID, p$PARAMETER_VIDEO_ID move-object/from16 v$REGISTER_PROTO_BUFFER, p$PARAMETER_PROTO_BUFFER move/from16 v$REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING, p$PARAMETER_IS_SHORT_AND_OPENING_OR_PLAYING @@ -81,7 +83,7 @@ object PlayerResponseMethodHookPatch : // Move the modified register back. playerResponseMethod.addInstruction( numberOfInstructionsAdded, - "move-object/from16 p$PARAMETER_PROTO_BUFFER, v$REGISTER_PROTO_BUFFER" + "move-object/from16 p$PARAMETER_PROTO_BUFFER, v$REGISTER_PROTO_BUFFER", ) } @@ -94,4 +96,3 @@ object PlayerResponseMethodHookPatch : override fun toString() = methodDescriptor } } - diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt index 2694940fd6..e0c723ef41 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt @@ -20,6 +20,6 @@ internal object PlayerParameterBuilderFingerprint : MethodFingerprint( "L", "Z", // Appears to indicate if the video id is being opened or is currently playing. "Z", - "Z" - ) -) \ No newline at end of file + "Z", + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt index 160e81df76..16dab1f43d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt @@ -30,29 +30,30 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference IntegrationsPatch::class, VideoInformationPatch::class, SettingsPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.48.39", "18.49.37", "19.01.34", "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object RememberVideoQualityPatch : BytecodePatch( setOf( VideoQualitySetterFingerprint, VideoQualityItemOnClickParentFingerprint, - NewVideoQualityChangedFingerprint - ) + NewVideoQualityChangedFingerprint, + ), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/playback/quality/RememberVideoQualityPatch;" @@ -66,14 +67,14 @@ object RememberVideoQualityPatch : BytecodePatch( key = "revanced_video_quality_default_wifi", summaryKey = null, entriesKey = "revanced_video_quality_default_entries", - entryValuesKey = "revanced_video_quality_default_entry_values" + entryValuesKey = "revanced_video_quality_default_entry_values", ), ListPreference( key = "revanced_video_quality_default_mobile", summaryKey = null, entriesKey = "revanced_video_quality_default_entries", - entryValuesKey = "revanced_video_quality_default_entry_values" - ) + entryValuesKey = "revanced_video_quality_default_entry_values", + ), ) /* @@ -85,11 +86,11 @@ object RememberVideoQualityPatch : BytecodePatch( */ VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted") - // Inject a call to set the remembered quality once a video loads. VideoQualitySetterFingerprint.result?.also { - if (!SetQualityByIndexMethodClassFieldReferenceFingerprint.resolve(context, it.classDef)) + if (!SetQualityByIndexMethodClassFieldReferenceFingerprint.resolve(context, it.classDef)) { throw PatchException("Could not resolve fingerprint to find setQualityByIndex method") + } }?.let { // This instruction refers to the field with the type that contains the setQualityByIndex method. val instructions = SetQualityByIndexMethodClassFieldReferenceFingerprint.result!! @@ -132,7 +133,6 @@ object RememberVideoQualityPatch : BytecodePatch( ) } ?: throw VideoQualitySetterFingerprint.exception - // Inject a call to remember the selected quality. VideoQualityItemOnClickParentFingerprint.result?.let { val onItemClickMethod = it.mutableClass.methods.find { method -> method.name == "onItemClick" } @@ -142,12 +142,11 @@ object RememberVideoQualityPatch : BytecodePatch( addInstruction( 0, - "invoke-static {p$listItemIndexParameter}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQuality(I)V" + "invoke-static {p$listItemIndexParameter}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQuality(I)V", ) } ?: throw PatchException("Failed to find onItemClick method") } ?: throw VideoQualityItemOnClickParentFingerprint.exception - // Remember video quality if not using old layout menu. NewVideoQualityChangedFingerprint.result?.apply { mutableMethod.apply { @@ -156,7 +155,7 @@ object RememberVideoQualityPatch : BytecodePatch( addInstruction( index + 1, - "invoke-static {v$qualityRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQualityInNewFlyout(I)V" + "invoke-static {v$qualityRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQualityInNewFlyout(I)V", ) } } ?: throw NewVideoQualityChangedFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/NewVideoQualityChangedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/NewVideoQualityChangedFingerprint.kt index f0fc4e9e38..2a5ccb1985 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/NewVideoQualityChangedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/NewVideoQualityChangedFingerprint.kt @@ -10,7 +10,7 @@ internal object NewVideoQualityChangedFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("L"), opcodes = listOf( - Opcode.IGET, // Video resolution (human readable). + Opcode.IGET, // Video resolution (human readable). Opcode.IGET_OBJECT, Opcode.IGET_BOOLEAN, Opcode.IGET_OBJECT, @@ -28,5 +28,5 @@ internal object NewVideoQualityChangedFingerprint : MethodFingerprint( Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, Opcode.IGET, - ) + ), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/SetQualityByIndexMethodClassFieldReferenceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/SetQualityByIndexMethodClassFieldReferenceFingerprint.kt index a6aa1e0427..aa8cf06ea8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/SetQualityByIndexMethodClassFieldReferenceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/SetQualityByIndexMethodClassFieldReferenceFingerprint.kt @@ -13,5 +13,5 @@ internal object SetQualityByIndexMethodClassFieldReferenceFingerprint : MethodFi Opcode.IGET_OBJECT, Opcode.IPUT_OBJECT, Opcode.IGET_OBJECT, - ) -) \ No newline at end of file + ), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualityItemOnClickParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualityItemOnClickParentFingerprint.kt index 09eb677ea0..9aeff56479 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualityItemOnClickParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualityItemOnClickParentFingerprint.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object VideoQualityItemOnClickParentFingerprint : MethodFingerprint( "V", - strings = listOf("VIDEO_QUALITIES_MENU_BOTTOM_SHEET_FRAGMENT") -) \ No newline at end of file + strings = listOf("VIDEO_QUALITIES_MENU_BOTTOM_SHEET_FRAGMENT"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualitySetterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualitySetterFingerprint.kt index 7db5b19f17..a03bcae95a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualitySetterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/fingerprints/VideoQualitySetterFingerprint.kt @@ -18,4 +18,4 @@ internal object VideoQualitySetterFingerprint : MethodFingerprint( Opcode.IPUT_BOOLEAN, ), strings = listOf("menu_item_video_quality"), -) \ No newline at end of file +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt index 061207c085..cd98b4f839 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt @@ -35,16 +35,16 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableField SettingsPatch::class, RecyclerViewTreeHookPatch::class, CustomPlaybackSpeedResourcePatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) object CustomPlaybackSpeedPatch : BytecodePatch( setOf( SpeedArrayGeneratorFingerprint, SpeedLimiterFingerprint, GetOldPlaybackSpeedsFingerprint, - ShowOldPlaybackSpeedMenuIntegrationsFingerprint - ) + ShowOldPlaybackSpeedMenuIntegrationsFingerprint, + ), ) { private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/PlaybackSpeedMenuFilterPatch;" @@ -56,7 +56,7 @@ object CustomPlaybackSpeedPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.VIDEO.addPreferences( - TextPreference("revanced_custom_playback_speeds", inputType = InputType.TEXT_MULTI_LINE) + TextPreference("revanced_custom_playback_speeds", inputType = InputType.TEXT_MULTI_LINE), ) val arrayGenMethod = SpeedArrayGeneratorFingerprint.result?.mutableMethod!! @@ -72,7 +72,7 @@ object CustomPlaybackSpeedPatch : BytecodePatch( arrayGenMethod.replaceInstruction( sizeCallIndex + 1, - "const/4 v$sizeCallResultRegister, 0x0" + "const/4 v$sizeCallResultRegister, 0x0", ) val (arrayLengthConstIndex, arrayLengthConst) = arrayGenMethodImpl.instructions.withIndex() @@ -87,21 +87,21 @@ object CustomPlaybackSpeedPatch : BytecodePatch( """ sget-object v$arrayLengthConstDestination, $playbackSpeedsArrayType array-length v$arrayLengthConstDestination, v$arrayLengthConstDestination - """ + """, ) val (originalArrayFetchIndex, originalArrayFetch) = arrayGenMethodImpl.instructions.withIndex() .first { val reference = ((it.value as? ReferenceInstruction)?.reference as? FieldReference) reference?.definingClass?.contains("PlayerConfigModel") ?: false && - reference?.type == "[F" + reference?.type == "[F" } val originalArrayFetchDestination = (originalArrayFetch as OneRegisterInstruction).registerA arrayGenMethod.replaceInstruction( originalArrayFetchIndex, - "sget-object v$originalArrayFetchDestination, $playbackSpeedsArrayType" + "sget-object v$originalArrayFetchDestination, $playbackSpeedsArrayType", ) val limiterMethod = SpeedLimiterFingerprint.result?.mutableMethod!! @@ -119,11 +119,11 @@ object CustomPlaybackSpeedPatch : BytecodePatch( limiterMethod.replaceInstruction( limiterMinConstIndex, - "const/high16 v$limiterMinConstDestination, 0x0" + "const/high16 v$limiterMinConstDestination, 0x0", ) limiterMethod.replaceInstruction( limiterMaxConstIndex, - "const/high16 v$limiterMaxConstDestination, 0x41200000 # 10.0f" + "const/high16 v$limiterMaxConstDestination, 0x41200000 # 10.0f", ) // region Force old video quality menu. @@ -144,7 +144,7 @@ object CustomPlaybackSpeedPatch : BytecodePatch( AccessFlags.PUBLIC or AccessFlags.STATIC, null, null, - null + null, ).toMutable() result.mutableClass.staticFields.add(instanceField) @@ -155,8 +155,9 @@ object CustomPlaybackSpeedPatch : BytecodePatch( // Get the "showOldPlaybackSpeedMenu" method. // This is later called on the field INSTANCE. val showOldPlaybackSpeedMenuMethod = ShowOldPlaybackSpeedMenuFingerprint.also { - if (!it.resolve(context, result.classDef)) + if (!it.resolve(context, result.classDef)) { throw ShowOldPlaybackSpeedMenuFingerprint.exception + } }.result!!.method.toString() // Insert the call to the "showOldPlaybackSpeedMenu" method on the field INSTANCE. @@ -169,7 +170,7 @@ object CustomPlaybackSpeedPatch : BytecodePatch( return-void :not_null invoke-virtual { v0 }, $showOldPlaybackSpeedMenuMethod - """ + """, ) } ?: throw ShowOldPlaybackSpeedMenuIntegrationsFingerprint.exception } ?: throw GetOldPlaybackSpeedsFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt index 2fc51faaa8..ae4f1a0a12 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt @@ -12,4 +12,4 @@ internal object CustomPlaybackSpeedResourcePatch : ResourcePatch() { it.type == "string" && it.name == "varispeed_unavailable_message" }.id } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/GetOldPlaybackSpeedsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/GetOldPlaybackSpeedsFingerprint.kt index d5e3760c74..7c2ce1c1c7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/GetOldPlaybackSpeedsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/GetOldPlaybackSpeedsFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object GetOldPlaybackSpeedsFingerprint : MethodFingerprint( parameters = listOf("[L", "I"), - strings = listOf("menu_item_playback_speed") + strings = listOf("menu_item_playback_speed"), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt index f893eb9043..fff78fbb4c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuFingerprint.kt @@ -6,5 +6,5 @@ import app.revanced.util.patch.LiteralValueFingerprint internal object ShowOldPlaybackSpeedMenuFingerprint : LiteralValueFingerprint( literalSupplier = { CustomPlaybackSpeedResourcePatch.speedUnavailableId - } + }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuIntegrationsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuIntegrationsFingerprint.kt index 161acc21bf..e869775ba1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuIntegrationsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/ShowOldPlaybackSpeedMenuIntegrationsFingerprint.kt @@ -3,5 +3,5 @@ package app.revanced.patches.youtube.video.speed.custom.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint internal object ShowOldPlaybackSpeedMenuIntegrationsFingerprint : MethodFingerprint( - customFingerprint = { method, _ -> method.name == "showOldPlaybackSpeedMenu" } + customFingerprint = { method, _ -> method.name == "showOldPlaybackSpeedMenu" }, ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/SpeedArrayGeneratorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/SpeedArrayGeneratorFingerprint.kt index 5dac958d64..a455607b1b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/SpeedArrayGeneratorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/fingerprints/SpeedArrayGeneratorFingerprint.kt @@ -17,5 +17,5 @@ internal object SpeedArrayGeneratorFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IGET_OBJECT, ), - strings = listOf("0.0#") + strings = listOf("0.0#"), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt index cc30d0de4c..112dddd1a9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt @@ -23,11 +23,11 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction SettingsPatch::class, VideoInformationPatch::class, CustomPlaybackSpeedPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) object RememberPlaybackSpeedPatch : BytecodePatch( - setOf(InitializePlaybackSpeedValuesFingerprint) + setOf(InitializePlaybackSpeedValuesFingerprint), ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/playback/speed/RememberPlaybackSpeedPatch;" @@ -42,13 +42,14 @@ object RememberPlaybackSpeedPatch : BytecodePatch( summaryKey = null, // Entries and values are set by Integrations code based on the actual speeds available. entriesKey = null, - entryValuesKey = null - ) + entryValuesKey = null, + ), ) VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted") VideoInformationPatch.userSelectedPlaybackSpeedHook( - INTEGRATIONS_CLASS_DESCRIPTOR, "userSelectedPlaybackSpeed" + INTEGRATIONS_CLASS_DESCRIPTOR, + "userSelectedPlaybackSpeed", ) /* @@ -83,7 +84,7 @@ object RememberPlaybackSpeedPatch : BytecodePatch( # Invoke setPlaybackSpeed on that class. invoke-virtual {v2, v0}, ${VideoInformationPatch.setPlaybackSpeedMethodReference} """.trimIndent(), - ExternalLabel("do_not_override", mutableMethod.getInstruction(0)) + ExternalLabel("do_not_override", mutableMethod.getInstruction(0)), ) } ?: throw InitializePlaybackSpeedValuesFingerprint.exception } diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/fingerprint/InitializePlaybackSpeedValuesFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/fingerprint/InitializePlaybackSpeedValuesFingerprint.kt index 44dfac7466..443d30135a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/fingerprint/InitializePlaybackSpeedValuesFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/fingerprint/InitializePlaybackSpeedValuesFingerprint.kt @@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.MethodFingerprint internal object InitializePlaybackSpeedValuesFingerprint : MethodFingerprint( parameters = listOf("[L", "I"), - strings = listOf("menu_item_playback_speed") -) \ No newline at end of file + strings = listOf("menu_item_playback_speed"), +) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt index efe99d7afd..53c2c626cd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt @@ -22,8 +22,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction object VideoIdPatch : BytecodePatch( setOf( VideoIdFingerprint, - VideoIdFingerprintBackgroundPlay - ) + VideoIdFingerprintBackgroundPlay, + ), ) { private var videoIdRegister = 0 private var videoIdInsertIndex = 0 @@ -34,7 +34,6 @@ object VideoIdPatch : BytecodePatch( private lateinit var backgroundPlaybackMethod: MutableMethod override fun execute(context: BytecodeContext) { - /** * Supplies the method and register index of the video id register. * @@ -47,7 +46,6 @@ object VideoIdPatch : BytecodePatch( val videoIdRegister = it.getInstruction(videoIdRegisterIndex).registerA val insertIndex = videoIdRegisterIndex + 1 consumer(it, insertIndex, videoIdRegister) - } } ?: throw exception @@ -76,10 +74,10 @@ object VideoIdPatch : BytecodePatch( * @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;` */ fun hookVideoId( - methodDescriptor: String + methodDescriptor: String, ) = videoIdMethod.addInstruction( videoIdInsertIndex++, - "invoke-static {v$videoIdRegister}, $methodDescriptor" + "invoke-static {v$videoIdRegister}, $methodDescriptor", ) /** @@ -93,10 +91,10 @@ object VideoIdPatch : BytecodePatch( * @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;` */ fun hookBackgroundPlayVideoId( - methodDescriptor: String + methodDescriptor: String, ) = backgroundPlaybackMethod.addInstruction( backgroundPlaybackInsertIndex++, // move-result-object offset - "invoke-static {v$backgroundPlaybackVideoIdRegister}, $methodDescriptor" + "invoke-static {v$backgroundPlaybackVideoIdRegister}, $methodDescriptor", ) /** @@ -124,8 +122,7 @@ object VideoIdPatch : BytecodePatch( */ fun hookPlayerResponseVideoId(methodDescriptor: String) { PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.VideoId( - methodDescriptor + methodDescriptor, ) } } - diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt index a01b2ebdcc..a4c43225b9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/fingerprint/VideoIdFingerprint.kt @@ -18,5 +18,5 @@ internal object VideoIdFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, - ) + ), ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt index e45d309521..d9363c615e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt @@ -19,7 +19,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction IntegrationsPatch::class, RestoreOldVideoQualityMenuResourcePatch::class, LithoFilterPatch::class, - RecyclerViewTreeHookPatch::class + RecyclerViewTreeHookPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -37,20 +37,20 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37" - ] - ) - ] + "19.04.37", + ], + ), + ], ) @Suppress("unused") object RestoreOldVideoQualityMenuPatch : BytecodePatch( - setOf(VideoQualityMenuViewInflateFingerprint) + setOf(VideoQualityMenuViewInflateFingerprint), ) { private const val FILTER_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/components/VideoQualityMenuFilterPatch;" + "Lapp/revanced/integrations/youtube/patches/components/VideoQualityMenuFilterPatch;" private const val INTEGRATIONS_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/playback/quality/RestoreOldVideoQualityMenuPatch;" + "Lapp/revanced/integrations/youtube/patches/playback/quality/RestoreOldVideoQualityMenuPatch;" override fun execute(context: BytecodeContext) { // region Patch for the old type of the video quality menu. @@ -64,8 +64,8 @@ object RestoreOldVideoQualityMenuPatch : BytecodePatch( addInstruction( checkCastIndex + 1, "invoke-static { v$listViewRegister }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->" + - "showOldVideoQualityMenu(Landroid/widget/ListView;)V" + "$INTEGRATIONS_CLASS_DESCRIPTOR->" + + "showOldVideoQualityMenu(Landroid/widget/ListView;)V", ) } } @@ -81,4 +81,4 @@ object RestoreOldVideoQualityMenuPatch : BytecodePatch( // endregion } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt index 7221e80b1d..67aebf0de4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt @@ -10,7 +10,7 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.youtube.misc.settings.SettingsPatch @Patch( - dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class] + dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class], ) object RestoreOldVideoQualityMenuResourcePatch : ResourcePatch() { internal var videoQualityBottomSheetListFragmentTitle = -1L @@ -19,7 +19,7 @@ object RestoreOldVideoQualityMenuResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.VIDEO.addPreferences( - SwitchPreference("revanced_restore_old_video_quality_menu") + SwitchPreference("revanced_restore_old_video_quality_menu"), ) fun findResource(name: String) = ResourceMappingPatch.resourceMappings.find { it.name == name }?.id diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuViewInflateFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuViewInflateFingerprint.kt index 20f18a3e41..d85e749875 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuViewInflateFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/fingerprints/VideoQualityMenuViewInflateFingerprint.kt @@ -24,7 +24,7 @@ internal object VideoQualityMenuViewInflateFingerprint : LiteralValueFingerprint Opcode.CONST, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST + Opcode.CHECK_CAST, ), - literalSupplier = { RestoreOldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle } -) \ No newline at end of file + literalSupplier = { RestoreOldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle }, +) diff --git a/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/HideAdsPatch.kt index 229a5b9a5f..cb50a129ec 100644 --- a/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/HideAdsPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtubevanced.ad.general -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -9,17 +8,18 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.shared.misc.fix.verticalscroll.VerticalScrollPatch import app.revanced.patches.youtubevanced.ad.general.fingerprints.ContainsAdFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c @Patch( name = "Hide ads", description = "Removes general ads.", dependencies = [VerticalScrollPatch::class], - compatiblePackages = [CompatiblePackage("com.vanced.android.youtube")] + compatiblePackages = [CompatiblePackage("com.vanced.android.youtube")], ) @Suppress("unused") object HideAdsPatch : BytecodePatch( - setOf(ContainsAdFingerprint) + setOf(ContainsAdFingerprint), ) { override fun execute(context: BytecodeContext) { ContainsAdFingerprint.result?.let { result -> @@ -40,14 +40,14 @@ object HideAdsPatch : BytecodePatch( "hero_promo_image", "statement_banner", "primetime_promo", - "carousel_footered_layout" + "carousel_footered_layout", ).forEach { component -> addInstructions( insertIndex, """ const-string v$adsListRegister, "$component" invoke-interface {v0, v$adsListRegister}, Ljava/util/List;->add(Ljava/lang/Object;)Z - """ + """, ) } } diff --git a/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/fingerprints/ContainsAdFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/fingerprints/ContainsAdFingerprint.kt index 75420f9429..3f6d060b31 100644 --- a/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/fingerprints/ContainsAdFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/fingerprints/ContainsAdFingerprint.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -internal object ContainsAdFingerprint: MethodFingerprint( +internal object ContainsAdFingerprint : MethodFingerprint( returnType = "Z", parameters = listOf("L", "L"), accessFlags = AccessFlags.STATIC or AccessFlags.PUBLIC, @@ -15,10 +15,10 @@ internal object ContainsAdFingerprint: MethodFingerprint( Opcode.CONST_STRING, Opcode.INVOKE_INTERFACE, Opcode.CONST_STRING, - Opcode.INVOKE_INTERFACE + Opcode.INVOKE_INTERFACE, ), strings = listOf("ads_video_with_context"), customFingerprint = { methodDef, _ -> methodDef.name == "containsAd" && methodDef.definingClass.endsWith("LithoAdRemoval;") - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/UnlockPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/UnlockPremiumPatch.kt index ef7768310a..e2c709704b 100644 --- a/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/UnlockPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/UnlockPremiumPatch.kt @@ -10,21 +10,21 @@ import app.revanced.patches.yuka.misc.unlockpremium.fingerprints.YukaUserConstru @Patch( name = "Unlock premium", - compatiblePackages = [CompatiblePackage("io.yuka.android", ["4.29"])] + compatiblePackages = [CompatiblePackage("io.yuka.android", ["4.29"])], ) @Suppress("unused") object UnlockPremiumPatch : BytecodePatch( - setOf(YukaUserConstructorFingerprint) + setOf(YukaUserConstructorFingerprint), ) { override fun execute(context: BytecodeContext) { - IsPremiumFingerprint.resolve(context,YukaUserConstructorFingerprint.result!!.classDef) + IsPremiumFingerprint.resolve(context, YukaUserConstructorFingerprint.result!!.classDef) val method = IsPremiumFingerprint.result!!.mutableMethod method.addInstructions( 0, """ const/4 v0, 0x1 return v0 - """ + """, ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/IsPremiumFingerprint.kt b/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/IsPremiumFingerprint.kt index 9659d92616..c664d8aa21 100644 --- a/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/IsPremiumFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/IsPremiumFingerprint.kt @@ -11,5 +11,5 @@ internal object IsPremiumFingerprint : MethodFingerprint( opcodes = listOf( Opcode.IGET_BOOLEAN, Opcode.RETURN, - ) + ), ) diff --git a/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/YukaUserConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/YukaUserConstructorFingerprint.kt index d93ca63c7d..20061bb1d7 100644 --- a/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/YukaUserConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/yuka/misc/unlockpremium/fingerprints/YukaUserConstructorFingerprint.kt @@ -8,6 +8,6 @@ internal object YukaUserConstructorFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, strings = listOf( - "premiumProvider" - ) + "premiumProvider", + ), ) diff --git a/src/main/kotlin/app/revanced/util/BytecodeUtils.kt b/src/main/kotlin/app/revanced/util/BytecodeUtils.kt index f47ae90df3..51dbd145e4 100644 --- a/src/main/kotlin/app/revanced/util/BytecodeUtils.kt +++ b/src/main/kotlin/app/revanced/util/BytecodeUtils.kt @@ -56,10 +56,10 @@ fun MutableMethod.injectHideViewCall( insertIndex: Int, viewRegister: Int, classDescriptor: String, - targetMethod: String + targetMethod: String, ) = addInstruction( insertIndex, - "invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V" + "invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V", ) /** @@ -127,27 +127,29 @@ inline fun Instruction.getReference() = (this as? Refere fun Method.indexOfFirstInstruction(predicate: Instruction.() -> Boolean) = this.implementation!!.instructions.indexOfFirst(predicate) - /** - * Return the resolved methods of [MethodFingerprint]s early. - */ - fun List.returnEarly(bool: Boolean = false) { - val const = if (bool) "0x1" else "0x0" - this.forEach { fingerprint -> - fingerprint.result?.let { result -> - val stringInstructions = when (result.method.returnType.first()) { - 'L' -> """ +/** + * Return the resolved methods of [MethodFingerprint]s early. + */ +fun List.returnEarly(bool: Boolean = false) { + val const = if (bool) "0x1" else "0x0" + this.forEach { fingerprint -> + fingerprint.result?.let { result -> + val stringInstructions = when (result.method.returnType.first()) { + 'L' -> + """ const/4 v0, $const return-object v0 """ - 'V' -> "return-void" - 'I', 'Z' -> """ + 'V' -> "return-void" + 'I', 'Z' -> + """ const/4 v0, $const return v0 """ - else -> throw Exception("This case should never happen.") - } + else -> throw Exception("This case should never happen.") + } - result.mutableMethod.addInstructions(0, stringInstructions) - } ?: throw fingerprint.exception - } + result.mutableMethod.addInstructions(0, stringInstructions) + } ?: throw fingerprint.exception } +} diff --git a/src/main/kotlin/app/revanced/util/microg/MicroGBytecodeHelper.kt b/src/main/kotlin/app/revanced/util/microg/MicroGBytecodeHelper.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/util/microg/MicroGResourceHelper.kt b/src/main/kotlin/app/revanced/util/microg/MicroGResourceHelper.kt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/kotlin/app/revanced/util/patch/LiteralValueFingerprint.kt b/src/main/kotlin/app/revanced/util/patch/LiteralValueFingerprint.kt index 6b1b67174e..bcfbda5dae 100644 --- a/src/main/kotlin/app/revanced/util/patch/LiteralValueFingerprint.kt +++ b/src/main/kotlin/app/revanced/util/patch/LiteralValueFingerprint.kt @@ -1,7 +1,7 @@ package app.revanced.util.patch -import app.revanced.util.containsWideLiteralInstructionValue import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.util.containsWideLiteralInstructionValue import com.android.tools.smali.dexlib2.Opcode /** @@ -21,7 +21,7 @@ abstract class LiteralValueFingerprint( opcodes: Iterable? = null, strings: Iterable? = null, // Has to be a supplier because the fingerprint is created before patches can set literals. - literalSupplier: () -> Long + literalSupplier: () -> Long, ) : MethodFingerprint( returnType = returnType, accessFlags = accessFlags, @@ -30,5 +30,5 @@ abstract class LiteralValueFingerprint( strings = strings, customFingerprint = { methodDef, _ -> methodDef.containsWideLiteralInstructionValue(literalSupplier()) - } -) \ No newline at end of file + }, +) diff --git a/src/main/kotlin/app/revanced/util/resource/ArrayResource.kt b/src/main/kotlin/app/revanced/util/resource/ArrayResource.kt index 190085bd54..e604925e51 100644 --- a/src/main/kotlin/app/revanced/util/resource/ArrayResource.kt +++ b/src/main/kotlin/app/revanced/util/resource/ArrayResource.kt @@ -20,9 +20,11 @@ class ArrayResource( setAttribute("name", name) items.forEach { item -> - appendChild(ownerDocument.createElement("item").also { itemNode -> - itemNode.textContent = item - }) + appendChild( + ownerDocument.createElement("item").also { itemNode -> + itemNode.textContent = item + }, + ) } } @@ -34,4 +36,4 @@ class ArrayResource( return ArrayResource(key, items) } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/util/resource/BaseResource.kt b/src/main/kotlin/app/revanced/util/resource/BaseResource.kt index 7093bffaf3..9dc8ca3e3a 100644 --- a/src/main/kotlin/app/revanced/util/resource/BaseResource.kt +++ b/src/main/kotlin/app/revanced/util/resource/BaseResource.kt @@ -12,7 +12,7 @@ import org.w3c.dom.Element @Suppress("MemberVisibilityCanBePrivate") abstract class BaseResource( val name: String, - val tag: String + val tag: String, ) { /** * Serialize resource element to XML. @@ -40,4 +40,4 @@ abstract class BaseResource( return name == other.name } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/util/resource/StringResource.kt b/src/main/kotlin/app/revanced/util/resource/StringResource.kt index c825d67598..61c7a81bc1 100644 --- a/src/main/kotlin/app/revanced/util/resource/StringResource.kt +++ b/src/main/kotlin/app/revanced/util/resource/StringResource.kt @@ -22,8 +22,9 @@ class StringResource( // if the string is un-formatted, explicitly add the formatted attribute if (!formatted) setAttribute("formatted", "false") - if (value.contains(Regex("(? Date: Mon, 4 Mar 2024 20:53:59 +0400 Subject: [PATCH 02/15] fix: do not use trailing commas --- .editorconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 2d6d258f47..50ba637ba3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,5 @@ [*.{kt,kts}] ktlint_code_style = intellij_idea -ktlint_standard_no-wildcard-imports = disabled \ No newline at end of file +ktlint_standard_no-wildcard-imports = disabled +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false \ No newline at end of file From ab0af3ec572251b3d8f2b4c699460ed29794ac57 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 4 Mar 2024 21:01:28 +0400 Subject: [PATCH 03/15] fix: organize imports --- .../hide/shorts/HideShortsComponentsPatch.kt | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index 3ce155ef55..cc0542bc7e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -8,7 +8,13 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.* +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.BottomNavigationBarFingerprint +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.CreateShortsButtonsFingerprint +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.ReelConstructorFingerprint +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.RenderBottomNavigationBarFingerprint +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.RenderBottomNavigationBarParentFingerprint +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.SetPivotBarVisibilityFingerprint +import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.SetPivotBarVisibilityParentFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch import app.revanced.util.exception @@ -25,7 +31,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction IntegrationsPatch::class, LithoFilterPatch::class, HideShortsComponentsResourcePatch::class, - ResourceMappingPatch::class, + ResourceMappingPatch::class ], compatiblePackages = [ CompatiblePackage( @@ -43,10 +49,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.02.39", "19.03.35", "19.03.36", - "19.04.37", - ], - ), - ], + "19.04.37" + ] + ) + ] ) @Suppress("unused") object HideShortsComponentsPatch : BytecodePatch( @@ -55,8 +61,8 @@ object HideShortsComponentsPatch : BytecodePatch( ReelConstructorFingerprint, BottomNavigationBarFingerprint, RenderBottomNavigationBarParentFingerprint, - SetPivotBarVisibilityParentFingerprint, - ), + SetPivotBarVisibilityParentFingerprint + ) ) { private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/ShortsFilter;" @@ -74,7 +80,7 @@ object HideShortsComponentsPatch : BytecodePatch( insertIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, - "hideShortsShelf", + "hideShortsShelf" ) } } // Do not throw an exception if not resolved. @@ -111,7 +117,7 @@ object HideShortsComponentsPatch : BytecodePatch( addInstruction( insertIndex, "sput-object v$viewRegister, $FILTER_CLASS_DESCRIPTOR->pivotBar:" + - "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;", + "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;" ) } } @@ -138,7 +144,7 @@ object HideShortsComponentsPatch : BytecodePatch( addInstruction( insertIndex, "invoke-static { v$viewRegister }, $FILTER_CLASS_DESCRIPTOR->" + - "hideNavigationBar(Landroid/view/View;)Landroid/view/View;", + "hideNavigationBar(Landroid/view/View;)Landroid/view/View;" ) } } ?: throw BottomNavigationBarFingerprint.exception @@ -149,7 +155,7 @@ object HideShortsComponentsPatch : BytecodePatch( private enum class ShortsButtons(private val resourceName: String, private val methodName: String) { COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"), REMIX("reel_dyn_remix", "hideShortsRemixButton"), - SHARE("reel_dyn_share", "hideShortsShareButton"), + SHARE("reel_dyn_share", "hideShortsShareButton") ; fun injectHideCall(method: MutableMethod) { From 6082bb67a2327c40bfdce2d8e0eb486173e4830a Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 4 Mar 2024 22:23:09 +0400 Subject: [PATCH 04/15] use JDK 17 language level --- .idea/misc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index e086a70c4e..f1854e4b53 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,5 +4,5 @@ - + \ No newline at end of file From fd1269fe7de97f7a9030b9ad656fb67a157208f2 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 4 Mar 2024 22:26:25 +0400 Subject: [PATCH 05/15] use Android style rules --- .editorconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 50ba637ba3..68dc752d0f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,4 @@ [*.{kt,kts}] -ktlint_code_style = intellij_idea +ktlint_code_style = android_studio ktlint_standard_no-wildcard-imports = disabled -ij_kotlin_allow_trailing_comma = false -ij_kotlin_allow_trailing_comma_on_call_site = false \ No newline at end of file +max_line_length = off \ No newline at end of file From 6835b4ca3efa3d0bc6ad59ae38702a159ba7d2a7 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 30 Mar 2024 20:44:18 +0400 Subject: [PATCH 06/15] fix(?): Use project kotlin style --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f13505f4ee..04ea7f7c80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true -kotlin.code.style = official +kotlin.code.style = auto # Use Project style setting. version = 4.5.0-dev.1 From f9c6747e339674c792f230b68f5fcaf0661d491b Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 30 Mar 2024 21:40:02 +0400 Subject: [PATCH 07/15] fix build --- api/revanced-patches.api | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/revanced-patches.api b/api/revanced-patches.api index 274be19883..1bdd4051be 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -950,8 +950,8 @@ public final class app/revanced/patches/strava/upselling/DisableSubscriptionSugg public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/ticktick/misc/themeunlock/UnlockProPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/ticktick/misc/themeunlock/UnlockProPatch; +public final class app/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/ticktick/misc/themeunlock/UnlockThemesPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } From d11feb179ea884d48ce8f3e5848655fc2d8c6427 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sun, 31 Mar 2024 23:22:19 +0400 Subject: [PATCH 08/15] fix: Use editor config settings that works with both Android Studio and Intellij --- .editorconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 68dc752d0f..20b04c8972 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ [*.{kt,kts}] -ktlint_code_style = android_studio -ktlint_standard_no-wildcard-imports = disabled +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_allow_trailing_comma = false max_line_length = off \ No newline at end of file From dbb2f3e0df7529e40517c5bc0351b4b62b6a7809 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sun, 31 Mar 2024 23:24:22 +0400 Subject: [PATCH 09/15] fix: Add ktlint gradle tasks --- build.gradle.kts | 1 + gradle/libs.versions.toml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 58308fbf48..b2e84b7f06 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { alias(libs.plugins.kotlin) + alias(libs.plugins.ktlint) alias(libs.plugins.binary.compatibility.validator) `maven-publish` signing diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a4c08e8987..279c277a1c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,7 @@ guava = "33.0.0-jre" gson = "2.10.1" binary-compatibility-validator = "0.14.0" kotlin = "1.9.22" +ktlint = "12.1.0" [libraries] revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" } @@ -15,3 +16,4 @@ gson = { module = "com.google.code.gson:gson", version.ref = "gson" } [plugins] binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } From 57012c0e587f54b023c6fa96df936a7065fa72c7 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sun, 31 Mar 2024 23:42:10 +0400 Subject: [PATCH 10/15] fix: Use ktlint settings to keep gradle task output consistent with Intellij / Android Studio plugin behavior --- .editorconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.editorconfig b/.editorconfig index 20b04c8972..545e573903 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,9 @@ [*.{kt,kts}] +# ktlint entries are for ktlint gradle task and ktlint Intellij / Android Studio plugin. +# Ignore all 'property not supported' warnings, these are correct. +ktlint_code_style = android_studio +ktlint_standard_no-wildcard-imports = disabled +ktlint_standard_discouraged-comment-location = disabled ij_kotlin_allow_trailing_comma_on_call_site = false ij_kotlin_allow_trailing_comma = false max_line_length = off \ No newline at end of file From e925ed6eb3aed14b553e8d5c63a7961b468da307 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sun, 31 Mar 2024 23:43:13 +0400 Subject: [PATCH 11/15] chore: Changes from gradle `ktlintformat` task --- build.gradle.kts | 5 +- .../generator/JsonPatchesFileGenerator.kt | 47 +-- .../kotlin/app/revanced/generator/Main.kt | 15 +- .../exportall/ExportAllActivitiesPatch.kt | 2 +- .../connectivity/wifi/spoof/SpoofWifiPatch.kt | 67 ++-- .../gestures/PredictiveBackGesturePatch.kt | 2 +- .../debugging/EnableAndroidDebuggingPatch.kt | 2 +- .../OverrideCertificatePinningPatch.kt | 6 +- .../packagename/ChangePackageNamePatch.kt | 8 +- .../all/misc/resources/AddResourcesPatch.kt | 18 +- .../BaseTransformInstructionsPatch.kt | 32 +- .../all/misc/transformation/MethodCall.kt | 38 +-- .../RemoveCaptureRestrictionPatch.kt | 19 +- .../RemoveScreenshotRestrictionPatch.kt | 28 +- .../sim/spoof/SpoofSimCountryPatch.kt | 46 +-- .../backdrops/misc/pro/ProUnlockPatch.kt | 6 +- .../pro/fingerprints/ProUnlockFingerprint.kt | 7 +- .../patches/candylinkvpn/UnlockProPatch.kt | 6 +- .../IsPremiumPurchasedFingerprint.kt | 2 +- .../root/BypassRootChecksPatch.kt | 4 +- .../root/fingerprints/CheckRootFingerprint.kt | 2 +- .../facebook/ads/story/HideStoryAdsPatch.kt | 4 +- .../fingerprints/FieldMethodFingerprint.kt | 11 +- .../bootloader/BootloaderDetectionPatch.kt | 6 +- .../fingerprints/BootStateFingerprint.kt | 7 +- .../fingerprints/CreateKeyFingerprint.kt | 2 +- .../detection/root/RootDetectionPatch.kt | 6 +- .../fingerprints/RootDetectionFingerprint.kt | 7 +- .../restrictions/RemoveDeviceRestrictions.kt | 4 +- .../OnApplicationCreateFingerprint.kt | 2 +- .../patches/hexeditor/ad/DisableAdsPatch.kt | 15 +- .../ad/fingerprints/PrimaryAdsFingerprint.kt | 2 +- .../iconpackstudio/misc/pro/UnlockProPatch.kt | 6 +- .../pro/fingerprints/CheckProFingerprint.kt | 2 +- .../detection/root/RootDetectionPatch.kt | 15 +- .../AttestationSupportedCheckFingerprint.kt | 2 +- .../BootloaderCheckFingerprint.kt | 2 +- .../root/fingerprints/RootCheckFingerprint.kt | 2 +- .../signature/SpoofSignaturePatch.kt | 6 +- .../fingerprints/SpoofSignatureFingerprint.kt | 2 +- .../patches/inshorts/ad/HideAdsPatch.kt | 6 +- .../ad/fingerprints/InshortsAdsFingerprint.kt | 2 +- .../ads/timeline/HideTimelineAdsPatch.kt | 8 +- .../fingerprints/IsAdCheckOneFingerprint.kt | 7 +- .../fingerprints/IsAdCheckTwoFingerprint.kt | 7 +- .../fingerprints/ShowAdFingerprint.kt | 7 +- .../patches/irplus/ad/RemoveAdsPatch.kt | 4 +- .../ad/fingerprints/IrplusAdsFingerprint.kt | 2 +- .../misc/login/DisableMandatoryLoginPatch.kt | 4 +- .../fingerprints/IsLoggedInFingerprint.kt | 7 +- .../misc/premium/UnlockPremiumPatch.kt | 4 +- .../fingerprints/HasPurchasedFingerprint.kt | 7 +- .../license/LicenseValidationPatch.kt | 4 +- .../LicenseValidationFingerprint.kt | 7 +- .../signature/SignatureVerificationPatch.kt | 4 +- .../VerifySignatureFingerprint.kt | 7 +- .../misc/pro/UnlockProVersionPatch.kt | 14 +- .../fingerprints/IsFreeVersionFingerprint.kt | 7 +- .../fingerprints/LoadInboxAdsFingerprint.kt | 7 +- .../ads/inbox/patch/HideInboxAdsPatch.kt | 4 +- .../SendTypingIndicatorFingerprint.kt | 11 +- ...itchMessangeInputEmojiButtonFingerprint.kt | 7 +- .../DisableSwitchingEmojiToStickerPatch.kt | 6 +- .../patch/DisableTypingIndicatorPatch.kt | 4 +- .../misc/locale/ForceEnglishLocalePatch.kt | 6 +- .../SyncBluetoothLanguageFingerprint.kt | 2 +- .../mifitness/misc/login/FixLoginPatch.kt | 6 +- ...omiAccountManagerConstructorFingerprint.kt | 7 +- .../patches/moneymanager/UnlockProPatch.kt | 6 +- .../fingerprints/UnlockProFingerprint.kt | 7 +- .../music/ad/video/HideMusicVideoAds.kt | 13 +- .../ShowMusicVideoAdsParentFingerprint.kt | 7 +- .../music/audio/codecs/CodecsUnlockPatch.kt | 23 +- .../AllCodecsReferenceFingerprint.kt | 4 +- .../fingerprints/CodecsLockFingerprint.kt | 7 +- .../EnableExclusiveAudioPlayback.kt | 6 +- .../AllowExclusiveAudioPlaybackFingerprint.kt | 4 +- .../permanentrepeat/PermanentRepeatPatch.kt | 6 +- .../fingerprints/RepeatTrackFingerprint.kt | 4 +- .../permanentshuffle/PermanentShufflePatch.kt | 7 +- .../fingerprints/DisableShuffleFingerprint.kt | 4 +- .../layout/compactheader/HideCategoryBar.kt | 8 +- .../ConstructCategoryBarFingerprint.kt | 4 +- .../MinimizedPlaybackPatch.kt | 10 +- .../BackgroundPlaybackDisableFingerprint.kt | 4 +- ...izedPlaybackPolicyControllerFingerprint.kt | 4 +- .../layout/premium/HideGetPremiumPatch.kt | 8 +- .../fingerprints/HideGetPremiumFingerprint.kt | 4 +- .../upgradebutton/RemoveUpgradeButtonPatch.kt | 22 +- .../PivotBarConstructorFingerprint.kt | 4 +- .../BypassCertificateChecksPatch.kt | 4 +- .../CheckCertificateFingerprint.kt | 2 +- .../music/misc/gms/GmsCoreSupportPatch.kt | 12 +- .../misc/gms/GmsCoreSupportResourcePatch.kt | 2 +- .../CastDynamiteModuleFingerprint.kt | 2 +- .../CastDynamiteModuleV2Fingerprint.kt | 2 +- .../GooglePlayUtilityFingerprint.kt | 7 +- .../fingerprints/PrimeMethodFingerprint.kt | 2 +- .../fingerprints/ServiceCheckFingerprint.kt | 2 +- .../misc/integrations/IntegrationsPatch.kt | 2 +- .../ApplicationInitFingerprint.kt | 7 +- .../backgroundplay/BackgroundPlayPatch.kt | 3 +- .../myexpenses/misc/pro/UnlockProPatch.kt | 13 +- .../pro/fingerprints/IsEnabledFingerprint.kt | 2 +- .../patches/myfitnesspal/ads/HideAdsPatch.kt | 8 +- .../IsPremiumUseCaseImplFingerprint.kt | 2 +- ...avigateToNativePremiumUpsellFingerprint.kt | 2 +- .../RemoveBroadcastsRestrictionPatch.kt | 2 +- .../nfctoolsse/misc/pro/UnlockProPatch.kt | 15 +- .../IsLicenseRegisteredFingerprint.kt | 2 +- .../patches/nyx/misc/pro/UnlockProPatch.kt | 13 +- .../pro/fingerprints/CheckProFingerprint.kt | 2 +- .../misc/fix/crash/FixCrashPatch.kt | 81 ++--- .../crash/fingerprints/SetPlaceFingerprint.kt | 2 +- .../detection/deviceid/SpoofDeviceIdPatch.kt | 15 +- .../fingerprints/GetDeviceIdFingerprint.kt | 2 +- .../signature/SignatureDetectionPatch.kt | 2 +- .../fingerprints/CheckSignatureFingerprint.kt | 12 +- .../misc/annoyances/HideUpdatePopupPatch.kt | 13 +- .../HideUpdatePopupFingerprint.kt | 7 +- .../unlock/bookpoint/EnableBookpointPatch.kt | 4 +- .../IsBookpointEnabledFingerprint.kt | 7 +- .../misc/unlock/plus/UnlockPlusPatch.kt | 15 +- .../fingerprints/IsPlusUnlockedFingerprint.kt | 7 +- .../patches/pixiv/ads/HideAdsPatch.kt | 4 +- .../fingerprints/IsNotPremiumFingerprint.kt | 2 +- .../reddit/ad/comments/HideCommentAdsPatch.kt | 13 +- .../fingerprints/HideCommentAdsFingerprint.kt | 7 +- .../patches/reddit/ad/general/HideAdsPatch.kt | 26 +- .../general/fingerprints/AdPostFingerprint.kt | 2 +- .../fingerprints/NewAdPostFingerprint.kt | 2 +- .../customclients/BaseSpoofClientPatch.kt | 11 +- .../patches/reddit/customclients/Constants.kt | 5 +- .../customclients/ads/BaseDisableAdsPatch.kt | 4 +- .../fingerprints/IsAdsEnabledFingerprint.kt | 2 +- .../baconreader/api/SpoofClientPatch.kt | 9 +- .../GetAuthorizationUrlFingerprint.kt | 2 +- .../fingerprints/GetClientIdFingerprint.kt | 2 +- .../fingerprints/RequestTokenFingerprint.kt | 2 +- .../boostforreddit/api/SpoofClientPatch.kt | 4 +- .../fingerprints/GetClientIdFingerprint.kt | 2 +- .../LoginActivityOnCreateFingerprint.kt | 7 +- .../infinityforreddit/api/SpoofClientPatch.kt | 33 +- .../api/fingerprints/APIUtilsFingerprint.kt | 2 +- .../subscription/UnlockSubscriptionPatch.kt | 6 +- .../BillingClientOnServiceConnected.kt | 2 +- .../StartSubscriptionActivityFingerprint.kt | 2 +- .../joeyforreddit/ads/DisableAdsPatch.kt | 4 +- .../fingerprints/IsAdFreeUserFingerprint.kt | 2 +- .../joeyforreddit/api/SpoofClientPatch.kt | 9 +- .../fingerprints/GetClientIdFingerprint.kt | 7 +- .../piracy/DisablePiracyDetectionPatch.kt | 2 +- .../PiracyDetectionFingerprint.kt | 7 +- .../redditisfun/api/SpoofClientPatch.kt | 11 +- .../fingerprints/BaseClientIdFingerprint.kt | 2 +- .../BasicAuthorizationFingerprint.kt | 2 +- .../BuildAuthorizationStringFingerprint.kt | 2 +- .../fingerprints/GetUserAgentFingerprint.kt | 4 +- .../relayforreddit/api/SpoofClientPatch.kt | 23 +- .../fingerprints/BaseClientIdFingerprint.kt | 2 +- .../RedditCheckDisableAPIFingerprint.kt | 2 +- .../SetRemoteConfigFingerprint.kt | 2 +- .../slide/api/SpoofClientPatch.kt | 4 +- .../fingerprints/GetClientIdFingerprint.kt | 2 +- .../syncforlemmy/ads/DisableAdsPatch.kt | 2 +- .../syncforreddit/ads/DisableAdsPatch.kt | 2 +- .../DisableSyncForLemmyBottomSheetPatch.kt | 4 +- .../MainActivityOnCreateFingerprint.kt | 2 +- .../syncforreddit/api/SpoofClientPatch.kt | 35 ++- .../GetAuthorizationStringFingerprint.kt | 2 +- .../fingerprints/GetBearerTokenFingerprint.kt | 2 +- .../fingerprints/ImgurImageAPIFingerprint.kt | 7 +- .../fingerprints/LoadBrowserURLFingerprint.kt | 2 +- .../PiracyDetectionFingerprint.kt | 7 +- .../syncforreddit/fix/slink/FixSLinksPatch.kt | 8 +- .../LinkHelperOpenLinkFingerprint.kt | 2 +- .../DisableScreenshotPopupPatch.kt | 2 +- .../DisableScreenshotPopupFingerprint.kt | 2 +- .../premiumicon/UnlockPremiumIconPatch.kt | 4 +- .../HasPremiumIconAccessFingerprint.kt | 2 +- .../tracking/url/SanitizeUrlQueryPatch.kt | 4 +- .../ShareLinkFormatterFingerprint.kt | 2 +- .../RemoveDebuggingDetectionPatch.kt | 6 +- .../DebuggingDetectionFingerprint.kt | 2 +- .../detection/root/RootDetectionPatch.kt | 4 +- .../fingerprints/RootDetectionFingerprint.kt | 2 +- .../CastContextFetchFingerprint.kt | 2 +- .../fix/verticalscroll/VerticalScrollPatch.kt | 4 +- .../CanScrollVerticallyFingerprint.kt | 7 +- .../misc/gms/BaseGmsCoreSupportPatch.kt | 295 +++++++++--------- .../gms/BaseGmsCoreSupportResourcePatch.kt | 22 +- .../fingerprints/GmsCoreSupportFingerprint.kt | 2 +- .../integrations/BaseIntegrationsPatch.kt | 19 +- .../misc/mapping/ResourceMappingPatch.kt | 2 +- .../settings/BaseSettingsResourcePatch.kt | 13 +- .../settings/preference/BasePreference.kt | 12 +- .../preference/BasePreferenceScreen.kt | 14 +- .../misc/settings/preference/InputType.kt | 2 +- .../settings/preference/IntentPreference.kt | 12 +- .../settings/preference/ListPreference.kt | 13 +- .../preference/NonInteractivePreference.kt | 8 +- .../settings/preference/PreferenceCategory.kt | 8 +- .../settings/preference/PreferenceScreen.kt | 9 +- .../misc/settings/preference/SummaryType.kt | 2 +- .../settings/preference/SwitchPreference.kt | 7 +- .../settings/preference/TextPreference.kt | 8 +- .../filesize/RemoveFileSizeLimitPatch.kt | 13 +- .../fingerprints/OnReadyFingerprint.kt | 7 +- .../patches/songpal/badge/BadgeTabPatch.kt | 6 +- .../badge/RemoveNotificationBadgePatch.kt | 2 +- .../fingerprints/CreateTabsFingerprint.kt | 2 +- .../ShowNotificationFingerprint.kt | 15 +- .../spotify/layout/theme/CustomThemePatch.kt | 12 +- .../spotify/lite/ondemand/OnDemandPatch.kt | 2 +- .../fingerprints/OnDemandFingerprint.kt | 7 +- .../spotify/navbar/PremiumNavbarTabPatch.kt | 15 +- .../navbar/PremiumNavbarTabResourcePatch.kt | 14 +- .../fingerprints/AddNavBarItemFingerprint.kt | 2 +- .../subscription/UnlockSubscriptionPatch.kt | 11 +- .../fingerprints/GetSubscribedFingerprint.kt | 2 +- .../DisableSubscriptionSuggestionsPatch.kt | 67 ++-- .../fingerprints/GetModulesFingerprint.kt | 2 +- .../misc/themeunlock/UnlockThemesPatch.kt | 4 +- .../CheckLockedThemesFingerprint.kt | 2 +- .../fingerprints/SetThemeFingerprint.kt | 2 +- .../tiktok/feedfilter/FeedFilterPatch.kt | 13 +- .../FeedApiServiceLIZFingerprint.kt | 2 +- .../cleardisplay/RememberClearDisplayPatch.kt | 12 +- .../OnClearDisplayEventFingerprint.kt | 2 +- .../OnRenderFirstFrameFingerprint.kt | 2 +- .../interaction/downloads/DownloadsPatch.kt | 50 +-- .../fingerprints/ACLCommonShareFingerprint.kt | 2 +- .../ACLCommonShareFingerprint2.kt | 2 +- .../ACLCommonShareFingerprint3.kt | 2 +- .../DownloadPathParentFingerprint.kt | 17 +- .../interaction/seekbar/ShowSeekbarPatch.kt | 8 +- .../SetSeekBarShowTypeFingerprint.kt | 7 +- .../ShouldShowSeekBarFingerprint.kt | 7 +- .../interaction/speed/PlaybackSpeedPatch.kt | 17 +- .../speed/fingerprints/GetSpeedFingerprint.kt | 2 +- .../OnRenderFirstFrameFingerprint.kt | 2 +- .../speed/fingerprints/SetSpeedFingerprint.kt | 7 +- .../misc/integrations/IntegrationsPatch.kt | 2 +- .../fingerprints/InitFingerprint.kt | 4 +- .../DisableLoginRequirementPatch.kt | 10 +- .../MandatoryLoginServiceFingerprint.kt | 3 +- .../MandatoryLoginServiceFingerprint2.kt | 2 +- .../login/fixgoogle/FixGoogleLoginPatch.kt | 10 +- .../GoogleAuthAvailableFingerprint.kt | 2 +- .../GoogleOneTapAuthAvailableFingerprint.kt | 2 +- .../tiktok/misc/settings/SettingsPatch.kt | 40 +-- ...sonalizationActivityOnCreateFingerprint.kt | 2 +- .../AddSettingsEntryFingerprint.kt | 2 +- .../fingerprints/SettingsEntryFingerprint.kt | 7 +- .../SettingsEntryInfoFingerprint.kt | 7 +- .../SettingsStatusLoadFingerprint.kt | 2 +- .../tiktok/misc/spoof/sim/SpoofSimPatch.kt | 30 +- .../revanced/patches/trakt/UnlockProPatch.kt | 4 +- .../trakt/fingerprints/IsVIPEPFingerprint.kt | 2 +- .../trakt/fingerprints/IsVIPFingerprint.kt | 2 +- .../fingerprints/RemoteUserFingerprint.kt | 2 +- .../fingerprints/BrightnessFingerprint.kt | 2 +- .../lockscreen/patch/ShowOnLockscreenPatch.kt | 48 +-- .../patches/tumblr/ads/DisableDashboardAds.kt | 5 +- .../inappupdate/DisableInAppUpdatePatch.kt | 2 +- .../DisableBlogNotificationReminderPatch.kt | 6 +- .../popups/DisableGiftMessagePopupPatch.kt | 4 +- .../ShowGiftMessagePopupFingerprint.kt | 2 +- .../featureflags/OverrideFeatureFlagsPatch.kt | 108 +++---- .../GetFeatureValueFingerprint.kt | 5 +- .../tumblr/fixes/FixOldVersionsPatch.kt | 11 +- .../fingerprints/HttpPathParserFingerprint.kt | 5 +- .../tumblr/live/DisableTumblrLivePatch.kt | 2 +- .../timelinefilter/TimelineFilterPatch.kt | 8 +- .../PostsResponseConstructorFingerprint.kt | 2 +- .../TimelineConstructorFingerprint.kt | 2 +- .../TimelineFilterIntegrationFingerprint.kt | 7 +- .../patches/twitch/ad/audio/AudioAdsPatch.kt | 8 +- .../AudioAdsPresenterPlayFingerprint.kt | 2 +- .../twitch/ad/embedded/EmbeddedAdsPatch.kt | 10 +- .../CreateUsherClientFingerprint.kt | 2 +- .../twitch/ad/shared/util/BaseAdPatch.kt | 24 +- .../patches/twitch/ad/video/VideoAdsPatch.kt | 38 +-- .../CheckAdEligibilityLambdaFingerprint.kt | 2 +- .../ContentConfigShowAdsFingerprint.kt | 2 +- .../GetReadyToShowAdFingerprint.kt | 2 +- .../antidelete/ShowDeletedMessagesPatch.kt | 16 +- .../ChatUtilCreateDeletedSpanFingerprint.kt | 2 +- ...etedMessageClickableSpanCtorFingerprint.kt | 2 +- .../SetHasModAccessFingerprint.kt | 2 +- .../autoclaim/AutoClaimChannelPointsPatch.kt | 8 +- ...nityPointsButtonViewDelegateFingerprint.kt | 2 +- .../patches/twitch/debug/DebugModePatch.kt | 12 +- .../IsDebugConfigEnabledFingerprint.kt | 2 +- .../IsOmVerificationEnabledFingerprint.kt | 2 +- .../ShouldShowDebugOptionsFingerprint.kt | 2 +- .../misc/integrations/IntegrationsPatch.kt | 2 +- .../fingerprints/InitFingerprint.kt | 2 +- .../twitch/misc/settings/SettingsPatch.kt | 34 +- .../MenuGroupsOnClickFingerprint.kt | 2 +- .../MenuGroupsUpdatedFingerprint.kt | 2 +- .../SettingsActivityOnCreateFingerprint.kt | 2 +- .../SettingsMenuItemEnumFingerprint.kt | 2 +- .../downloads/UnlockDownloadsPatch.kt | 21 +- .../BuildMediaOptionsSheetFingerprint.kt | 7 +- .../ConstructMediaOptionsSheetFingerprint.kt | 2 +- ...wnloadVideoUpsellBottomSheetFingerprint.kt | 2 +- .../layout/viewcount/HideViewCountPatch.kt | 6 +- .../ViewCountsEnabledFingerprint.kt | 2 +- .../misc/dynamiccolor/DynamicColorPatch.kt | 6 +- .../twitter/misc/hook/json/JsonHookPatch.kt | 30 +- .../fingerprints/JsonHookPatchFingerprint.kt | 7 +- .../JsonInputStreamFingerprint.kt | 2 +- .../fingerprints/LoganSquareFingerprint.kt | 2 +- .../misc/hook/patch/ads/HideAdsHookPatch.kt | 2 +- .../HideRecommendedUsersPatch.kt | 4 +- .../links/OpenLinksWithAppChooserPatch.kt | 9 +- .../links/fingerprints/OpenLinkFingerprint.kt | 2 +- .../patches/vsco/misc/pro/UnlockProPatch.kt | 6 +- .../RevCatSubscriptionFingerprint.kt | 2 +- .../firebasegetcert/FirebaseGetCertPatch.kt | 10 +- .../GetMessagingCertFingerprint.kt | 7 +- .../GetRegistrationCertFingerprint.kt | 7 +- .../misc/promocode/PromoCodeUnlockPatch.kt | 6 +- .../PromoCodeUnlockFingerprint.kt | 2 +- .../windyapp/misc/unlockpro/UnlockProPatch.kt | 6 +- .../fingerprints/CheckProFingerprint.kt | 2 +- .../youtube/ad/general/HideAdsPatch.kt | 10 +- .../ad/general/HideAdsResourcePatch.kt | 6 +- .../ad/getpremium/HideGetPremiumPatch.kt | 3 +- .../fingerprints/GetPremiumViewFingerprint.kt | 7 +- .../patches/youtube/ad/video/VideoAdsPatch.kt | 3 +- .../fingerprints/LoadVideoAdsFingerprint.kt | 7 +- .../copyvideourl/CopyVideoUrlBytecodePatch.kt | 17 +- .../copyvideourl/CopyVideoUrlResourcePatch.kt | 10 +- .../RemoveViewerDiscretionDialogPatch.kt | 12 +- .../fingerprints/CreateDialogFingerprint.kt | 4 +- .../interaction/downloads/DownloadsPatch.kt | 11 +- .../downloads/DownloadsResourcePatch.kt | 15 +- .../OfflineVideoEndpointFingerprint.kt | 6 +- .../DisablePreciseSeekingGesturePatch.kt | 4 +- .../seekbar/EnableSeekbarTappingPatch.kt | 23 +- .../seekbar/EnableSlideToSeekPatch.kt | 2 +- .../DoubleSpeedSeekNoticeFingerprint.kt | 2 +- .../fingerprints/IsSwipingUpFingerprint.kt | 7 +- .../OnTouchEventHandlerFingerprint.kt | 7 +- .../fingerprints/SeekbarTappingFingerprint.kt | 7 +- .../fingerprints/SlideToSeekFingerprint.kt | 2 +- .../SwipeControlsBytecodePatch.kt | 2 +- .../SwipeControlsResourcePatch.kt | 8 +- .../SwipeControlsHostActivityFingerprint.kt | 2 +- .../layout/autocaptions/AutoCaptionsPatch.kt | 3 +- .../StartVideoInformerFingerprint.kt | 7 +- .../SubtitleButtonControllerFingerprint.kt | 7 +- .../fingerprints/SubtitleTrackFingerprint.kt | 4 +- .../layout/branding/CustomBrandingPatch.kt | 52 +-- .../branding/header/ChangeHeaderPatch.kt | 58 ++-- .../layout/buttons/action/HideButtonsPatch.kt | 5 +- .../autoplay/HideAutoplayButtonPatch.kt | 2 +- .../captions/HideCaptionsButtonPatch.kt | 7 +- .../buttons/cast/HideCastButtonPatch.kt | 15 +- .../navigation/NavigationButtonsPatch.kt | 30 +- .../AddCreateButtonViewFingerprint.kt | 7 +- ...layerControlsVisibilityModelFingerprint.kt | 2 +- .../layout/hide/albumcards/AlbumCardsPatch.kt | 8 +- .../albumcards/AlbumCardsResourcePatch.kt | 13 +- .../fingerprints/AlbumCardsFingerprint.kt | 7 +- .../hide/breakingnews/BreakingNewsPatch.kt | 4 +- .../breakingnews/BreakingNewsResourcePatch.kt | 13 +- .../fingerprints/BreakingNewsFingerprint.kt | 7 +- .../layout/hide/comments/CommentsPatch.kt | 3 +- .../crowdfundingbox/CrowdfundingBoxPatch.kt | 2 +- .../CrowdfundingBoxResourcePatch.kt | 13 +- .../CrowdfundingBoxFingerprint.kt | 7 +- .../endscreencards/HideEndscreenCardsPatch.kt | 4 +- .../HideEndscreenCardsResourcePatch.kt | 13 +- .../fingerprints/LayoutCircleFingerprint.kt | 7 +- .../fingerprints/LayoutIconFingerprint.kt | 7 +- .../fingerprints/LayoutVideoFingerprint.kt | 7 +- .../hide/filterbar/HideFilterBarPatch.kt | 4 +- .../filterbar/HideFilterBarResourcePatch.kt | 9 +- .../FilterBarHeightFingerprint.kt | 7 +- .../RelatedChipCloudFingerprint.kt | 7 +- .../SearchResultsChipBarFingerprint.kt | 7 +- .../HideFloatingMicrophoneButtonPatch.kt | 2 +- ...deFloatingMicrophoneButtonResourcePatch.kt | 6 +- ...ShowFloatingMicrophoneButtonFingerprint.kt | 7 +- .../DisableFullscreenAmbientModePatch.kt | 5 +- .../InitializeAmbientModeFingerprint.kt | 2 +- .../hide/general/HideLayoutComponentsPatch.kt | 39 +-- .../ParseElementFromBufferFingerprint.kt | 2 +- .../fingerprints/PlayerOverlayFingerprint.kt | 2 +- .../fingerprints/ShowWatermarkFingerprint.kt | 2 +- .../hide/infocards/HideInfoCardsPatch.kt | 24 +- .../infocards/HideInfocardsResourcePatch.kt | 13 +- .../InfocardsIncognitoFingerprint.kt | 2 +- .../InfocardsIncognitoParentFingerprint.kt | 2 +- .../InfocardsMethodCallFingerprint.kt | 7 +- .../loadmorebutton/HideLoadMoreButtonPatch.kt | 4 +- .../HideLoadMoreButtonResourcePatch.kt | 13 +- .../HideLoadMoreButtonFingerprint.kt | 7 +- .../HidePlayerFlyoutMenuPatch.kt | 33 +- .../DisableRollingNumberAnimationPatch.kt | 3 +- .../layout/hide/seekbar/HideSeekbarPatch.kt | 3 +- .../hide/shorts/HideShortsComponentsPatch.kt | 21 +- .../HideShortsComponentsResourcePatch.kt | 5 +- .../BottomNavigationBarFingerprint.kt | 12 +- .../CreateShortsButtonsFingerprint.kt | 2 +- .../ReelConstructorFingerprint.kt | 2 +- .../RenderBottomNavigationBarFingerprint.kt | 7 +- ...derBottomNavigationBarParentFingerprint.kt | 2 +- .../SetPivotBarVisibilityFingerprint.kt | 7 +- .../SetPivotBarVisibilityParentFingerprint.kt | 2 +- .../DisableSuggestedVideoEndScreenPatch.kt | 7 +- ...bleSuggestedVideoEndScreenResourcePatch.kt | 13 +- .../CreateEndScreenViewFingerprint.kt | 7 +- .../layout/hide/time/HideTimestampPatch.kt | 7 +- .../fingerprints/TimeCounterFingerprint.kt | 4 +- .../panels/popup/PlayerPopupPanelsPatch.kt | 8 +- .../EngagementPanelControllerFingerprint.kt | 7 +- .../PlayerControlsBackgroundPatch.kt | 6 +- .../CustomPlayerOverlayOpacityPatch.kt | 6 +- ...CustomPlayerOverlayOpacityResourcePatch.kt | 11 +- .../CreatePlayerOverviewFingerprint.kt | 7 +- .../ReturnYouTubeDislikePatch.kt | 41 +-- .../ReturnYouTubeDislikeResourcePatch.kt | 24 +- .../ConversionContextFingerprint.kt | 7 +- .../fingerprints/DislikeFingerprint.kt | 2 +- .../DislikesOldLayoutTextViewFingerprint.kt | 7 +- .../fingerprints/LikeFingerprint.kt | 2 +- .../fingerprints/RemoveLikeFingerprint.kt | 2 +- ...ingNumberMeasureAnimatedTextFingerprint.kt | 12 +- ...lingNumberMeasureStaticLabelFingerprint.kt | 7 +- ...mberMeasureStaticLabelParentFingerprint.kt | 2 +- .../RollingNumberSetterFingerprint.kt | 7 +- .../RollingNumberTextViewFingerprint.kt | 7 +- .../fingerprints/ShortsTextViewFingerprint.kt | 7 +- .../TextComponentConstructorFingerprint.kt | 2 +- .../TextComponentDataFingerprint.kt | 2 +- .../TextComponentLookupFingerprint.kt | 2 +- .../layout/searchbar/WideSearchbarPatch.kt | 10 +- .../CreateSearchSuggestionsFingerprint.kt | 7 +- .../SetWordmarkHeaderFingerprint.kt | 7 +- .../RestoreOldSeekbarThumbnailsPatch.kt | 3 +- .../seekbar/SeekbarColorBytecodePatch.kt | 17 +- .../seekbar/SeekbarColorResourcePatch.kt | 2 +- .../FullscreenSeekbarThumbnailsFingerprint.kt | 2 +- .../PlayerSeekbarColorFingerprint.kt | 2 +- .../SetSeekbarClickedColorFingerprint.kt | 2 +- .../ShortsSeekbarColorFingerprint.kt | 2 +- .../sponsorblock/SponsorBlockBytecodePatch.kt | 60 ++-- .../sponsorblock/SponsorBlockResourcePatch.kt | 31 +- .../fingerprints/AppendTimeFingerprint.kt | 4 +- .../ControlsOverlayFingerprint.kt | 7 +- .../RectangleFieldInvalidatorFingerprint.kt | 2 +- .../spoofappversion/SpoofAppVersionPatch.kt | 10 +- .../SpoofAppVersionFingerprint.kt | 5 +- .../layout/startpage/ChangeStartPagePatch.kt | 16 +- .../fingerprints/StartActivityFingerprint.kt | 2 +- .../DisableResumingShortsOnStartupPatch.kt | 11 +- .../UserWasInShortsFingerprint.kt | 2 +- .../layout/tablet/EnableTabletLayoutPatch.kt | 10 +- .../fingerprints/GetFormFactorFingerprint.kt | 7 +- .../tabletminiplayer/TabletMiniPlayerPatch.kt | 20 +- ...erDimensionsCalculatorParentFingerprint.kt | 7 +- .../MiniPlayerOverrideFingerprint.kt | 2 +- .../MiniPlayerOverrideNoContextFingerprint.kt | 2 +- ...PlayerResponseModelSizeCheckFingerprint.kt | 4 +- .../layout/theme/LithoColorHookPatch.kt | 11 +- .../layout/theme/ThemeBytecodePatch.kt | 10 +- .../layout/theme/ThemeResourcePatch.kt | 16 +- .../fingerprints/LithoThemeFingerprint.kt | 7 +- .../UseGradientLoadingScreenFingerprint.kt | 2 +- .../thumbnails/AlternativeThumbnailsPatch.kt | 57 ++-- .../MessageDigestImageUrlFingerprint.kt | 2 +- .../MessageDigestImageUrlParentFingerprint.kt | 2 +- .../fingerprints/cronet/RequestFingerprint.kt | 2 +- .../request/callback/OnFailureFingerprint.kt | 2 +- .../callback/OnResponseStartedFingerprint.kt | 7 +- .../callback/OnSucceededFingerprint.kt | 2 +- .../misc/announcements/AnnouncementsPatch.kt | 2 +- .../misc/autorepeat/AutoRepeatPatch.kt | 39 +-- .../fingerprints/AutoRepeatFingerprint.kt | 2 +- .../AutoRepeatParentFingerprint.kt | 7 +- .../youtube/misc/debugging/DebuggingPatch.kt | 11 +- .../spoof/SpoofDeviceDimensionsPatch.kt | 4 +- ...eviceDimensionsModelToStringFingerprint.kt | 2 +- .../FixBackToExitGesturePatch.kt | 46 +-- .../fingerprints/OnBackPressedFingerprint.kt | 7 +- .../RecyclerViewScrollingFingerprint.kt | 7 +- .../RecyclerViewTopScrollingFingerprint.kt | 4 +- ...cyclerViewTopScrollingParentFingerprint.kt | 7 +- .../misc/fix/playback/ClientSpoofPatch.kt | 30 +- .../misc/fix/playback/SpoofSignaturePatch.kt | 56 ++-- .../playback/SpoofSignatureResourcePatch.kt | 7 +- .../fingerprints/ParamsMapPutFingerprint.kt | 12 +- ...ayerResponseModelImplGeneralFingerprint.kt | 7 +- ...rResponseModelImplLiveStreamFingerprint.kt | 7 +- ...nseModelImplRecommendedLevelFingerprint.kt | 7 +- .../ScrubbedPreviewLayoutFingerprint.kt | 7 +- .../StatsQueryParameterFingerprint.kt | 2 +- ...dererDecoderRecommendedLevelFingerprint.kt | 7 +- ...toryboardRendererDecoderSpecFingerprint.kt | 7 +- .../StoryboardRendererSpecFingerprint.kt | 2 +- .../StoryboardThumbnailFingerprint.kt | 7 +- .../StoryboardThumbnailParentFingerprint.kt | 2 +- .../youtube/misc/gms/GmsCoreSupportPatch.kt | 26 +- .../misc/gms/GmsCoreSupportResourcePatch.kt | 9 +- .../CastDynamiteModuleFingerprint.kt | 2 +- .../CastDynamiteModuleV2Fingerprint.kt | 2 +- .../GooglePlayUtilityFingerprint.kt | 2 +- .../fingerprints/PrimeMethodFingerprint.kt | 2 +- .../fingerprints/ServiceCheckFingerprint.kt | 2 +- .../misc/integrations/IntegrationsPatch.kt | 4 +- .../APIPlayerServiceFingerprint.kt | 2 +- .../ApplicationInitFingerprint.kt | 2 +- ...mbeddedPlayerControlsOverlayFingerprint.kt | 2 +- .../fingerprints/EmbeddedPlayerFingerprint.kt | 2 +- .../RemoteEmbedFragmentFingerprint.kt | 2 +- .../RemoteEmbeddedPlayerFingerprint.kt | 2 +- .../StandalonePlayerActivityFingerprint.kt | 2 +- .../misc/links/BypassURLRedirectsPatch.kt | 8 +- .../misc/links/OpenLinksExternallyPatch.kt | 15 +- .../fingerprints/ABUriParserFingerprint.kt | 7 +- .../fingerprints/HTTPUriParserFingerprint.kt | 7 +- .../misc/litho/filter/LithoFilterPatch.kt | 29 +- .../ComponentContextParserFingerprint.kt | 2 +- .../EmptyComponentBuilderFingerprint.kt | 7 +- .../fingerprints/LithoFilterFingerprint.kt | 2 +- .../ProtobufBufferReferenceFingerprint.kt | 7 +- .../ReadComponentIdentifierFingerprint.kt | 7 +- .../MinimizedPlaybackPatch.kt | 5 +- ...izedPlaybackPolicyControllerFingerprint.kt | 7 +- .../MinimizedPlaybackManagerFingerprint.kt | 4 +- .../MinimizedPlaybackSettingsFingerprint.kt | 7 +- ...imizedPlaybackSettingsParentFingerprint.kt | 2 +- .../misc/navigation/NavigationBarHookPatch.kt | 32 +- .../NavigationBarHookResourcePatch.kt | 16 +- .../ActionBarSearchResultsFingerprint.kt | 2 +- .../InitializeButtonsFingerprint.kt | 2 +- .../NavigationBarHookCallbackFingerprint.kt | 2 +- .../fingerprints/NavigationEnumFingerprint.kt | 3 +- ...BarButtonsCreateDrawableViewFingerprint.kt | 4 +- ...BarButtonsCreateResourceViewFingerprint.kt | 2 +- .../PivotBarConstructorFingerprint.kt | 2 +- .../BottomControlsResourcePatch.kt | 16 +- .../PlayerControlsBytecodePatch.kt | 19 +- .../BottomControlsInflateFingerprint.kt | 7 +- .../PlayerControlsVisibilityFingerprint.kt | 2 +- .../playeroverlay/PlayerOverlaysHookPatch.kt | 4 +- ...layerOverlaysOnFinishInflateFingerprint.kt | 6 +- .../misc/playertype/PlayerTypeHookPatch.kt | 8 +- .../fingerprint/PlayerTypeFingerprint.kt | 7 +- .../fingerprint/VideoStateFingerprint.kt | 7 +- .../RemoveTrackingQueryParameterPatch.kt | 11 +- .../fingerprints/CopyTextFingerprint.kt | 7 +- .../SystemShareSheetFingerprint.kt | 7 +- .../YouTubeShareSheetFingerprint.kt | 7 +- .../hook/RecyclerViewTreeHookPatch.kt | 6 +- .../RecyclerViewTreeObserverFingerprint.kt | 7 +- .../youtube/misc/settings/SettingsPatch.kt | 127 ++++---- .../misc/settings/SettingsResourcePatch.kt | 8 +- .../LicenseActivityOnCreateFingerprint.kt | 2 +- .../fingerprints/SetThemeFingerprint.kt | 2 +- .../misc/zoomhaptics/ZoomHapticsPatch.kt | 8 +- .../fingerprints/ZoomHapticsFingerprint.kt | 7 +- .../fingerprints/HomeActivityFingerprint.kt | 2 +- .../LayoutConstructorFingerprint.kt | 2 +- .../fingerprints/MainActivityFingerprint.kt | 2 +- .../MainActivityOnCreateFingerprint.kt | 10 +- ...umberTextViewAnimationUpdateFingerprint.kt | 7 +- .../shared/fingerprints/SeekbarFingerprint.kt | 2 +- .../fingerprints/SeekbarOnDrawFingerprint.kt | 2 +- .../video/hdrbrightness/HDRBrightnessPatch.kt | 8 +- .../fingerprints/HDRBrightnessFingerprint.kt | 2 +- .../information/VideoInformationPatch.kt | 92 ++++-- .../CreateVideoPlayerSeekbarFingerprint.kt | 2 +- .../OnPlaybackSpeedItemClickFingerprint.kt | 2 +- ...erControllerSetTimeReferenceFingerprint.kt | 2 +- .../fingerprints/PlayerInitFingerprint.kt | 7 +- .../fingerprints/SeekFingerprint.kt | 2 +- .../fingerprints/VideoLengthFingerprint.kt | 7 +- .../PlayerResponseMethodHookPatch.kt | 12 +- .../PlayerParameterBuilderFingerprint.kt | 7 +- .../quality/RememberVideoQualityPatch.kt | 28 +- .../NewVideoQualityChangedFingerprint.kt | 7 +- ...dexMethodClassFieldReferenceFingerprint.kt | 7 +- ...ideoQualityItemOnClickParentFingerprint.kt | 2 +- .../VideoQualitySetterFingerprint.kt | 4 +- .../youtube/video/speed/PlaybackSpeedPatch.kt | 6 +- .../speed/custom/CustomPlaybackSpeedPatch.kt | 85 ++--- .../CustomPlaybackSpeedResourcePatch.kt | 7 +- .../GetOldPlaybackSpeedsFingerprint.kt | 2 +- .../ShowOldPlaybackSpeedMenuFingerprint.kt | 2 +- ...laybackSpeedMenuIntegrationsFingerprint.kt | 2 +- .../SpeedArrayGeneratorFingerprint.kt | 7 +- .../fingerprints/SpeedLimiterFingerprint.kt | 4 +- .../remember/RememberPlaybackSpeedPatch.kt | 50 +-- ...nitializePlaybackSpeedValuesFingerprint.kt | 2 +- .../youtube/video/videoid/VideoIdPatch.kt | 38 +-- .../videoid/fingerprint/VideoIdFingerprint.kt | 7 +- .../VideoIdFingerprintBackgroundPlay.kt | 7 +- .../RestoreOldVideoQualityMenuPatch.kt | 10 +- ...RestoreOldVideoQualityMenuResourcePatch.kt | 9 +- .../VideoQualityMenuViewInflateFingerprint.kt | 7 +- .../youtubevanced/ad/general/HideAdsPatch.kt | 8 +- .../fingerprints/ContainsAdFingerprint.kt | 7 +- .../misc/unlockpremium/UnlockPremiumPatch.kt | 6 +- .../fingerprints/IsPremiumFingerprint.kt | 7 +- .../YukaUserConstructorFingerprint.kt | 7 +- .../kotlin/app/revanced/util/BytecodeUtils.kt | 52 +-- .../kotlin/app/revanced/util/ResourceUtils.kt | 19 +- .../util/patch/LiteralValueFingerprint.kt | 4 +- .../revanced/util/resource/ArrayResource.kt | 9 +- .../revanced/util/resource/BaseResource.kt | 7 +- .../revanced/util/resource/StringResource.kt | 7 +- 616 files changed, 3064 insertions(+), 2615 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b2e84b7f06..3da402dadc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -68,8 +68,9 @@ tasks { dependsOn(build) doLast { - val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools") - .listFilesOrdered().last().resolve("d8").absolutePath + val d8 = + File(System.getenv("ANDROID_HOME")).resolve("build-tools") + .listFilesOrdered().last().resolve("d8").absolutePath val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath val workingDirectory = layout.buildDirectory.dir("libs").get().asFile diff --git a/src/main/kotlin/app/revanced/generator/JsonPatchesFileGenerator.kt b/src/main/kotlin/app/revanced/generator/JsonPatchesFileGenerator.kt index 28871d6d10..e2f810f6db 100644 --- a/src/main/kotlin/app/revanced/generator/JsonPatchesFileGenerator.kt +++ b/src/main/kotlin/app/revanced/generator/JsonPatchesFileGenerator.kt @@ -6,27 +6,28 @@ import com.google.gson.GsonBuilder import java.io.File internal class JsonPatchesFileGenerator : PatchesFileGenerator { - override fun generate(patches: PatchSet) = patches.map { - JsonPatch( - it.name!!, - it.description, - it.compatiblePackages, - it.use, - it.requiresIntegrations, - it.options.values.map { option -> - JsonPatch.Option( - option.key, - option.default, - option.values, - option.title, - option.description, - option.required, - ) - }, - ) - }.let { - File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it)) - } + override fun generate(patches: PatchSet) = + patches.map { + JsonPatch( + it.name!!, + it.description, + it.compatiblePackages, + it.use, + it.requiresIntegrations, + it.options.values.map { option -> + JsonPatch.Option( + option.key, + option.default, + option.values, + option.title, + option.description, + option.required + ) + } + ) + }.let { + File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it)) + } @Suppress("unused") private class JsonPatch( @@ -35,7 +36,7 @@ internal class JsonPatchesFileGenerator : PatchesFileGenerator { val compatiblePackages: Set? = null, val use: Boolean = true, val requiresIntegrations: Boolean = false, - val options: List