mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-22 07:07:34 +01:00
refactor: adapt patcher 4.0.0 changes
This commit is contained in:
parent
50cd62f64f
commit
fd76c45098
@ -53,8 +53,6 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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()
|
||||||
@ -67,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)
|
||||||
}
|
}
|
||||||
@ -93,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."
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user