mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-09 15:07:00 +01:00
refactor: adapt patcher 4.0.0 changes
This commit is contained in:
parent
f667b76c39
commit
c8b3a0942a
@ -53,8 +53,6 @@ class CustomBrandingPatch : ResourcePatch() {
|
||||
}
|
||||
|
||||
// Name branding
|
||||
val appName: String by options[keyAppName]
|
||||
|
||||
val manifest = data["AndroidManifest.xml"]
|
||||
manifest.writeText(
|
||||
manifest.readText()
|
||||
@ -67,24 +65,7 @@ class CustomBrandingPatch : ResourcePatch() {
|
||||
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? {
|
||||
val appIconPath: String? by options[keyAppIconPath]
|
||||
if (appIconPath == null) {
|
||||
return this.javaClass.classLoader.getResourceAsStream(iconPath)
|
||||
}
|
||||
@ -93,8 +74,24 @@ class CustomBrandingPatch : ResourcePatch() {
|
||||
return FileInputStream(file)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val keyAppName = "appName"
|
||||
private const val keyAppIconPath = "appIconPath"
|
||||
companion object : OptionsContainer() {
|
||||
private var appName: String by option(
|
||||
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."
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user