chore: merge branch dev to main (#2041)

This commit is contained in:
oSumAtrIX 2023-05-02 07:46:34 +02:00 committed by GitHub
commit 4fdb2df061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
80 changed files with 655 additions and 407 deletions

View File

@ -1,3 +1,39 @@
# [2.173.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.173.0-dev.4...v2.173.0-dev.5) (2023-05-02)
### Features
* **youtube:** `navigation-buttons` patch ([4bece31](https://github.com/revanced/revanced-patches/commit/4bece31f56eb340933ad26da3d1bfc902ea8569f))
# [2.173.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.173.0-dev.3...v2.173.0-dev.4) (2023-05-02)
### Features
* **youtube/create-button:** switch create with notifications button ([385ceda](https://github.com/revanced/revanced-patches/commit/385ceda61f586f24b11a284688f55758ef5b4e74))
# [2.173.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.173.0-dev.2...v2.173.0-dev.3) (2023-05-02)
### Features
* **youtube/theme:** theme seekbar when clicked ([691a231](https://github.com/revanced/revanced-patches/commit/691a231d99b3b2fbe446fc7edb7a88c7a3127037))
# [2.173.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.173.0-dev.1...v2.173.0-dev.2) (2023-05-02)
### Features
* **youtube/theme:** change seekbar color via preference ([9b465d9](https://github.com/revanced/revanced-patches/commit/9b465d95887863f6b42baa6b710ed98c97383a82))
# [2.173.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.172.0...v2.173.0-dev.1) (2023-05-02)
### Features
* **youtube:** bump compatibility to `18.16.37` ([fe3fdd5](https://github.com/revanced/revanced-patches/commit/fe3fdd5c6cb186bcebc2f86b1d5b597109b25cb6))
* **youtube:** support version `18.16.37` ([8beb5ea](https://github.com/revanced/revanced-patches/commit/8beb5ea860284be915c0ef0c6039821a50c14fa8))
# [2.172.0](https://github.com/revanced/revanced-patches/compare/v2.171.0...v2.172.0) (2023-05-01)

109
README.md
View File

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

View File

@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.172.0
version = 2.173.0-dev.5

File diff suppressed because one or more lines are too long

View File

@ -4,10 +4,21 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package("com.google.android.youtube"),
Package("com.vanced.android.youtube")
]
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40",
"18.16.37"
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class ClientSpoofCompatibility

View File

@ -10,15 +10,18 @@ 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.shared.misc.fix.spoof.annotations.ClientSpoofCompatibility
import app.revanced.patches.shared.misc.fix.spoof.fingerprints.UserAgentHeaderBuilderFingerprint
import app.revanced.patches.youtube.misc.fix.playback.patch.SpoofSignatureVerificationPatch
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
@Patch
@Name("client-spoof")
@Description("Spoofs a patched client to allow playback.")
@ClientSpoofCompatibility
@DependsOn([SpoofSignatureVerificationPatch::class])
@Version("0.0.1")
class ClientSpoofPatch : BytecodePatch(
listOf(UserAgentHeaderBuilderFingerprint)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.fix.playback.annotation
package app.revanced.patches.youtube.layout.buttons.navigation.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@ -15,9 +15,10 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class ProtobufSpoofCompatibility
internal annotation class NavigationButtonsCompatibility

View File

@ -0,0 +1,12 @@
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
internal const val ANDROID_AUTOMOTIVE_STRING = "Android Automotive"
object AddCreateButtonViewFingerprint : MethodFingerprint(
strings = listOf(
"Android Wear",
ANDROID_AUTOMOTIVE_STRING,
)
)

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.patch.ResolvePivotBarFingerprintsPatch
import app.revanced.patches.youtube.layout.buttons.navigation.patch.ResolvePivotBarFingerprintsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction

View File

@ -1,9 +1,9 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.shorts.fingerprints
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object PivotBarShortsButtonViewFingerprint : MethodFingerprint(
object PivotBarButtonsViewFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.MOVE_RESULT_OBJECT, // target reference

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.create.fingerprints
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.shorts.fingerprints
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -0,0 +1,196 @@
package app.revanced.patches.youtube.layout.buttons.navigation.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.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.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.buttons.navigation.annotations.NavigationButtonsCompatibility
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.*
import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.injectHook
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@DependsOn(
[
IntegrationsPatch::class,
SettingsPatch::class,
ResolvePivotBarFingerprintsPatch::class,
]
)
@Name("navigation-buttons")
@Description("Adds options to hide or change navigation buttons.")
@NavigationButtonsCompatibility
@Version("0.0.1")
class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_navigation_buttons",
StringResource("revanced_navigation_buttons", "Navigation button settings"),
listOf(
SwitchPreference(
"revanced_hide_home_button",
StringResource("revanced_hide_home_button_title", "Hide home button"),
false,
StringResource("revanced_hide_home_button_summary_on", "Home button is hidden"),
StringResource("revanced_hide_home_button_summary_off", "Home button is shown")
),
SwitchPreference(
"revanced_hide_shorts_button",
StringResource("revanced_hide_shorts_button_title", "Hide shorts button"),
true,
StringResource("revanced_hide_shorts_button_summary_on", "Shorts button is hidden"),
StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown")
),
SwitchPreference(
"revanced_hide_subscriptions_button",
StringResource("revanced_hide_subscriptions_button_title", "Hide subscriptions button"),
false,
StringResource(
"revanced_hide_subscriptions_button_summary_on",
"Home subscriptions is hidden"
),
StringResource("revanced_hide_subscriptions_button_summary_off", "Home subscriptions is shown")
),
SwitchPreference(
"revanced_hide_create_button",
StringResource("revanced_hide_create_button_title", "Hide create button"),
true,
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
StringResource("revanced_hide_create_button_summary_off", "Create button is shown")
),
SwitchPreference(
"revanced_switch_create_with_notifications_button",
StringResource(
"revanced_switch_create_with_notifications_button_title",
"Switch create with notifications button"
),
true,
StringResource(
"revanced_switch_create_with_notifications_button_summary_on",
"Create button is switched with notifications"
),
StringResource(
"revanced_switch_create_with_notifications_button_summary_off",
"Create button is not switched with notifications"
),
),
),
)
)
/*
* Resolve fingerprints
*/
val initializeButtonsResult = InitializeButtonsFingerprint.result!!
val fingerprintResults =
arrayOf(PivotBarEnumFingerprint, PivotBarButtonsViewFingerprint)
.onEach {
if (!it.resolve(
context,
initializeButtonsResult.mutableMethod,
initializeButtonsResult.mutableClass
)
)
return it.toErrorResult()
}
.map { it.result!!.scanResult.patternScanResult!! }
val enumScanResult = fingerprintResults[0]
val buttonViewResult = fingerprintResults[1]
val enumHookInsertIndex = enumScanResult.startIndex + 2
val buttonHookInsertIndex = buttonViewResult.endIndex
/*
* Inject hooks
*/
val enumHook = "sput-object v$REGISTER_TEMPLATE_REPLACEMENT, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->lastNavigationButton:Ljava/lang/Enum;"
val buttonHook = "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideButton(Landroid/view/View;)V"
// Inject bottom to top to not mess up the indices
mapOf(
buttonHook to buttonHookInsertIndex,
enumHook to enumHookInsertIndex
).forEach { (hook, insertIndex) ->
initializeButtonsResult.mutableMethod.injectHook(hook, insertIndex)
}
/*
* Hide create or switch it with notifications buttons.
*/
AddCreateButtonViewFingerprint.result?.let {
it.mutableMethod.apply {
val stringIndex = it.scanResult.stringsScanResult!!.matches.find {
match -> match.string == ANDROID_AUTOMOTIVE_STRING
}!!.index
val conditionalCheckIndex = stringIndex - 1
val conditionRegister = (instruction(conditionalCheckIndex) as OneRegisterInstruction).registerA
addInstructions(
conditionalCheckIndex,
"""
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->switchCreateWithNotificationButton()Z
move-result v$conditionRegister
"""
)
}
} ?: return AddCreateButtonViewFingerprint.toErrorResult()
/*
* Resolve fingerprints
*/
InitializeButtonsFingerprint.result!!.let {
if (!PivotBarCreateButtonViewFingerprint.resolve(context, it.mutableMethod, it.mutableClass))
return PivotBarCreateButtonViewFingerprint.toErrorResult()
}
PivotBarCreateButtonViewFingerprint.result!!.apply {
val insertIndex = mutableMethod.implementation!!.instructions.let {
val scanStart = scanResult.patternScanResult!!.endIndex
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_STATIC
}
}
/*
* Inject hooks
*/
val hook = "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideCreateButton(Landroid/view/View;)V"
mutableMethod.injectHook(hook, insertIndex)
}
return PatchResultSuccess()
}
private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/NavigationButtonsPatch;"
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.shared.patch
package app.revanced.patches.youtube.layout.buttons.navigation.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -11,21 +11,15 @@ import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.annotations.PivotBarCompatibility
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.PivotBarConstructorFingerprint
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.PivotBarConstructorFingerprint
@DependsOn([ResourceMappingPatch::class])
@PivotBarCompatibility
@Description("Resolves necessary fingerprints.")
@Version("0.0.1")
class ResolvePivotBarFingerprintsPatch : BytecodePatch(
listOf(PivotBarConstructorFingerprint)
) {
internal companion object {
var imageOnlyTabResourceId: Long = -1
}
override fun execute(context: BytecodeContext): PatchResult {
// imageOnlyTabResourceId is used in InitializeButtonsFingerprint fingerprint
ResourceMappingPatch.resourceMappings.find { it.type == "layout" && it.name == "image_only_tab" }
@ -42,4 +36,8 @@ class ResolvePivotBarFingerprintsPatch : BytecodePatch(
} ?: return PivotBarConstructorFingerprint.toErrorResult()
return PatchResultSuccess()
}
internal companion object {
var imageOnlyTabResourceId: Long = -1
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.utils
package app.revanced.patches.youtube.layout.buttons.navigation.utils
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction

View File

@ -1,79 +0,0 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.create.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.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.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.buttons.pivotbar.create.fingerprints.PivotBarCreateButtonViewFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.annotations.PivotBarCompatibility
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.patch.ResolvePivotBarFingerprintsPatch
import app.revanced.patches.youtube.layout.buttons.pivotbar.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.patches.youtube.layout.buttons.pivotbar.utils.InjectionUtils.injectHook
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.jf.dexlib2.Opcode
@Patch
@DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class, ResolvePivotBarFingerprintsPatch::class])
@Name("hide-create-button")
@Description("Hides the create button in the navigation bar.")
@PivotBarCompatibility
@Version("0.0.1")
class CreateButtonRemoverPatch : BytecodePatch() {
private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/HideCreateButtonPatch;"
}
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_create_button",
StringResource("revanced_hide_create_button_title", "Hide create button"),
true,
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
StringResource("revanced_hide_create_button_summary_off", "Create button is shown")
)
)
/*
* Resolve fingerprints
*/
InitializeButtonsFingerprint.result!!.let {
if (!PivotBarCreateButtonViewFingerprint.resolve(context, it.mutableMethod, it.mutableClass))
return PivotBarCreateButtonViewFingerprint.toErrorResult()
}
PivotBarCreateButtonViewFingerprint.result!!.apply {
val insertIndex = mutableMethod.implementation!!.instructions.let {
val scanStart = scanResult.patternScanResult!!.endIndex
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_STATIC
}
}
/*
* Inject hooks
*/
val hook = "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideCreateButton(Landroid/view/View;)V"
mutableMethod.injectHook(hook, insertIndex)
}
return PatchResultSuccess()
}
}

View File

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

View File

@ -1,93 +0,0 @@
package app.revanced.patches.youtube.layout.buttons.pivotbar.shorts.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.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.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.annotations.PivotBarCompatibility
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.patch.ResolvePivotBarFingerprintsPatch
import app.revanced.patches.youtube.layout.buttons.pivotbar.shorts.fingerprints.PivotBarEnumFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shorts.fingerprints.PivotBarShortsButtonViewFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.patches.youtube.layout.buttons.pivotbar.utils.InjectionUtils.injectHook
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResolvePivotBarFingerprintsPatch::class])
@Name("hide-shorts-button")
@Description("Hides the shorts button on the navigation bar.")
@PivotBarCompatibility
@Version("0.0.1")
class ShortsButtonRemoverPatch : BytecodePatch() {
private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/HideShortsButtonPatch;"
}
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_shorts_button",
StringResource("revanced_hide_shorts_button_title", "Hide shorts button"),
true,
StringResource("revanced_hide_shorts_button_summary_on", "Shorts button is hidden"),
StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown")
)
)
/*
* Resolve fingerprints
*/
val initializeButtonsResult = InitializeButtonsFingerprint.result!!
val fingerprintResults =
arrayOf(PivotBarEnumFingerprint, PivotBarShortsButtonViewFingerprint)
.onEach {
if (!it.resolve(
context,
initializeButtonsResult.mutableMethod,
initializeButtonsResult.mutableClass
)
)
return it.toErrorResult()
}
.map { it.result!!.scanResult.patternScanResult!! }
val enumScanResult = fingerprintResults[0]
val buttonViewResult = fingerprintResults[1]
val enumHookInsertIndex = enumScanResult.startIndex + 2
val buttonHookInsertIndex = buttonViewResult.endIndex
/*
* Inject hooks
*/
val enumHook = "sput-object v$REGISTER_TEMPLATE_REPLACEMENT, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->lastPivotTab:Ljava/lang/Enum;"
val buttonHook = "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideShortsButton(Landroid/view/View;)V"
// Inject bottom to top to not mess up the indices
mapOf(
buttonHook to buttonHookInsertIndex,
enumHook to enumHookInsertIndex
).forEach { (hook, insertIndex) ->
initializeButtonsResult.mutableMethod.injectHook(hook, insertIndex)
}
return PatchResultSuccess()
}
}

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

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

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

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

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40", "18.16.37"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class SponsorBlockCompatibility

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

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

View File

@ -7,5 +7,17 @@ import org.jf.dexlib2.Opcode
object MiniPlayerOverrideFingerprint : MethodFingerprint(
"Z", AccessFlags.STATIC or AccessFlags.PUBLIC,
opcodes = listOf(Opcode.RETURN), // anchor to insert the instruction
listOf("L"),
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.CONST_4,
Opcode.IF_EQ,
Opcode.CONST_4,
Opcode.IF_EQ,
Opcode.CONST_4, // override this value
Opcode.RETURN,
Opcode.CONST_4, // override this value
Opcode.RETURN
),
)

View File

@ -1,13 +1,7 @@
package app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object MiniPlayerOverrideParentFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L"),
strings = listOf("PLAYBACK_RATE_MENU_BOTTOM_SHEET_FRAGMENT")
strings = listOf("Possible Context wrapper loop - chain of wrappers larger than 10000")
)

View File

@ -10,6 +10,7 @@ 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
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
@ -20,6 +21,7 @@ import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMi
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.*
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@ -68,10 +70,28 @@ class TabletMiniPlayerPatch : BytecodePatch(
MiniPlayerOverrideParentFingerprint.result?.let {
if (!MiniPlayerOverrideFingerprint.resolve(context, it.classDef))
throw MiniPlayerOverrideFingerprint.toErrorResult()
MiniPlayerOverrideFingerprint.addProxyCall()
} ?: return MiniPlayerOverrideParentFingerprint.toErrorResult()
/*
* Override every return instruction with the proxy call.
*/
MiniPlayerOverrideFingerprint.result!!.mutableMethod.apply {
implementation!!.let { implementation ->
val returnIndices = implementation.instructions
.withIndex()
.filter { (_, instruction) -> instruction.opcode == Opcode.RETURN }
.map { (index, _) -> index }
if (returnIndices.isEmpty()) throw PatchResultError("No return instructions found.")
// This method clobbers register p0 to return the value, calculate to override.
val returnedRegister = implementation.registerCount - parameters.size
// Hook the returned register on every return instruction.
returnIndices.forEach { index -> insertOverride(index, returnedRegister) }
}
}
/*
* Size check return value override.
*/

View File

@ -0,0 +1,25 @@
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint.indexOfInstructionWithSeekbarId
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
object CreateDarkThemeSeekbarFingerprint : MethodFingerprint(
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
customFingerprint = { method -> method.indexOfInstructionWithSeekbarId != -1 },
) {
/**
* The index of the instruction that loads the resource id of the seekbar.
*/
internal val Method.indexOfInstructionWithSeekbarId
get() = implementation?.let {
it.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == ThemeResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId
}
}
}

