mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-27 12:41:03 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f11f269c2f | ||
|
|
b0cd520b1a | ||
|
|
5c0fd8a6da | ||
|
|
e34d67f01e | ||
|
|
72703d6a56 | ||
|
|
b8c473796a | ||
|
|
25e86c5545 | ||
|
|
f1bf2c589b | ||
|
|
8b54559953 | ||
|
|
3761dbd7b2 | ||
|
|
8cf0343f29 | ||
|
|
f3753a22da | ||
|
|
c90312a925 |
42
CHANGELOG.md
42
CHANGELOG.md
@@ -1,3 +1,45 @@
|
|||||||
|
# [2.90.0](https://github.com/revanced/revanced-patches/compare/v2.89.0...v2.90.0) (2022-10-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `comment` patch ([#858](https://github.com/revanced/revanced-patches/issues/858)) ([472fb4f](https://github.com/revanced/revanced-patches/commit/472fb4f3747c835be2c5069a0f65017ab42f8d7e))
|
||||||
|
|
||||||
|
# [2.89.0](https://github.com/revanced/revanced-patches/compare/v2.88.0...v2.89.0) (2022-10-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `hide-album-cards` patch ([#857](https://github.com/revanced/revanced-patches/issues/857)) ([bce9d0c](https://github.com/revanced/revanced-patches/commit/bce9d0c9405d7afd5c51c2a9c2c247f3ff7581f5))
|
||||||
|
|
||||||
|
# [2.88.0](https://github.com/revanced/revanced-patches/compare/v2.87.0...v2.88.0) (2022-10-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `hide-artist-card` patch ([#859](https://github.com/revanced/revanced-patches/issues/859)) ([1f76246](https://github.com/revanced/revanced-patches/commit/1f7624680b86e3a7afd45521bfef86f88f52c976))
|
||||||
|
|
||||||
|
# [2.87.0](https://github.com/revanced/revanced-patches/compare/v2.86.0...v2.87.0) (2022-10-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **metanav/fix-scaling:** use semantic versioning in package versions ([a9445a8](https://github.com/revanced/revanced-patches/commit/a9445a823e3a4885764cea9d08b51a1584d3238f))
|
||||||
|
* **youtube/theme:** theme litho ui components & use correct theme for settings ([#791](https://github.com/revanced/revanced-patches/issues/791)) ([91c03c5](https://github.com/revanced/revanced-patches/commit/91c03c5624ca28ac13ee761261dea423f0ac42d7))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `fix-metanav-scaling` patch ([#831](https://github.com/revanced/revanced-patches/issues/831)) ([4808e09](https://github.com/revanced/revanced-patches/commit/4808e099856e50a6f7e66834a92e2210cc84c8bc))
|
||||||
|
* `hide-crowdfunding-box` patch ([#856](https://github.com/revanced/revanced-patches/issues/856)) ([3704ce2](https://github.com/revanced/revanced-patches/commit/3704ce22dbbff02b2e2d6dbdf9a74254a2511d3c))
|
||||||
|
|
||||||
|
# [2.86.0](https://github.com/revanced/revanced-patches/compare/v2.85.2...v2.86.0) (2022-10-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube/theme:** extend theming to splash screen ([#769](https://github.com/revanced/revanced-patches/issues/769)) ([f7bb937](https://github.com/revanced/revanced-patches/commit/f7bb937ef2374d1042ea3772f03627d7f0111b78))
|
||||||
|
|
||||||
## [2.85.2](https://github.com/revanced/revanced-patches/compare/v2.85.1...v2.85.2) (2022-10-22)
|
## [2.85.2](https://github.com/revanced/revanced-patches/compare/v2.85.1...v2.85.2) (2022-10-22)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -4,6 +4,14 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||||
|
|
||||||
|
### 📦 `com.metanav`
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `fix-scaling` | Scales the content properly. | 0.1.0 |
|
||||||
|
</details>
|
||||||
|
|
||||||
### 📦 `com.ss.android.ugc.trill`
|
### 📦 `com.ss.android.ugc.trill`
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -65,6 +73,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 17.36.37 |
|
||||||
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.36.37 |
|
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.36.37 |
|
||||||
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 17.36.37 |
|
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 17.36.37 |
|
||||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
||||||
@@ -75,10 +84,13 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-cast-button` | Hides the cast button in the video player. | all |
|
| `hide-cast-button` | Hides the cast button in the video player. | all |
|
||||||
| `sponsorblock` | Integrate SponsorBlock. | 17.36.37 |
|
| `sponsorblock` | Integrate SponsorBlock. | 17.36.37 |
|
||||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
||||||
|
| `hide-album-cards` | Hides the album cards below the artist description. | 17.36.37 |
|
||||||
| `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 17.36.37 |
|
| `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 17.36.37 |
|
||||||
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 17.36.37 |
|
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 17.36.37 |
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
||||||
|
| `hide-artist-card` | Hides the artist card below the searchbar. | 17.36.37 |
|
||||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.36.37 |
|
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.36.37 |
|
||||||
|
| `comments` | Hides comments components below the video player. | 17.36.37 |
|
||||||
| `theme` | Applies a custom theme. | all |
|
| `theme` | Applies a custom theme. | all |
|
||||||
| `hide-email-address` | Hides the email address in the account switcher. | 17.36.37 |
|
| `hide-email-address` | Hides the email address in the account switcher. | 17.36.37 |
|
||||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.36.37 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.36.37 |
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.85.2
|
version = 2.90.0
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.metanav.scaling.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.metanav", arrayOf("0.1.0"))])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class FixScalingCompatibility
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patches.metanav.scaling.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.metanav.scaling.annotations.FixScalingCompatibility
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("fix-scaling")
|
||||||
|
@Description("Scales the content properly.")
|
||||||
|
@FixScalingCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class FixScalingPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
context.xmlEditor["assets/startScreenCanvas.html"].use { editor ->
|
||||||
|
val svgNode = editor
|
||||||
|
.file
|
||||||
|
.getElementsByTagName("svg")
|
||||||
|
.item(0) as Element
|
||||||
|
|
||||||
|
svgNode.setAttribute("height", "750")
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -105,13 +105,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
StringResource("revanced_adremover_compact_banner_enabled_summary_on", "Compact banners are hidden"),
|
StringResource("revanced_adremover_compact_banner_enabled_summary_on", "Compact banners are hidden"),
|
||||||
StringResource("revanced_adremover_compact_banner_enabled_summary_off", "Compact banners are shown")
|
StringResource("revanced_adremover_compact_banner_enabled_summary_off", "Compact banners are shown")
|
||||||
),
|
),
|
||||||
SwitchPreference(
|
|
||||||
"revanced_adremover_comments_removal",
|
|
||||||
StringResource("revanced_adremover_comments_enabled_title", "Remove comments section"),
|
|
||||||
false,
|
|
||||||
StringResource("revanced_adremover_comments_enabled_summary_on", "Comment section is hidden"),
|
|
||||||
StringResource("revanced_adremover_comments_enabled_summary_off", "Comment section is shown")
|
|
||||||
),
|
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_adremover_movie",
|
"revanced_adremover_movie",
|
||||||
StringResource("revanced_adremover_movie_enabled_title", "Remove movies section"),
|
StringResource("revanced_adremover_movie_enabled_title", "Remove movies section"),
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.comments.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class CommentsCompatibility
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.comments.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
|
||||||
|
import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([ResourceMappingResourcePatch::class, GeneralBytecodeAdsPatch::class])
|
||||||
|
@Name("comments")
|
||||||
|
@Description("Hides comments components below the video player.")
|
||||||
|
@CommentsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class CommentsPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
PreferenceScreen(
|
||||||
|
"revanced_comments",
|
||||||
|
StringResource("revanced_comments_title", "Comments"),
|
||||||
|
listOf(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_comments_section",
|
||||||
|
StringResource("revanced_hide_comments_section_title", "Remove comments section"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_comments_section_summary_on", "Comment section is hidden"),
|
||||||
|
StringResource("revanced_hide_comments_section_summary_off", "Comment section is shown")
|
||||||
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_preview_comment",
|
||||||
|
StringResource("revanced_hide_preview_comment_title", "Hide preview comment"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_preview_comment_on", "Preview comment is hidden"),
|
||||||
|
StringResource("revanced_hide_preview_comment_off", "Preview comment is shown")
|
||||||
|
),
|
||||||
|
),
|
||||||
|
StringResource("revanced_comments_summary", "Manage the visibility of comments section components")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hidealbumcards.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class AlbumCardsCompatibility
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hidealbumcards.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("album-cards-view-fingerprint")
|
||||||
|
@AlbumCardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object AlbumCardsFingerprint : MethodFingerprint(
|
||||||
|
"V",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
listOf("L", "L", "L", "L", "L", "L", "[B"),
|
||||||
|
listOf(
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hidealbumcards.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hidealbumcards.fingerprints.AlbumCardsFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||||
|
@Name("hide-album-cards")
|
||||||
|
@Description("Hides the album cards below the artist description.")
|
||||||
|
@AlbumCardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class AlbumCardsPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
AlbumCardsFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_album_cards",
|
||||||
|
StringResource("revanced_hide_album_cards_title", "Hide the album cards"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_album_cards_summary_on", "Album cards is hidden"),
|
||||||
|
StringResource("revanced_hide_album_cards_summary_off", "Album cards is visible")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val albumCardsResult = AlbumCardsFingerprint.result!!
|
||||||
|
val albumCardsMethod = albumCardsResult.mutableMethod
|
||||||
|
|
||||||
|
val checkCastIndex = albumCardsResult.scanResult.patternScanResult!!.endIndex
|
||||||
|
val patchIndex = checkCastIndex + 1
|
||||||
|
|
||||||
|
albumCardsMethod.addInstruction(
|
||||||
|
patchIndex, """
|
||||||
|
invoke-static {v${(albumCardsMethod.instruction(checkCastIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideAlbumCardsPatch;->hideAlbumCards(Landroid/view/View;)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.buttons.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class HideArtistCardCompatibility
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideartistcard.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
|
||||||
|
import app.revanced.patches.youtube.layout.buttons.annotations.HideArtistCardCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([ResourceMappingResourcePatch::class, GeneralBytecodeAdsPatch::class])
|
||||||
|
@Name("hide-artist-card")
|
||||||
|
@Description("Hides the artist card below the searchbar.")
|
||||||
|
@HideArtistCardCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideArtistCardPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_artist_card",
|
||||||
|
StringResource("revanced_hide_hide_artist_card_title", "Hide artist card"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_hide_artist_card_on", "Artist card is hidden"),
|
||||||
|
StringResource("revanced_hide_hide_artist_card_off", "Artist card is shown")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class CrowdfundingBoxCompatibility
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("crowdfunding-box-view-fingerprint")
|
||||||
|
@FuzzyPatternScanMethod(3)
|
||||||
|
@CrowdfundingBoxCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object CrowdfundingBoxFingerprint : MethodFingerprint(
|
||||||
|
"V",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
listOf("L", "L", "L", "L", "L", "L", "L", "[B", "[B"),
|
||||||
|
listOf(
|
||||||
|
Opcode.MOVE_OBJECT,
|
||||||
|
Opcode.MOVE_OBJECT_FROM16,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.MOVE_OBJECT_FROM16,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.MOVE_OBJECT_FROM16,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hidecrowdfundingbox.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hidecrowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||||
|
@Name("hide-crowdfunding-box")
|
||||||
|
@Description("Hides the crowdfunding box between the player and video description.")
|
||||||
|
@CrowdfundingBoxCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class CrowdfundingBoxPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
CrowdfundingBoxFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_crowdfunding_box",
|
||||||
|
StringResource("revanced_hide_crowdfunding_box_title", "Hide the crowdfunding box"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_crowdfunding_box_summary_on", "Crowdfunding box is hidden"),
|
||||||
|
StringResource("revanced_hide_crowdfunding_box_summary_off", "Crowdfunding box is visible")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val crowdfundingBoxResult = CrowdfundingBoxFingerprint.result!!
|
||||||
|
val crowdfundingBoxMethod = crowdfundingBoxResult.mutableMethod
|
||||||
|
|
||||||
|
val moveResultObjectIndex = crowdfundingBoxResult.scanResult.patternScanResult!!.endIndex
|
||||||
|
val patchIndex = moveResultObjectIndex + 1
|
||||||
|
|
||||||
|
crowdfundingBoxMethod.addInstruction(
|
||||||
|
patchIndex, """
|
||||||
|
invoke-static {v${(crowdfundingBoxMethod.instruction(moveResultObjectIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,10 +8,10 @@ import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
|||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("comment-actionbar-fingerprint")
|
@Name("litho-ui-fingerprint")
|
||||||
@ThemeCompatibility
|
@ThemeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object CommentsFilterBarFingerprint : MethodFingerprint(
|
object LithoThemeFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L"), listOf(
|
"V", AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L"), listOf(
|
||||||
Opcode.APUT,
|
Opcode.APUT,
|
||||||
Opcode.NEW_INSTANCE,
|
Opcode.NEW_INSTANCE,
|
||||||
@@ -11,36 +11,27 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.theme.fingerprints.CommentsFilterBarFingerprint
|
import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint
|
||||||
|
|
||||||
@Name("comment-filter-bar-theme")
|
@Name("litho-components-theme")
|
||||||
@Description("Applies custom theming to comments filter action bar.")
|
@Description("Applies a custom theme to litho components.")
|
||||||
@ThemeCompatibility
|
@ThemeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CommentsFilterBarPatch : BytecodePatch(
|
class LithoThemePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
CommentsFilterBarFingerprint
|
LithoThemeFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = CommentsFilterBarFingerprint.result!!
|
val result = LithoThemeFingerprint.result!!
|
||||||
val method = result.mutableMethod
|
val method = result.mutableMethod
|
||||||
val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
|
||||||
method.addInstructions(
|
method.addInstructions(
|
||||||
patchIndex, """
|
patchIndex, """
|
||||||
invoke-static {}, Lapp/revanced/integrations/utils/ThemeHelper;->isDarkTheme()Z
|
invoke-static {p1}, Lapp/revanced/integrations/patches/LithoThemePatch;->applyLithoTheme(I)I
|
||||||
move-result v2
|
move-result p1
|
||||||
if-nez v2, :comments_filter_white
|
"""
|
||||||
const v1, -0x1
|
|
||||||
if-ne v1, p1, :comments_filter_white
|
|
||||||
const/4 p1, 0x0
|
|
||||||
:comments_filter_white
|
|
||||||
if-eqz v2, :comments_filter_dark
|
|
||||||
const v1, -0xdededf
|
|
||||||
if-ne v1, p1, :comments_filter_dark
|
|
||||||
const/4 p1, 0x0
|
|
||||||
""", listOf(ExternalLabel("comments_filter_dark", method.instruction(patchIndex)))
|
|
||||||
)
|
)
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,12 @@ 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.youtube.layout.theme.annotations.ThemeCompatibility
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import app.revanced.util.resources.ResourceUtils
|
||||||
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([CommentsFilterBarPatch::class, FixLocaleConfigErrorPatch::class])
|
@DependsOn([LithoThemePatch::class, FixLocaleConfigErrorPatch::class])
|
||||||
@Name("theme")
|
@Name("theme")
|
||||||
@Description("Applies a custom theme.")
|
@Description("Applies a custom theme.")
|
||||||
@ThemeCompatibility
|
@ThemeCompatibility
|
||||||
@@ -31,16 +33,22 @@ class ThemePatch : ResourcePatch {
|
|||||||
node.textContent = when (node.getAttribute("name")) {
|
node.textContent = when (node.getAttribute("name")) {
|
||||||
"yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4",
|
"yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4",
|
||||||
"yt_status_bar_background_dark", "material_grey_100", "material_grey_50", "material_grey_600",
|
"yt_status_bar_background_dark", "material_grey_100", "material_grey_50", "material_grey_600",
|
||||||
"material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000" -> darkThemeBackgroundColor
|
"material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000",
|
||||||
|
"sud_glif_v3_dialog_background_color_dark" -> darkThemeBackgroundColor
|
||||||
|
|
||||||
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3",
|
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3",
|
||||||
"yt_white4" -> lightThemeBackgroundColor
|
"yt_white4", "sud_glif_v3_dialog_background_color_light" -> lightThemeBackgroundColor
|
||||||
|
|
||||||
else -> continue
|
else -> continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copies the resource file to change the splash screen color
|
||||||
|
context.copyResources("theme",
|
||||||
|
ResourceUtils.ResourceGroup("values-night-v31", "styles.xml")
|
||||||
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
|
||||||
|
|
||||||
// TODO: This is more of a class fingerprint than a method fingerprint.
|
|
||||||
// Convert to a class fingerprint whenever possible.
|
|
||||||
@Name("revanced-settings-activity-fingerprint")
|
|
||||||
@SettingsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
object ReVancedSettingsActivityFingerprint : MethodFingerprint(
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("ReVancedSettingActivity;") && methodDef.name == "initializeSettings"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("theme-setter-app-fingerprint")
|
||||||
|
@SettingsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ThemeSetterAppFingerprint : MethodFingerprint(
|
||||||
|
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L"), listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IF_NE,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.GOTO,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.RETURN_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IF_NE,
|
||||||
|
Opcode.CONST,
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -5,18 +5,19 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
@Name("theme-setter-fingerprint")
|
@Name("theme-setter-system-fingerprint")
|
||||||
@SettingsCompatibility
|
@SettingsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object ThemeSetterFingerprint : MethodFingerprint(
|
object ThemeSetterSystemFingerprint : MethodFingerprint(
|
||||||
"L",
|
"L",
|
||||||
opcodes = listOf(Opcode.RETURN_OBJECT),
|
opcodes = listOf(Opcode.RETURN_OBJECT),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.implementation?.instructions?.any {
|
methodDef.implementation?.instructions?.any {
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal && (it as WideLiteralInstruction).wideLiteral == SettingsPatch.appearanceStringId
|
it.opcode.ordinal == Opcode.CONST.ordinal && (it as WideLiteralInstruction).wideLiteral == SettingsResourcePatch.appearanceStringId
|
||||||
} == true
|
} == true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -11,15 +11,12 @@ 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.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.toInstruction
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint
|
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ReVancedSettingsActivityFingerprint
|
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterAppFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterFingerprint
|
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference
|
import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.ArrayResource
|
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
@@ -39,64 +36,92 @@ import java.io.Closeable
|
|||||||
@SettingsCompatibility
|
@SettingsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SettingsPatch : BytecodePatch(
|
class SettingsPatch : BytecodePatch(
|
||||||
listOf(LicenseActivityFingerprint, ReVancedSettingsActivityFingerprint, ThemeSetterFingerprint)
|
listOf(LicenseActivityFingerprint, ThemeSetterSystemFingerprint, ThemeSetterAppFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val licenseActivityResult = LicenseActivityFingerprint.result!!
|
fun buildInvokeInstructionsString(
|
||||||
val settingsResult = ReVancedSettingsActivityFingerprint.result!!
|
registers: String = "v0",
|
||||||
val themeSetterResult = ThemeSetterFingerprint.result!!
|
classDescriptor: String = THEME_HELPER_DESCRIPTOR,
|
||||||
|
methodName: String = SET_THEME_METHOD_NAME,
|
||||||
|
parameters: String = "Ljava/lang/Object;"
|
||||||
|
) = "invoke-static {$registers}, $classDescriptor->$methodName($parameters)V"
|
||||||
|
|
||||||
val licenseActivityClass = licenseActivityResult.mutableClass
|
// apply the current theme of the settings page
|
||||||
val settingsClass = settingsResult.mutableClass
|
with(ThemeSetterSystemFingerprint.result!!) {
|
||||||
|
with(mutableMethod) {
|
||||||
|
val call = buildInvokeInstructionsString()
|
||||||
|
|
||||||
val onCreate = licenseActivityResult.mutableMethod
|
addInstruction(
|
||||||
val setThemeMethodName = "setTheme"
|
scanResult.patternScanResult!!.startIndex,
|
||||||
val initializeSettings = settingsResult.mutableMethod
|
call
|
||||||
|
)
|
||||||
|
|
||||||
val setThemeInstruction =
|
addInstruction(
|
||||||
"invoke-static {v0}, Lapp/revanced/integrations/utils/ThemeHelper;->setTheme(Ljava/lang/Object;)V".toInstruction(
|
mutableMethod.implementation!!.instructions.size - 1,
|
||||||
themeSetterResult.mutableMethod
|
call
|
||||||
)
|
)
|
||||||
|
}
|
||||||
// add instructions to set the theme of the settings activity
|
|
||||||
themeSetterResult.mutableMethod.implementation!!.let {
|
|
||||||
it.addInstruction(
|
|
||||||
themeSetterResult.scanResult.patternScanResult!!.startIndex,
|
|
||||||
setThemeInstruction
|
|
||||||
)
|
|
||||||
|
|
||||||
it.addInstruction(
|
|
||||||
it.instructions.size - 1, // add before return
|
|
||||||
setThemeInstruction
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the setTheme call to the onCreate method to not affect the offsets
|
// set the theme based on the preference of the app
|
||||||
onCreate.addInstructions(
|
with(ThemeSetterAppFingerprint.result!!) {
|
||||||
1,
|
with(mutableMethod) {
|
||||||
"""
|
fun buildInstructionsString(theme: Int) = """
|
||||||
invoke-static { p0 }, ${settingsClass.type}->${initializeSettings.name}(${licenseActivityClass.type})V
|
const/4 v0, 0x$theme
|
||||||
return-void
|
${buildInvokeInstructionsString(parameters = "I")}
|
||||||
"""
|
"""
|
||||||
)
|
|
||||||
|
|
||||||
// add the initializeSettings call to the onCreate method
|
addInstructions(
|
||||||
onCreate.addInstruction(
|
scanResult.patternScanResult!!.endIndex + 1,
|
||||||
0,
|
buildInstructionsString(1)
|
||||||
"invoke-static { p0 }, ${settingsClass.type}->$setThemeMethodName(${licenseActivityClass.type})V"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
// get rid of, now, useless overridden methods
|
addInstructions(
|
||||||
licenseActivityResult.mutableClass.methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) }
|
mutableMethod.implementation!!.instructions.size - 2,
|
||||||
|
buildInstructionsString(0)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the theme based on the preference of the device
|
||||||
|
with(LicenseActivityFingerprint.result!!) licenseActivity@{
|
||||||
|
with(mutableMethod) {
|
||||||
|
fun buildSettingsActivityInvokeString(
|
||||||
|
registers: String = "p0",
|
||||||
|
classDescriptor: String = SETTINGS_ACTIVITY_DESCRIPTOR,
|
||||||
|
methodName: String = "initializeSettings",
|
||||||
|
parameters: String = this@licenseActivity.mutableClass.type
|
||||||
|
) = buildInvokeInstructionsString(registers, classDescriptor, methodName, parameters)
|
||||||
|
|
||||||
|
// initialize the settings
|
||||||
|
addInstructions(
|
||||||
|
1,
|
||||||
|
"""
|
||||||
|
${buildSettingsActivityInvokeString()}
|
||||||
|
return-void
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
// set the current theme
|
||||||
|
addInstruction(0, buildSettingsActivityInvokeString(methodName = "setTheme"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove method overrides
|
||||||
|
with(mutableClass) {
|
||||||
|
methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal companion object {
|
internal companion object {
|
||||||
// TODO: hide this somehow
|
private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations"
|
||||||
var appearanceStringId: Long = ResourceMappingResourcePatch.resourceMappings.find {
|
|
||||||
it.type == "string" && it.name == "app_theme_appearance_dark"
|
private const val SETTINGS_ACTIVITY_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settingsmenu/ReVancedSettingActivity;"
|
||||||
}!!.id
|
|
||||||
|
private const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/utils/ThemeHelper;"
|
||||||
|
private const val SET_THEME_METHOD_NAME = "setTheme"
|
||||||
|
|
||||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||||
SettingsResourcePatch.addString(identifier, value, formatted)
|
SettingsResourcePatch.addString(identifier, value, formatted)
|
||||||
@@ -107,9 +132,6 @@ class SettingsPatch : BytecodePatch(
|
|||||||
fun addPreference(preference: Preference) =
|
fun addPreference(preference: Preference) =
|
||||||
SettingsResourcePatch.addPreference(preference)
|
SettingsResourcePatch.addPreference(preference)
|
||||||
|
|
||||||
fun addArray(arrayResource: ArrayResource) =
|
|
||||||
SettingsResourcePatch.addArray(arrayResource)
|
|
||||||
|
|
||||||
fun renameIntentsTargetPackage(newPackage: String) {
|
fun renameIntentsTargetPackage(newPackage: String) {
|
||||||
SettingsResourcePatch.overrideIntentsTargetPackage = newPackage
|
SettingsResourcePatch.overrideIntentsTargetPackage = newPackage
|
||||||
}
|
}
|
||||||
@@ -152,4 +174,4 @@ class SettingsPatch : BytecodePatch(
|
|||||||
|
|
||||||
override fun close() = PreferenceScreen.values().forEach(PreferenceScreen::close)
|
override fun close() = PreferenceScreen.values().forEach(PreferenceScreen::close)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,14 @@ import org.w3c.dom.Node
|
|||||||
@DependsOn([FixLocaleConfigErrorPatch::class, ResourceMappingResourcePatch::class])
|
@DependsOn([FixLocaleConfigErrorPatch::class, ResourceMappingResourcePatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SettingsResourcePatch : ResourcePatch {
|
class SettingsResourcePatch : ResourcePatch {
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
/*
|
||||||
|
* used by a fingerprint of SettingsPatch
|
||||||
|
*/
|
||||||
|
appearanceStringId = ResourceMappingResourcePatch.resourceMappings.find {
|
||||||
|
it.type == "string" && it.name == "app_theme_appearance_dark"
|
||||||
|
}!!.id
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create missing directory for the resources
|
* create missing directory for the resources
|
||||||
*/
|
*/
|
||||||
@@ -84,6 +90,12 @@ class SettingsResourcePatch : ResourcePatch {
|
|||||||
|
|
||||||
|
|
||||||
internal companion object {
|
internal companion object {
|
||||||
|
// Used by a fingerprint of SettingsPatch
|
||||||
|
// this field is located in the SettingsResourcePatch
|
||||||
|
// because if it were to be defined in the SettingsPatch companion object,
|
||||||
|
// the companion object could be initialized before ResourceMappingResourcePatch has executed.
|
||||||
|
internal var appearanceStringId: Long = -1
|
||||||
|
|
||||||
// if this is not null, all intents will be renamed to this
|
// if this is not null, all intents will be renamed to this
|
||||||
var overrideIntentsTargetPackage: String? = null
|
var overrideIntentsTargetPackage: String? = null
|
||||||
|
|
||||||
|
|||||||
8
src/main/resources/theme/values-night-v31/styles.xml
Normal file
8
src/main/resources/theme/values-night-v31/styles.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="Base.Theme.YouTube.Launcher" parent="@style/Theme.AppCompat.NoActionBar">
|
||||||
|
<item name="android:windowSplashScreenBackground">@android:color/black</item>
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/avd_anim</item>
|
||||||
|
<item name="android:windowSplashScreenAnimationDuration">1000</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
Reference in New Issue
Block a user