Compare commits

...

36 Commits

Author SHA1 Message Date
semantic-release-bot
c681316ee1 chore(release): 2.174.0-dev.36 [skip ci]
# [2.174.0-dev.36](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.35...v2.174.0-dev.36) (2023-05-20)

### Bug Fixes

* **twitter:** correctly resolve to integrations methods ([b56844d](b56844dc6b))
2023-05-20 02:35:28 +00:00
oSumAtrIX
b56844dc6b fix(twitter): correctly resolve to integrations methods 2023-05-20 04:32:39 +02:00
semantic-release-bot
d4843d185a chore(release): 2.174.0-dev.35 [skip ci]
# [2.174.0-dev.35](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.34...v2.174.0-dev.35) (2023-05-19)

### Bug Fixes

* **youtube/minimized-playback:** update settings description ([#2191](https://github.com/revanced/revanced-patches/issues/2191)) ([ebf144e](ebf144e2c8))
* **youtube/settings:** fix non functional back button in settings ([#2178](https://github.com/revanced/revanced-patches/issues/2178)) ([52029ee](52029ee987))

### Features

* add capability to filter from protobuf buffer ([7e2502c](7e2502c26b))
* use consistent names for patches ([acb9b5f](acb9b5fe6b))
* **youtube/copy-video-url:** add tap and hold functionality to copy video url buttons ([#2174](https://github.com/revanced/revanced-patches/issues/2174)) ([80661db](80661dbf43))
* **youtube/hide-shorts-components:** hide navigation bar ([8e627c6](8e627c682f))
* **youtube:** add `hide-shorts-components` patch ([af82eb6](af82eb633c))
* **youtube:** constrain patches to `18.16.37` ([d746f32](d746f32594))
* **youtube:** support version `18.19.35` ([3cfbe20](3cfbe206dc))
2023-05-19 21:46:05 +00:00
LisoUseInAIKyrios
52029ee987 fix(youtube/settings): fix non functional back button in settings (#2178) 2023-05-19 23:43:49 +02:00
LisoUseInAIKyrios
80661dbf43 feat(youtube/copy-video-url): add tap and hold functionality to copy video url buttons (#2174) 2023-05-19 23:43:48 +02:00
oSumAtrIX
e9b2b72681 chore: use correct description for patch 2023-05-19 23:43:48 +02:00
oSumAtrIX
b4110fb798 refactor: remove spacing 2023-05-19 23:43:48 +02:00
oSumAtrIX
3cfbe206dc feat(youtube): support version 18.19.35 2023-05-19 23:43:47 +02:00
oSumAtrIX
1d0bf1b289 refactor(youtube/remember-playback-speed): do not use other unrelated patches extension methods 2023-05-19 23:43:47 +02:00
oSumAtrIX
99de705e8e refactor(youtube/settings): increase fingerprint robustness 2023-05-19 23:43:46 +02:00
oSumAtrIX
d746f32594 feat(youtube): constrain patches to 18.16.37 2023-05-19 23:43:46 +02:00
johnconner122
ebf144e2c8 fix(youtube/minimized-playback): update settings description (#2191) 2023-05-19 23:43:46 +02:00
oSumAtrIX
8e627c682f feat(youtube/hide-shorts-components): hide navigation bar 2023-05-18 19:06:06 +02:00
oSumAtrIX
af82eb633c feat(youtube): add hide-shorts-components patch 2023-05-18 19:06:05 +02:00
oSumAtrIX
acb9b5fe6b feat: use consistent names for patches 2023-05-18 18:59:35 +02:00
oSumAtrIX
7e2502c26b feat: add capability to filter from protobuf buffer 2023-05-18 18:59:35 +02:00
semantic-release-bot
1fcdc74056 chore(release): 2.174.0-dev.34 [skip ci]
# [2.174.0-dev.34](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.33...v2.174.0-dev.34) (2023-05-16)

### Features

* **vsco:** add `unlock-pro` patch ([#2168](https://github.com/revanced/revanced-patches/issues/2168)) ([91ee6b7](91ee6b7750))
2023-05-16 21:52:12 +00:00
redphx
91ee6b7750 feat(vsco): add unlock-pro patch (#2168)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-16 23:50:33 +02:00
semantic-release-bot
3a905484c0 chore(release): 2.174.0-dev.33 [skip ci]
# [2.174.0-dev.33](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.32...v2.174.0-dev.33) (2023-05-16)

### Bug Fixes

* **youtube/spoof-signature-verification:** adjusting summary text ([#2169](https://github.com/revanced/revanced-patches/issues/2169)) ([677c0f8](677c0f8145))
2023-05-16 17:28:32 +00:00
LisoUseInAIKyrios
677c0f8145 fix(youtube/spoof-signature-verification): adjusting summary text (#2169) 2023-05-16 21:26:42 +04:00
semantic-release-bot
aad21ab6f7 chore(release): 2.174.0-dev.32 [skip ci]
# [2.174.0-dev.32](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.31...v2.174.0-dev.32) (2023-05-16)

### Bug Fixes

* **youtube/sponsorblock:** fix toast shown when scrubbing thru a paused video ([#2152](https://github.com/revanced/revanced-patches/issues/2152)) ([a06d061](a06d061e26))

### Features

* **youtube:** add options to disable toasts on connection error ([#2159](https://github.com/revanced/revanced-patches/issues/2159)) ([97f70f2](97f70f2490))
2023-05-16 06:33:22 +00:00
LisoUseInAIKyrios
a06d061e26 fix(youtube/sponsorblock): fix toast shown when scrubbing thru a paused video (#2152)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-16 10:31:35 +04:00
LisoUseInAIKyrios
97f70f2490 feat(youtube): add options to disable toasts on connection error (#2159)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-16 10:29:24 +04:00
semantic-release-bot
219c24c965 chore(release): 2.174.0-dev.31 [skip ci]
# [2.174.0-dev.31](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.30...v2.174.0-dev.31) (2023-05-16)

### Features

* **candylinkvpn:** add `unlock-pro` patch ([#2157](https://github.com/revanced/revanced-patches/issues/2157)) ([bb2572d](bb2572d12a))
* **messenger:** add `disable-typing-indicator` patch ([#2115](https://github.com/revanced/revanced-patches/issues/2115)) ([c1f74dd](c1f74dddcf))
2023-05-16 03:42:01 +00:00
johnconner122
bb2572d12a feat(candylinkvpn): add unlock-pro patch (#2157)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-16 05:39:48 +02:00
badawoll
c1f74dddcf feat(messenger): add disable-typing-indicator patch (#2115)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-16 05:39:19 +02:00
semantic-release-bot
337c80fb47 chore(release): 2.174.0-dev.30 [skip ci]
# [2.174.0-dev.30](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.29...v2.174.0-dev.30) (2023-05-16)

### Features

* **youtube/hide-filter-bar:** add `PreferenceScreen` summary ([4f7c2b4](4f7c2b4b5d))
2023-05-16 03:38:46 +00:00
oSumAtrIX
4f7c2b4b5d feat(youtube/hide-filter-bar): add PreferenceScreen summary 2023-05-16 05:36:06 +02:00
semantic-release-bot
e4034bc6fd chore(release): 2.174.0-dev.29 [skip ci]
# [2.174.0-dev.29](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.28...v2.174.0-dev.29) (2023-05-16)

### Features

* **youtube/downloads:** improve patch description ([0b79e89](0b79e8960e))
2023-05-16 02:34:51 +00:00
oSumAtrIX
0b79e8960e feat(youtube/downloads): improve patch description 2023-05-16 04:27:47 +02:00
oSumAtrIX
0b10d5589f refactor: remove unused annotations 2023-05-16 04:27:30 +02:00
semantic-release-bot
8df6aaf087 chore(release): 2.174.0-dev.28 [skip ci]
# [2.174.0-dev.28](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.27...v2.174.0-dev.28) (2023-05-15)

### Bug Fixes

* **youtube:** add missing compatibility annotations for `theme` and `hide-load-more-button` ([#2150](https://github.com/revanced/revanced-patches/issues/2150)) ([0555cdc](0555cdc54f))

### Features

* **youtube:** import / export of revanced settings ([#2077](https://github.com/revanced/revanced-patches/issues/2077)) ([5ff3215](5ff3215132))
2023-05-15 07:53:27 +00:00
LisoUseInAIKyrios
5ff3215132 feat(youtube): import / export of revanced settings (#2077)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-15 11:51:43 +04:00
Dawid K
0555cdc54f fix(youtube): add missing compatibility annotations for theme and hide-load-more-button (#2150) 2023-05-15 11:49:44 +04:00
semantic-release-bot
018bf78e85 chore(release): 2.174.0-dev.27 [skip ci]
# [2.174.0-dev.27](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.26...v2.174.0-dev.27) (2023-05-14)

### Bug Fixes

* **youtube/video-speed:** add compatibility annotation ([#2156](https://github.com/revanced/revanced-patches/issues/2156)) ([1a72c9b](1a72c9b6b0))
2023-05-14 23:09:19 +00:00
LisoUseInAIKyrios
1a72c9b6b0 fix(youtube/video-speed): add compatibility annotation (#2156) 2023-05-15 03:07:36 +04:00
210 changed files with 2116 additions and 2341 deletions

View File

@@ -1,3 +1,96 @@
# [2.174.0-dev.36](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.35...v2.174.0-dev.36) (2023-05-20)
### Bug Fixes
* **twitter:** correctly resolve to integrations methods ([c655416](https://github.com/revanced/revanced-patches/commit/c655416a91f0a32cfe82b1384f5958cace891833))
# [2.174.0-dev.35](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.34...v2.174.0-dev.35) (2023-05-19)
### Bug Fixes
* **youtube/minimized-playback:** update settings description ([#2191](https://github.com/revanced/revanced-patches/issues/2191)) ([a561a9a](https://github.com/revanced/revanced-patches/commit/a561a9afc233e466459546fcc8452800ec56e057))
* **youtube/settings:** fix non functional back button in settings ([#2178](https://github.com/revanced/revanced-patches/issues/2178)) ([46da834](https://github.com/revanced/revanced-patches/commit/46da83430f69b451f971bf5e9261e9d64d1a365c))
### Features
* add capability to filter from protobuf buffer ([b738b6b](https://github.com/revanced/revanced-patches/commit/b738b6bf3506f222844ef4bca99a91f78d331391))
* use consistent names for patches ([6347146](https://github.com/revanced/revanced-patches/commit/634714690086168e63d6aa9475893135cb58db68))
* **youtube/copy-video-url:** add tap and hold functionality to copy video url buttons ([#2174](https://github.com/revanced/revanced-patches/issues/2174)) ([95bbf46](https://github.com/revanced/revanced-patches/commit/95bbf46e77a608bd7ba8f0073d50fef01012d4df))
* **youtube/hide-shorts-components:** hide navigation bar ([24f376a](https://github.com/revanced/revanced-patches/commit/24f376a4b8d6bdccc32ffff0d983f22eb4940791))
* **youtube:** add `hide-shorts-components` patch ([64868f4](https://github.com/revanced/revanced-patches/commit/64868f41be9f567cb54d9214fafbf849d08b64d2))
* **youtube:** constrain patches to `18.16.37` ([758b300](https://github.com/revanced/revanced-patches/commit/758b3005919e11d9dd4f19bf110e9d282f8d1925))
* **youtube:** support version `18.19.35` ([491f292](https://github.com/revanced/revanced-patches/commit/491f292182a419cb5399de768560ae4daa7c86cb))
# [2.174.0-dev.34](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.33...v2.174.0-dev.34) (2023-05-16)
### Features
* **vsco:** add `unlock-pro` patch ([#2168](https://github.com/revanced/revanced-patches/issues/2168)) ([7ffd1a0](https://github.com/revanced/revanced-patches/commit/7ffd1a09a7bcf09bc7e7d5f3c8c8613ca34c8c59))
# [2.174.0-dev.33](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.32...v2.174.0-dev.33) (2023-05-16)
### Bug Fixes
* **youtube/spoof-signature-verification:** adjusting summary text ([#2169](https://github.com/revanced/revanced-patches/issues/2169)) ([4ccb1ee](https://github.com/revanced/revanced-patches/commit/4ccb1ee0b988bc0ddd6a0c986975b17caa828770))
# [2.174.0-dev.32](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.31...v2.174.0-dev.32) (2023-05-16)
### Bug Fixes
* **youtube/sponsorblock:** fix toast shown when scrubbing thru a paused video ([#2152](https://github.com/revanced/revanced-patches/issues/2152)) ([c6c23ff](https://github.com/revanced/revanced-patches/commit/c6c23ff0d9a18e3ef3d4b9b28ffa562a2eceb58b))
### Features
* **youtube:** add options to disable toasts on connection error ([#2159](https://github.com/revanced/revanced-patches/issues/2159)) ([99916ae](https://github.com/revanced/revanced-patches/commit/99916aefaaea3b94e94e2901d70493fdb18a3dab))
# [2.174.0-dev.31](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.30...v2.174.0-dev.31) (2023-05-16)
### Features
* **candylinkvpn:** add `unlock-pro` patch ([#2157](https://github.com/revanced/revanced-patches/issues/2157)) ([7159f86](https://github.com/revanced/revanced-patches/commit/7159f867801300d4ae32937743de59421de76238))
* **messenger:** add `disable-typing-indicator` patch ([#2115](https://github.com/revanced/revanced-patches/issues/2115)) ([5d1de4f](https://github.com/revanced/revanced-patches/commit/5d1de4f4eab83e61cfc1c4aaee74179afcb9431f))
# [2.174.0-dev.30](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.29...v2.174.0-dev.30) (2023-05-16)
### Features
* **youtube/hide-filter-bar:** add `PreferenceScreen` summary ([2bba5f7](https://github.com/revanced/revanced-patches/commit/2bba5f72fae06e352d2984fea7c8cc65d38ed221))
# [2.174.0-dev.29](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.28...v2.174.0-dev.29) (2023-05-16)
### Features
* **youtube/downloads:** improve patch description ([e0f6452](https://github.com/revanced/revanced-patches/commit/e0f64520d0235ea219f1965ba34b7e52ded9c1d9))
# [2.174.0-dev.28](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.27...v2.174.0-dev.28) (2023-05-15)
### Bug Fixes
* **youtube:** add missing compatibility annotations for `theme` and `hide-load-more-button` ([#2150](https://github.com/revanced/revanced-patches/issues/2150)) ([78803f8](https://github.com/revanced/revanced-patches/commit/78803f8ea85684e4c69e75b676fa40bae8760957))
### Features
* **youtube:** import / export of revanced settings ([#2077](https://github.com/revanced/revanced-patches/issues/2077)) ([b59cb3e](https://github.com/revanced/revanced-patches/commit/b59cb3ed60293aaf81067ff3469863add09c6b13))
# [2.174.0-dev.27](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.26...v2.174.0-dev.27) (2023-05-14)
### Bug Fixes
* **youtube/video-speed:** add compatibility annotation ([#2156](https://github.com/revanced/revanced-patches/issues/2156)) ([ffa2e5d](https://github.com/revanced/revanced-patches/commit/ffa2e5d7eb0b90bb5c7a6854bab4caf9f810d917))
# [2.174.0-dev.26](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.25...v2.174.0-dev.26) (2023-05-14)

131
README.md
View File

@@ -9,57 +9,61 @@ The official ReVanced Patches.
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `always-autorepeat` | Always repeats the playing video again. | 18.16.37 |
| `client-spoof` | Spoofs a patched client to allow playback. | 18.16.37 |
| `comments` | Hides components related to comments. | 18.16.37 |
| `copy-video-url` | Adds buttons in player to copy video links. | 18.16.37 |
| `always-autorepeat` | Always repeats the playing video again. | 18.19.35 |
| `client-spoof` | Spoofs a patched client to allow playback. | 18.19.35 |
| `comments` | Hides components related to comments. | 18.19.35 |
| `copy-video-url` | Adds buttons in player to copy video links. | 18.19.35 |
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
| `custom-video-buffer` | Lets you change the buffers of videos. | 18.16.37 |
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 18.16.37 |
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 18.16.37 |
| `disable-player-popup-panels` | Disables panels from appearing automatically when going into fullscreen (playlist or live chat). | 18.16.37 |
| `disable-shorts-on-startup` | Disables playing YouTube Shorts when launching YouTube. | 18.16.37 |
| `custom-video-buffer` | Lets you change the buffers of videos. | 18.19.35 |
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 18.19.35 |
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 18.19.35 |
| `disable-player-popup-panels` | Disables panels from appearing automatically when going into fullscreen (playlist or live chat). | 18.19.35 |
| `disable-shorts-on-startup` | Disables playing YouTube Shorts when launching YouTube. | 18.19.35 |
| `disable-zoom-haptics` | Disables haptics when zooming. | all |
| `downloads` | Enables downloading music and videos from YouTube. | 18.16.37 |
| `downloads` | Adds a download button to the YouTube video player. | 18.19.35 |
| `enable-debugging` | Adds debugging options. | all |
| `general-ads` | Removes general ads. | 18.16.37 |
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 18.16.37 |
| `hide-album-cards` | Hides the album cards below the artist description. | 18.16.37 |
| `hide-artist-card` | Hides the artist card below the searchbar. | 18.16.37 |
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 18.16.37 |
| `hide-breaking-news-shelf` | Hides the breaking news shelf on the homepage tab. | 18.16.37 |
| `hide-captions-button` | Hides the captions button on video player. | 18.16.37 |
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 18.19.35 |
| `hide-ads` | Removes general ads. | 18.19.35 |
| `hide-album-cards` | Hides the album cards below the artist description. | 18.19.35 |
| `hide-artist-card` | Hides the artist card below the searchbar. | 18.19.35 |
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 18.19.35 |
| `hide-breaking-news-shelf` | Hides the breaking news shelf on the homepage tab. | 18.19.35 |
| `hide-captions-button` | Hides the captions button on video player. | 18.19.35 |
| `hide-cast-button` | Hides the cast button in the video player. | all |
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.16.37 |
| `hide-email-address` | Hides the email address in the account switcher. | 18.16.37 |
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.16.37 |
| `hide-filter-bar` | Hides the filter bar in video feeds. | 18.16.37 |
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.16.37 |
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.19.35 |
| `hide-email-address` | Hides the email address in the account switcher. | 18.19.35 |
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.19.35 |
| `hide-filter-bar` | Hides the filter bar in video feeds. | 18.19.35 |
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.19.35 |
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.19.35 |
| `hide-info-cards` | Hides info cards in videos. | 18.19.35 |
| `hide-load-more-button` | Hides the button under videos that loads similar videos. | 18.19.35 |
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | 18.19.35 |
| `hide-player-overlay` | Hides the dark background overlay from the player when player controls are visible. | all |
| `hide-seekbar` | Hides the seekbar. | 18.16.37 |
| `hide-timestamp` | Hides timestamp in video player. | 18.16.37 |
| `hide-video-action-buttons` | Adds the options to hide action buttons under a video. | 18.16.37 |
| `hide-watch-in-vr` | Hides the option to watch in VR from the player settings flyout panel. | 18.16.37 |
| `hide-watermark` | Hides creator's watermarks on videos. | 18.16.37 |
| `minimized-playback` | Enables minimized and background playback. | 18.16.37 |
| `navigation-buttons` | Adds options to hide or change navigation buttons. | 18.16.37 |
| `old-quality-layout` | Enables the original video quality flyout in the video player settings | 18.16.37 |
| `open-links-externally` | Open links outside of the app directly in your browser. | 18.16.37 |
| `hide-seekbar` | Hides the seekbar. | 18.19.35 |
| `hide-shorts-components` | Hides components from YouTube Shorts. | 18.19.35 |
| `hide-timestamp` | Hides timestamp in video player. | 18.19.35 |
| `hide-video-action-buttons` | Adds the options to hide action buttons under a video. | 18.19.35 |
| `hide-watch-in-vr` | Hides the option to watch in VR from the player settings flyout panel. | 18.19.35 |
| `hide-watermark` | Hides creator's watermarks on videos. | 18.19.35 |
| `minimized-playback` | Enables minimized and background playback. | 18.19.35 |
| `navigation-buttons` | Adds options to hide or change navigation buttons. | 18.19.35 |
| `old-quality-layout` | Enables the original video quality flyout in the video player settings. | 18.19.35 |
| `open-links-externally` | Open links outside of the app directly in your browser. | 18.19.35 |
| `premium-heading` | Shows premium branding on the home screen. | all |
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 18.16.37 |
| `remove-player-button-background` | Removes the background from the video player buttons. | 18.16.37 |
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 18.16.37 |
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 18.16.37 |
| `sponsorblock` | Integrates SponsorBlock which allows skipping video segments such as sponsored content. | 18.16.37 |
| `spoof-app-version` | Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI. | 18.16.37 |
| `swipe-controls` | Adds volume and brightness swipe controls. | 18.16.37 |
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.16.37 |
| `vanced-microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.16.37 |
| `video-ads` | Removes ads in the video player. | 18.16.37 |
| `wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.16.37 |
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 18.19.35 |
| `remove-player-button-background` | Removes the background from the video player buttons. | 18.19.35 |
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 18.19.35 |
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 18.19.35 |
| `sponsorblock` | Integrates SponsorBlock which allows skipping video segments such as sponsored content. | 18.19.35 |
| `spoof-app-version` | Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI. | 18.19.35 |
| `swipe-controls` | Adds volume and brightness swipe controls. | 18.19.35 |
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.19.35 |
| `theme` | Applies a custom theme. | all |
| `vanced-microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.19.35 |
| `video-ads` | Removes ads in the video player. | 18.19.35 |
| `video-speed` | Adds custom video speeds and ability to remember the playback speed you chose in the video playback speed flyout. | 18.19.35 |
| `wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.19.35 |
</details>
### [📦 `com.google.android.apps.youtube.music`](https://play.google.com/store/apps/details?id=com.google.android.apps.youtube.music)
@@ -147,25 +151,26 @@ The official ReVanced Patches.
| `spotify-theme` | Applies a custom theme. | all |
</details>
### [📦 `com.reddit.frontpage`](https://play.google.com/store/apps/details?id=com.reddit.frontpage)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `general-reddit-ads` | Removes general ads from the Reddit frontpage and subreddits. | 2023.12.0 |
| `hide-subreddit-banner` | Hides banner ads from comments on subreddits. | 2023.12.0 |
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
</details>
### [📦 `com.facebook.orca`](https://play.google.com/store/apps/details?id=com.facebook.orca)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `disable-switching-emoji-to-sticker-in-message-input-field` | Disables switching from emoji to sticker search mode in message input field | all |
| `disable-typing-indicator` | Disables the indicator while typing a message | all |
| `hide-inbox-ads` | Hides ads in inbox. | all |
</details>
### [📦 `com.reddit.frontpage`](https://play.google.com/store/apps/details?id=com.reddit.frontpage)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `hide-ads` | Removes general ads from the Reddit frontpage and subreddits. | 2023.12.0 |
| `hide-subreddit-banner` | Hides banner ads from comments on subreddits. | 2023.12.0 |
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
</details>
### [📦 `at.gv.bmf.bmf2go`](https://play.google.com/store/apps/details?id=at.gv.bmf.bmf2go)
<details>
@@ -352,6 +357,14 @@ The official ReVanced Patches.
| `unlock-pro` | Unlocks pro features. | 4.6377 |
</details>
### [📦 `com.candylink.openvpn`](https://play.google.com/store/apps/details?id=com.candylink.openvpn)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `unlock-pro` | Unlocks premium features. | all |
</details>
### [📦 `org.totschnig.myexpenses`](https://play.google.com/store/apps/details?id=org.totschnig.myexpenses)
<details>
@@ -360,6 +373,14 @@ The official ReVanced Patches.
| `unlock-pro` | Unlocks all professional features. | 3.4.9 |
</details>
### [📦 `com.vsco.cam`](https://play.google.com/store/apps/details?id=com.vsco.cam)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `unlock-pro` | Unlocks pro features. | all |
</details>
### [📦 `com.ticktick.task`](https://play.google.com/store/apps/details?id=com.ticktick.task)
<details>

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.174.0-dev.26
version = 2.174.0-dev.36

File diff suppressed because one or more lines are too long

View File

@@ -1,11 +1,15 @@
package app.revanced.extensions
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.util.MethodUtil
import org.w3c.dom.Node
@@ -15,7 +19,7 @@ import org.w3c.dom.Node
*
* @return A [PatchResultError] for the [MethodFingerprint].
*/
fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $name")
internal fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $name")
/**
* Find the [MutableMethod] from a given [Method] in a [MutableClass].
@@ -23,7 +27,7 @@ fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $nam
* @param method The [Method] to find.
* @return The [MutableMethod].
*/
fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
internal fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
MethodUtil.methodSignaturesMatch(it, method)
}
@@ -32,7 +36,7 @@ fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
*
* @param transform the transformation function. original method goes in, transformed method goes out
*/
fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) {
internal fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) {
val transformedMethods = methods.map { it.transform() }
methods.clear()
methods.addAll(transformedMethods)
@@ -41,4 +45,29 @@ fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod)
internal fun Node.doRecursively(action: (Node) -> Unit) {
action(this)
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
}
internal fun MutableMethod.injectHideViewCall(
insertIndex: Int,
viewRegister: Int,
classDescriptor: String,
targetMethod: String
) = addInstruction(
insertIndex,
"invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V"
)
internal fun MutableMethod.findIndexForIdResource(resourceName: String): Int {
fun getIdResourceId(resourceName: String) = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == resourceName
}.id
val resourceId = getIdResourceId(resourceName)
return implementation!!.instructions.indexOfFirst {
if (it.opcode != Opcode.CONST) return@indexOfFirst false
val literal = (it as WideLiteralInstruction).wideLiteral
return@indexOfFirst resourceId == literal
}
}

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.candylinkvpn.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.candylink.openvpn")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View File

@@ -0,0 +1,11 @@
package app.revanced.patches.candylinkvpn.fingereprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object IsPremiumPurchasedFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("PreferenceProvider;") &&
methodDef.name == "isPremiumPurchased"
}
) {
}

View File

@@ -0,0 +1,37 @@
package app.revanced.patches.candylinkvpn.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.candylinkvpn.annotations.UnlockProCompatibility
import app.revanced.patches.candylinkvpn.fingereprints.IsPremiumPurchasedFingerprint
@Patch
@Name("unlock-pro")
@Description("Unlocks premium features.")
@UnlockProCompatibility
@Version("0.0.1")
class UnlockProPatch : BytecodePatch(
listOf(IsPremiumPurchasedFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
IsPremiumPurchasedFingerprint.result?.let {
it.mutableMethod.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
} ?: return IsPremiumPurchasedFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@@ -0,0 +1,15 @@
package app.revanced.patches.messenger.inputfield.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.dexbacked.value.DexBackedStringEncodedValue
object SendTypingIndicatorFingerprint : MethodFingerprint(
returnType = "V",
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"
}
}
)

View File

@@ -0,0 +1,29 @@
package app.revanced.patches.messenger.inputfield.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint
@Patch
@Name("disable-typing-indicator")
@Description("Disables the indicator while typing a message")
@Compatibility([Package("com.facebook.orca")])
@Version("0.0.1")
class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult {
SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void")
?: throw SendTypingIndicatorFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@@ -22,4 +22,4 @@ import app.revanced.patcher.annotation.Package
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class GeneralAdsCompatibility
internal annotation class HideAdsCompatibility

View File

@@ -8,7 +8,7 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.ad.general.annotations.GeneralAdsCompatibility
import app.revanced.patches.reddit.ad.general.annotations.HideAdsCompatibility
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
@@ -16,11 +16,11 @@ import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@Patch
@Name("general-reddit-ads")
@Name("hide-ads")
@Description("Removes general ads from the Reddit frontpage and subreddits.")
@GeneralAdsCompatibility
@HideAdsCompatibility
@Version("0.0.1")
class GeneralAdsPatch : BytecodePatch() {
class HideAdsPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach methodLoop@{ method ->

View File

@@ -1,24 +0,0 @@
package app.revanced.patches.shared.misc.fix.spoof.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class ClientSpoofCompatibility

View File

@@ -13,7 +13,7 @@ import app.revanced.patches.shared.misc.fix.verticalscroll.annotations.VerticalS
import app.revanced.patches.shared.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Description("Fixes issues with scrolling on the home screen when the first component is of type EmptyComponent.")
@Description("Fixes issues with refreshing the feed when the first component is of type EmptyComponent.")
@VerticalScrollCompatibility
@Version("0.0.1")
class VerticalScrollPatch : BytecodePatch(

View File

@@ -9,23 +9,26 @@ import org.w3c.dom.Element
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param tag The tag of the preference.
* @param summary The summary of the preference.
*/
internal abstract class BasePreference(
override val key: String,
override val title: StringResource,
) : IPreference {
val key: String?,
val title: StringResource,
val summary: StringResource? = null,
val tag: String
) {
/**
* Serialize preference element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
* @return The serialized element.
*/
open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element {
return ownerDocument.createElement(tag).apply {
if(key.isNotEmpty())
setAttribute("android:key", key)
setAttribute("android:title", "@string/${title.also { resourceCallback?.invoke(it) }.name}")
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element =
ownerDocument.createElement(tag).apply {
if (key != null) setAttribute("android:key", key)
setAttribute("android:title", "@string/${title.also { resourceCallback.invoke(it) }.name}")
addSummary(summary?.also { resourceCallback.invoke(it) })
}
}
}

View File

@@ -7,18 +7,19 @@ import org.w3c.dom.Element
* Base resource class for all resources.
*
* @param name The name of the resource.
* @param tag The tag of the resource.
*/
internal abstract class BaseResource(
override val name: String
) : IResource {
val name: String,
val tag: String
) {
/**
* Serialize resource element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
*/
open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element {
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit = { }): Element {
return ownerDocument.createElement(tag).apply {
setAttribute("name", name)
}

View File

@@ -10,7 +10,7 @@ import org.w3c.dom.Node
* @param resource The resource to add.
* @param resourceCallback Called when a resource has been processed.
*/
internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResource) -> Unit)? = null) {
internal fun Node.addResource(resource: BaseResource, resourceCallback: (BaseResource) -> Unit = { }) {
appendChild(resource.serialize(ownerDocument, resourceCallback))
}
@@ -20,7 +20,7 @@ internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResou
* @param preference The preference to add.
* @param resourceCallback Called when a resource has been processed.
*/
internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((IResource) -> Unit)? = null) {
internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((BaseResource) -> Unit) = { }) {
appendChild(preference.serialize(ownerDocument, resourceCallback))
}
@@ -30,10 +30,11 @@ internal fun Element.addSummary(summaryResource: StringResource?, summaryType: S
}
internal fun <T> Element.addDefault(default: T) {
if (default is Boolean && !(default as Boolean)) return // No need to include the default, as no value already means 'false'
default?.let {
setAttribute(
"android:defaultValue", when (it) {
is Boolean -> if (it) "true" else "false"
is Boolean -> it.toString()
is String -> it
else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}")
}

View File

@@ -0,0 +1,32 @@
package app.revanced.patches.shared.settings.preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import org.w3c.dom.Document
/**
* Base preference class that also has a default value.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param tag The tag of the preference.
* @param summary The summary of the preference.
* @param default The default value of the preference.
*/
internal abstract class DefaultBasePreference<T>(
key: String?,
title: StringResource,
summary: StringResource? = null,
tag: String,
val default: T? = null,
) : BasePreference(key, title, summary, tag) {
/**
* Serialize preference element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
* @return The serialized element.
*/
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply { addDefault(default) }
}

View File

@@ -1,23 +0,0 @@
package app.revanced.patches.shared.settings.preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
/**
* Preference
*/
internal interface IPreference {
/**
* Key of the preference.
*/
val key: String
/**
* Title of the preference.
*/
val title: StringResource
/**
* Tag name of the preference.
*/
val tag: String
}

View File

@@ -1,16 +0,0 @@
package app.revanced.patches.shared.settings.preference
/**
* Resource
*/
internal interface IResource {
/**
* Name of the resource.
*/
val name: String
/**
* Tag name of the resource.
*/
val tag: String
}

View File

@@ -1,34 +1,29 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.IResource
import org.w3c.dom.Document
import org.w3c.dom.Element
// TODO: allow specifying an array resource file instead of using a list of StringResources
/**
* Represents an array resource.
* An array resource.
*
* @param name The name of the array resource.
* @param items The items of the array resource.
*/
// TODO: allow specifying an array resource file instead of using a list of StringResources
internal data class ArrayResource(
override val name: String,
internal class ArrayResource(
name: String,
val items: List<StringResource>
) : BaseResource(name) {
override val tag = "string-array"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
) : BaseResource(name, "string-array") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("name", name)
items.forEach { item ->
resourceCallback?.invoke(item)
resourceCallback.invoke(item)
this.appendChild(ownerDocument.createElement("item").also { itemNode ->
itemNode.textContent = "@string/${item.name}"
})
}
}
}
}

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.shared.settings.preference.impl
enum class InputType(val type: String) {
STRING("text"), // TODO: rename to "TEXT"
TEXT("text"),
TEXT_CAP_CHARACTERS("textCapCharacters"),
TEXT_MULTI_LINE("textMultiLine"),
NUMBER("number"),

View File

@@ -1,11 +1,9 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.addDefault
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* List preference.
@@ -14,25 +12,21 @@ import org.w3c.dom.Element
* @param title The title of the list preference.
* @param entries The human-readable entries of the list preference.
* @param entryValues The entry values of the list preference.
* @param default The default entry value of the list preference.
* @param summary The summary of the list preference.
* @param default The default entry value of the list preference.
*/
internal class ListPreference(
key: String,
title: StringResource,
val entries: ArrayResource,
val entryValues: ArrayResource,
val default: String? = null,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "ListPreference"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:entries", "@array/${entries.also { resourceCallback?.invoke(it) }.name}")
setAttribute("android:entryValues", "@array/${entryValues.also { resourceCallback?.invoke(it) }.name}")
addDefault(default)
summary: StringResource? = null,
default: String? = null,
) : DefaultBasePreference<String>(key, title, summary, "ListPreference", default) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:entries", "@array/${entries.also { resourceCallback.invoke(it) }.name}")
setAttribute("android:entryValues", "@array/${entryValues.also { resourceCallback.invoke(it) }.name}")
addSummary(summary)
}
}
}

View File

@@ -1,24 +1,27 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* A simple static title and summary that is not backed by any preference key/value,
* and cannot be changed by or interacted with by the user,
* A non interactive preference.
*
* Not backed by any preference key/value,
* and cannot be changed by or interacted with by the user.
*
* @param title The title of the preference.
* @param summary The summary of the text preference.
*/
internal class NonInteractivePreference(
title: StringResource,
val summary: StringResource,
) : BasePreference("", title) {
override val tag: String = "Preference"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
summary: StringResource,
) : BasePreference(null, title, summary, "Preference") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary.also { resourceCallback?.invoke(it)
addSummary(summary?.also { resourceCallback.invoke(it)
setAttribute("android:selectable", false.toString())
})
}

View File

@@ -1,44 +1,41 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.addSummary
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* A Preference object.
* A preference object.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param intent The intent of the preference.
* @param summary The summary of the text preference.
* @param intent The intent of the preference.
*/
internal class Preference(
key: String,
title: StringResource,
val intent: Intent,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "Preference"
/* Key-less constructor */
summary: StringResource,
val intent: Intent
) : BasePreference(key, title, summary, "Preference") {
constructor(
title: StringResource,
intent: Intent,
summary: StringResource? = null
) : this("", title, intent, summary)
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback?.invoke(it) })
summary: StringResource,
intent: Intent
) : this("", title, summary, intent)
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
this.appendChild(ownerDocument.createElement("intent").also { intentNode ->
intentNode.setAttribute("android:targetPackage", intent.targetPackage)
intentNode.setAttribute("android:data", intent.data)
intentNode.setAttribute("android:targetClass", intent.targetClass)
})
}
}
data class Intent(val targetPackage: String, val data: String, val targetClass: String)
internal class Intent(
internal val targetPackage: String,
internal val data: String,
internal val targetClass: String
)
}

View File

@@ -1,12 +1,11 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Preference category.
* A preference category.
*
* @param key The key of the preference.
* @param title The title of the preference.
@@ -15,15 +14,13 @@ import org.w3c.dom.Element
internal open class PreferenceCategory(
key: String,
title: StringResource,
var preferences: List<BasePreference>
) : BasePreference(key, title) {
override val tag: String = "PreferenceCategory"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
var preferences: List<BasePreference>,
tag: String = "PreferenceCategory"
) : BasePreference(key, title, null, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
for (childPreference in preferences) {
this.appendChild(childPreference.serialize(ownerDocument, resourceCallback))
}
}
}
}

View File

@@ -1,13 +1,12 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Preference screen.
* A preference screen.
*
* @param key The key of the preference.
* @param title The title of the preference.
@@ -18,17 +17,13 @@ internal open class PreferenceScreen(
key: String,
title: StringResource,
var preferences: List<BasePreference>,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "PreferenceScreen"
summary: StringResource? = null
) : BasePreference(key, title, summary, "PreferenceScreen") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback.invoke(it) })
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback?.invoke(it) })
for (childPreference in preferences) {
for (childPreference in preferences)
this.appendChild(childPreference.serialize(ownerDocument, resourceCallback))
}
}
}
}

View File

@@ -1,31 +1,27 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.IResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Represents a string value in the strings.xml file
* A string value.
* Represets a string in the strings.xml file.
*
* @param name The name of the string
* @param value The value of the string
* @param formatted If the string is formatted. If false, the attribute will be set
* @param name The name of the string.
* @param value The value of the string.
* @param formatted If the string is formatted. If false, the attribute will be set.
*/
internal data class StringResource(
override val name: String,
internal class StringResource(
name: String,
val value: String,
val formatted: Boolean = true
) : BaseResource(name) {
override val tag = "string"
) : BaseResource(name, "string") {
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
// if the string is un-formatted, explicitly add the formatted attribute
if (!formatted)
setAttribute("formatted", "false")
if (!formatted) setAttribute("formatted", "false")
textContent = value
}
}
}

View File

@@ -1,37 +1,36 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.*
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import app.revanced.patches.shared.settings.preference.SummaryType
import app.revanced.patches.shared.settings.preference.addSummary
import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch.Companion.include
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Switch preference.
* A switch preference.
*
* @param key The key of the switch.
* @param title The title of the switch.
* @param default The default value of the switch.
* @param summaryOn The summary to show when the preference is enabled.
* @param summaryOff The summary to show when the preference is disabled.
* @param userDialogMessage The message to show in a dialog when the user toggles the preference.
* @param default The default value of the switch.
*/
internal class SwitchPreference(
key: String, title: StringResource,
val default: Boolean = false,
val summaryOn: StringResource? = null,
val summaryOff: StringResource? = null,
val userDialogMessage: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "SwitchPreference"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
// dialog message is stored as a regular string and later referenced by SettingsEnum
val summaryOn: StringResource,
val summaryOff: StringResource,
val userDialogMessage: StringResource? = null,
default: Boolean = false,
) : DefaultBasePreference<Boolean>( key, title, null, "SwitchPreference", default) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
userDialogMessage?.include()
return super.serialize(ownerDocument, resourceCallback).apply {
addDefault(default)
addSummary(summaryOn?.also { resourceCallback?.invoke(it) }, SummaryType.ON)
addSummary(summaryOff?.also { resourceCallback?.invoke(it) }, SummaryType.OFF)
addSummary(summaryOn.also { resourceCallback.invoke(it) }, SummaryType.ON)
addSummary(summaryOff.also { resourceCallback.invoke(it) }, SummaryType.OFF)
}
}
}

View File

@@ -1,35 +1,29 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.addDefault
import app.revanced.patches.shared.settings.preference.addSummary
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Text preference.
* A text preference.
*
* @param key The key of the text preference.
* @param title The title of the text preference.
* @param inputType The input type of the text preference.
* @param default The default value of the text preference.
* @param summary The summary of the text preference.
* @param default The default value of the text preference.
*/
internal class TextPreference(
key: String,
key: String?,
title: StringResource,
var inputType: InputType = InputType.STRING,
val default: String? = null,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "app.revanced.integrations.settingsmenu.ResettableEditTextPreference"
summary: StringResource?,
val inputType: InputType = InputType.TEXT,
default: String? = null,
tag: String = "app.revanced.integrations.settingsmenu.ResettableEditTextPreference"
) : DefaultBasePreference<String>(key, title, summary, tag, default) {
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:inputType", inputType.type)
addDefault(default)
addSummary(summary?.also { resourceCallback?.invoke(it) })
}
}
}

View File

@@ -6,7 +6,7 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addPreference
import app.revanced.patches.shared.settings.preference.addResource
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
@@ -108,7 +108,7 @@ abstract class AbstractSettingsResourcePatch(
*
* @throws IllegalArgumentException if the resource already exists.
*/
internal fun IResource.include() {
internal fun BaseResource.include() {
when (this) {
is StringResource -> {
if (strings.any { it.name == name }) return

View File

@@ -50,7 +50,6 @@ class AudioAdsPatch : BytecodePatch(
"revanced_block_audio_ads",
"Block audio ads"
),
true,
StringResource(
"revanced_block_audio_ads_on",
"Audio ads are blocked"
@@ -59,6 +58,7 @@ class AudioAdsPatch : BytecodePatch(
"revanced_block_audio_ads_off",
"Audio ads are unblocked"
),
default = true,
)
)

View File

@@ -66,7 +66,7 @@ class EmbeddedAdsPatch : BytecodePatch(
StringResource("key_revanced_proxy_purpleadblock", "purpleadblock")
)
),
"ttv-lol"
default = "ttv-lol"
)
)

View File

@@ -132,7 +132,6 @@ class VideoAdsPatch : AbstractAdPatch(
"revanced_block_video_ads",
"Block video ads"
),
true,
StringResource(
"revanced_block_video_ads_on",
"Video ads are blocked"
@@ -141,6 +140,7 @@ class VideoAdsPatch : AbstractAdPatch(
"revanced_block_video_ads_off",
"Video ads are unblocked"
),
default = true
)
)

View File

@@ -98,7 +98,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
StringResource("key_revanced_deleted_messages_cross_out", "cross-out")
)
),
"cross-out"
default = "cross-out"
)
)

View File

@@ -36,7 +36,6 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points",
"Automatically claim Channel Points"
),
true,
StringResource(
"revanced_auto_claim_channel_points_on",
"Channel Points are claimed automatically"
@@ -45,6 +44,7 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points_off",
"Channel Points are not claimed automatically"
),
default = true
)
)

View File

@@ -59,7 +59,6 @@ class DebugModePatch : BytecodePatch(
"revanced_debug_mode_enable",
"Enable debug mode"
),
false,
StringResource(
"revanced_debug_mode_on",
"Debug mode is enabled (not recommended)"
@@ -68,6 +67,7 @@ class DebugModePatch : BytecodePatch(
"revanced_debug_mode_off",
"Debug mode is disabled"
),
default = false,
)
)

View File

@@ -20,7 +20,6 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
@@ -183,10 +182,11 @@ class SettingsPatch : BytecodePatch(
internal inner class CustomCategory(key: String, title: String) : Screen.Category(key, title) {
/* For Twitch, we need to load our CustomPreferenceCategory class instead of the default one. */
override fun transform(): PreferenceCategory {
return CustomPreferenceCategory(
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value }
preferences.sortedBy { it.title.value },
"app.revanced.twitch.settingsmenu.preference.CustomPreferenceCategory"
)
}
}

View File

@@ -1,20 +0,0 @@
package app.revanced.patches.twitch.misc.settings.components
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.impl.PreferenceCategory
import app.revanced.patches.shared.settings.preference.impl.StringResource
/**
* Customized preference category for Twitch.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param preferences Child preferences of this category.
*/
internal open class CustomPreferenceCategory(
key: String,
title: StringResource,
preferences: List<BasePreference>
) : PreferenceCategory(key, title, preferences) {
override val tag: String = "app.revanced.twitch.settingsmenu.preference.CustomPreferenceCategory"
}

View File

@@ -5,5 +5,9 @@ import org.jf.dexlib2.Opcode
object JsonHookPatchFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ -> methodDef.name == "<clinit>" },
opcodes = listOf(Opcode.IGET_OBJECT)
opcodes = listOf(
Opcode.INVOKE_INTERFACE, // Add dummy hook to hooks list.
// Add hooks to the hooks list.
Opcode.INVOKE_STATIC // Call buildList.
)
)

View File

@@ -5,13 +5,18 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patches.twitter.misc.hook.json.fingerprints.JsonHookPatchFingerprint
import app.revanced.patches.twitter.misc.hook.json.fingerprints.JsonInputStreamFingerprint
import app.revanced.patches.twitter.misc.hook.json.fingerprints.LoganSquareFingerprint
import java.io.Closeable
import java.io.InvalidClassException
@Name("json-hook")
@@ -20,16 +25,16 @@ import java.io.InvalidClassException
@RequiresIntegrations
class JsonHookPatch : BytecodePatch(
listOf(LoganSquareFingerprint)
) {
), Closeable {
override fun execute(context: BytecodeContext): PatchResult {
// Make sure the integrations are present.
val jsonHookPatch = context.findClass { it.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
?: return PatchResultError("Could not find integrations.")
JsonHookPatchFingerprint.also {
// Make sure the integrations are present.
val jsonHookPatch = context.findClass { classDef -> classDef.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
?: throw PatchResultError("Could not find integrations.")
// Allow patch to inject hooks into the patches integrations.
jsonHookPatchFingerprintResult = JsonHookPatchFingerprint.also {
it.resolve(context, jsonHookPatch.immutableClass)
}.result ?: return PatchResultError("Unexpected integrations.")
if (!it.resolve(context, jsonHookPatch.immutableClass))
throw PatchResultError("Unexpected integrations.")
}.let { hooks = JsonHookPatchHook(it) }
// Conveniently find the type to hook a method in, via a named field.
val jsonFactory = LoganSquareFingerprint.result
@@ -64,30 +69,10 @@ class JsonHookPatch : BytecodePatch(
*
* @param context The [BytecodeContext] of the current patch.
* @param descriptor The class descriptor of the hook.
* @throws ClassNotFoundException If the class could not be found.
*/
internal class Hook(context: BytecodeContext, private val descriptor: String) {
private var added = false
/**
* Add the hook.
*/
internal fun add() {
if (added) return
jsonHookPatchFingerprintResult.apply {
mutableMethod.apply {
addInstructions(
scanResult.patternScanResult!!.startIndex,
"""
sget-object v1, $descriptor->INSTANCE:$descriptor
invoke-virtual {v0, v1}, Lkotlin/collections/builders/ListBuilder;->add(Ljava/lang/Object;)Z
"""
)
}
}
added = true
}
internal class Hook(context: BytecodeContext, internal val descriptor: String) {
internal var added = false
init {
context.findClass { it.type == descriptor }?.let {
@@ -102,15 +87,67 @@ class JsonHookPatch : BytecodePatch(
}
}
private companion object {
const val JSON_HOOK_CLASS_NAMESPACE = "app/revanced/twitter/patches/hook/json"
/**
* A hook for the [JsonHookPatch].
*
* @param jsonHookPatchFingerprint The [JsonHookPatchFingerprint] to hook.
*/
internal class JsonHookPatchHook(jsonHookPatchFingerprint: MethodFingerprint): Closeable {
private val jsonHookPatchFingerprintResult = jsonHookPatchFingerprint.result!!
private val jsonHookPatchIndex = jsonHookPatchFingerprintResult.scanResult.patternScanResult!!.endIndex
const val JSON_HOOK_PATCH_CLASS_DESCRIPTOR = "L$JSON_HOOK_CLASS_NAMESPACE/JsonHookPatch;"
/**
* Add a hook to the [JsonHookPatch].
* Will not add the hook if it's already added.
*
* @param hook The [Hook] to add.
*/
fun addHook(hook: Hook) {
if (hook.added) return
const val BASE_PATCH_CLASS_NAME = "BaseJsonHook"
jsonHookPatchFingerprintResult.mutableMethod.apply {
// Insert hooks right before calling buildList.
val insertIndex = jsonHookPatchIndex
const val JSON_HOOK_CLASS_DESCRIPTOR = "L$JSON_HOOK_CLASS_NAMESPACE/$BASE_PATCH_CLASS_NAME;"
addInstructions(
insertIndex,
"""
sget-object v1, ${hook.descriptor}->INSTANCE:${hook.descriptor}
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
"""
)
}
private lateinit var jsonHookPatchFingerprintResult: MethodFingerprintResult
hook.added = true
}
override fun close() {
// Remove hooks.add(dummyHook).
jsonHookPatchFingerprintResult.mutableMethod.apply {
val addDummyHookIndex = jsonHookPatchIndex - 2
removeInstructions(addDummyHookIndex, 2)
}
}
}
override fun close() = hooks.close()
internal companion object {
private const val JSON_HOOK_CLASS_NAMESPACE = "app/revanced/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"
private const val JSON_HOOK_CLASS_DESCRIPTOR = "L$JSON_HOOK_CLASS_NAMESPACE/$BASE_PATCH_CLASS_NAME;"
/**
* The [JsonHookPatchHook] of the [JsonHookPatch].
*
* @see JsonHookPatchHook
*/
internal lateinit var hooks: JsonHookPatchHook
}
}

View File

@@ -4,13 +4,13 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.twitter.misc.hook.json.patch.JsonHookPatch
@DependsOn([JsonHookPatch::class])
abstract class BaseHookPatchPatch(private val hookClassDescriptor: String) : BytecodePatch() {
override fun execute(context: BytecodeContext) = try {
PatchResultSuccess().also { JsonHookPatch.Hook(context, hookClassDescriptor).add() }
JsonHookPatch.hooks.addHook(JsonHookPatch.Hook(context, hookClassDescriptor))
PatchResultSuccess()
} catch (ex: Exception) {
PatchResultError(ex)
}

View File

@@ -15,8 +15,4 @@ import app.revanced.patches.twitter.misc.hook.patch.ads.annotations.HideAdsCompa
@Description("Hides ads.")
@HideAdsCompatibility
@Version("0.0.1")
class HideAdsPatch : BaseHookPatchPatch(HOOK_CLASS_DESCRIPTOR) {
private companion object {
const val HOOK_CLASS_DESCRIPTOR = "Lapp/revanced/twitter/patches/hook/patch/ads/AdsHook;"
}
}
class HideAdsPatch : BaseHookPatchPatch("Lapp/revanced/twitter/patches/hook/patch/ads/AdsHook;")

View File

@@ -15,9 +15,6 @@ import app.revanced.patches.twitter.misc.hook.patch.recommendation.annotations.H
@Description("Hides recommended users.")
@HideRecommendedUsersCompatibility
@Version("0.0.1")
class HideRecommendedUsersPatch : BaseHookPatchPatch(HOOK_CLASS_DESCRIPTOR) {
private companion object {
const val HOOK_CLASS_DESCRIPTOR =
"Lapp/revanced/twitter/patches/hook/patch/recommendation/RecommendedUsersHook;"
}
}
class HideRecommendedUsersPatch : BaseHookPatchPatch(
"Lapp/revanced/twitter/patches/hook/patch/recommendation/RecommendedUsersHook;"
)

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.vsco.misc.pro.fingerprints
import org.jf.dexlib2.AccessFlags
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object RevCatSubscriptionFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf("use_debug_subscription_settings"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("/RevCatSubscriptionSettingsRepository;")
}
)

View File

@@ -0,0 +1,35 @@
package app.revanced.patches.vsco.misc.pro.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.vsco.misc.pro.fingerprints.RevCatSubscriptionFingerprint
@Patch
@Name("unlock-pro")
@Description("Unlocks pro features.")
@Compatibility([Package("com.vsco.cam")])
@Version("0.0.1")
class UnlockProPatch : BytecodePatch(
listOf(RevCatSubscriptionFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
RevCatSubscriptionFingerprint.result?.mutableMethod?.apply {
// Set isSubscribed to true.
addInstructions(
0,
"""
const p1, 0x1
"""
)
} ?: return RevCatSubscriptionFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@@ -1,25 +0,0 @@
package app.revanced.patches.youtube.ad.general.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class GeneralAdsCompatibility

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.youtube.ad.general.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideAdsCompatibility

View File

@@ -1,17 +0,0 @@
package app.revanced.patches.youtube.ad.general.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
object ReelConstructorFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.INVOKE_VIRTUAL
),
customFingerprint = { method, _ ->
method.implementation?.instructions?.any {
it.opcode == Opcode.CONST && (it as WideLiteralInstruction).wideLiteral == GeneralAdsResourcePatch.reelMultipleItemShelfId
} ?: false
}
)

View File

@@ -1,47 +1,32 @@
package app.revanced.patches.youtube.ad.general.bytecode.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.toErrorResult
import app.revanced.extensions.injectHideViewCall
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
import app.revanced.patches.youtube.ad.general.bytecode.fingerprints.ReelConstructorFingerprint
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch
import app.revanced.patches.youtube.ad.general.annotation.HideAdsCompatibility
import app.revanced.patches.youtube.ad.general.resource.patch.HideAdsResourcePatch
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch
@DependsOn([GeneralAdsResourcePatch::class, VerticalScrollPatch::class, FixBackToExitGesturePatch::class])
@Name("general-ads")
@DependsOn([HideAdsResourcePatch::class, VerticalScrollPatch::class, FixBackToExitGesturePatch::class])
@Name("hide-ads")
@Description("Removes general ads.")
@GeneralAdsCompatibility
@HideAdsCompatibility
@Version("0.0.1")
class GeneralAdsPatch : BytecodePatch(
listOf(ReelConstructorFingerprint)
) {
class HideAdsPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
fun String.buildHideCall(viewRegister: Int) = "invoke-static { v$viewRegister }, " +
"Lapp/revanced/integrations/patches/GeneralAdsPatch;" +
"->" +
"$this(Landroid/view/View;)V"
fun MutableMethod.injectHideCall(insertIndex: Int, viewRegister: Int, method: String) =
this.addInstruction(insertIndex, method.buildHideCall(viewRegister))
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
with(method.implementation) {
@@ -49,7 +34,7 @@ class GeneralAdsPatch : BytecodePatch(
if (instruction.opcode != org.jf.dexlib2.Opcode.CONST)
return@forEachIndexed
// Instruction to store the id adAttribution into a register
if ((instruction as Instruction31i).wideLiteral != GeneralAdsResourcePatch.adAttributionId)
if ((instruction as Instruction31i).wideLiteral != HideAdsResourcePatch.adAttributionId)
return@forEachIndexed
val insertIndex = index + 1
@@ -64,25 +49,18 @@ class GeneralAdsPatch : BytecodePatch(
context.proxy(classDef)
.mutableClass
.findMutableMethodOf(method)
.injectHideCall(insertIndex, viewRegister, "hideAdAttributionView")
.injectHideViewCall(
insertIndex,
viewRegister,
"Lapp/revanced/integrations/patches/components/AdsFilter;",
"hideAdAttributionView"
)
}
}
}
}
}
ReelConstructorFingerprint.result?.let {
// iput-object v$viewRegister, ...
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 2
it.mutableMethod.apply {
val viewRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
injectHideCall(insertIndex, viewRegister, "hideReelView")
}
} ?: return ReelConstructorFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@@ -1,303 +0,0 @@
package app.revanced.patches.youtube.ad.general.resource.patch
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen
@DependsOn(
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class,
ResourceMappingPatch::class
]
)
@GeneralAdsCompatibility
@Version("0.0.1")
class GeneralAdsResourcePatch : ResourcePatch {
internal companion object {
var adAttributionId: Long = -1
var reelMultipleItemShelfId: Long = -1
}
override fun execute(context: ResourceContext): PatchResult {
PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_adremover_separator",
StringResource("revanced_adremover_separator_title", "Hide gray separator"),
true,
StringResource("revanced_adremover_separator_summary_on", "Gray separators are hidden"),
StringResource("revanced_adremover_separator_summary_off", "Gray separators are shown")
),
SwitchPreference(
"revanced_adremover_hide_channel_guidelines",
StringResource("revanced_adremover_hide_channel_guidelines_enabled_title", "Hide channel guidelines"),
true,
StringResource(
"revanced_adremover_hide_channel_guidelines_enabled_summary_on",
"Channel guidelines are hidden"
),
StringResource(
"revanced_adremover_hide_channel_guidelines_enabled_summary_off",
"Channel guidelines are shown"
)
),
SwitchPreference(
"revanced_adremover_chapter_teaser",
StringResource(
"revanced_adremover_chapter_teaser_enabled_title",
"Hide chapter teaser under videos"
),
true,
StringResource(
"revanced_adremover_chapter_teaser_enabled_summary_on",
"Chapter teasers are hidden"
),
StringResource(
"revanced_adremover_chapter_teaser_enabled_summary_off",
"Chapter teasers are shown"
)
),
SwitchPreference(
"revanced_adremover_merchandise",
StringResource("revanced_adremover_merchandise_enabled_title", "Hide merchandise banners"),
true,
StringResource("revanced_adremover_merchandise_enabled_summary_on", "Merchandise banners are hidden"),
StringResource("revanced_adremover_merchandise_enabled_summary_off", "Merchandise banners are shown")
),
SwitchPreference(
"revanced_adremover_community_posts_removal",
StringResource("revanced_adremover_community_posts_enabled_title", "Hide community posts"),
false,
StringResource("revanced_adremover_community_posts_enabled_summary_on", "Community posts are hidden"),
StringResource("revanced_adremover_community_posts_enabled_summary_off", "Community posts are shown")
),
SwitchPreference(
"revanced_adremover_compact_banner_removal",
StringResource("revanced_adremover_compact_banner_enabled_title", "Hide compact banners"),
true,
StringResource("revanced_adremover_compact_banner_enabled_summary_on", "Compact banners are hidden"),
StringResource("revanced_adremover_compact_banner_enabled_summary_off", "Compact banners are shown")
),
SwitchPreference(
"revanced_adremover_view_products",
StringResource("revanced_adremover_view_products_title", "Hide banner to view products"),
true,
StringResource("revanced_adremover_view_products_summary_on", "Banner is hidden"),
StringResource("revanced_adremover_view_products_summary_off", "Banner is shown")
),
SwitchPreference(
"revanced_adremover_web_search_result",
StringResource("revanced_adremover_web_search_result_panel_title", "Hide web search results"),
true,
StringResource("revanced_adremover_web_search_result_summary_on", "Web search results are hidden"),
StringResource("revanced_adremover_web_search_result_summary_off", "Web search results are shown")
),
SwitchPreference(
"revanced_adremover_movie",
StringResource("revanced_adremover_movie_enabled_title", "Hide movies section"),
true,
StringResource("revanced_adremover_movie_enabled_summary_on", "Movies section is hidden"),
StringResource("revanced_adremover_movie_enabled_summary_off", "Movies section is shown")
),
SwitchPreference(
"revanced_adremover_feed_survey",
StringResource("revanced_adremover_feed_survey_enabled_title", "Hide feed surveys"),
true,
StringResource("revanced_adremover_feed_survey_enabled_summary_on", "Feed surveys are hidden"),
StringResource("revanced_adremover_feed_survey_enabled_summary_off", "Feed surveys are shown")
),
SwitchPreference(
"revanced_adremover_shorts",
StringResource("revanced_adremover_shorts_enabled_title", "Hide shorts"),
true,
StringResource("revanced_adremover_shorts_enabled_summary_on", "Shorts are hidden"),
StringResource("revanced_adremover_shorts_enabled_summary_off", "Shorts are shown")
),
SwitchPreference(
"revanced_adremover_community_guidelines",
StringResource("revanced_adremover_community_guidelines_enabled_title", "Hide community guidelines"),
true,
StringResource(
"revanced_adremover_community_guidelines_enabled_summary_on",
"Community guidelines are hidden"
),
StringResource(
"revanced_adremover_community_guidelines_enabled_summary_off",
"Community guidelines are shown"
)
),
SwitchPreference(
"revanced_adremover_subscribers_community_guidelines_removal",
StringResource(
"revanced_adremover_subscribers_community_guidelines_enabled_title",
"Hide subscribers community guidelines"
),
true,
StringResource(
"revanced_adremover_subscribers_community_guidelines_enabled_summary_on",
"Subscribers community guidelines are hidden"
),
StringResource(
"revanced_adremover_subscribers_community_guidelines_enabled_summary_off",
"Subscribers community guidelines are shown"
)
),
SwitchPreference(
"revanced_adremover_channel_member_shelf_removal",
StringResource("revanced_adremover_channel_member_shelf_enabled_title", "Hide channel member shelf"),
true,
StringResource(
"revanced_adremover_channel_member_shelf_enabled_summary_on",
"Channel member shelf is hidden"
),
StringResource(
"revanced_adremover_channel_member_shelf_enabled_summary_off",
"Channel member shelf is shown"
)
),
SwitchPreference(
"revanced_adremover_emergency_box_removal",
StringResource("revanced_adremover_emergency_box_enabled_title", "Hide emergency boxes"),
true,
StringResource("revanced_adremover_emergency_box_enabled_summary_on", "Emergency boxes are hidden"),
StringResource("revanced_adremover_emergency_box_enabled_summary_off", "Emergency boxes are shown")
),
SwitchPreference(
"revanced_adremover_info_panel",
StringResource("revanced_adremover_info_panel_enabled_title", "Hide info panels"),
true,
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Info panels are hidden"),
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Info panels are shown")
),
SwitchPreference(
"revanced_adremover_medical_panel",
StringResource("revanced_adremover_medical_panel_enabled_title", "Hide medical panels"),
true,
StringResource("revanced_adremover_medical_panel_enabled_summary_on", "Medical panels are hidden"),
StringResource("revanced_adremover_medical_panel_enabled_summary_off", "Medical panels are shown")
),
SwitchPreference(
"revanced_hide_channel_bar",
StringResource("revanced_hide_channel_bar_title", "Hide channel bar"),
false,
StringResource("revanced_hide_channel_bar_summary_on", "Channel bar is hidden"),
StringResource("revanced_hide_channel_bar_summary_off", "Channel bar is shown")
),
SwitchPreference(
"revanced_hide_quick_actions",
StringResource("revanced_hide_quick_actions_title", "Hide quick actions in fullscreen"),
false,
StringResource("revanced_hide_quick_actions_summary_on", "Quick actions are hidden"),
StringResource("revanced_hide_quick_actions_summary_off", "Quick actions are shown")
),
SwitchPreference(
"revanced_hide_related_videos",
StringResource("revanced_hide_related_videos_title", "Hide related videos in quick actions"),
false,
StringResource("revanced_hide_related_videos_summary_on", "Related videos are hidden"),
StringResource("revanced_hide_related_videos_summary_off", "Related videos are shown")
),
SwitchPreference(
"revanced_hide_image_shelf",
StringResource("revanced_hide_image_shelf", "Hide image shelf in search results"),
true,
StringResource("revanced_hide_image_shelf_summary_on", "Image shelf is hidden"),
StringResource("revanced_hide_image_shelf_summary_off", "Image shelf is shown")
),
SwitchPreference(
"revanced_hide_audio_track_button",
StringResource("revanced_hide_audio_track_button_title", "Hide audio track button"),
false,
StringResource("revanced_hide_audio_track_button_on", "Audio track button is hidden"),
StringResource("revanced_hide_audio_track_button_off", "Audio track button is shown")
)
)
PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_adremover_ad_removal",
StringResource("revanced_adremover_ad_removal_enabled_title", "Hide general ads"),
true,
StringResource("revanced_adremover_ad_removal_enabled_summary_on", "General ads are hidden"),
StringResource("revanced_adremover_ad_removal_enabled_summary_off", "General ads are shown")
),
SwitchPreference(
"revanced_adremover_buttoned",
StringResource("revanced_adremover_buttoned_enabled_title", "Hide buttoned ad"),
true,
StringResource("revanced_adremover_buttoned_enabled_summary_on", "Buttoned ads are hidden"),
StringResource("revanced_adremover_buttoned_enabled_summary_off", "Buttoned ads are shown")
),
SwitchPreference(
"revanced_adremover_paid_content",
StringResource("revanced_adremover_paid_content_enabled_title", "Hide paid content"),
true,
StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"),
StringResource("revanced_adremover_paid_content_enabled_summary_off", "Paid content is shown")
),
SwitchPreference(
"revanced_adremover_hide_latest_posts",
StringResource("revanced_adremover_hide_latest_posts_enabled_title", "Hide latest posts"),
true,
StringResource("revanced_adremover_hide_latest_posts_enabled_summary_on", "Latest posts are hidden"),
StringResource("revanced_adremover_hide_latest_posts_enabled_summary_off", "Latest posts are shown")
),
SwitchPreference(
"revanced_adremover_self_sponsor",
StringResource("revanced_adremover_self_sponsor_enabled_title", "Hide self sponsored cards"),
true,
StringResource("revanced_adremover_self_sponsor_enabled_summary_on", "Self sponsored cards are hidden"),
StringResource("revanced_adremover_self_sponsor_enabled_summary_off", "Self sponsored cards are shown")
),
PreferenceScreen(
"revanced_adremover_custom",
StringResource("revanced_adremover_custom_title", "Custom filter"),
listOf(
SwitchPreference(
"revanced_adremover_custom_enabled",
StringResource(
"revanced_adremover_custom_enabled_title",
"Enable custom filter"
),
false,
StringResource(
"revanced_adremover_custom_enabled_summary_on",
"Custom filter is enabled"
),
StringResource(
"revanced_adremover_custom_enabled_summary_off",
"Custom filter is disabled"
)
),
// TODO: This should be a dynamic ListPreference, which does not exist yet
TextPreference(
"revanced_adremover_custom_strings",
StringResource("revanced_adremover_custom_strings_title", "Custom filter"),
InputType.STRING,
"",
StringResource(
"revanced_adremover_custom_strings_summary",
"Filter components by their name separated by a comma"
)
)
)
)
)
fun String.getId() = ResourceMappingPatch.resourceMappings.single { it.name == this }.id
adAttributionId = "ad_attribution".getId()
reelMultipleItemShelfId = "reel_multiple_items_shelf".getId()
return PatchResultSuccess()
}
}

View File

@@ -0,0 +1,264 @@
package app.revanced.patches.youtube.ad.general.resource.patch
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.youtube.ad.general.annotation.HideAdsCompatibility
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen
@DependsOn(
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class,
ResourceMappingPatch::class
]
)
@HideAdsCompatibility
@Version("0.0.1")
class HideAdsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_gray_separator",
StringResource("revanced_hide_gray_separator_title", "Hide gray separator"),
StringResource("revanced_hide_gray_separator_summary_on", "Gray separators are hidden"),
StringResource("revanced_hide_gray_separator_summary_off", "Gray separators are shown")
),
SwitchPreference(
"revanced_hide_channel_guidelines",
StringResource("revanced_hide_channel_guidelines_title", "Hide channel guidelines"),
StringResource(
"revanced_hide_channel_guidelines_summary_on",
"Channel guidelines are hidden"
),
StringResource(
"revanced_hide_channel_guidelines_summary_off",
"Channel guidelines are shown"
)
),
SwitchPreference(
"revanced_hide_chapter_teaser",
StringResource(
"revanced_hide_chapter_teaser_title",
"Hide chapter teaser under videos"
),
StringResource(
"revanced_hide_chapter_teaser_summary_on",
"Chapter teasers are hidden"
),
StringResource(
"revanced_hide_chapter_teaser_summary_off",
"Chapter teasers are shown"
)
),
SwitchPreference(
"revanced_hide_merchandise_banners",
StringResource("revanced_hide_merchandise_banners_title", "Hide merchandise banners"),
StringResource("revanced_hide_merchandise_banners_summary_on", "Merchandise banners are hidden"),
StringResource("revanced_hide_merchandise_banners_summary_off", "Merchandise banners are shown")
),
SwitchPreference(
"revanced_hide_community_posts",
StringResource("revanced_hide_community_posts_title", "Hide community posts"),
StringResource("revanced_hide_community_posts_summary_on", "Community posts are hidden"),
StringResource("revanced_hide_community_posts_summary_off", "Community posts are shown")
),
SwitchPreference(
"revanced_hide_compact_banner",
StringResource("revanced_hide_compact_banner_title", "Hide compact banners"),
StringResource("revanced_hide_compact_banner_summary_on", "Compact banners are hidden"),
StringResource("revanced_hide_compact_banner_summary_off", "Compact banners are shown")
),
SwitchPreference(
"revanced_hide_products_banner",
StringResource("revanced_hide_products_banner_title", "Hide banner to view products"),
StringResource("revanced_hide_products_banner_summary_on", "Banner is hidden"),
StringResource("revanced_hide_products_banner_summary_off", "Banner is shown")
),
SwitchPreference(
"revanced_hide_web_search_results",
StringResource("revanced_hide_web_search_results_title", "Hide web search results"),
StringResource("revanced_hide_web_search_results_summary_on", "Web search results are hidden"),
StringResource("revanced_hide_web_search_results_summary_off", "Web search results are shown")
),
SwitchPreference(
"revanced_hide_movies_section",
StringResource("revanced_hide_movies_section_title", "Hide movies section"),
StringResource("revanced_hide_movies_section_summary_on", "Movies section is hidden"),
StringResource("revanced_hide_movies_section_summary_off", "Movies section is shown")
),
SwitchPreference(
"revanced_hide_feed_survey",
StringResource("revanced_hide_feed_survey_title", "Hide feed surveys"),
StringResource("revanced_hide_feed_survey_summary_on", "Feed surveys are hidden"),
StringResource("revanced_hide_feed_survey_summary_off", "Feed surveys are shown")
),
SwitchPreference(
"revanced_hide_community_guidelines",
StringResource("revanced_hide_community_guidelines_title", "Hide community guidelines"),
StringResource(
"revanced_hide_community_guidelines_summary_on",
"Community guidelines are hidden"
),
StringResource(
"revanced_hide_community_guidelines_summary_off",
"Community guidelines are shown"
)
),
SwitchPreference(
"revanced_hide_subscribers_community_guidelines",
StringResource(
"revanced_hide_subscribers_community_guidelines_title",
"Hide subscribers community guidelines"
),
StringResource(
"revanced_hide_subscribers_community_guidelines_summary_on",
"Subscribers community guidelines are hidden"
),
StringResource(
"revanced_hide_subscribers_community_guidelines_summary_off",
"Subscribers community guidelines are shown"
)
),
SwitchPreference(
"revanced_hide_channel_member_shelf",
StringResource("revanced_hide_channel_member_shelf_title", "Hide channel member shelf"),
StringResource(
"revanced_hide_channel_member_shelf_summary_on",
"Channel member shelf is hidden"
),
StringResource(
"revanced_hide_channel_member_shelf_summary_off",
"Channel member shelf is shown"
)
),
SwitchPreference(
"revanced_hide_emergency_box",
StringResource("revanced_hide_emergency_box_title", "Hide emergency boxes"),
StringResource("revanced_hide_emergency_box_summary_on", "Emergency boxes are hidden"),
StringResource("revanced_hide_emergency_box_summary_off", "Emergency boxes are shown")
),
SwitchPreference(
"revanced_hide_info_panels",
StringResource("revanced_hide_info_panels_title", "Hide info panels"),
StringResource("revanced_hide_info_panels_summary_on", "Info panels are hidden"),
StringResource("revanced_hide_info_panels_summary_off", "Info panels are shown")
),
SwitchPreference(
"revanced_hide_medical_panels",
StringResource("revanced_hide_medical_panels_title", "Hide medical panels"),
StringResource("revanced_hide_medical_panels_summary_on", "Medical panels are hidden"),
StringResource("revanced_hide_medical_panels_summary_off", "Medical panels are shown")
),
SwitchPreference(
"revanced_hide_channel_bar",
StringResource("revanced_hide_channel_bar_title", "Hide channel bar"),
StringResource("revanced_hide_channel_bar_summary_on", "Channel bar is hidden"),
StringResource("revanced_hide_channel_bar_summary_off", "Channel bar is shown")
),
SwitchPreference(
"revanced_hide_quick_actions",
StringResource("revanced_hide_quick_actions_title", "Hide quick actions in fullscreen"),
StringResource("revanced_hide_quick_actions_summary_on", "Quick actions are hidden"),
StringResource("revanced_hide_quick_actions_summary_off", "Quick actions are shown")
),
SwitchPreference(
"revanced_hide_related_videos",
StringResource("revanced_hide_related_videos_title", "Hide related videos in quick actions"),
StringResource("revanced_hide_related_videos_summary_on", "Related videos are hidden"),
StringResource("revanced_hide_related_videos_summary_off", "Related videos are shown")
),
SwitchPreference(
"revanced_hide_image_shelf",
StringResource("revanced_hide_image_shelf", "Hide image shelf in search results"),
StringResource("revanced_hide_image_shelf_summary_on", "Image shelf is hidden"),
StringResource("revanced_hide_image_shelf_summary_off", "Image shelf is shown")
),
SwitchPreference(
"revanced_hide_audio_track_button",
StringResource("revanced_hide_audio_track_button_title", "Hide audio track button"),
StringResource("revanced_hide_audio_track_button_on", "Audio track button is hidden"),
StringResource("revanced_hide_audio_track_button_off", "Audio track button is shown")
)
)
PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_hide_general_ads",
StringResource("revanced_hide_general_ads_title", "Hide general ads"),
StringResource("revanced_hide_general_ads_summary_on", "General ads are hidden"),
StringResource("revanced_hide_general_ads_summary_off", "General ads are shown")
),
SwitchPreference(
"revanced_hide_buttoned_ads",
StringResource("revanced_hide_buttoned_ads_title", "Hide buttoned ad"),
StringResource("revanced_hide_buttoned_ads_summary_on", "Buttoned ads are hidden"),
StringResource("revanced_hide_buttoned_ads_summary_off", "Buttoned ads are shown")
),
SwitchPreference(
"revanced_hide_paid_content_ads",
StringResource("revanced_hide_paid_content_ads_title", "Hide paid content"),
StringResource("revanced_hide_paid_content_ads_summary_on", "Paid content is hidden"),
StringResource("revanced_hide_paid_content_ads_summary_off", "Paid content is shown")
),
SwitchPreference(
"revanced_hide_latest_posts_ads",
StringResource("revanced_hide_latest_posts_ads_title", "Hide latest posts"),
StringResource("revanced_hide_latest_posts_ads_summary_on", "Latest posts are hidden"),
StringResource("revanced_hide_latest_posts_ads_summary_off", "Latest posts are shown")
),
SwitchPreference(
"revanced_hide_self_sponsor_ads",
StringResource("revanced_hide_self_sponsor_ads_title", "Hide self sponsored cards"),
StringResource("revanced_hide_self_sponsor_ads_summary_on", "Self sponsored cards are hidden"),
StringResource("revanced_hide_self_sponsor_ads_summary_off", "Self sponsored cards are shown")
),
PreferenceScreen(
"revanced_custom_filter_preference_screen",
StringResource("revanced_custom_filter_preference_screen_title", "Custom filter"),
listOf(
SwitchPreference(
"revanced_custom_filter",
StringResource(
"revanced_custom_filter_title",
"Enable custom filter"
),
StringResource(
"revanced_custom_filter_summary_on",
"Custom filter is enabled"
),
StringResource(
"revanced_custom_filter_summary_off",
"Custom filter is disabled"
)
),
// TODO: This should be a dynamic ListPreference, which does not exist yet
TextPreference(
"revanced_custom_filter_strings",
StringResource("revanced_custom_filter_strings_title", "Custom filter"),
StringResource(
"revanced_custom_filter_strings_summary",
"Filter components by their name separated by a comma"
)
)
)
)
)
adAttributionId = ResourceMappingPatch.resourceMappings.single { it.name == "ad_attribution" }.id
return PatchResultSuccess()
}
internal companion object {
var adAttributionId: Long = -1
}
}

View File

@@ -3,23 +3,7 @@ package app.revanced.patches.youtube.ad.video.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class VideoAdsCompatibility

View File

@@ -33,11 +33,10 @@ class VideoAdsPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_video_ads_removal",
StringResource("revanced_video_ads_removal_title", "Hide video ads"),
true,
StringResource("revanced_video_ads_removal_summary_on", "Video ads are hidden"),
StringResource("revanced_video_ads_removal_summary_off", "Video ads are shown")
"revanced_hide_video_ads",
StringResource("revanced_hide_video_ads_title", "Hide video ads"),
StringResource("revanced_hide_video_ads_summary_on", "Video ads are hidden"),
StringResource("revanced_hide_video_ads_summary_off", "Video ads are shown")
)
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.interaction.copyvideourl.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class CopyVideoUrlCompatibility

View File

@@ -26,8 +26,7 @@ import app.revanced.patches.youtube.video.information.patch.VideoInformationPatc
@Version("0.0.1")
class CopyVideoUrlBytecodePatch : BytecodePatch() {
private companion object {
const val INTEGRATIONS_PACKAGE = "Lapp/revanced/integrations"
const val INTEGRATIONS_PLAYER_PACKAGE = "$INTEGRATIONS_PACKAGE/videoplayer"
const val INTEGRATIONS_PLAYER_PACKAGE = "Lapp/revanced/integrations/videoplayer"
val BUTTONS_DESCRIPTORS = listOf(
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlButton;",
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlTimestampButton;"
@@ -38,10 +37,8 @@ class CopyVideoUrlBytecodePatch : BytecodePatch() {
// Initialize buttons and inject visibility control
BUTTONS_DESCRIPTORS.forEach { descriptor ->
val initializeButtonDescriptor = "$descriptor->initializeButton(Ljava/lang/Object;)V"
val visibilityDescriptor = "$descriptor->changeVisibility(Z)V"
PlayerControlsBytecodePatch.initializeControl(initializeButtonDescriptor)
PlayerControlsBytecodePatch.injectVisibilityCheckCall(visibilityDescriptor)
PlayerControlsBytecodePatch.initializeControl("$descriptor->initializeButton(Landroid/view/View;)V")
PlayerControlsBytecodePatch.injectVisibilityCheckCall("$descriptor->changeVisibility(Z)V")
}
return PatchResultSuccess()

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.interaction.copyvideourl.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
@@ -11,40 +10,36 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.interaction.copyvideourl.annotation.CopyVideoUrlCompatibility
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
import app.revanced.util.resources.ResourceUtils.mergeStrings
@Name("copy-video-url-resource")
@Description("Makes necessary changes to resources for copy video link buttons.")
@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class])
@CopyVideoUrlCompatibility
@Version("0.0.1")
class CopyVideoUrlResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Copy video URL settings"),
"revanced_copy_video_url_preference_screen",
StringResource("revanced_copy_video_url_preference_screen_title", "Copy video URL settings"),
listOf(
SwitchPreference(
"revanced_copy_video_url_enabled",
StringResource("revanced_copy_video_url_enabled_title", "Show copy video URL button"),
true,
StringResource("revanced_copy_video_url_enabled_summary_on", "Button is shown, click to copy video URL without timestamp"),
StringResource("revanced_copy_video_url_enabled_summary_off", "Button is not shown")
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
StringResource("revanced_copy_video_url_summary_on", "Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp"),
StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
),
SwitchPreference(
"revanced_copy_video_url_timestamp_enabled",
StringResource("revanced_copy_video_url_timestamp_enabled_title", "Show copy timestamp URL button"),
true,
StringResource("revanced_copy_video_url_timestamp_enabled_summary_on", "Button is shown, click to copy video URL with timestamp"),
StringResource("revanced_copy_video_url_timestamp_enabled_summary_off", "Button is not shown")
"revanced_copy_video_url_timestamp",
StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
StringResource("revanced_copy_video_url_timestamp_summary_on", "Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp"),
StringResource("revanced_copy_video_url_timestamp_summary_off", "Button is not shown")
)
),
StringResource("revanced_copy_video_url_summary", "Settings related to copy URL buttons in video player")
StringResource("revanced_copy_video_url_preference_screen_summary", "Settings related to copy URL buttons in video player")
)
)
@@ -54,6 +49,9 @@ class CopyVideoUrlResourcePatch : ResourcePatch {
"revanced_yt_copy_timestamp.xml"
))
// merge strings
context.mergeStrings("copyvideourl/host/values/strings.xml")
BottomControlsResourcePatch.addControls("copyvideourl/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
return PatchResultSuccess()

View File

@@ -3,23 +3,7 @@ package app.revanced.patches.youtube.interaction.downloads.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class DownloadsCompatibility

View File

@@ -17,27 +17,28 @@ import app.revanced.patches.youtube.video.information.patch.VideoInformationPatc
@Patch
@Name("downloads")
@DependsOn([DownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoInformationPatch::class])
@Description("Enables downloading music and videos from YouTube.")
@Description("Adds a download button to the YouTube video player.")
@DownloadsCompatibility
@Version("0.0.1")
class DownloadsBytecodePatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
val integrationsPackage = "app/revanced/integrations"
val classDescriptor = "L$integrationsPackage/videoplayer/DownloadButton;"
private companion object {
const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/DownloadButton;"
}
override fun execute(context: BytecodeContext): PatchResult {
/*
initialize the control
*/
val initializeDownloadsDescriptor = "$classDescriptor->initializeButton(Ljava/lang/Object;)V"
PlayerControlsBytecodePatch.initializeControl(initializeDownloadsDescriptor)
PlayerControlsBytecodePatch.initializeControl(
"$BUTTON_DESCRIPTOR->initializeButton(Landroid/view/View;)V")
/*
add code to change the visibility of the control
*/
val changeVisibilityDescriptor = "$classDescriptor->changeVisibility(Z)V"
PlayerControlsBytecodePatch.injectVisibilityCheckCall(changeVisibilityDescriptor)
PlayerControlsBytecodePatch.injectVisibilityCheckCall(
"$BUTTON_DESCRIPTOR->changeVisibility(Z)V")
return PatchResultSuccess()
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.interaction.downloads.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
@@ -9,7 +8,6 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils
@@ -18,32 +16,28 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
@Name("downloads-resource-patch")
@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class])
@Description("Makes necessary changes to resources for the download button.")
@DownloadsCompatibility
@Version("0.0.1")
class DownloadsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_downloads",
StringResource("revanced_downloads_title", "Download settings"),
"revanced_external_downloader_preference_screen",
StringResource("revanced_external_downloader_preference_screen_title", "Download settings"),
listOf(
SwitchPreference(
"revanced_downloads_enabled",
StringResource("revanced_downloads_enabled_title", "Show download button"),
true,
StringResource("revanced_downloads_enabled_summary_on", "Download button is shown"),
StringResource("revanced_downloads_enabled_summary_off", "Download button is not shown")
"revanced_external_downloader",
StringResource("revanced_external_downloader_title", "Show download button"),
StringResource("revanced_external_downloader_summary_on", "Download button is shown"),
StringResource("revanced_external_downloader_summary_off", "Download button is not shown")
),
TextPreference(
"revanced_downloads_package_name",
StringResource("revanced_downloads_package_name_title", "Downloader package name"),
InputType.STRING,
"org.schabi.newpipe" /* NewPipe */,
StringResource("revanced_downloads_package_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s")
"revanced_external_downloader_name",
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
StringResource("revanced_external_downloader_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s"),
InputType.TEXT
)
),
StringResource("revanced_downloads_summary", "Settings related to downloads")
StringResource("revanced_external_downloader_preference_screen_summary", "Settings related to downloads")
)
)

View File

@@ -3,23 +3,7 @@ package app.revanced.patches.youtube.interaction.seekbar.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class SeekbarTappingCompatibility

View File

@@ -0,0 +1,23 @@
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.interaction.seekbar.patch.EnableSeekbarTappingResourcePatch
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
object AccessibilityPlayerProgressTimeFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
customFingerprint = { methodDef, _ ->
methodDef.implementation?.instructions?.any { instruction ->
if (instruction.opcode != Opcode.CONST) return@any false
val wideLiteral = (instruction as WideLiteralInstruction).wideLiteral
EnableSeekbarTappingResourcePatch.accessibilityPlayerProgressTime == wideLiteral
} ?: false
}
)

View File

@@ -1,34 +1,34 @@
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
object SeekbarTappingFingerprint : MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_WIDE,
Opcode.IGET,
Opcode.IGET_OBJECT,
Opcode.IGET,
Opcode.DIV_INT_2ADDR,
Opcode.ADD_INT,
Opcode.SUB_INT_2ADDR,
Opcode.INT_TO_FLOAT,
Opcode.CMPG_FLOAT,
Opcode.IF_GTZ,
Opcode.INT_TO_FLOAT,
Opcode.CMPG_FLOAT,
Opcode.IF_GTZ,
Opcode.CONST_4,
Opcode.INVOKE_INTERFACE,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL
)
Opcode.INVOKE_VIRTUAL,
// Insert seekbar tapping instructions here.
Opcode.RETURN,
Opcode.INVOKE_VIRTUAL,
),
customFingerprint = custom@{ methodDef, _ ->
if (methodDef.name != "onTouchEvent") return@custom false
methodDef.implementation!!.instructions.any { instruction ->
if (instruction.opcode != Opcode.CONST) return@any false
val literal = (instruction as NarrowLiteralInstruction).narrowLiteral
// onTouchEvent method contains a CONST instruction
// with this literal making it unique with the rest of the properties of this fingerprint.
literal == Integer.MAX_VALUE
}
}
)

View File

@@ -1,44 +0,0 @@
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
object SeekbarTappingParentFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_4,
Opcode.NEW_ARRAY,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_WIDE,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_4,
Opcode.APUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_WIDE,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_4,
Opcode.APUT_OBJECT,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.RETURN_OBJECT
)
)

View File

@@ -1,110 +1,95 @@
package app.revanced.patches.youtube.interaction.seekbar.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.AccessibilityPlayerProgressTimeFingerprint
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingParentFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@DependsOn([IntegrationsPatch::class, EnableSeekbarTappingResourcePatch::class])
@Name("seekbar-tapping")
@Description("Enables tap-to-seek on the seekbar of the video player.")
@SeekbarTappingCompatibility
@Version("0.0.1")
class EnableSeekbarTappingPatch : BytecodePatch(
listOf(
SeekbarTappingParentFingerprint, SeekbarTappingFingerprint
)
listOf(AccessibilityPlayerProgressTimeFingerprint, SeekbarTappingFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_enable_tap_seeking",
StringResource("revanced_seekbar_tapping_enabled_title", "Enable seekbar tapping"),
true,
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
)
)
// Find the required methods to tap the seekbar.
val seekbarTappingMethods =
AccessibilityPlayerProgressTimeFingerprint.result?.classDef?.methods?.let { methods ->
buildMap {
// find the methods which tap the seekbar
methods.forEach { method ->
if (method.implementation == null) return@forEach
var result = SeekbarTappingParentFingerprint.result!!
val instructions = method.implementation!!.instructions
val tapSeekMethods = mutableMapOf<String, Method>()
// The method has more than 7 instructions.
if (instructions.count() < 7) return@forEach
// find the methods which tap the seekbar
for (it in result.classDef.methods) {
if (it.implementation == null) continue
// The 7th instruction has the opcode CONST_4.
val instruction = instructions.elementAt(6)
if (instruction.opcode != Opcode.CONST_4) return@forEach
val instructions = it.implementation!!.instructions
// here we make sure we actually find the method because it has more than 7 instructions
if (instructions.count() < 7) continue
// the literal for this instruction has to be either 1 or 2.
val literal = (instruction as NarrowLiteralInstruction).narrowLiteral
// we know that the 7th instruction has the opcode CONST_4
val instruction = instructions.elementAt(6)
if (instruction.opcode != Opcode.CONST_4) continue
// Based on the literal, determine which method is which.
if (literal == 1) this["P"] = method
if (literal == 2) this["O"] = method
}
}
}
// the literal for this instruction has to be either 1 or 2
val literal = (instruction as Instruction11n).narrowLiteral
seekbarTappingMethods ?: return AccessibilityPlayerProgressTimeFingerprint.toErrorResult()
// method founds
if (literal == 1) tapSeekMethods["P"] = it
if (literal == 2) tapSeekMethods["O"] = it
}
SeekbarTappingFingerprint.result?.let {
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
// replace map because we don't need the upper one anymore
result = SeekbarTappingFingerprint.result!!
it.mutableMethod.apply {
val thisInstanceRegister = instruction<Instruction35c>(insertIndex - 1).registerC
val implementation = result.mutableMethod.implementation!!
val freeRegister = 0
val xAxisRegister = 2
// if tap-seeking is enabled, do not invoke the two methods below
val pMethod = tapSeekMethods["P"]!!
val oMethod = tapSeekMethods["O"]!!
val pMethod = seekbarTappingMethods["P"]!!
val oMethod = seekbarTappingMethods["O"]!!
val insertIndex = result.scanResult.patternScanResult!!.endIndex + 1
fun Method.toInvokeInstructionString() =
"invoke-virtual { v$thisInstanceRegister, v$xAxisRegister }, $definingClass->$name(I)V"
// get the required register
val instruction = implementation.instructions[insertIndex - 1]
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC
addInstructions(
insertIndex,
"""
invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->seekbarTappingEnabled()Z
move-result v$freeRegister
if-eqz v$freeRegister, :disabled
${oMethod.toInvokeInstructionString()}
${pMethod.toInvokeInstructionString()}
""",
listOf(ExternalLabel("disabled", instruction(insertIndex)))
)
}
} ?: return SeekbarTappingFingerprint.toErrorResult()
val elseLabel = implementation.newLabelForIndex(insertIndex)
// the instructions are written in reverse order.
result.mutableMethod.addInstructions(
insertIndex, """
invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
"""
)
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
implementation.addInstruction(
insertIndex, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
)
result.mutableMethod.addInstructions(
insertIndex, """
invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->isTapSeekingEnabled()Z
move-result v0
"""
)
return PatchResultSuccess()
}
}
}

View File

@@ -0,0 +1,38 @@
package app.revanced.patches.youtube.interaction.seekbar.patch
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
@Version("0.0.1")
class EnableSeekbarTappingResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_seekbar_tapping",
StringResource("revanced_seekbar_tapping_title", "Enable seekbar tapping"),
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
)
)
accessibilityPlayerProgressTime = ResourceMappingPatch.resourceMappings.find {
it.name == "accessibility_player_progress_time"
}?.id ?: return PatchResultError("Failed to find required resource")
return PatchResultSuccess()
}
internal companion object {
var accessibilityPlayerProgressTime = -1L
}
}

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.interaction.swipecontrols.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class SwipeControlsCompatibility

View File

@@ -7,92 +7,80 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.shared.settings.preference.impl.InputType
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
@Name("swipe-controls-resource-patch")
@DependsOn([SettingsPatch::class])
@SwipeControlsCompatibility
@Version("0.0.1")
class SwipeControlsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_swipe_controls", StringResource("revanced_swipe_controls_title", "Swipe controls"), listOf(
"revanced_swipe_controls_preference_screen",
StringResource("revanced_swipe_controls_preference_screen_title", "Swipe controls"),
listOf(
SwitchPreference(
"revanced_enable_swipe_brightness",
StringResource("revanced_swipe_brightness_enabled_title", "Enable brightness gesture"),
true,
"revanced_swipe_brightness",
StringResource("revanced_swipe_brightness_title", "Enable brightness gesture"),
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
),
SwitchPreference(
"revanced_enable_swipe_volume",
StringResource("revanced_swipe_volume_enabled_title", "Enable volume gesture"),
true,
"revanced_swipe_volume",
StringResource("revanced_swipe_volume_title", "Enable volume gesture"),
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
),
SwitchPreference(
"revanced_enable_press_to_swipe",
StringResource("revanced_press_to_swipe_enabled_title", "Enable press-to-swipe gesture"),
false,
StringResource("revanced_press_to_swipe_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_press_to_swipe_summary_off", "Press-to-swipe is disabled")
"revanced_swipe_press_to_engage",
StringResource("revanced_swipe_press_to_engage_title", "Enable press-to-swipe gesture"),
StringResource("revanced_swipe_press_to_engage_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_swipe_press_to_engage_summary_off", "Press-to-swipe is disabled")
),
SwitchPreference(
"revanced_enable_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_enabled_title", "Enable haptic feedback"),
true,
"revanced_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_title", "Enable haptic feedback"),
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
),
TextPreference(
"revanced_swipe_overlay_timeout",
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
InputType.NUMBER,
"500",
StringResource(
"revanced_swipe_overlay_timeout_summary",
"The amount of milliseconds the overlay is visible"
)
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_text_size",
StringResource("revanced_swipe_overlay_text_size_title", "Swipe overlay text size"),
InputType.NUMBER,
"22",
StringResource("revanced_swipe_overlay_text_size_summary", "The text size for swipe overlay")
"revanced_swipe_text_overlay_size",
StringResource("revanced_swipe_text_overlay_size_title", "Swipe overlay text size"),
StringResource("revanced_swipe_text_overlay_size_summary", "The text size for swipe overlay"),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_background_alpha",
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
InputType.NUMBER,
"127",
StringResource(
"revanced_swipe_overlay_background_alpha_summary",
"The visibility of swipe overlay background"
)
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_magnitude_threshold",
StringResource("revanced_swipe_magnitude_threshold_title", "Swipe magnitude threshold"),
InputType.NUMBER,
"30",
"revanced_swipe_threshold",
StringResource("revanced_swipe_threshold_title", "Swipe magnitude threshold"),
StringResource(
"revanced_swipe_magnitude_threshold_summary",
"revanced_swipe_threshold_summary",
"The amount of threshold for swipe to occur"
)
),
InputType.NUMBER
)
),
StringResource("revanced_swipe_controls_summary","Control volume and brightness")
StringResource("revanced_swipe_controls_preference_screen_summary","Control volume and brightness")
)
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.autocaptions.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class AutoCaptionsCompatibility

View File

@@ -33,11 +33,10 @@ class AutoCaptionsPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_autocaptions_enabled",
StringResource("revanced_autocaptions_enabled_title", "Disable auto captions"),
false,
StringResource("revanced_autocaptions_summary_on", "Auto captions are disabled"),
StringResource("revanced_autocaptions_summary_off", "Auto captions are enabled")
"revanced_auto_captions",
StringResource("revanced_auto_captions_title", "Disable auto captions"),
StringResource("revanced_auto_captions_summary_on", "Auto captions are disabled"),
StringResource("revanced_auto_captions_summary_off", "Auto captions are enabled")
)
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.action.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideButtonsCompatibility

View File

@@ -27,34 +27,30 @@ class HideButtonsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_hide_buttons",
StringResource("revanced_hide_buttons_title", "Hide action buttons"),
"revanced_hide_buttons_preference_screen",
StringResource("revanced_hide_buttons_preference_screen_title", "Hide action buttons"),
listOf(
SwitchPreference(
"revanced_hide_like_dislike_button",
StringResource("revanced_hide_like_dislike_button_title", "Hide like and dislike buttons"),
false,
StringResource("revanced_hide_like_dislike_button_summary_on", "Like and dislike buttons are hidden"),
StringResource("revanced_hide_like_dislike_button_summary_off", "Like and dislike buttons are shown")
),
SwitchPreference(
"revanced_hide_download_button",
StringResource("revanced_hide_download_button_title", "Hide download button"),
false,
StringResource("revanced_hide_download_button_summary_on", "Download button is hidden"),
StringResource("revanced_hide_download_button_summary_off", "Download button is shown")
),
SwitchPreference(
"revanced_hide_playlist_button",
StringResource("revanced_hide_playlist_button_title", "Hide playlist button"),
false,
StringResource("revanced_hide_playlist_button_summary_on", "Playlist button is hidden"),
StringResource("revanced_hide_playlist_button_summary_off", "Playlist button is shown")
),
SwitchPreference(
"revanced_hide_clip_button",
StringResource("revanced_hide_clip_button_title", "Hide clip button"),
false,
StringResource("revanced_hide_clip_button_summary_on", "Clip button is hidden"),
StringResource("revanced_hide_clip_button_summary_off", "Clip button is shown"),
StringResource("revanced_hide_clip_button_user_dialog_message",
@@ -63,12 +59,11 @@ class HideButtonsPatch : ResourcePatch {
SwitchPreference(
"revanced_hide_action_buttons",
StringResource("revanced_hide_action_buttons_title", "Hide all other action buttons"),
false,
StringResource("revanced_hide_action_buttons_summary_on", "Share, remix, thanks, shop, live chat buttons are hidden"),
StringResource("revanced_hide_action_buttons_summary_off", "Share, remix, thanks, shop, live chat buttons are shown")
)
),
StringResource("revanced_hide_buttons_summary", "Hide or show buttons under videos")
StringResource("revanced_hide_buttons_preference_screen_summary", "Hide or show buttons under videos")
)
)
return PatchResultSuccess()

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.autoplay.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class AutoplayButtonCompatibility

View File

@@ -40,7 +40,6 @@ class HideAutoplayButtonPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_autoplay_button",
StringResource("revanced_hide_autoplay_button_title", "Hide autoplay button"),
true,
StringResource("revanced_hide_autoplay_button_summary_on", "Autoplay button is hidden"),
StringResource("revanced_hide_autoplay_button_summary_off", "Autoplay button is shown")
),

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.captions.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideCaptionsButtonCompatibility

View File

@@ -32,7 +32,6 @@ class HideCaptionsButtonPatch : BytecodePatch(listOf(
SwitchPreference(
"revanced_hide_captions_button",
StringResource("revanced_hide_captions_button_title", "Hide captions button"),
false,
StringResource("revanced_hide_captions_button_summary_on", "Captions button is hidden"),
StringResource("revanced_hide_captions_button_summary_off", "Captions button is shown")
)

View File

@@ -29,7 +29,6 @@ class HideCastButtonPatch : BytecodePatch() {
SwitchPreference(
"revanced_hide_cast_button",
StringResource("revanced_hide_cast_button_title", "Hide cast button"),
true,
StringResource("revanced_hide_cast_button_summary_on", "Cast button is hidden"),
StringResource("revanced_hide_cast_button_summary_off", "Cast button is shown")
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.navigation.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class NavigationButtonsCompatibility

View File

@@ -41,27 +41,24 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_navigation_buttons",
StringResource("revanced_navigation_buttons", "Navigation button settings"),
"revanced_navigation_buttons_preference_screen",
StringResource("revanced_navigation_buttons_preference_screen_title", "Navigation button settings"),
listOf(
SwitchPreference(
"revanced_hide_home_button",
StringResource("revanced_hide_home_button_title", "Hide home button"),
false,
StringResource("revanced_hide_home_button_summary_on", "Home button is hidden"),
StringResource("revanced_hide_home_button_summary_off", "Home button is shown")
),
SwitchPreference(
"revanced_hide_shorts_button",
StringResource("revanced_hide_shorts_button_title", "Hide shorts button"),
true,
StringResource("revanced_hide_shorts_button_summary_on", "Shorts button is hidden"),
StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown")
),
SwitchPreference(
"revanced_hide_subscriptions_button",
StringResource("revanced_hide_subscriptions_button_title", "Hide subscriptions button"),
false,
StringResource(
"revanced_hide_subscriptions_button_summary_on",
"Home subscriptions is hidden"
@@ -71,7 +68,6 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
SwitchPreference(
"revanced_hide_create_button",
StringResource("revanced_hide_create_button_title", "Hide create button"),
true,
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
StringResource("revanced_hide_create_button_summary_off", "Create button is shown")
),
@@ -81,7 +77,6 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
"revanced_switch_create_with_notifications_button_title",
"Switch create with notifications button"
),
true,
StringResource(
"revanced_switch_create_with_notifications_button_summary_on",
"Create button is switched with notifications"

View File

@@ -2,22 +2,6 @@ package app.revanced.patches.youtube.layout.buttons.player.background.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class PlayerButtonBackgroundCompatibility

View File

@@ -3,10 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.player.hide.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf()
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HidePlayerButtonsCompatibility

View File

@@ -41,7 +41,6 @@ class HidePlayerButtonsPatch : BytecodePatch(
"revanced_hide_player_buttons_title",
"Hide previous & next video buttons"
),
false,
StringResource(
"revanced_hide_player_buttons_summary_on",
"Buttons are hidden"

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.hide.albumcards.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class AlbumCardsCompatibility

View File

@@ -27,7 +27,6 @@ class AlbumCardsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_album_cards",
StringResource("revanced_hide_album_cards_title", "Hide album cards"),
false,
StringResource("revanced_hide_album_cards_summary_on", "Album cards are hidden"),
StringResource("revanced_hide_album_cards_summary_off", "Album cards are shown")
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.hide.artistcards.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideArtistCardCompatibility

View File

@@ -28,7 +28,6 @@ class HideArtistCardsPatch : ResourcePatch {
SwitchPreference(
"revanced_hide_artist_cards",
StringResource("revanced_hide_artist_cards_title", "Hide artist cards"),
false,
StringResource("revanced_hide_artist_cards_on", "Artist cards is hidden"),
StringResource("revanced_hide_artist_cards_off", "Artist cards is shown")
),

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.hide.breakingnews.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class BreakingNewsCompatibility

View File

@@ -25,7 +25,6 @@ class BreakingNewsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_breaking_news",
StringResource("revanced_hide_breaking_news_title", "Hide breaking news"),
true,
StringResource("revanced_hide_breaking_news_summary_on", "Breaking news are hidden"),
StringResource("revanced_hide_breaking_news_summary_off", "Breaking news are shown")
)

View File

@@ -1,24 +0,0 @@
package app.revanced.patches.youtube.layout.hide.comments.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class CommentsCompatibility

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.youtube.layout.hide.comments.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideCommentsCompatibility

View File

@@ -1,17 +0,0 @@
package app.revanced.patches.youtube.layout.hide.comments.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.hide.comments.resource.patch.CommentsResourcePatch
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
object ShortsCommentsButtonFingerprint : MethodFingerprint(
"V", AccessFlags.PRIVATE or AccessFlags.FINAL, listOf("Z", "Z", "L"),
customFingerprint = { methodDef, _ ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal && (it as WideLiteralInstruction).wideLiteral == CommentsResourcePatch.shortsCommentsButtonId
} == true
}
)

View File

@@ -1,69 +0,0 @@
package app.revanced.patches.youtube.layout.hide.comments.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.layout.hide.comments.annotations.CommentsCompatibility
import app.revanced.patches.youtube.layout.hide.comments.bytecode.fingerprints.ShortsCommentsButtonFingerprint
import app.revanced.patches.youtube.layout.hide.comments.resource.patch.CommentsResourcePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@DependsOn([IntegrationsPatch::class, CommentsResourcePatch::class])
@Name("comments")
@Description("Hides components related to comments.")
@CommentsCompatibility
@Version("0.0.1")
class CommentsPatch : BytecodePatch(
listOf(
ShortsCommentsButtonFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
val checkCastAnchorFingerprint = object : MethodFingerprint(
opcodes = listOf(
Opcode.CONST,
Opcode.CONST_HIGH16,
Opcode.IF_EQZ,
Opcode.CONST,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
)
) {}
ShortsCommentsButtonFingerprint.result?.let {
it.mutableMethod.apply {
val checkCastAnchorIndex = checkCastAnchorFingerprint.also { result ->
if (!result.resolve(context, this, it.classDef))
throw checkCastAnchorFingerprint.toErrorResult()
}.result!!.scanResult.patternScanResult!!.endIndex
val shortsCommentsButtonRegister = instruction<OneRegisterInstruction>(checkCastAnchorIndex).registerA
val insertIndex = checkCastAnchorIndex + 1
addInstructions(
insertIndex,
"""
invoke-static { v$shortsCommentsButtonRegister }, Lapp/revanced/integrations/patches/HideShortsCommentsButtonPatch;->hideShortsCommentsButton(Landroid/view/View;)V
"""
)
}
} ?: return ShortsCommentsButtonFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@@ -1,5 +1,6 @@
package app.revanced.patches.youtube.layout.hide.comments.resource.patch
package app.revanced.patches.youtube.layout.hide.comments.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
@@ -7,58 +8,44 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.hide.comments.annotations.CommentsCompatibility
import app.revanced.patches.youtube.layout.hide.comments.annotations.HideCommentsCompatibility
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@Name("comments-resource-patch")
@CommentsCompatibility
@Patch
@Name("comments")
@Description("Hides components related to comments.")
@HideCommentsCompatibility
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
@Version("0.0.1")
class CommentsResourcePatch : ResourcePatch {
companion object {
internal var shortsCommentsButtonId: Long = -1
}
class CommentsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_comments",
StringResource("revanced_comments_title", "Comments"),
"revanced_comments_preference_screen",
StringResource("revanced_comments_preference_screen_title", "Comments"),
listOf(
SwitchPreference(
"revanced_hide_comments_section",
StringResource("revanced_hide_comments_section_title", "Hide comments section"),
false,
StringResource("revanced_hide_comments_section_summary_on", "Comment section is hidden"),
StringResource("revanced_hide_comments_section_summary_off", "Comment section is shown")
),
SwitchPreference(
"revanced_hide_preview_comment",
StringResource("revanced_hide_preview_comment_title", "Hide preview comment"),
false,
StringResource("revanced_hide_preview_comment_on", "Preview comment is hidden"),
StringResource("revanced_hide_preview_comment_off", "Preview comment is shown")
),
SwitchPreference(
"revanced_hide_shorts_comments_button",
StringResource("revanced_hide_shorts_comments_button_title", "Hide shorts comments button"),
false,
StringResource("revanced_hide_shorts_comments_button_on", "Shorts comments button is hidden"),
StringResource("revanced_hide_shorts_comments_button_off", "Shorts comments button is shown")
),
)
),
StringResource("revanced_comments_summary", "Manage the visibility of comments section components")
StringResource("revanced_comments_preference_screen_summary", "Manage the visibility of comments section components")
)
)
shortsCommentsButtonId = ResourceMappingPatch.resourceMappings.single {
it.type == "drawable" && it.name == "ic_right_comment_32c"
}.id
return PatchResultSuccess()
}
}

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.hide.crowdfundingbox.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class CrowdfundingBoxCompatibility

View File

@@ -27,7 +27,6 @@ class CrowdfundingBoxResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_crowdfunding_box",
StringResource("revanced_hide_crowdfunding_box_title", "Hide crowdfunding box"),
false,
StringResource("revanced_hide_crowdfunding_box_summary_on", "Crowdfunding box is hidden"),
StringResource("revanced_hide_crowdfunding_box_summary_off", "Crowdfunding box is shown")
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.hide.endscreencards.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideEndscreenCardsCompatibility

View File

@@ -29,7 +29,6 @@ class HideEndscreenCardsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_endscreen_cards",
StringResource("revanced_hide_endscreen_cards_title", "Hide end screen cards"),
true,
StringResource("revanced_hide_endscreen_cards_summary_on", "End screen cards are hidden"),
StringResource("revanced_hide_endscreen_cards_summary_off", "End screen cards are shown")
),

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.filterbar.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37"))])
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideFilterBar

View File

@@ -30,7 +30,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_feed_title",
"Hide in feed"
),
false,
StringResource(
"revanced_hide_filter_bar_feed_in_feed_summary_on",
"Hidden in feed"
@@ -46,7 +45,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_search_title",
"Hide in search"
),
false,
StringResource(
"revanced_hide_filter_bar_feed_in_search_summary_on",
"Hidden in search"
@@ -62,7 +60,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_related_videos_title",
"Hide in related videos"
),
false,
StringResource(
"revanced_hide_filter_bar_feed_in_related_videos_summary_on",
"Hidden in related videos"
@@ -73,6 +70,10 @@ class HideFilterBarResourcePatch : ResourcePatch {
)
),
),
StringResource(
"revanced_hide_filter_bar_preference_summary",
"Manage the visibility of the filter bar in the feed, search and related videos"
)
)
)

View File

@@ -3,22 +3,6 @@ package app.revanced.patches.youtube.layout.hide.floatingmicrophone.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideFloatingMicrophoneButtonCompatibility

Some files were not shown because too many files have changed in this diff Show More