Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f818396243 | ||
|
|
3d124af58c | ||
|
|
df18d4a15a | ||
|
|
f08a2b6a90 | ||
|
|
fce8df8284 | ||
|
|
6ec99045d7 | ||
|
|
757784b038 | ||
|
|
7e06f23e29 | ||
|
|
26a43b1753 | ||
|
|
c8023f0b66 | ||
|
|
25f65c7c02 | ||
|
|
07d39f2b81 | ||
|
|
01e226d0c9 | ||
|
|
c98e10adf7 | ||
|
|
858b8a6fa8 | ||
|
|
53a66f64ab | ||
|
|
e2b9baed25 | ||
|
|
6bc24755d5 | ||
|
|
e871d655d2 | ||
|
|
1fa0d5da0e | ||
|
|
461e4bef09 | ||
|
|
9b1df03087 | ||
|
|
541a1a0e0a | ||
|
|
ce2f7042da | ||
|
|
ca3438b640 | ||
|
|
5121c3d45b | ||
|
|
666b241a53 | ||
|
|
b961bdf9d3 | ||
|
|
8aa1d58b76 | ||
|
|
570723bb59 | ||
|
|
7027929e30 | ||
|
|
f11f269c2f | ||
|
|
b0cd520b1a | ||
|
|
5c0fd8a6da | ||
|
|
e34d67f01e | ||
|
|
72703d6a56 | ||
|
|
b8c473796a | ||
|
|
25e86c5545 | ||
|
|
f1bf2c589b | ||
|
|
8b54559953 | ||
|
|
3761dbd7b2 | ||
|
|
8cf0343f29 | ||
|
|
f3753a22da | ||
|
|
c90312a925 | ||
|
|
c1d6aa3e49 | ||
|
|
c097370960 |
2
.github/workflows/release.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup JDK
|
||||
|
||||
149
CHANGELOG.md
@@ -1,3 +1,152 @@
|
||||
## [2.100.2](https://github.com/revanced/revanced-patches/compare/v2.100.1...v2.100.2) (2022-10-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/theme-patch:** respect app specific theme ([#946](https://github.com/revanced/revanced-patches/issues/946)) ([fe8d6c7](https://github.com/revanced/revanced-patches/commit/fe8d6c7b2c10be5cca0717b6a03cfa1bef10e2c0))
|
||||
|
||||
## [2.100.1](https://github.com/revanced/revanced-patches/compare/v2.100.0...v2.100.1) (2022-10-31)
|
||||
|
||||
# [2.100.0](https://github.com/revanced/revanced-patches/compare/v2.99.0...v2.100.0) (2022-10-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `hide-watch-in-vr` patch ([#911](https://github.com/revanced/revanced-patches/issues/911)) ([8ea0b20](https://github.com/revanced/revanced-patches/commit/8ea0b20e96df53211039df0468b2d4a735a381f1))
|
||||
|
||||
# [2.99.0](https://github.com/revanced/revanced-patches/compare/v2.98.0...v2.99.0) (2022-10-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/sponsorblock:** skip segments once automatically ([#907](https://github.com/revanced/revanced-patches/issues/907)) ([afc7588](https://github.com/revanced/revanced-patches/commit/afc75882062a9316dbc28a9dc4f990cf88b52654))
|
||||
|
||||
# [2.98.0](https://github.com/revanced/revanced-patches/compare/v2.97.0...v2.98.0) (2022-10-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/comments:** hide shorts comments button ([#866](https://github.com/revanced/revanced-patches/issues/866)) ([c78a74e](https://github.com/revanced/revanced-patches/commit/c78a74e21b4521034f44e9bfd226c5a362c21e6c))
|
||||
|
||||
# [2.97.0](https://github.com/revanced/revanced-patches/compare/v2.96.0...v2.97.0) (2022-10-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/microg-support:** handle availability of Vanced MicroG ([bfd0d14](https://github.com/revanced/revanced-patches/commit/bfd0d1418fb68f1d37687ec2072d3b64a9c3c6ee))
|
||||
|
||||
# [2.96.0](https://github.com/revanced/revanced-patches/compare/v2.95.0...v2.96.0) (2022-10-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/return-youtube-dislike:** compatibility for old and new button layout ([6629bd7](https://github.com/revanced/revanced-patches/commit/6629bd71716a753be06617724e536b8ab4c3b69a))
|
||||
|
||||
# [2.95.0](https://github.com/revanced/revanced-patches/compare/v2.94.0...v2.95.0) (2022-10-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube:** bump patches compatibility to v17.41.37 ([#888](https://github.com/revanced/revanced-patches/issues/888)) ([11ed0c0](https://github.com/revanced/revanced-patches/commit/11ed0c0fb3236d87284806d2fa957699e908cc61))
|
||||
|
||||
# [2.94.0](https://github.com/revanced/revanced-patches/compare/v2.93.0...v2.94.0) (2022-10-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* remove compatibility for YouTube v17.41.37 ([#886](https://github.com/revanced/revanced-patches/issues/886)) ([0f4bc19](https://github.com/revanced/revanced-patches/commit/0f4bc197455574b84dd1cb1a43f03af90858bc39))
|
||||
|
||||
# [2.93.0](https://github.com/revanced/revanced-patches/compare/v2.92.3...v2.93.0) (2022-10-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bump YouTube patches to v17.41.37 ([#878](https://github.com/revanced/revanced-patches/issues/878)) ([9072986](https://github.com/revanced/revanced-patches/commit/9072986f99e624386ff51c7eeb1d65158bd9249a))
|
||||
|
||||
## [2.92.3](https://github.com/revanced/revanced-patches/compare/v2.92.2...v2.92.3) (2022-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube:** resolve fingerprints on mutable methods ([10e4af3](https://github.com/revanced/revanced-patches/commit/10e4af386652d51c621519f7a67aac8c22ed8c18))
|
||||
|
||||
## [2.92.2](https://github.com/revanced/revanced-patches/compare/v2.92.1...v2.92.2) (2022-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/theme:** theme missing gray color ([#873](https://github.com/revanced/revanced-patches/issues/873)) ([5267d56](https://github.com/revanced/revanced-patches/commit/5267d56a05b4053d556171ffd2d2870f3f932e8e))
|
||||
|
||||
## [2.92.1](https://github.com/revanced/revanced-patches/compare/v2.92.0...v2.92.1) (2022-10-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/custom-branding:** use proper scaled icons ([24b5bcd](https://github.com/revanced/revanced-patches/commit/24b5bcdd703474c940fd436a37f0ae924d8b8c74))
|
||||
|
||||
# [2.92.0](https://github.com/revanced/revanced-patches/compare/v2.91.0...v2.92.0) (2022-10-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/hide-mix-playlists:** hide in video suggestions ([#854](https://github.com/revanced/revanced-patches/issues/854)) ([acde5f0](https://github.com/revanced/revanced-patches/commit/acde5f066053ca3d58ca09fc2a6a1381ba27d84b))
|
||||
|
||||
# [2.91.0](https://github.com/revanced/revanced-patches/compare/v2.90.0...v2.91.0) (2022-10-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* remove partially complete patch ([d212e19](https://github.com/revanced/revanced-patches/commit/d212e19c3276c2ba6550f03dfd9bba47b7773524))
|
||||
|
||||
# [2.90.0](https://github.com/revanced/revanced-patches/compare/v2.89.0...v2.90.0) (2022-10-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `comment` patch ([#858](https://github.com/revanced/revanced-patches/issues/858)) ([472fb4f](https://github.com/revanced/revanced-patches/commit/472fb4f3747c835be2c5069a0f65017ab42f8d7e))
|
||||
|
||||
# [2.89.0](https://github.com/revanced/revanced-patches/compare/v2.88.0...v2.89.0) (2022-10-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `hide-album-cards` patch ([#857](https://github.com/revanced/revanced-patches/issues/857)) ([bce9d0c](https://github.com/revanced/revanced-patches/commit/bce9d0c9405d7afd5c51c2a9c2c247f3ff7581f5))
|
||||
|
||||
# [2.88.0](https://github.com/revanced/revanced-patches/compare/v2.87.0...v2.88.0) (2022-10-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `hide-artist-card` patch ([#859](https://github.com/revanced/revanced-patches/issues/859)) ([1f76246](https://github.com/revanced/revanced-patches/commit/1f7624680b86e3a7afd45521bfef86f88f52c976))
|
||||
|
||||
# [2.87.0](https://github.com/revanced/revanced-patches/compare/v2.86.0...v2.87.0) (2022-10-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **metanav/fix-scaling:** use semantic versioning in package versions ([a9445a8](https://github.com/revanced/revanced-patches/commit/a9445a823e3a4885764cea9d08b51a1584d3238f))
|
||||
* **youtube/theme:** theme litho ui components & use correct theme for settings ([#791](https://github.com/revanced/revanced-patches/issues/791)) ([91c03c5](https://github.com/revanced/revanced-patches/commit/91c03c5624ca28ac13ee761261dea423f0ac42d7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `fix-metanav-scaling` patch ([#831](https://github.com/revanced/revanced-patches/issues/831)) ([4808e09](https://github.com/revanced/revanced-patches/commit/4808e099856e50a6f7e66834a92e2210cc84c8bc))
|
||||
* `hide-crowdfunding-box` patch ([#856](https://github.com/revanced/revanced-patches/issues/856)) ([3704ce2](https://github.com/revanced/revanced-patches/commit/3704ce22dbbff02b2e2d6dbdf9a74254a2511d3c))
|
||||
|
||||
# [2.86.0](https://github.com/revanced/revanced-patches/compare/v2.85.2...v2.86.0) (2022-10-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/theme:** extend theming to splash screen ([#769](https://github.com/revanced/revanced-patches/issues/769)) ([f7bb937](https://github.com/revanced/revanced-patches/commit/f7bb937ef2374d1042ea3772f03627d7f0111b78))
|
||||
|
||||
## [2.85.2](https://github.com/revanced/revanced-patches/compare/v2.85.1...v2.85.2) (2022-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/integrations:** set context for remaining activities ([#828](https://github.com/revanced/revanced-patches/issues/828)) ([b2b6a3d](https://github.com/revanced/revanced-patches/commit/b2b6a3d1492bc2d5a6e27c68c74e3904764dda4b))
|
||||
|
||||
## [2.85.1](https://github.com/revanced/revanced-patches/compare/v2.85.0...v2.85.1) (2022-10-21)
|
||||
|
||||
|
||||
|
||||
67
README.md
@@ -65,44 +65,49 @@ The official Patch bundle provided by ReVanced and the community.
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.36.37 |
|
||||
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 17.36.37 |
|
||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
||||
| `hide-captions-button` | Hides the captions button on video player. | 17.36.37 |
|
||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.36.37 |
|
||||
| `hide-create-button` | Hides the create button in the navigation bar. | 17.36.37 |
|
||||
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.36.37 |
|
||||
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 17.41.37 |
|
||||
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.41.37 |
|
||||
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 17.41.37 |
|
||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.41.37 |
|
||||
| `hide-captions-button` | Hides the captions button on video player. | 17.41.37 |
|
||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.41.37 |
|
||||
| `hide-create-button` | Hides the create button in the navigation bar. | 17.41.37 |
|
||||
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.41.37 |
|
||||
| `hide-cast-button` | Hides the cast button in the video player. | all |
|
||||
| `sponsorblock` | Integrate SponsorBlock. | 17.36.37 |
|
||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
||||
| `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 17.36.37 |
|
||||
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 17.36.37 |
|
||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.36.37 |
|
||||
| `sponsorblock` | Integrate SponsorBlock. | 17.41.37 |
|
||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.41.37 |
|
||||
| `hide-watch-in-vr` | Hides the Watch in VR option from the player settings flyout panel. | 17.41.37 |
|
||||
| `hide-album-cards` | Hides the album cards below the artist description. | 17.41.37 |
|
||||
| `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 17.41.37 |
|
||||
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 17.41.37 |
|
||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.41.37 |
|
||||
| `hide-artist-card` | Hides the artist card below the searchbar. | 17.41.37 |
|
||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.41.37 |
|
||||
| `comments` | Hides components related to comments. | 17.41.37 |
|
||||
| `theme` | Applies a custom theme. | all |
|
||||
| `hide-email-address` | Hides the email address in the account switcher. | 17.36.37 |
|
||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.36.37 |
|
||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.36.37 |
|
||||
| `hide-my-mix` | Removes mix playlists from the feed. | 17.40.41 |
|
||||
| `hide-email-address` | Hides the email address in the account switcher. | 17.41.37 |
|
||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.41.37 |
|
||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.41.37 |
|
||||
| `hide-my-mix` | Hides mix playlists. | 17.41.37 |
|
||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
||||
| `premium-heading` | Shows premium branding on the home screen. | all |
|
||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.36.37 |
|
||||
| `general-ads` | Removes general ads. | 17.36.37 |
|
||||
| `video-ads` | Removes ads in the video player. | 17.36.37 |
|
||||
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.36.37 |
|
||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.36.37 |
|
||||
| `downloads` | Enables downloading music and videos from YouTube. | 17.36.37 |
|
||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.36.37 |
|
||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.41.37 |
|
||||
| `general-ads` | Removes general ads. | 17.41.37 |
|
||||
| `video-ads` | Removes ads in the video player. | 17.41.37 |
|
||||
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.41.37 |
|
||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.41.37 |
|
||||
| `downloads` | Enables downloading music and videos from YouTube. | 17.41.37 |
|
||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.41.37 |
|
||||
| `settings` | Adds settings for ReVanced to YouTube. | all |
|
||||
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.36.37 |
|
||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.36.37 |
|
||||
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.41.37 |
|
||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.41.37 |
|
||||
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
|
||||
| `always-autorepeat` | Always repeats the playing video again. | 17.36.37 |
|
||||
| `always-autorepeat` | Always repeats the playing video again. | 17.41.37 |
|
||||
| `enable-debugging` | Enables app debugging by patching the manifest file. | all |
|
||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.36.37 |
|
||||
| `minimized-playback` | Enables minimized and background playback. | 17.36.37 |
|
||||
| `custom-playback-speed` | Adds more video playback speed options. | 17.36.37 |
|
||||
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.36.37 |
|
||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.41.37 |
|
||||
| `minimized-playback` | Enables minimized and background playback. | 17.41.37 |
|
||||
| `custom-playback-speed` | Adds more video playback speed options. | 17.41.37 |
|
||||
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.41.37 |
|
||||
</details>
|
||||
|
||||
### 📦 `com.vanced.android.youtube`
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 2.85.1
|
||||
version = 2.100.2
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -105,13 +105,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
||||
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_comments_removal",
|
||||
StringResource("revanced_adremover_comments_enabled_title", "Remove comments section"),
|
||||
false,
|
||||
StringResource("revanced_adremover_comments_enabled_summary_on", "Comment section is hidden"),
|
||||
StringResource("revanced_adremover_comments_enabled_summary_off", "Comment section is shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_movie",
|
||||
StringResource("revanced_adremover_movie_enabled_title", "Remove movies section"),
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -11,8 +11,8 @@ import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||
@Version("0.0.1")
|
||||
object LoadVideoAdsFingerprint : MethodFingerprint(
|
||||
strings = listOf(
|
||||
"OnFulfillmentTriggersActivated has non registered slot",
|
||||
"markFillRequested",
|
||||
"TriggerBundle doesn't have the required metadata specified by the trigger ",
|
||||
"Tried to enter slot with no assigned slotAdapter",
|
||||
"Trying to enter a slot when a slot of same type and physical position is already active. Its status: ",
|
||||
)
|
||||
)
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.27.39", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.27.39", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -9,9 +9,9 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.InputStream
|
||||
import java.nio.file.Files
|
||||
|
||||
@Patch
|
||||
@@ -22,36 +22,43 @@ import java.nio.file.Files
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
val resDirectory = context["res"]
|
||||
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
|
||||
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
|
||||
iconPath?.let { iconPathString ->
|
||||
val iconPath = File(iconPathString)
|
||||
val resourceDirectory = context["res"]
|
||||
|
||||
// Icon branding
|
||||
val iconNames = arrayOf(
|
||||
resourceGroups.forEach { group ->
|
||||
val fromDirectory = iconPath.resolve(group.resourceDirectoryName)
|
||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||
|
||||
group.resources.forEach { iconFileName ->
|
||||
Files.write(
|
||||
toDirectory.resolve(iconFileName).toPath(),
|
||||
fromDirectory.resolve(iconFileName).readBytes()
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: resourceGroups.forEach { context.copyResources("branding", it) }
|
||||
}
|
||||
|
||||
val iconResourceFileNames = arrayOf(
|
||||
"adaptiveproduct_youtube_background_color_108",
|
||||
"adaptiveproduct_youtube_foreground_color_108",
|
||||
"ic_launcher",
|
||||
"ic_launcher_round"
|
||||
).map { "$it.png" }.toTypedArray()
|
||||
|
||||
fun createGroup(directory: String) = ResourceUtils.ResourceGroup(
|
||||
directory, *iconResourceFileNames
|
||||
)
|
||||
|
||||
mapOf(
|
||||
"xxxhdpi" to 192,
|
||||
"xxhdpi" to 144,
|
||||
"xhdpi" to 96,
|
||||
"hdpi" to 72,
|
||||
"mdpi" to 48
|
||||
).forEach { (iconDirectory, size) ->
|
||||
iconNames.forEach { iconName ->
|
||||
val iconFile = getIconStream("branding/$size/$iconName.png")
|
||||
?: return PatchResultError("The icon $iconName can not be found.")
|
||||
// change the app icon
|
||||
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi")
|
||||
.map { "mipmap-$it" }
|
||||
.map(::createGroup)
|
||||
.let(::copyResources)
|
||||
|
||||
Files.write(
|
||||
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
|
||||
iconFile.readBytes()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Name branding
|
||||
// change the name of the app
|
||||
val manifest = context["AndroidManifest.xml"]
|
||||
manifest.writeText(
|
||||
manifest.readText()
|
||||
@@ -64,15 +71,6 @@ class CustomBrandingPatch : ResourcePatch {
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun getIconStream(iconPath: String): InputStream? {
|
||||
if (appIconPath == null) {
|
||||
return this.javaClass.classLoader.getResourceAsStream(iconPath)
|
||||
}
|
||||
val file = File(appIconPath!!).resolve(iconPath)
|
||||
if (!file.exists()) return null
|
||||
return FileInputStream(file)
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
private var appName: String? by option(
|
||||
PatchOption.StringOption(
|
||||
@@ -84,12 +82,12 @@ class CustomBrandingPatch : ResourcePatch {
|
||||
)
|
||||
)
|
||||
|
||||
private var appIconPath: String? by option(
|
||||
private var iconPath: String? by option(
|
||||
PatchOption.StringOption(
|
||||
key = "appIconPath",
|
||||
key = "iconPath",
|
||||
default = null,
|
||||
title = "Application Icon Path",
|
||||
description = "A path to the icon of the application."
|
||||
title = "App Icon Path",
|
||||
description = "A path containing mipmap resource folders with icons."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.comments.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class CommentsCompatibility
|
||||
@@ -0,0 +1,23 @@
|
||||
package app.revanced.patches.youtube.layout.comments.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility
|
||||
import app.revanced.patches.youtube.layout.comments.resource.patch.CommentsResourcePatch
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
|
||||
@Name("shorts-comments-button-fingerprint")
|
||||
@CommentsCompatibility
|
||||
@Version("0.0.1")
|
||||
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
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,68 @@
|
||||
package app.revanced.patches.youtube.layout.comments.bytecode.patch
|
||||
|
||||
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.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
|
||||
import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility
|
||||
import app.revanced.patches.youtube.layout.comments.bytecode.fingerprints.ShortsCommentsButtonFingerprint
|
||||
import app.revanced.patches.youtube.layout.comments.resource.patch.CommentsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||
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 shortsCommentsButtonResult = ShortsCommentsButtonFingerprint.result!!
|
||||
val shortsCommentsButtonMethod = shortsCommentsButtonResult.mutableMethod
|
||||
|
||||
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,
|
||||
)
|
||||
) {}
|
||||
|
||||
val checkCastAnchorIndex = checkCastAnchorFingerprint.also {
|
||||
it.resolve(context, shortsCommentsButtonMethod, shortsCommentsButtonResult.classDef)
|
||||
}.result!!.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
shortsCommentsButtonMethod.addInstructions(
|
||||
checkCastAnchorIndex + 1, """
|
||||
invoke-static {v${(shortsCommentsButtonMethod.instruction(checkCastAnchorIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideShortsCommentsButtonPatch;->hideShortsCommentsButton(Landroid/view/View;)V
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package app.revanced.patches.youtube.layout.comments.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||
|
||||
@Name("comments-resource-patch")
|
||||
@CommentsCompatibility
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||
@Version("0.0.1")
|
||||
class CommentsResourcePatch : ResourcePatch {
|
||||
companion object {
|
||||
internal var shortsCommentsButtonId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_comments",
|
||||
StringResource("revanced_comments_title", "Comments"),
|
||||
listOf(
|
||||
SwitchPreference(
|
||||
"revanced_hide_comments_section",
|
||||
StringResource("revanced_hide_comments_section_title", "Remove 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")
|
||||
)
|
||||
)
|
||||
|
||||
shortsCommentsButtonId = ResourceMappingResourcePatch.resourceMappings.single {
|
||||
it.type == "drawable" && it.name == "ic_right_comment_32c"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.hidealbumcards.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class AlbumCardsCompatibility
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.revanced.patches.youtube.layout.hidealbumcards.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("album-cards-view-fingerprint")
|
||||
@AlbumCardsCompatibility
|
||||
@Version("0.0.1")
|
||||
object AlbumCardsFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
listOf("L", "L", "L", "L", "L", "L", "[B"),
|
||||
listOf(
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CONST,
|
||||
Opcode.CONST_4,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
package app.revanced.patches.youtube.layout.hidealbumcards.patch
|
||||
|
||||
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.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hidealbumcards.fingerprints.AlbumCardsFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||
@Name("hide-album-cards")
|
||||
@Description("Hides the album cards below the artist description.")
|
||||
@AlbumCardsCompatibility
|
||||
@Version("0.0.1")
|
||||
class AlbumCardsPatch : BytecodePatch(
|
||||
listOf(
|
||||
AlbumCardsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_album_cards",
|
||||
StringResource("revanced_hide_album_cards_title", "Hide the album cards"),
|
||||
false,
|
||||
StringResource("revanced_hide_album_cards_summary_on", "Album cards is hidden"),
|
||||
StringResource("revanced_hide_album_cards_summary_off", "Album cards is visible")
|
||||
)
|
||||
)
|
||||
|
||||
val albumCardsResult = AlbumCardsFingerprint.result!!
|
||||
val albumCardsMethod = albumCardsResult.mutableMethod
|
||||
|
||||
val checkCastIndex = albumCardsResult.scanResult.patternScanResult!!.endIndex
|
||||
val patchIndex = checkCastIndex + 1
|
||||
|
||||
albumCardsMethod.addInstruction(
|
||||
patchIndex, """
|
||||
invoke-static {v${(albumCardsMethod.instruction(checkCastIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideAlbumCardsPatch;->hideAlbumCards(Landroid/view/View;)V
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class HideArtistCardCompatibility
|
||||
@@ -0,0 +1,38 @@
|
||||
package app.revanced.patches.youtube.layout.hideartistcard.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
|
||||
import app.revanced.patches.youtube.layout.buttons.annotations.HideArtistCardCompatibility
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||
|
||||
@Patch
|
||||
@DependsOn([ResourceMappingResourcePatch::class, GeneralBytecodeAdsPatch::class])
|
||||
@Name("hide-artist-card")
|
||||
@Description("Hides the artist card below the searchbar.")
|
||||
@HideArtistCardCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideArtistCardPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_artist_card",
|
||||
StringResource("revanced_hide_hide_artist_card_title", "Hide artist card"),
|
||||
false,
|
||||
StringResource("revanced_hide_hide_artist_card_on", "Artist card is hidden"),
|
||||
StringResource("revanced_hide_hide_artist_card_off", "Artist card is shown")
|
||||
),
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class CrowdfundingBoxCompatibility
|
||||
@@ -0,0 +1,37 @@
|
||||
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("crowdfunding-box-view-fingerprint")
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@CrowdfundingBoxCompatibility
|
||||
@Version("0.0.1")
|
||||
object CrowdfundingBoxFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
listOf("L", "L", "L", "L", "L", "L", "L", "[B", "[B"),
|
||||
listOf(
|
||||
Opcode.MOVE_OBJECT,
|
||||
Opcode.MOVE_OBJECT_FROM16,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.MOVE_OBJECT_FROM16,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.MOVE_OBJECT_FROM16,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CONST_4,
|
||||
Opcode.CONST_4,
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.patch
|
||||
|
||||
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.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility
|
||||
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||
@Name("hide-crowdfunding-box")
|
||||
@Description("Hides the crowdfunding box between the player and video description.")
|
||||
@CrowdfundingBoxCompatibility
|
||||
@Version("0.0.1")
|
||||
class CrowdfundingBoxPatch : BytecodePatch(
|
||||
listOf(
|
||||
CrowdfundingBoxFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_crowdfunding_box",
|
||||
StringResource("revanced_hide_crowdfunding_box_title", "Hide the crowdfunding box"),
|
||||
false,
|
||||
StringResource("revanced_hide_crowdfunding_box_summary_on", "Crowdfunding box is hidden"),
|
||||
StringResource("revanced_hide_crowdfunding_box_summary_off", "Crowdfunding box is visible")
|
||||
)
|
||||
)
|
||||
|
||||
val crowdfundingBoxResult = CrowdfundingBoxFingerprint.result!!
|
||||
val crowdfundingBoxMethod = crowdfundingBoxResult.mutableMethod
|
||||
|
||||
val moveResultObjectIndex = crowdfundingBoxResult.scanResult.patternScanResult!!.endIndex
|
||||
val patchIndex = moveResultObjectIndex + 1
|
||||
|
||||
crowdfundingBoxMethod.addInstruction(
|
||||
patchIndex, """
|
||||
invoke-static {v${(crowdfundingBoxMethod.instruction(moveResultObjectIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.32.39", "17.34.36", "17.36.37", "17.36.39", "17.37.35", "17.38.36", "17.39.35", "17.40.41")
|
||||
"com.google.android.youtube", arrayOf("17.32.39", "17.34.36", "17.36.37", "17.36.39", "17.37.35", "17.38.36", "17.39.35", "17.40.41", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -8,10 +8,10 @@ import app.revanced.patches.youtube.layout.hidemixplaylists.annotations.MixPlayl
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("mix-playlists-fingerprint")
|
||||
@Name("create-mix-playlist-fingerprint")
|
||||
@MixPlaylistsPatchCompatibility
|
||||
@Version("0.0.1")
|
||||
object MixPlaylistsPatchFingerprint : MethodFingerprint(
|
||||
object CreateMixPlaylistFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L", "L"), listOf(
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
@@ -26,6 +26,5 @@ object MixPlaylistsPatchFingerprint : MethodFingerprint(
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
package app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.hidemixplaylists.annotations.MixPlaylistsPatchCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("second-create-mix-playlist-fingerprint")
|
||||
@MixPlaylistsPatchCompatibility
|
||||
@Version("0.0.1")
|
||||
object SecondCreateMixPlaylistFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L"), listOf(
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
)
|
||||
)
|
||||
@@ -5,13 +5,16 @@ 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.fingerprint.method.impl.MethodFingerprint
|
||||
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.patch.BytecodePatch
|
||||
import app.revanced.patches.youtube.layout.hidemixplaylists.annotations.MixPlaylistsPatchCompatibility
|
||||
import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.MixPlaylistsPatchFingerprint
|
||||
import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.CreateMixPlaylistFingerprint
|
||||
import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.SecondCreateMixPlaylistFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
@@ -21,12 +24,12 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@Name("hide-my-mix")
|
||||
@Description("Removes mix playlists from the feed.")
|
||||
@Description("Hides mix playlists.")
|
||||
@MixPlaylistsPatchCompatibility
|
||||
@Version("0.0.1")
|
||||
class MixPlaylistsPatch : BytecodePatch(
|
||||
listOf(
|
||||
MixPlaylistsPatchFingerprint
|
||||
CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
@@ -40,16 +43,22 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
|
||||
val result = MixPlaylistsPatchFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
val index = result.scanResult.patternScanResult!!.endIndex - 6
|
||||
val register = (method.implementation!!.instructions[index] as OneRegisterInstruction).registerA
|
||||
|
||||
method.addInstruction(
|
||||
index + 2,
|
||||
"invoke-static {v$register}, Lapp/revanced/integrations/patches/HideMixPlaylistsPatch;->hideMixPlaylists(Landroid/view/View;)V"
|
||||
)
|
||||
arrayOf(CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint).forEach(::addHook)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun addHook(fingerprint: MethodFingerprint) {
|
||||
with (fingerprint.result!!) {
|
||||
val insertIndex = scanResult.patternScanResult!!.endIndex - 3
|
||||
|
||||
val register = (mutableMethod.instruction(insertIndex - 2) as OneRegisterInstruction).registerA
|
||||
|
||||
mutableMethod.addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static {v$register}, Lapp/revanced/integrations/patches/HideMixPlaylistsPatch;->hideMixPlaylists(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -51,7 +51,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
|
||||
|
||||
val pivotBarResult = PivotBarFingerprint.result ?: return PatchResultError("PivotBarFingerprint failed")
|
||||
|
||||
if (!PivotBarCreateButtonViewFingerprint.resolve(context, pivotBarResult.method, pivotBarResult.classDef))
|
||||
if (!PivotBarCreateButtonViewFingerprint.resolve(context, pivotBarResult.mutableMethod, pivotBarResult.mutableClass))
|
||||
return PatchResultError("${PivotBarCreateButtonViewFingerprint.name} failed")
|
||||
|
||||
val createButtonResult = PivotBarCreateButtonViewFingerprint.result!!
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -11,11 +11,11 @@ import org.jf.dexlib2.Opcode
|
||||
@Version("0.0.1")
|
||||
object PivotBarEnumFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IF_NEZ, // target reference
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IGET,
|
||||
Opcode.AND_INT_LIT8, // unique instruction anchor
|
||||
)
|
||||
)
|
||||
@@ -11,8 +11,8 @@ import org.jf.dexlib2.Opcode
|
||||
@Version("0.0.1")
|
||||
object PivotBarShortsButtonViewFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL_RANGE, // unique instruction anchor
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||
Opcode.MOVE_RESULT_OBJECT, // target reference
|
||||
Opcode.GOTO,
|
||||
)
|
||||
)
|
||||
@@ -52,8 +52,8 @@ class ShortsButtonRemoverPatch : BytecodePatch(
|
||||
.onEach {
|
||||
val resolutionSucceeded = it.resolve(
|
||||
context,
|
||||
pivotBarResult.method,
|
||||
pivotBarResult.classDef
|
||||
pivotBarResult.mutableMethod,
|
||||
pivotBarResult.mutableClass
|
||||
)
|
||||
|
||||
if (!resolutionSucceeded) return PatchResultError("${it.name} failed")
|
||||
@@ -63,7 +63,7 @@ class ShortsButtonRemoverPatch : BytecodePatch(
|
||||
val enumScanResult = fingerprintResults[0]
|
||||
val buttonViewResult = fingerprintResults[1]
|
||||
|
||||
val enumHookInsertIndex = enumScanResult.startIndex
|
||||
val enumHookInsertIndex = enumScanResult.startIndex + 2
|
||||
val buttonHookInsertIndex = buttonViewResult.endIndex
|
||||
|
||||
/*
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||
|
||||
@Name("text-component-spec-fingerprint")
|
||||
@ReturnYouTubeDislikeCompatibility
|
||||
@Version("0.0.1")
|
||||
object TextComponentFingerprint : MethodFingerprint(
|
||||
strings = listOf("com.google.android.apps.youtube.music")
|
||||
)
|
||||
@@ -4,7 +4,10 @@ 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.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
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.PatchResultError
|
||||
@@ -12,10 +15,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.DislikeFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.LikeFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RemoveLikeFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.TextComponentSpecParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
||||
@@ -32,49 +32,53 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
LikeFingerprint.result!!.mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 1
|
||||
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->sendVote(I)V
|
||||
"""
|
||||
)
|
||||
DislikeFingerprint.result!!.mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, -1
|
||||
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->sendVote(I)V
|
||||
"""
|
||||
)
|
||||
RemoveLikeFingerprint.result!!.mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0
|
||||
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->sendVote(I)V
|
||||
"""
|
||||
)
|
||||
listOf(
|
||||
LikeFingerprint.toPatch(Vote.LIKE),
|
||||
DislikeFingerprint.toPatch(Vote.DISLIKE),
|
||||
RemoveLikeFingerprint.toPatch(Vote.REMOVE_LIKE)
|
||||
).forEach { (fingerprint, vote) ->
|
||||
with(fingerprint.result ?: return PatchResultError("Failed to find ${fingerprint.name} method.")) {
|
||||
mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, ${vote.value}
|
||||
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->sendVote(I)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
VideoIdPatch.injectCall("Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->newVideoLoaded(Ljava/lang/String;)V")
|
||||
|
||||
val parentResult = TextComponentSpecParentFingerprint.result!!
|
||||
val createComponentMethod = parentResult.mutableClass.methods.find { method ->
|
||||
method.parameters.size >= 19 && method.parameterTypes.takeLast(4)
|
||||
.all { param -> param == "Ljava/util/concurrent/atomic/AtomicReference;" }
|
||||
with(TextComponentFingerprint
|
||||
.also { it.resolve(context, TextComponentSpecParentFingerprint.result!!.classDef) }
|
||||
.result ?: return PatchResultError("Could not find createComponent method")
|
||||
) {
|
||||
val createComponentMethod = mutableMethod
|
||||
|
||||
val conversionContextParam = 5
|
||||
val textRefParam = createComponentMethod.parameters.size - 2
|
||||
val insertIndex = scanResult.stringsScanResult!!.matches.first().index - 2
|
||||
|
||||
createComponentMethod.addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
move-object/from16 v7, p$conversionContextParam
|
||||
move-object/from16 v8, p$textRefParam
|
||||
invoke-static {v7, v8}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->onComponentCreated(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
?: return PatchResultError("TextComponentSpec.createComponent not found")
|
||||
|
||||
val conversionContextParam = 5
|
||||
val textRefParam = createComponentMethod.parameters.size - 2
|
||||
|
||||
createComponentMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
move-object/from16 v0, p$conversionContextParam
|
||||
move-object/from16 v1, p$textRefParam
|
||||
invoke-static {v0, v1}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;->onComponentCreated(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;)V
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun MethodFingerprint.toPatch(voteKind: Vote) = VotePatch(this, voteKind)
|
||||
|
||||
private data class VotePatch(val fingerprint: MethodFingerprint, val voteKind: Vote)
|
||||
|
||||
private enum class Vote(val value: Int) {
|
||||
LIKE(1),
|
||||
DISLIKE(-1),
|
||||
REMOVE_LIKE(0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.22.36", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.22.36", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.26.35", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.26.35", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -8,10 +8,10 @@ import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("comment-actionbar-fingerprint")
|
||||
@Name("litho-ui-fingerprint")
|
||||
@ThemeCompatibility
|
||||
@Version("0.0.1")
|
||||
object CommentsFilterBarFingerprint : MethodFingerprint(
|
||||
object LithoThemeFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L"), listOf(
|
||||
Opcode.APUT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
@@ -11,36 +11,27 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||
import app.revanced.patches.youtube.layout.theme.fingerprints.CommentsFilterBarFingerprint
|
||||
import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint
|
||||
|
||||
@Name("comment-filter-bar-theme")
|
||||
@Description("Applies custom theming to comments filter action bar.")
|
||||
@Name("litho-components-theme")
|
||||
@Description("Applies a custom theme to litho components.")
|
||||
@ThemeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CommentsFilterBarPatch : BytecodePatch(
|
||||
class LithoThemePatch : BytecodePatch(
|
||||
listOf(
|
||||
CommentsFilterBarFingerprint
|
||||
LithoThemeFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val result = CommentsFilterBarFingerprint.result!!
|
||||
val result = LithoThemeFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
||||
|
||||
method.addInstructions(
|
||||
patchIndex, """
|
||||
invoke-static {}, Lapp/revanced/integrations/utils/ThemeHelper;->isDarkTheme()Z
|
||||
move-result v2
|
||||
if-nez v2, :comments_filter_white
|
||||
const v1, -0x1
|
||||
if-ne v1, p1, :comments_filter_white
|
||||
const/4 p1, 0x0
|
||||
:comments_filter_white
|
||||
if-eqz v2, :comments_filter_dark
|
||||
const v1, -0xdededf
|
||||
if-ne v1, p1, :comments_filter_dark
|
||||
const/4 p1, 0x0
|
||||
""", listOf(ExternalLabel("comments_filter_dark", method.instruction(patchIndex)))
|
||||
invoke-static {p1}, Lapp/revanced/integrations/patches/LithoThemePatch;->applyLithoTheme(I)I
|
||||
move-result p1
|
||||
"""
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
@@ -9,10 +9,12 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch
|
||||
@DependsOn([CommentsFilterBarPatch::class, FixLocaleConfigErrorPatch::class])
|
||||
@DependsOn([LithoThemePatch::class, FixLocaleConfigErrorPatch::class])
|
||||
@Name("theme")
|
||||
@Description("Applies a custom theme.")
|
||||
@ThemeCompatibility
|
||||
@@ -29,18 +31,24 @@ class ThemePatch : ResourcePatch {
|
||||
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
|
||||
|
||||
node.textContent = when (node.getAttribute("name")) {
|
||||
"yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4",
|
||||
"yt_status_bar_background_dark", "material_grey_100", "material_grey_50", "material_grey_600",
|
||||
"material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000" -> darkThemeBackgroundColor
|
||||
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3",
|
||||
"yt_black4", "yt_status_bar_background_dark", "material_grey_100", "material_grey_50",
|
||||
"material_grey_600", "material_grey_800", "material_grey_850", "material_grey_900",
|
||||
"material_grey_white_1000", "sud_glif_v3_dialog_background_color_dark" -> darkThemeBackgroundColor
|
||||
|
||||
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3",
|
||||
"yt_white4" -> lightThemeBackgroundColor
|
||||
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3", "yt_white4",
|
||||
"sud_glif_v3_dialog_background_color_light" -> lightThemeBackgroundColor
|
||||
|
||||
else -> continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// copies the resource file to change the splash screen color
|
||||
context.copyResources("theme",
|
||||
ResourceUtils.ResourceGroup("values-night-v31", "styles.xml")
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.watchinvr.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class WatchinVRCompatibility
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.youtube.layout.watchinvr.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.watchinvr.annotations.WatchinVRCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
@Name("watch-in-vr-fingerprint")
|
||||
@WatchinVRCompatibility
|
||||
@Version("0.0.1")
|
||||
object WatchinVRFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"),
|
||||
strings = listOf("menu_item_cardboard_vr")
|
||||
)
|
||||
@@ -0,0 +1,55 @@
|
||||
package app.revanced.patches.youtube.layout.watchinvr.patch
|
||||
|
||||
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.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.watchinvr.annotations.WatchinVRCompatibility
|
||||
import app.revanced.patches.youtube.layout.watchinvr.fingerprints.WatchinVRFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("hide-watch-in-vr")
|
||||
@Description("Hides the Watch in VR option from the player settings flyout panel.")
|
||||
@WatchinVRCompatibility
|
||||
@Version("0.0.1")
|
||||
class WatchinVRPatch : BytecodePatch(
|
||||
listOf(
|
||||
WatchinVRFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_watch_in_vr",
|
||||
StringResource("revanced_hide_watch_in_vr_title", "Hide Watch in VR option"),
|
||||
false,
|
||||
StringResource("revanced_hide_watch_in_vr_summary_on", "Watch in VR option is hidden"),
|
||||
StringResource("revanced_hide_watch_in_vr_summary_off", "Watch in VR option is shown")
|
||||
)
|
||||
)
|
||||
|
||||
WatchinVRFingerprint.result!!.mutableMethod.addInstructions(
|
||||
0, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideWatchinVRPatch;->hideWatchinVR()Z
|
||||
move-result v0
|
||||
if-eqz v0, :shown
|
||||
return-void
|
||||
:shown
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.youtube.misc.integrations.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
||||
|
||||
@Name("service-fingerprint")
|
||||
@IntegrationsCompatibility
|
||||
@Version("0.0.1")
|
||||
object ServiceFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("ApiPlayerService;") && methodDef.name == "<init>" }
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.youtube.misc.integrations.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
||||
|
||||
@Name("standalone-player-fingerprint")
|
||||
@IntegrationsCompatibility
|
||||
@Version("0.0.1")
|
||||
object StandalonePlayerFingerprint : MethodFingerprint(
|
||||
strings = listOf(
|
||||
"Invalid PlaybackStartDescriptor. Returning the instance itself.",
|
||||
"com.google.android.music",
|
||||
)
|
||||
)
|
||||
@@ -4,6 +4,7 @@ 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.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@@ -14,6 +15,8 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMu
|
||||
import app.revanced.patcher.util.smali.toInstructions
|
||||
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||
@@ -24,42 +27,33 @@ import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||
@Version("0.0.1")
|
||||
class IntegrationsPatch : BytecodePatch(
|
||||
listOf(
|
||||
InitFingerprint
|
||||
InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint
|
||||
)
|
||||
) {
|
||||
companion object {
|
||||
private const val INTEGRATIONS_DESCRIPTOR = "Lapp/revanced/integrations/utils/ReVancedUtils;"
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
if (context.findClass("Lapp/revanced/integrations/utils/ReVancedUtils") == null)
|
||||
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
|
||||
if (context.findClass(INTEGRATIONS_DESCRIPTOR) == null)
|
||||
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without merging the integrations.")
|
||||
|
||||
val result = InitFingerprint.result!!
|
||||
arrayOf(InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint).map {
|
||||
it to (it.result ?: return PatchResultError("${it.name} failed to resolve"))
|
||||
}.forEach { (fingerprint, result) ->
|
||||
with(result.mutableMethod) {
|
||||
// parameter which holds the context
|
||||
val contextParameter = if (fingerprint == ServiceFingerprint) parameters.size else 1
|
||||
// register which holds the context
|
||||
val contextRegister = implementation!!.registerCount - contextParameter
|
||||
|
||||
val method = result.mutableMethod
|
||||
val implementation = method.implementation!!
|
||||
val count = implementation.registerCount - 1
|
||||
|
||||
method.addInstruction(
|
||||
0, "sput-object v$count, Lapp/revanced/integrations/utils/ReVancedUtils;->context:Landroid/content/Context;"
|
||||
)
|
||||
|
||||
val classDef = result.mutableClass
|
||||
classDef.methods.add(
|
||||
ImmutableMethod(
|
||||
classDef.type,
|
||||
"getAppContext",
|
||||
null,
|
||||
"Landroid/content/Context;",
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
null,
|
||||
null,
|
||||
ImmutableMethodImplementation(
|
||||
1, """
|
||||
invoke-static { }, Lapp/revanced/integrations/utils/ReVancedUtils;->getAppContext()Landroid/content/Context;
|
||||
move-result-object v0
|
||||
return-object v0
|
||||
""".toInstructions(), null, null
|
||||
addInstruction(
|
||||
0,
|
||||
"sput-object v$contextRegister, $INTEGRATIONS_DESCRIPTOR->context:Landroid/content/Context;"
|
||||
)
|
||||
).toMutable()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -4,10 +4,13 @@ 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.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.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
|
||||
import app.revanced.patches.youtube.misc.clientspoof.patch.ClientSpoofPatch
|
||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||
@@ -38,9 +41,10 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeFingerprint,
|
||||
WatchWhileActivityFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) =
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
// apply common microG patch
|
||||
MicroGBytecodeHelper.patchBytecode(
|
||||
context, arrayOf(
|
||||
@@ -62,5 +66,11 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint
|
||||
)
|
||||
).let { PatchResultSuccess() }
|
||||
)
|
||||
|
||||
// inject the notice for MicroG
|
||||
MicroGBytecodeHelper.injectNotice(WatchWhileActivityFingerprint)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ class MicroGResourcePatch : ResourcePatch {
|
||||
SPOOFED_PACKAGE_NAME,
|
||||
SPOOFED_PACKAGE_SIGNATURE
|
||||
)
|
||||
|
||||
// add strings
|
||||
MicroGResourceHelper.addStrings(context)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.27.39", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.27.39", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.22.36", "17.24.35", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.22.36", "17.24.35", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||
|
||||
// TODO: This is more of a class fingerprint than a method fingerprint.
|
||||
// Convert to a class fingerprint whenever possible.
|
||||
@Name("revanced-settings-activity-fingerprint")
|
||||
@SettingsCompatibility
|
||||
@Version("0.0.1")
|
||||
object ReVancedSettingsActivityFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.definingClass.endsWith("ReVancedSettingActivity;") && methodDef.name == "initializeSettings"
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,39 @@
|
||||
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("theme-setter-app-fingerprint")
|
||||
@SettingsCompatibility
|
||||
@Version("0.0.1")
|
||||
object ThemeSetterAppFingerprint : MethodFingerprint(
|
||||
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L"), listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IF_NE,
|
||||
Opcode.CONST, //target reference
|
||||
Opcode.GOTO,
|
||||
Opcode.CONST, //target reference
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.RETURN_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IF_NE,
|
||||
Opcode.CONST, //target reference
|
||||
)
|
||||
)
|
||||
@@ -5,18 +5,19 @@ import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
|
||||
@Name("theme-setter-fingerprint")
|
||||
@Name("theme-setter-system-fingerprint")
|
||||
@SettingsCompatibility
|
||||
@Version("0.0.1")
|
||||
object ThemeSetterFingerprint : MethodFingerprint(
|
||||
object ThemeSetterSystemFingerprint : MethodFingerprint(
|
||||
"L",
|
||||
opcodes = listOf(Opcode.RETURN_OBJECT),
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.implementation?.instructions?.any {
|
||||
it.opcode.ordinal == Opcode.CONST.ordinal && (it as WideLiteralInstruction).wideLiteral == SettingsPatch.appearanceStringId
|
||||
it.opcode.ordinal == Opcode.CONST.ordinal && (it as WideLiteralInstruction).wideLiteral == SettingsResourcePatch.appearanceStringId
|
||||
} == true
|
||||
}
|
||||
)
|
||||
@@ -11,15 +11,12 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.toInstruction
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ReVancedSettingsActivityFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterAppFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.ArrayResource
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
@@ -39,64 +36,100 @@ import java.io.Closeable
|
||||
@SettingsCompatibility
|
||||
@Version("0.0.1")
|
||||
class SettingsPatch : BytecodePatch(
|
||||
listOf(LicenseActivityFingerprint, ReVancedSettingsActivityFingerprint, ThemeSetterFingerprint)
|
||||
listOf(LicenseActivityFingerprint, ThemeSetterSystemFingerprint, ThemeSetterAppFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val licenseActivityResult = LicenseActivityFingerprint.result!!
|
||||
val settingsResult = ReVancedSettingsActivityFingerprint.result!!
|
||||
val themeSetterResult = ThemeSetterFingerprint.result!!
|
||||
fun buildInvokeInstructionsString(
|
||||
registers: String = "v0",
|
||||
classDescriptor: String = THEME_HELPER_DESCRIPTOR,
|
||||
methodName: String = SET_THEME_METHOD_NAME,
|
||||
parameters: String = "Ljava/lang/Object;"
|
||||
) = "invoke-static {$registers}, $classDescriptor->$methodName($parameters)V"
|
||||
|
||||
val licenseActivityClass = licenseActivityResult.mutableClass
|
||||
val settingsClass = settingsResult.mutableClass
|
||||
// apply the current theme of the settings page
|
||||
with(ThemeSetterSystemFingerprint.result!!) {
|
||||
with(mutableMethod) {
|
||||
val call = buildInvokeInstructionsString()
|
||||
|
||||
val onCreate = licenseActivityResult.mutableMethod
|
||||
val setThemeMethodName = "setTheme"
|
||||
val initializeSettings = settingsResult.mutableMethod
|
||||
addInstruction(
|
||||
scanResult.patternScanResult!!.startIndex,
|
||||
call
|
||||
)
|
||||
|
||||
val setThemeInstruction =
|
||||
"invoke-static {v0}, Lapp/revanced/integrations/utils/ThemeHelper;->setTheme(Ljava/lang/Object;)V".toInstruction(
|
||||
themeSetterResult.mutableMethod
|
||||
)
|
||||
|
||||
// add instructions to set the theme of the settings activity
|
||||
themeSetterResult.mutableMethod.implementation!!.let {
|
||||
it.addInstruction(
|
||||
themeSetterResult.scanResult.patternScanResult!!.startIndex,
|
||||
setThemeInstruction
|
||||
)
|
||||
|
||||
it.addInstruction(
|
||||
it.instructions.size - 1, // add before return
|
||||
setThemeInstruction
|
||||
)
|
||||
addInstruction(
|
||||
mutableMethod.implementation!!.instructions.size - 1,
|
||||
call
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// add the setTheme call to the onCreate method to not affect the offsets
|
||||
onCreate.addInstructions(
|
||||
1,
|
||||
"""
|
||||
invoke-static { p0 }, ${settingsClass.type}->${initializeSettings.name}(${licenseActivityClass.type})V
|
||||
return-void
|
||||
"""
|
||||
)
|
||||
// set the theme based on the preference of the app
|
||||
with(ThemeSetterAppFingerprint.result!!) {
|
||||
with(mutableMethod) {
|
||||
fun buildInstructionsString(theme: Int) = """
|
||||
const/4 v0, 0x$theme
|
||||
${buildInvokeInstructionsString(parameters = "I")}
|
||||
"""
|
||||
|
||||
// add the initializeSettings call to the onCreate method
|
||||
onCreate.addInstruction(
|
||||
0,
|
||||
"invoke-static { p0 }, ${settingsClass.type}->$setThemeMethodName(${licenseActivityClass.type})V"
|
||||
)
|
||||
addInstructions(
|
||||
scanResult.patternScanResult!!.endIndex + 1,
|
||||
buildInstructionsString(1)
|
||||
)
|
||||
addInstructions(
|
||||
scanResult.patternScanResult!!.endIndex - 7,
|
||||
buildInstructionsString(0)
|
||||
)
|
||||
|
||||
// get rid of, now, useless overridden methods
|
||||
licenseActivityResult.mutableClass.methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) }
|
||||
addInstructions(
|
||||
scanResult.patternScanResult!!.endIndex - 9,
|
||||
buildInstructionsString(1)
|
||||
)
|
||||
addInstructions(
|
||||
mutableMethod.implementation!!.instructions.size - 2,
|
||||
buildInstructionsString(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// set the theme based on the preference of the device
|
||||
with(LicenseActivityFingerprint.result!!) licenseActivity@{
|
||||
with(mutableMethod) {
|
||||
fun buildSettingsActivityInvokeString(
|
||||
registers: String = "p0",
|
||||
classDescriptor: String = SETTINGS_ACTIVITY_DESCRIPTOR,
|
||||
methodName: String = "initializeSettings",
|
||||
parameters: String = this@licenseActivity.mutableClass.type
|
||||
) = buildInvokeInstructionsString(registers, classDescriptor, methodName, parameters)
|
||||
|
||||
// initialize the settings
|
||||
addInstructions(
|
||||
1,
|
||||
"""
|
||||
${buildSettingsActivityInvokeString()}
|
||||
return-void
|
||||
"""
|
||||
)
|
||||
|
||||
// set the current theme
|
||||
addInstruction(0, buildSettingsActivityInvokeString(methodName = "setTheme"))
|
||||
}
|
||||
|
||||
// remove method overrides
|
||||
with(mutableClass) {
|
||||
methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) }
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
// TODO: hide this somehow
|
||||
var appearanceStringId: Long = ResourceMappingResourcePatch.resourceMappings.find {
|
||||
it.type == "string" && it.name == "app_theme_appearance_dark"
|
||||
}!!.id
|
||||
private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations"
|
||||
|
||||
private const val SETTINGS_ACTIVITY_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settingsmenu/ReVancedSettingActivity;"
|
||||
|
||||
private const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/utils/ThemeHelper;"
|
||||
private const val SET_THEME_METHOD_NAME = "setTheme"
|
||||
|
||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||
SettingsResourcePatch.addString(identifier, value, formatted)
|
||||
@@ -107,9 +140,6 @@ class SettingsPatch : BytecodePatch(
|
||||
fun addPreference(preference: Preference) =
|
||||
SettingsResourcePatch.addPreference(preference)
|
||||
|
||||
fun addArray(arrayResource: ArrayResource) =
|
||||
SettingsResourcePatch.addArray(arrayResource)
|
||||
|
||||
fun renameIntentsTargetPackage(newPackage: String) {
|
||||
SettingsResourcePatch.overrideIntentsTargetPackage = newPackage
|
||||
}
|
||||
@@ -152,4 +182,4 @@ class SettingsPatch : BytecodePatch(
|
||||
|
||||
override fun close() = PreferenceScreen.values().forEach(PreferenceScreen::close)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,14 @@ import org.w3c.dom.Node
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class, ResourceMappingResourcePatch::class])
|
||||
@Version("0.0.1")
|
||||
class SettingsResourcePatch : ResourcePatch {
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
/*
|
||||
* used by a fingerprint of SettingsPatch
|
||||
*/
|
||||
appearanceStringId = ResourceMappingResourcePatch.resourceMappings.find {
|
||||
it.type == "string" && it.name == "app_theme_appearance_dark"
|
||||
}!!.id
|
||||
|
||||
/*
|
||||
* create missing directory for the resources
|
||||
*/
|
||||
@@ -84,6 +90,12 @@ class SettingsResourcePatch : ResourcePatch {
|
||||
|
||||
|
||||
internal companion object {
|
||||
// Used by a fingerprint of SettingsPatch
|
||||
// this field is located in the SettingsResourcePatch
|
||||
// because if it were to be defined in the SettingsPatch companion object,
|
||||
// the companion object could be initialized before ResourceMappingResourcePatch has executed.
|
||||
internal var appearanceStringId: Long = -1
|
||||
|
||||
// if this is not null, all intents will be renamed to this
|
||||
var overrideIntentsTargetPackage: String? = null
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.22.36", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.22.36", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37", "17.41.37")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.fingerprints
|
||||
package app.revanced.shared.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@@ -20,6 +21,17 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
||||
* Helper class for applying bytecode patches needed for the microg-support patches.
|
||||
*/
|
||||
internal object MicroGBytecodeHelper {
|
||||
/**
|
||||
* Hook a method to check the availability of MicroG.
|
||||
*
|
||||
* @param fingerprint The fingerprint of the method to add the call for the notice in.
|
||||
*/
|
||||
fun injectNotice(fingerprint: MethodFingerprint) {
|
||||
fingerprint.result!!.mutableMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/integrations/patches/MicroGSupport;->checkAvailability()V"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform strings with package name out of [fromPackageName] and [toPackageName].
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
|
||||
/**
|
||||
* Helper class for applying resource patches needed for the microg-support patches.
|
||||
*/
|
||||
internal object MicroGResourceHelper {
|
||||
|
||||
/**
|
||||
* Add necessary strings to the strings.xml file.
|
||||
*
|
||||
* @param context The resource context.
|
||||
* @param stringsHost The file which hosts the strings.
|
||||
*/
|
||||
fun addStrings(context: ResourceContext, stringsHost: String = "microg/host/values/strings.xml") = context.mergeStrings(stringsHost)
|
||||
|
||||
/**
|
||||
* Patch the manifest to work with MicroG.
|
||||
*
|
||||
* @param context Bytecode context.
|
||||
* @param fromPackageName Original package name.
|
||||
* @param context The resource context.
|
||||
* @param fromPackageName The original package name.
|
||||
* @param toPackageName The package name to accept.
|
||||
* @param toName The new name of the app.
|
||||
*/
|
||||
|
||||
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |