mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 18:51:03 +00:00
Compare commits
7 Commits
v2.173.0-d
...
v2.173.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0c91102e1 | ||
|
|
eb93f149df | ||
|
|
24d2f11659 | ||
|
|
dc9575e52d | ||
|
|
a10ff13c74 | ||
|
|
f8d5fb8ac1 | ||
|
|
95edd987f1 |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,24 @@
|
|||||||
|
# [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)
|
# [2.173.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.172.0...v2.173.0-dev.1) (2023-05-02)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -10,9 +10,10 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
| `always-autorepeat` | Always repeats the playing video again. | 18.16.37 |
|
| `always-autorepeat` | Always repeats the playing video again. | 18.16.37 |
|
||||||
| `client-spoof` | Spoofs a patched client to allow playback. | all |
|
| `client-spoof` | Spoofs a patched client to allow playback. | 18.16.37 |
|
||||||
| `comments` | Hides components related to comments. | 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 |
|
| `copy-video-url` | Adds buttons in player to copy video links. | 18.16.37 |
|
||||||
|
| `create-button` | Hide the create button in the navigation bar or switch it with notifications. | 18.16.37 |
|
||||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
||||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 18.16.37 |
|
| `custom-video-buffer` | Lets you change the buffers of videos. | 18.16.37 |
|
||||||
| `custom-video-speed` | Adds more video speed options. | 18.16.37 |
|
| `custom-video-speed` | Adds more video speed options. | 18.16.37 |
|
||||||
@@ -31,7 +32,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-breaking-news-shelf` | Hides the breaking news shelf on the homepage tab. | 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-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-cast-button` | Hides the cast button in the video player. | all |
|
||||||
| `hide-create-button` | Hides the create button in the navigation bar. | 18.16.37 |
|
|
||||||
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.16.37 |
|
| `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-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-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.16.37 |
|
||||||
@@ -57,7 +57,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 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 |
|
| `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 |
|
| `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 |
|
||||||
| `spoof-signature-verification` | Spoofs a patched client to prevent playback issues. | 18.16.37 |
|
|
||||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 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 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.16.37 |
|
||||||
| `theme` | Applies a custom theme. | all |
|
| `theme` | Applies a custom theme. | all |
|
||||||
@@ -160,15 +159,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
||||||
</details>
|
</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)
|
### [📦 `at.gv.bmf.bmf2go`](https://play.google.com/store/apps/details?id=at.gv.bmf.bmf2go)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -211,6 +201,14 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-ads` | Removes ads from Inshorts. | all |
|
| `hide-ads` | Removes ads from Inshorts. | all |
|
||||||
</details>
|
</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)
|
### [📦 `com.facebook.orca`](https://play.google.com/store/apps/details?id=com.facebook.orca)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.173.0-dev.1
|
version = 2.173.0-dev.4
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -4,10 +4,21 @@ import app.revanced.patcher.annotation.Compatibility
|
|||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[
|
[Package(
|
||||||
Package("com.google.android.youtube"),
|
"com.google.android.youtube", arrayOf(
|
||||||
Package("com.vanced.android.youtube")
|
"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)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class ClientSpoofCompatibility
|
internal annotation class ClientSpoofCompatibility
|
||||||
|
|||||||
@@ -10,15 +10,18 @@ import app.revanced.patcher.extensions.instruction
|
|||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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.annotations.Patch
|
||||||
import app.revanced.patches.shared.misc.fix.spoof.annotations.ClientSpoofCompatibility
|
import app.revanced.patches.shared.misc.fix.spoof.annotations.ClientSpoofCompatibility
|
||||||
import app.revanced.patches.shared.misc.fix.spoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
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
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("client-spoof")
|
@Name("client-spoof")
|
||||||
@Description("Spoofs a patched client to allow playback.")
|
@Description("Spoofs a patched client to allow playback.")
|
||||||
@ClientSpoofCompatibility
|
@ClientSpoofCompatibility
|
||||||
|
@DependsOn([SpoofSignatureVerificationPatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ClientSpoofPatch : BytecodePatch(
|
class ClientSpoofPatch : BytecodePatch(
|
||||||
listOf(UserAgentHeaderBuilderFingerprint)
|
listOf(UserAgentHeaderBuilderFingerprint)
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.buttons.pivotbar.create.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,
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -5,6 +5,8 @@ import app.revanced.patcher.annotation.Description
|
|||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
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.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@@ -14,6 +16,8 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
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.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.layout.buttons.pivotbar.create.fingerprints.ANDROID_AUTOMOTIVE_STRING
|
||||||
|
import app.revanced.patches.youtube.layout.buttons.pivotbar.create.fingerprints.AddCreateButtonViewFingerprint
|
||||||
import app.revanced.patches.youtube.layout.buttons.pivotbar.create.fingerprints.PivotBarCreateButtonViewFingerprint
|
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.annotations.PivotBarCompatibility
|
||||||
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.InitializeButtonsFingerprint
|
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.InitializeButtonsFingerprint
|
||||||
@@ -23,16 +27,17 @@ import app.revanced.patches.youtube.layout.buttons.pivotbar.utils.InjectionUtils
|
|||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
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.bytecode.patch.SettingsPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class, ResolvePivotBarFingerprintsPatch::class])
|
@DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class, ResolvePivotBarFingerprintsPatch::class])
|
||||||
@Name("hide-create-button")
|
@Name("create-button")
|
||||||
@Description("Hides the create button in the navigation bar.")
|
@Description("Hide the create button in the navigation bar or switch it with notifications.")
|
||||||
@PivotBarCompatibility
|
@PivotBarCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CreateButtonRemoverPatch : BytecodePatch() {
|
class CreateButtonPatch : BytecodePatch(listOf(AddCreateButtonViewFingerprint)) {
|
||||||
private companion object {
|
private companion object {
|
||||||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/HideCreateButtonPatch;"
|
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/CreateButtonPatch;"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
@@ -43,9 +48,43 @@ class CreateButtonRemoverPatch : BytecodePatch() {
|
|||||||
true,
|
true,
|
||||||
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
|
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
|
||||||
StringResource("revanced_hide_create_button_summary_off", "Create button is shown")
|
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"
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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
|
* Resolve fingerprints
|
||||||
*/
|
*/
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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")
|
||||||
|
)
|
||||||
@@ -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;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.*
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
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.youtube.layout.theme.annotations.ThemeCompatibility
|
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
|
||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
@DependsOn([LithoThemePatch::class])
|
class ThemeResourcePatch : ResourcePatch {
|
||||||
@Name("theme")
|
|
||||||
@Description("Applies a custom theme.")
|
|
||||||
@ThemeCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class ThemePatch : ResourcePatch {
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
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 darkThemeBackgroundColor = darkThemeBackgroundColor!!
|
||||||
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
|
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
|
||||||
val darkThemeSeekbarColor = darkThemeSeekbarColor!!
|
|
||||||
|
|
||||||
|
// Edit theme colors via resources.
|
||||||
context.xmlEditor["res/values/colors.xml"].use { editor ->
|
context.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
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
|
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
|
||||||
|
|
||||||
node.textContent = when (node.getAttribute("name")) {
|
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
|
-> lightThemeBackgroundColor
|
||||||
|
|
||||||
"inline_time_bar_colorized_bar_played_color_dark" -> darkThemeSeekbarColor
|
|
||||||
else -> continue
|
else -> continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copies the resource file to change the splash screen color
|
// Copy the resource file to change the splash screen color.
|
||||||
context.copyResources(
|
context.copyResources(
|
||||||
"theme", ResourceUtils.ResourceGroup("values-night-v31", "styles.xml")
|
"theme", ResourceUtils.ResourceGroup("values-night-v31", "styles.xml")
|
||||||
)
|
)
|
||||||
@@ -51,6 +68,8 @@ class ThemePatch : ResourcePatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object : OptionsContainer() {
|
companion object : OptionsContainer() {
|
||||||
|
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
|
||||||
|
|
||||||
var darkThemeBackgroundColor: String? by option(
|
var darkThemeBackgroundColor: String? by option(
|
||||||
PatchOption.StringOption(
|
PatchOption.StringOption(
|
||||||
key = "darkThemeBackgroundColor",
|
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.",
|
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.",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.fix.playback.annotation
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.youtube", arrayOf(
|
|
||||||
"17.49.37",
|
|
||||||
"18.03.36",
|
|
||||||
"18.03.42",
|
|
||||||
"18.04.35",
|
|
||||||
"18.04.41",
|
|
||||||
"18.05.32",
|
|
||||||
"18.05.35",
|
|
||||||
"18.05.40",
|
|
||||||
"18.08.37",
|
|
||||||
"18.15.40",
|
|
||||||
"18.16.37"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
internal annotation class ProtobufSpoofCompatibility
|
|
||||||
@@ -12,12 +12,9 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
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.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.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
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.OpenCronetDataSourceFingerprint
|
||||||
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
|
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
|
||||||
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SubtitleWindowSettingsConstructorFingerprint
|
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 app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("spoof-signature-verification")
|
@Name("spoof-signature-verification")
|
||||||
@Description("Spoofs a patched client to prevent playback issues.")
|
@Description("Spoofs a patched client to prevent playback issues.")
|
||||||
@ProtobufSpoofCompatibility
|
|
||||||
@DependsOn([
|
@DependsOn([
|
||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
PlayerTypeHookPatch::class,
|
PlayerTypeHookPatch::class,
|
||||||
ClientSpoofPatch::class,
|
|
||||||
VideoIdPatch::class
|
VideoIdPatch::class
|
||||||
])
|
])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
|
|||||||
Reference in New Issue
Block a user