refactor: migrate CustomBrandingPatch.kt to DependsOn

This commit is contained in:
Sculas 2022-08-02 20:23:53 +02:00
parent de61c38a23
commit 6d73591d59
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89

View File

@ -7,7 +7,7 @@ import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies 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.branding.icon.annotations.CustomBrandingCompatibility import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
@ -15,7 +15,7 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc
import java.nio.file.Files import java.nio.file.Files
@Patch @Patch
@Dependencies([FixLocaleConfigErrorPatch::class]) @DependsOn(FixLocaleConfigErrorPatch::class)
@Name("custom-branding") @Name("custom-branding")
@Description("Changes the YouTube launcher icon to be ReVanced's.") @Description("Changes the YouTube launcher icon to be ReVanced's.")
@CustomBrandingCompatibility @CustomBrandingCompatibility
@ -44,7 +44,8 @@ class CustomBrandingPatch : ResourcePatch() {
?: return PatchResultError("The icon $iconName can not be found.") ?: return PatchResultError("The icon $iconName can not be found.")
Files.write( Files.write(
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(), iconFile.readAllBytes() resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
iconFile.readAllBytes()
) )
} }
} }