mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-28 13:11:03 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8541ee0066 | ||
|
|
f7e0b46bc7 | ||
|
|
59af825d0a | ||
|
|
04ffffbdf2 | ||
|
|
ecc131fa4f | ||
|
|
a4f1d3558e | ||
|
|
4cbd58721d | ||
|
|
7cfe43e666 | ||
|
|
c93d7bc212 | ||
|
|
c28fd5cf20 | ||
|
|
069f754d51 | ||
|
|
cba04cf5a6 | ||
|
|
5e358c7319 | ||
|
|
ce69471684 | ||
|
|
a0981dda9d | ||
|
|
6073181ee1 | ||
|
|
522587321c | ||
|
|
b16748794e | ||
|
|
01e9a396d6 | ||
|
|
86fcd4d475 | ||
|
|
8bbc744114 | ||
|
|
d7a4ad76ea | ||
|
|
7e6ee73908 | ||
|
|
87954a1aaf | ||
|
|
e5a2ed0f70 | ||
|
|
2295aaebf4 | ||
|
|
a72bf150c2 | ||
|
|
0290cd3d36 | ||
|
|
e8d61e0c0e | ||
|
|
19769d80eb | ||
|
|
12c16d4644 | ||
|
|
75f4653c16 |
1
.idea/.gitignore
generated
vendored
1
.idea/.gitignore
generated
vendored
@@ -6,3 +6,4 @@
|
|||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
# Editor-based HTTP Client requests
|
# Editor-based HTTP Client requests
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
|
/kotlinc.xml
|
||||||
|
|||||||
52
CHANGELOG.md
52
CHANGELOG.md
@@ -1,3 +1,55 @@
|
|||||||
|
## [2.52.2](https://github.com/revanced/revanced-patches/compare/v2.52.1...v2.52.2) (2022-09-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* design language for download icon ([#464](https://github.com/revanced/revanced-patches/issues/464)) ([c24dc17](https://github.com/revanced/revanced-patches/commit/c24dc175f705fd5364b8bcf01f27f3ac8ecc0e64))
|
||||||
|
|
||||||
|
## [2.52.1](https://github.com/revanced/revanced-patches/compare/v2.52.0...v2.52.1) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* multiple compatible pkgs on readme ([3f82a13](https://github.com/revanced/revanced-patches/commit/3f82a1349fb11b1152ac10d76deb930f7325b7c9))
|
||||||
|
|
||||||
|
# [2.52.0](https://github.com/revanced/revanced-patches/compare/v2.51.3...v2.52.0) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add deprecated & options to patches.json ([759315b](https://github.com/revanced/revanced-patches/commit/759315be1b23a6b3655fc87b56a8974ebac648cc))
|
||||||
|
|
||||||
|
## [2.51.3](https://github.com/revanced/revanced-patches/compare/v2.51.2...v2.51.3) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* cleanup & trigger release for ThemePatch ([8d25b21](https://github.com/revanced/revanced-patches/commit/8d25b214e297797092432b5fe1a4ede1f42115c8)), closes [#447](https://github.com/revanced/revanced-patches/issues/447) [revanced/revanced-patcher#99](https://github.com/revanced/revanced-patcher/issues/99)
|
||||||
|
|
||||||
|
## [2.51.2](https://github.com/revanced/revanced-patches/compare/v2.51.1...v2.51.2) (2022-09-08)
|
||||||
|
|
||||||
|
## [2.51.1](https://github.com/revanced/revanced-patches/compare/v2.51.0...v2.51.1) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* wrap theme option ([150c173](https://github.com/revanced/revanced-patches/commit/150c173adce31d9984d6feca694b472649233056))
|
||||||
|
|
||||||
|
# [2.51.0](https://github.com/revanced/revanced-patches/compare/v2.50.8...v2.51.0) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Theme Patch ([#440](https://github.com/revanced/revanced-patches/issues/440)) ([f3b92ca](https://github.com/revanced/revanced-patches/commit/f3b92cab5a057ce605b6d9e75e3b99161bf1422c))
|
||||||
|
|
||||||
|
## [2.50.8](https://github.com/revanced/revanced-patches/compare/v2.50.7...v2.50.8) (2022-09-08)
|
||||||
|
|
||||||
|
## [2.50.7](https://github.com/revanced/revanced-patches/compare/v2.50.6...v2.50.7) (2022-09-08)
|
||||||
|
|
||||||
|
## [2.50.6](https://github.com/revanced/revanced-patches/compare/v2.50.5...v2.50.6) (2022-09-07)
|
||||||
|
|
||||||
|
## [2.50.5](https://github.com/revanced/revanced-patches/compare/v2.50.4...v2.50.5) (2022-09-07)
|
||||||
|
|
||||||
## [2.50.4](https://github.com/revanced/revanced-patches/compare/v2.50.3...v2.50.4) (2022-09-03)
|
## [2.50.4](https://github.com/revanced/revanced-patches/compare/v2.50.3...v2.50.4) (2022-09-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,23 @@ This section explains the JSON format for the [patches.json](patches.json) file.
|
|||||||
|
|
||||||
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
||||||
|
|
||||||
| key | description |
|
| key | description |
|
||||||
|-------------------------------|------------------------------------------------------------------------------------------------------------------|
|
|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `name` | The name of the patch. |
|
| `name` | The name of the patch. |
|
||||||
| `description` | The description of the patch. |
|
| `description` | The description of the patch. |
|
||||||
| `version` | The version of the patch. |
|
| `version` | The version of the patch. |
|
||||||
| `excluded` | Whether a patch is excluded by default. If `true`, the patch must never be included by default. |
|
| `excluded` | Whether the patch is excluded by default. If `true`, the patch must never be included by default. |
|
||||||
| `dependencies` | An array of dependencies, which are patch names. |
|
| `deprecated` | Whether the patch is deprecated. |
|
||||||
| `compatiblePackages` | An array of packages compatible with this patch. |
|
| `options` | An array of options for this patch. |
|
||||||
| `compatiblePackages.name` | The name of the package. |
|
| `options.key` | The key of the option. |
|
||||||
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
| `options.title` | The title of the option. |
|
||||||
|
| `options.description` | The description of the option. |
|
||||||
|
| `options.required` | Whether the option is required. |
|
||||||
|
| `options.choices?` | An array of choices of the option. This may be `null` if this option has no choices. The element type of this array may be any type. It can be a `String`, `Int` or something else. |
|
||||||
|
| `dependencies` | An array of dependencies, which are patch names. |
|
||||||
|
| `compatiblePackages` | An array of packages compatible with this patch. |
|
||||||
|
| `compatiblePackages.name` | The name of the package. |
|
||||||
|
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@@ -32,6 +39,8 @@ Example:
|
|||||||
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"options": [],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"integrations",
|
"integrations",
|
||||||
"video-id-hook"
|
"video-id-hook"
|
||||||
@@ -46,24 +55,67 @@ Example:
|
|||||||
"17.27.39",
|
"17.27.39",
|
||||||
"17.28.34",
|
"17.28.34",
|
||||||
"17.29.34",
|
"17.29.34",
|
||||||
"17.32.35"
|
"17.32.35",
|
||||||
|
"17.33.42"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "client-spoof",
|
"name": "theme",
|
||||||
"description": "Spoofs the YouTube or Vanced client to prevent playback issues.",
|
"description": "Enables a custom theme.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"dependencies": [],
|
"deprecated": false,
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"key": "theme",
|
||||||
|
"title": "Theme",
|
||||||
|
"description": "Select a theme.",
|
||||||
|
"required": true,
|
||||||
|
"choices": [
|
||||||
|
"Amoled"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": [
|
||||||
|
"locale-config-fix"
|
||||||
|
],
|
||||||
"compatiblePackages": [
|
"compatiblePackages": [
|
||||||
{
|
{
|
||||||
"name": "com.google.android.youtube",
|
"name": "com.google.android.youtube",
|
||||||
"versions": []
|
"versions": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "custom-branding",
|
||||||
|
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"excluded": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"key": "appName",
|
||||||
|
"title": "Application Name",
|
||||||
|
"description": "The name of the application it will show on your home screen.",
|
||||||
|
"required": true,
|
||||||
|
"choices": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.vanced.android.youtube",
|
"key": "appIconPath",
|
||||||
|
"title": "Application Icon Path",
|
||||||
|
"description": "A path to the icon of the application.",
|
||||||
|
"required": false,
|
||||||
|
"choices": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": [
|
||||||
|
"locale-config-fix"
|
||||||
|
],
|
||||||
|
"compatiblePackages": [
|
||||||
|
{
|
||||||
|
"name": "com.google.android.youtube",
|
||||||
"versions": []
|
"versions": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
101
README.md
101
README.md
@@ -64,6 +64,16 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `tiktok-ads` | Removes ads from TikTok. | all |
|
| `tiktok-ads` | Removes ads from TikTok. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### 📦 `com.zhiliaoapp.musically`
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `tiktok-download` | Remove restrictions on downloads video. | all |
|
||||||
|
| `tiktok-seekbar` | Show progress bar for all video. | all |
|
||||||
|
| `tiktok-ads` | Removes ads from TikTok. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### 📦 `com.google.android.youtube`
|
### 📦 `com.google.android.youtube`
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -81,6 +91,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `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 |
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.33.42 |
|
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.33.42 |
|
||||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.33.42 |
|
| `old-quality-layout` | Enables the original quality flyout menu. | 17.33.42 |
|
||||||
|
| `theme` | Enables a custom theme. | all |
|
||||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.33.42 |
|
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.33.42 |
|
||||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.33.42 |
|
| `hide-watermark` | Hides creator's watermarks on videos. | 17.33.42 |
|
||||||
| `sponsorblock` | Integrate SponsorBlock. | 17.33.42 |
|
| `sponsorblock` | Integrate SponsorBlock. | 17.33.42 |
|
||||||
@@ -101,6 +112,14 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.33.42 |
|
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.33.42 |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### 📦 `com.vanced.android.youtube`
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 📝 JSON Format
|
## 📝 JSON Format
|
||||||
@@ -109,16 +128,23 @@ This section explains the JSON format for the [patches.json](patches.json) file.
|
|||||||
|
|
||||||
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
||||||
|
|
||||||
| key | description |
|
| key | description |
|
||||||
|-------------------------------|------------------------------------------------------------------------------------------------------------------|
|
|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `name` | The name of the patch. |
|
| `name` | The name of the patch. |
|
||||||
| `description` | The description of the patch. |
|
| `description` | The description of the patch. |
|
||||||
| `version` | The version of the patch. |
|
| `version` | The version of the patch. |
|
||||||
| `excluded` | Whether a patch is excluded by default. If `true`, the patch must never be included by default. |
|
| `excluded` | Whether the patch is excluded by default. If `true`, the patch must never be included by default. |
|
||||||
| `dependencies` | An array of dependencies, which are patch names. |
|
| `deprecated` | Whether the patch is deprecated. |
|
||||||
| `compatiblePackages` | An array of packages compatible with this patch. |
|
| `options` | An array of options for this patch. |
|
||||||
| `compatiblePackages.name` | The name of the package. |
|
| `options.key` | The key of the option. |
|
||||||
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
| `options.title` | The title of the option. |
|
||||||
|
| `options.description` | The description of the option. |
|
||||||
|
| `options.required` | Whether the option is required. |
|
||||||
|
| `options.choices?` | An array of choices of the option. This may be `null` if this option has no choices. The element type of this array may be any type. It can be a `String`, `Int` or something else. |
|
||||||
|
| `dependencies` | An array of dependencies, which are patch names. |
|
||||||
|
| `compatiblePackages` | An array of packages compatible with this patch. |
|
||||||
|
| `compatiblePackages.name` | The name of the package. |
|
||||||
|
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@@ -129,6 +155,8 @@ Example:
|
|||||||
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"options": [],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"integrations",
|
"integrations",
|
||||||
"video-id-hook"
|
"video-id-hook"
|
||||||
@@ -143,24 +171,67 @@ Example:
|
|||||||
"17.27.39",
|
"17.27.39",
|
||||||
"17.28.34",
|
"17.28.34",
|
||||||
"17.29.34",
|
"17.29.34",
|
||||||
"17.32.35"
|
"17.32.35",
|
||||||
|
"17.33.42"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "client-spoof",
|
"name": "theme",
|
||||||
"description": "Spoofs the YouTube or Vanced client to prevent playback issues.",
|
"description": "Enables a custom theme.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"dependencies": [],
|
"deprecated": false,
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"key": "theme",
|
||||||
|
"title": "Theme",
|
||||||
|
"description": "Select a theme.",
|
||||||
|
"required": true,
|
||||||
|
"choices": [
|
||||||
|
"Amoled"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": [
|
||||||
|
"locale-config-fix"
|
||||||
|
],
|
||||||
"compatiblePackages": [
|
"compatiblePackages": [
|
||||||
{
|
{
|
||||||
"name": "com.google.android.youtube",
|
"name": "com.google.android.youtube",
|
||||||
"versions": []
|
"versions": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "custom-branding",
|
||||||
|
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"excluded": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"key": "appName",
|
||||||
|
"title": "Application Name",
|
||||||
|
"description": "The name of the application it will show on your home screen.",
|
||||||
|
"required": true,
|
||||||
|
"choices": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.vanced.android.youtube",
|
"key": "appIconPath",
|
||||||
|
"title": "Application Icon Path",
|
||||||
|
"description": "A path to the icon of the application.",
|
||||||
|
"required": false,
|
||||||
|
"choices": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": [
|
||||||
|
"locale-config-fix"
|
||||||
|
],
|
||||||
|
"compatiblePackages": [
|
||||||
|
{
|
||||||
|
"name": "com.google.android.youtube",
|
||||||
"versions": []
|
"versions": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation("app.revanced:revanced-patcher:4.2.3")
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:3.4.0")
|
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
|
|
||||||
// Required for meta
|
// Required for meta
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.50.4
|
version = 2.52.2
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -3,14 +3,17 @@ package app.revanced.meta.json
|
|||||||
import app.revanced.meta.Bundle
|
import app.revanced.meta.Bundle
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.dependencies
|
import app.revanced.patcher.extensions.PatchExtensions.dependencies
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.deprecated
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.include
|
import app.revanced.patcher.extensions.PatchExtensions.include
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.options
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.version
|
import app.revanced.patcher.extensions.PatchExtensions.version
|
||||||
import com.google.gson.Gson
|
import app.revanced.patcher.patch.PatchOption
|
||||||
|
import com.google.gson.GsonBuilder
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
private val gson = Gson()
|
private val gson = GsonBuilder().serializeNulls().create()
|
||||||
|
|
||||||
fun generateJson(bundle: Bundle) {
|
fun generateJson(bundle: Bundle) {
|
||||||
val patches = bundle.map {
|
val patches = bundle.map {
|
||||||
@@ -19,6 +22,20 @@ fun generateJson(bundle: Bundle) {
|
|||||||
it.description ?: "This patch has no description.",
|
it.description ?: "This patch has no description.",
|
||||||
it.version ?: "0.0.0",
|
it.version ?: "0.0.0",
|
||||||
!it.include,
|
!it.include,
|
||||||
|
it.deprecated != null,
|
||||||
|
it.options?.map { option ->
|
||||||
|
Option(
|
||||||
|
option.key,
|
||||||
|
option.title,
|
||||||
|
option.description,
|
||||||
|
option.required,
|
||||||
|
option.let { lo ->
|
||||||
|
if (lo is PatchOption.ListOption<*>) {
|
||||||
|
lo.options.toMutableList().toTypedArray()
|
||||||
|
} else null
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}?.toTypedArray() ?: emptyArray(),
|
||||||
it.dependencies?.map { dep ->
|
it.dependencies?.map { dep ->
|
||||||
dep.java.patchName
|
dep.java.patchName
|
||||||
}?.toTypedArray() ?: emptyArray(),
|
}?.toTypedArray() ?: emptyArray(),
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ data class JsonPatch(
|
|||||||
val description: String,
|
val description: String,
|
||||||
val version: String,
|
val version: String,
|
||||||
val excluded: Boolean,
|
val excluded: Boolean,
|
||||||
|
val deprecated: Boolean,
|
||||||
|
val options: Array<Option>,
|
||||||
val dependencies: Array<String>,
|
val dependencies: Array<String>,
|
||||||
val compatiblePackages: Array<CompatiblePackage>,
|
val compatiblePackages: Array<CompatiblePackage>,
|
||||||
)
|
)
|
||||||
@@ -15,3 +17,11 @@ data class CompatiblePackage(
|
|||||||
val name: String,
|
val name: String,
|
||||||
val versions: Array<String>,
|
val versions: Array<String>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class Option(
|
||||||
|
val key: String,
|
||||||
|
val title: String,
|
||||||
|
val description: String,
|
||||||
|
val required: Boolean,
|
||||||
|
val choices: Array<*>?,
|
||||||
|
)
|
||||||
@@ -17,13 +17,11 @@ fun generateText(bundle: Bundle) {
|
|||||||
val output = StringBuilder()
|
val output = StringBuilder()
|
||||||
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>()
|
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>()
|
||||||
|
|
||||||
bundle.map {
|
for (patch in bundle) {
|
||||||
val packageName = it.compatiblePackages?.first()?.name!!
|
patch.compatiblePackages?.forEach { pkg ->
|
||||||
if (!packages.contains(packageName)) {
|
if (!packages.contains(pkg.name)) packages[pkg.name] = mutableListOf()
|
||||||
packages[packageName] = mutableListOf()
|
packages[pkg.name]!!.add(patch)
|
||||||
}
|
}
|
||||||
|
|
||||||
packages[packageName]?.add(it)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pkg in packages) {
|
for (pkg in packages) {
|
||||||
|
|||||||
@@ -2,17 +2,16 @@ package app.revanced.patches.youtube.layout.amoled.patch
|
|||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.PatchDeprecated
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
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.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
|
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.theme.patch.ThemePatch
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import org.w3c.dom.Element
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([FixLocaleConfigErrorPatch::class])
|
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||||
@@ -20,24 +19,10 @@ import java.io.File
|
|||||||
@Description("Enables pure black theme.")
|
@Description("Enables pure black theme.")
|
||||||
@AmoledCompatibility
|
@AmoledCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
|
@PatchDeprecated("Theme patch already includes the Amoled theme.", ThemePatch::class)
|
||||||
class AmoledPatch : ResourcePatch() {
|
class AmoledPatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
data.xmlEditor["res${File.separator}values${File.separator}colors.xml"].use { editor ->
|
ThemePatch.theme = ThemePatch.Themes.Amoled.name
|
||||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
return ThemePatch().execute(data)
|
||||||
|
|
||||||
for (i in 0 until resourcesNode.childNodes.length) {
|
|
||||||
val node = resourcesNode.childNodes.item(i)
|
|
||||||
if (node !is Element) continue
|
|
||||||
|
|
||||||
val element = resourcesNode.childNodes.item(i) as Element
|
|
||||||
element.textContent = when (element.getAttribute("name")) {
|
|
||||||
"yt_black1", "yt_black1_opacity95", "yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark" -> "@android:color/black"
|
|
||||||
"yt_selected_nav_label_dark" -> "#ffdf0000"
|
|
||||||
else -> continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
@@ -42,27 +41,18 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
"hdpi" to 72,
|
"hdpi" to 72,
|
||||||
"mdpi" to 48
|
"mdpi" to 48
|
||||||
).forEach { (iconDirectory, size) ->
|
).forEach { (iconDirectory, size) ->
|
||||||
iconNames.forEach iconLoop@{ iconName ->
|
iconNames.forEach { iconName ->
|
||||||
val iconFile = getIconStream("branding/$size/$iconName.png")
|
val iconFile = getIconStream("branding/$size/$iconName.png")
|
||||||
?: return PatchResultError("The icon $iconName can not be found.")
|
?: return PatchResultError("The icon $iconName can not be found.")
|
||||||
|
|
||||||
val outputStream = ByteArrayOutputStream()
|
|
||||||
iconFile.use { input ->
|
|
||||||
outputStream.use { output ->
|
|
||||||
input.copyTo(output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.write(
|
Files.write(
|
||||||
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
|
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
|
||||||
outputStream.toByteArray()
|
iconFile.readBytes()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name branding
|
// Name branding
|
||||||
val appName: String by options[keyAppName]
|
|
||||||
|
|
||||||
val manifest = data["AndroidManifest.xml"]
|
val manifest = data["AndroidManifest.xml"]
|
||||||
manifest.writeText(
|
manifest.writeText(
|
||||||
manifest.readText()
|
manifest.readText()
|
||||||
@@ -75,24 +65,7 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val options = PatchOptions(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
key = keyAppName,
|
|
||||||
default = "YouTube ReVanced",
|
|
||||||
title = "Application Name",
|
|
||||||
description = "The name of the application it will show on your home screen.",
|
|
||||||
required = true
|
|
||||||
),
|
|
||||||
PatchOption.StringOption(
|
|
||||||
key = keyAppIconPath,
|
|
||||||
default = null,
|
|
||||||
title = "Application Icon Path",
|
|
||||||
description = "A path to the icon of the application."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun getIconStream(iconPath: String): InputStream? {
|
private fun getIconStream(iconPath: String): InputStream? {
|
||||||
val appIconPath: String? by options[keyAppIconPath]
|
|
||||||
if (appIconPath == null) {
|
if (appIconPath == null) {
|
||||||
return this.javaClass.classLoader.getResourceAsStream(iconPath)
|
return this.javaClass.classLoader.getResourceAsStream(iconPath)
|
||||||
}
|
}
|
||||||
@@ -101,8 +74,24 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
return FileInputStream(file)
|
return FileInputStream(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
companion object : OptionsContainer() {
|
||||||
private const val keyAppName = "appName"
|
private var appName: String? by option(
|
||||||
private const val keyAppIconPath = "appIconPath"
|
PatchOption.StringOption(
|
||||||
|
key = "appName",
|
||||||
|
default = "YouTube ReVanced",
|
||||||
|
title = "Application Name",
|
||||||
|
description = "The name of the application it will show on your home screen.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
private var appIconPath: String? by option(
|
||||||
|
PatchOption.StringOption(
|
||||||
|
key = "appIconPath",
|
||||||
|
default = null,
|
||||||
|
title = "Application Icon Path",
|
||||||
|
description = "A path to the icon of the application."
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.google.android.youtube")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class ThemeCompatibility
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
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.impl.ResourceData
|
||||||
|
import app.revanced.patcher.patch.*
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||||
|
@Name("theme")
|
||||||
|
@Description("Enables a custom theme.")
|
||||||
|
@ThemeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ThemePatch : ResourcePatch() {
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
val theme = Themes.of(theme!!) ?: return PatchResultError("Theme '$theme' not found.")
|
||||||
|
|
||||||
|
data.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||||
|
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||||
|
|
||||||
|
for (i in 0 until resourcesNode.childNodes.length) {
|
||||||
|
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
|
||||||
|
node.textContent = theme.apply(node.getAttribute("name")) ?: continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object : OptionsContainer() {
|
||||||
|
var theme: String? by option(
|
||||||
|
PatchOption.StringListOption(
|
||||||
|
key = "theme",
|
||||||
|
default = Themes.Amoled.name,
|
||||||
|
options = Themes.names,
|
||||||
|
title = "Theme",
|
||||||
|
description = "Select a theme.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Themes(val apply: (String) -> String?) {
|
||||||
|
Amoled({ attr ->
|
||||||
|
when (attr) {
|
||||||
|
"yt_black1", "yt_black1_opacity95", "yt_black2", "yt_black3", "yt_black4",
|
||||||
|
"yt_status_bar_background_dark" -> "@android:color/black"
|
||||||
|
|
||||||
|
"yt_selected_nav_label_dark" -> "#ffdf0000"
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val names = values().map { it.name }
|
||||||
|
|
||||||
|
fun of(name: String) = values().firstOrNull { it.name == name }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:tint="#FFFFFF" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:tint="#FFFFFF" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||||
<path android:fillColor="#FFFFFF" android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
|
<path android:fillColor="#FFFFFF" android:pathData="M6 9.3V0h1v9.3l3.6-3.7.8.8-4.9 4.8-4.9-4.8.8-.8L6 9.3ZM.5 11h1v1.5h10V11h1v2.5H.5V11Zx"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
Reference in New Issue
Block a user