refactor: adapt patcher 4.0.0 changes

This commit is contained in:
Sculas 2022-09-07 21:14:03 +02:00
parent 50cd62f64f
commit fd76c45098
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89

View File

@ -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."
)
)
}
}