View File

@ -0,0 +1,9 @@
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object SetSeekbarClickedColorFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.CONST_HIGH16),
strings = listOf("YOUTUBE", "PREROLL", "POSTROLL")
)

View File

@ -0,0 +1,77 @@
package app.revanced.patches.youtube.layout.theme.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint.indexOfInstructionWithSeekbarId
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@Name("theme")
@Description("Applies a custom theme.")
@DependsOn([ThemeLithoComponentsPatch::class, ThemeResourcePatch::class, IntegrationsPatch::class])
@ThemeCompatibility
@Version("0.0.1")
class ThemeBytecodePatch : BytecodePatch(
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
CreateDarkThemeSeekbarFingerprint.result?.let {
val putColorValueIndex = it.method.indexOfInstructionWithSeekbarId!! + 3
it.mutableMethod.apply {
val overrideRegister = (instruction(putColorValueIndex) as TwoRegisterInstruction).registerA
addInstructions(
putColorValueIndex,
"""
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue()I
move-result v$overrideRegister
"""
)
}
} ?: return CreateDarkThemeSeekbarFingerprint.toErrorResult()
SetSeekbarClickedColorFingerprint.result?.let { result ->
result.mutableMethod.let {
val setColorMethodIndex = result.scanResult.patternScanResult!!.startIndex + 1
val method = context
.toMethodWalker(it)
.nextMethod(setColorMethodIndex, true)
.getMethod() as MutableMethod
method.apply {
val colorRegister = (method.instruction(0) as TwoRegisterInstruction).registerA
addInstructions(
0,
"""
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarClickedColorValue(I)I
move-result v$colorRegister
"""
)
}
}
} ?: return SetSeekbarClickedColorFingerprint.toErrorResult()
return PatchResultSuccess()
}
private companion object {
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemePatch;"
}
}

