fix: Use deprecated members to ensure backwards compatibility

By migrating to early to new APIs of ReVanced Patcher, if you were to use old versions of ReVanced Patcher, you would get compatibility issues. By using deprecated members until most have updated ReVanced Patcher, we can ensure seamless migration.
This commit is contained in:
oSumAtrIX
2024-02-22 01:10:09 +01:00
parent 1e3356808d
commit a6d8e4210f
24 changed files with 174 additions and 108 deletions
@@ -16,7 +16,7 @@ import java.nio.file.Files
@Suppress("unused")
object DynamicColorPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
val resDirectory = context.get("res", false)
val resDirectory = context.get("res")
if (!resDirectory.isDirectory) throw PatchException("The res folder can not be found.")
val valuesV31Directory = resDirectory.resolve("values-v31")
@@ -35,7 +35,9 @@ object DynamicColorPatch : ResourcePatch() {
}
}
context.document["res/values-v31/colors.xml"].use { document ->
context.xmlEditor["res/values-v31/colors.xml"].use { editor ->
val document = editor.file
mapOf(
"ps__twitter_blue" to "@color/twitter_blue",
"ps__twitter_blue_pressed" to "@color/twitter_blue_fill_pressed",
@@ -55,7 +57,9 @@ object DynamicColorPatch : ResourcePatch() {
}
}
context.document["res/values-night-v31/colors.xml"].use { document ->
context.xmlEditor["res/values-night-v31/colors.xml"].use { editor ->
val document = editor.file
mapOf(
"twitter_blue" to "@android:color/system_accent1_200",
"twitter_blue_fill_pressed" to "@android:color/system_accent1_300",