forked from ReVanced/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Personal Logo && Add upstream sync
- Loading branch information
Showing
47 changed files
with
216 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Delete old workflow runs | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
days: | ||
description: 'Number of days.' | ||
required: true | ||
default: 0 | ||
minimum_runs: | ||
description: 'The minimum runs to keep for each workflow.' | ||
required: true | ||
default: 0 | ||
delete_workflow_pattern: | ||
description: 'The name of the workflow. if not set then it will target all workflows.' | ||
required: false | ||
|
||
jobs: | ||
del_runs: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Delete workflow runs | ||
uses: Mattraks/delete-workflow-runs@v2 | ||
with: | ||
token: ${{ github.token }} | ||
repository: ${{ github.repository }} | ||
retain_days: ${{ github.event.inputs.days }} | ||
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} | ||
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Sync upstream | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 */8 * * *" | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GH_PAT }} | ||
|
||
- name: sync | ||
id: sync | ||
shell: bash | ||
run: | | ||
git config --global user.name 'E85Addict' | ||
git config --global user.email '[email protected]' | ||
if [[ $(git log | grep Author | head -1) == *"semantic"* ]]; then | ||
git reset --hard HEAD~1 | ||
fi | ||
T=$(git tag --sort=creatordate | tail -1) | ||
git remote add upstream https://github.com/revanced/revanced-patches | ||
git tag -d $(git tag -l) | ||
git fetch upstream --tags -f | ||
LatestRemoteTag=$(curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest | jq -r '.tag_name') | ||
C=$(git rev-list --left-right --count origin/dev...remotes/upstream/dev | awk '{print$2}') | ||
echo "Ahead $C commits." | ||
if [ "$C" -gt 0 ]; then | ||
echo "Rebasing" | ||
# git push origin --delete $T | ||
git rebase -X ours upstream/dev | ||
git push --tags -f | ||
git push origin --delete $LatestRemoteTag | ||
git push -f | ||
else | ||
echo "in sync" | ||
fi | ||
- name: Delete old workflow runs | ||
uses: Mattraks/delete-workflow-runs@v2 | ||
with: | ||
token: ${{ github.token }} | ||
repository: ${{ github.repository }} | ||
retain_days: 0 | ||
keep_minimum_runs: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
...es/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingMusicPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package app.revanced.patches.music.layout.branding | ||
|
||
import app.revanced.patcher.patch.resourcePatch | ||
import app.revanced.patcher.patch.stringOption | ||
import app.revanced.util.ResourceGroup | ||
import app.revanced.util.Utils.trimIndentMultiline | ||
import app.revanced.util.copyResources | ||
import java.io.File | ||
import java.nio.file.Files | ||
|
||
private const val REVANCED_ICON = "ReVanced*Logo" // Can never be a valid path. | ||
private const val APP_NAME = "YT Music" | ||
|
||
private val iconResourceFileNames = arrayOf( | ||
"adaptiveproduct_youtube_music_background_color_108", | ||
"adaptiveproduct_youtube_music_foreground_color_108", | ||
"ic_launcher", | ||
"ic_launcher_round", | ||
).map { "$it.png" }.toTypedArray() | ||
|
||
private val iconResourceFileNamesNew = mapOf( | ||
"adaptiveproduct_youtube_music_foreground_color_108" to "adaptiveproduct_youtube_music_2024_q4_foreground_color_108", | ||
"adaptiveproduct_youtube_music_background_color_108" to "adaptiveproduct_youtube_music_2024_q4_background_color_108", | ||
) | ||
|
||
private val mipmapDirectories = arrayOf( | ||
"xxxhdpi", | ||
"xxhdpi", | ||
"xhdpi", | ||
"hdpi", | ||
"mdpi", | ||
).map { "mipmap-$it" } | ||
|
||
@Suppress("unused") | ||
val customBrandingPatch = resourcePatch( | ||
name = "Custom Music branding", | ||
description = "Applies a custom app name and icon. Defaults to \"YT Music ReVanced\" and the ReVanced logo.", | ||
use = true, | ||
) { | ||
compatibleWith("com.google.android.apps.youtube.music") | ||
|
||
val appName by stringOption( | ||
key = "appName", | ||
default = APP_NAME, | ||
values = mapOf( | ||
"YouTube Music ReVanced" to APP_NAME, | ||
"YTM ReVanced" to "YTM ReVanced", | ||
"YTM" to "YTM", | ||
"YouTube Music" to "YouTube Music", | ||
), | ||
title = "App name", | ||
description = "The name of the app.", | ||
) | ||
|
||
val icon by stringOption( | ||
key = "iconPath", | ||
default = REVANCED_ICON, | ||
values = mapOf("ReVanced Logo" to REVANCED_ICON), | ||
title = "App icon", | ||
description = """ | ||
The icon to apply to the app. | ||
If a path to a folder is provided, the folder must contain the following folders: | ||
${mipmapDirectories.joinToString("\n") { "- $it" }} | ||
Each of these folders must contain the following files: | ||
${iconResourceFileNames.joinToString("\n") { "- $it" }} | ||
""".trimIndentMultiline(), | ||
) | ||
|
||
execute { | ||
icon?.let { icon -> | ||
// Change the app icon. | ||
mipmapDirectories.map { directory -> | ||
ResourceGroup( | ||
directory, | ||
*iconResourceFileNames, | ||
) | ||
}.let { resourceGroups -> | ||
if (icon != REVANCED_ICON) { | ||
val path = File(icon) | ||
val resourceDirectory = get("res") | ||
|
||
resourceGroups.forEach { group -> | ||
val fromDirectory = path.resolve(group.resourceDirectoryName) | ||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName) | ||
|
||
group.resources.forEach { iconFileName -> | ||
Files.write( | ||
toDirectory.resolve(iconFileName).toPath(), | ||
fromDirectory.resolve(iconFileName).readBytes(), | ||
) | ||
} | ||
} | ||
} else { | ||
resourceGroups.forEach { copyResources("branding/music", it) } | ||
} | ||
} | ||
|
||
val resourceDirectory = get("res") | ||
|
||
mipmapDirectories.forEach { directory -> | ||
val targetDirectory = resourceDirectory.resolve(directory) | ||
|
||
iconResourceFileNamesNew.forEach { (old, new) -> | ||
val oldFile = targetDirectory.resolve("$old.png") | ||
val newFile = targetDirectory.resolve("$new.png") | ||
|
||
Files.write(newFile.toPath(), oldFile.readBytes()) | ||
} | ||
} | ||
} | ||
|
||
appName?.let { name -> | ||
// Change the app name. | ||
val manifest = get("AndroidManifest.xml") | ||
manifest.writeText( | ||
manifest.readText() | ||
.replace( | ||
"android:label=\"@string/application_name", | ||
"android:label=\"$name", | ||
), | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+158 Bytes
...anding/music/mipmap-hdpi/adaptiveproduct_youtube_music_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.88 KB
...anding/music/mipmap-hdpi/adaptiveproduct_youtube_music_foreground_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.15 KB
patches/src/main/resources/branding/music/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.14 KB
patches/src/main/resources/branding/music/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+150 Bytes
...anding/music/mipmap-mdpi/adaptiveproduct_youtube_music_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.76 KB
...anding/music/mipmap-mdpi/adaptiveproduct_youtube_music_foreground_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.43 KB
patches/src/main/resources/branding/music/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.42 KB
patches/src/main/resources/branding/music/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+168 Bytes
...nding/music/mipmap-xhdpi/adaptiveproduct_youtube_music_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
...nding/music/mipmap-xhdpi/adaptiveproduct_youtube_music_foreground_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.89 KB
patches/src/main/resources/branding/music/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.88 KB
patches/src/main/resources/branding/music/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+158 Bytes
...ding/music/mipmap-xxhdpi/adaptiveproduct_youtube_music_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.4 KB
...ding/music/mipmap-xxhdpi/adaptiveproduct_youtube_music_foreground_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.79 KB
patches/src/main/resources/branding/music/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.79 KB
patches/src/main/resources/branding/music/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+168 Bytes
...ing/music/mipmap-xxxhdpi/adaptiveproduct_youtube_music_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.1 KB
...ing/music/mipmap-xxxhdpi/adaptiveproduct_youtube_music_foreground_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.8 KB
patches/src/main/resources/branding/music/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.8 KB
patches/src/main/resources/branding/music/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+158 Bytes
...s/branding/youtube/mipmap-hdpi/adaptiveproduct_youtube_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.11 KB
...s/branding/youtube/mipmap-hdpi/adaptiveproduct_youtube_foreground_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.36 KB
patches/src/main/resources/branding/youtube/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.44 KB
patches/src/main/resources/branding/youtube/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+150 Bytes
...s/branding/youtube/mipmap-mdpi/adaptiveproduct_youtube_background_color_108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.01 KB
...s/branding/youtube/mipmap-mdpi/adaptiveproduct_youtube_foreground_color_108.png
Oops, something went wrong.
Binary file added
BIN
+2.35 KB
patches/src/main/resources/branding/youtube/mipmap-mdpi/ic_launcher.png
Oops, something went wrong.
Binary file added
BIN
+2.33 KB
patches/src/main/resources/branding/youtube/mipmap-mdpi/ic_launcher_round.png
Oops, something went wrong.
Binary file added
BIN
+168 Bytes
.../branding/youtube/mipmap-xhdpi/adaptiveproduct_youtube_background_color_108.png
Oops, something went wrong.
Binary file added
BIN
+4.19 KB
.../branding/youtube/mipmap-xhdpi/adaptiveproduct_youtube_foreground_color_108.png
Oops, something went wrong.
Binary file added
BIN
+4.96 KB
patches/src/main/resources/branding/youtube/mipmap-xhdpi/ic_launcher.png
Oops, something went wrong.
Binary file added
BIN
+4.8 KB
patches/src/main/resources/branding/youtube/mipmap-xhdpi/ic_launcher_round.png
Oops, something went wrong.
Binary file added
BIN
+158 Bytes
...branding/youtube/mipmap-xxhdpi/adaptiveproduct_youtube_background_color_108.png
Oops, something went wrong.
Binary file added
BIN
+6.58 KB
...branding/youtube/mipmap-xxhdpi/adaptiveproduct_youtube_foreground_color_108.png
Oops, something went wrong.
Binary file added
BIN
+7.83 KB
patches/src/main/resources/branding/youtube/mipmap-xxhdpi/ic_launcher.png
Oops, something went wrong.
Binary file added
BIN
+7.89 KB
patches/src/main/resources/branding/youtube/mipmap-xxhdpi/ic_launcher_round.png
Oops, something went wrong.
Binary file added
BIN
+168 Bytes
...randing/youtube/mipmap-xxxhdpi/adaptiveproduct_youtube_background_color_108.png
Oops, something went wrong.
Binary file added
BIN
+9.08 KB
...randing/youtube/mipmap-xxxhdpi/adaptiveproduct_youtube_foreground_color_108.png
Oops, something went wrong.
Binary file added
BIN
+11.2 KB
patches/src/main/resources/branding/youtube/mipmap-xxxhdpi/ic_launcher.png
Oops, something went wrong.
Binary file added
BIN
+11.4 KB
patches/src/main/resources/branding/youtube/mipmap-xxxhdpi/ic_launcher_round.png
Oops, something went wrong.