View File

@ -0,0 +1,40 @@
package app.revanced.patches.youtube.layout.theme.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint
@Name("theme-litho-components")
@Description("Applies a custom theme to Litho components.")
@ThemeCompatibility
@Version("0.0.1")
class ThemeLithoComponentsPatch : BytecodePatch(listOf(LithoThemeFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult {
LithoThemeFingerprint.result?.let {
it.mutableMethod.apply {
val patchIndex = it.scanResult.patternScanResult!!.endIndex - 1
addInstructions(
patchIndex,
"""
invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->getValue(I)I
move-result p1
"""
)
}
} ?: return LithoThemeFingerprint.toErrorResult()
return PatchResultSuccess()
}
private companion object {
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemeLithoComponentsPatch;"
}
}

View File

@ -1,36 +0,0 @@
package app.revanced.patches.youtube.layout.theme.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.patches.youtube.layout.theme.annotations.ThemeCompatibility
import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint
@Name("litho-components-theme")
@Description("Applies a custom theme to litho components.")
@ThemeCompatibility
@Version("0.0.1")
class LithoThemePatch : BytecodePatch(
listOf(
LithoThemeFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
val result = LithoThemeFingerprint.result!!
val method = result.mutableMethod
val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1
method.addInstructions(
patchIndex, """
invoke-static {p1}, Lapp/revanced/integrations/patches/LithoThemePatch;->applyLithoTheme(I)I
move-result p1
"""
)
return PatchResultSuccess()
}
}

View File

@ -1,29 +1,45 @@
package app.revanced.patches.youtube.layout.theme.patch
package app.revanced.patches.youtube.layout.theme.resource
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.*
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.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.InputType
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
import org.w3c.dom.Element
@Patch
@DependsOn([LithoThemePatch::class])
@Name("theme")
@Description("Applies a custom theme.")
@ThemeCompatibility
@Version("0.0.1")
class ThemePatch : ResourcePatch {
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
class ThemeResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
TextPreference(
"revanced_seekbar_color",
StringResource("revanced_seekbar_color_title", "Seekbar color"),
InputType.STRING,
"#ffff0000",
StringResource(
"revanced_seekbar_color_summary",
"The color of the seekbar for the dark theme."
)
),
)
// Edit theme colors via bytecode.
// For that the resource id is used in a bytecode patch to change the color.
inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch.resourceMappings
.find { it.name == "inline_time_bar_colorized_bar_played_color_dark" }?.id
?: return PatchResultError("Could not find seekbar resource")
val darkThemeBackgroundColor = darkThemeBackgroundColor!!
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
val darkThemeSeekbarColor = darkThemeSeekbarColor!!
// Edit theme colors via resources.
context.xmlEditor["res/values/colors.xml"].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
@ -31,18 +47,19 @@ class ThemePatch : ResourcePatch {
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
node.textContent = when (node.getAttribute("name")) {
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark", "material_grey_850" -> darkThemeBackgroundColor
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3",
"yt_black4", "yt_status_bar_background_dark", "material_grey_850" -> darkThemeBackgroundColor
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3", "yt_white4",
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98",
"yt_white2", "yt_white3", "yt_white4",
-> lightThemeBackgroundColor
"inline_time_bar_colorized_bar_played_color_dark" -> darkThemeSeekbarColor
else -> continue
}
}
}
// copies the resource file to change the splash screen color
// Copy the resource file to change the splash screen color.
context.copyResources(
"theme", ResourceUtils.ResourceGroup("values-night-v31", "styles.xml")
)
@ -51,6 +68,8 @@ class ThemePatch : ResourcePatch {
}
companion object : OptionsContainer() {
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
var darkThemeBackgroundColor: String? by option(
PatchOption.StringOption(
key = "darkThemeBackgroundColor",
@ -68,14 +87,5 @@ class ThemePatch : ResourcePatch {
description = "The background color of the light theme. Can be a hex color or a resource reference.",
)
)
var darkThemeSeekbarColor: String? by option(
PatchOption.StringOption(
key = "darkThemeSeekbarColor",
default = "#ffff0000",
title = "Dark theme seekbar color",
description = "The background color of the seekbar of the dark theme. Leave empty for default color.",
)
)
}
}

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -12,12 +12,9 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.misc.fix.spoof.patch.ClientSpoofPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.fix.playback.annotation.ProtobufSpoofCompatibility
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.OpenCronetDataSourceFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SubtitleWindowSettingsConstructorFingerprint
@ -27,15 +24,12 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("spoof-signature-verification")
@Description("Spoofs a patched client to prevent playback issues.")
@ProtobufSpoofCompatibility
@DependsOn([
IntegrationsPatch::class,
SettingsPatch::class,
PlayerTypeHookPatch::class,
ClientSpoofPatch::class,
VideoIdPatch::class
])
@Version("0.0.1")

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40", "18.16.37"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class VideoInformationCompatibility

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40", "18.16.37"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class RememberVideoQualityCompatibility

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40", "18.16.37"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class RememberPlaybackSpeedCompatibility

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)

View File

@ -16,7 +16,8 @@ import app.revanced.patcher.annotation.Package
"18.05.35",
"18.05.40",
"18.08.37",
"18.15.40"
"18.15.40",
"18.16.37"
)
)]
)