diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/patch/DynamicColorPatch.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/patch/DynamicColorPatch.kt
index e6b5aa4b9..b72037e01 100644
--- a/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/patch/DynamicColorPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/patch/DynamicColorPatch.kt
@@ -10,6 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.twitter.misc.dynamiccolor.annotations.DynamicColorCompatibility
+import java.io.FileWriter
import java.nio.file.Files
@Patch
@@ -28,16 +29,19 @@ class DynamicColorPatch : ResourcePatch() {
val valuesNightV31Directory = resDirectory.resolve("values-night-v31")
if (!valuesNightV31Directory.isDirectory) Files.createDirectories(valuesNightV31Directory.toPath())
- listOf(valuesV31Directory, valuesNightV31Directory).forEach {
+ listOf(valuesV31Directory, valuesNightV31Directory).forEach { it ->
val colorsXml = it.resolve("colors.xml")
if(!colorsXml.exists()) {
- Files.writeString(
- colorsXml.toPath(),
- "\n" +
- "\n" +
- ""
- )
+ FileWriter(
+ colorsXml,
+ ).use {
+ it.write(
+ "\n" +
+ "\n" +
+ "".trimIndent()
+ )
+ }
}
}
diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/monochrome/patch/MonochromeIconPatch.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/monochrome/patch/MonochromeIconPatch.kt
index ec65952e2..ed5994283 100644
--- a/src/main/kotlin/app/revanced/patches/twitter/misc/monochrome/patch/MonochromeIconPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/twitter/misc/monochrome/patch/MonochromeIconPatch.kt
@@ -3,7 +3,6 @@ package app.revanced.patches.twitter.misc.monochrome.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
-import app.revanced.patcher.data.impl.DomFileEditor
import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
@@ -11,6 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.twitter.misc.monochrome.annotations.MonochromeIconCompatibility
+import java.io.FileWriter
import java.nio.file.Files
@Patch
@@ -26,27 +26,29 @@ class MonochromeIconPatch : ResourcePatch() {
val mipmapV33Directory = resDirectory.resolve("mipmap-anydpi-v33")
if (!mipmapV33Directory.isDirectory) Files.createDirectories(mipmapV33Directory.toPath())
- Files.writeString(
- mipmapV33Directory.resolve("ic_launcher_twitter.xml").toPath(),
+ FileWriter(
+ mipmapV33Directory.resolve("ic_launcher_twitter.xml"),
+ ).use {
"\n" +
- "\n" +
- " \n" +
- " \n" +
- " \n" +
- ""
- )
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ ""
+ }
- Files.writeString(
- mipmapV33Directory.resolve("ic_launcher_twitter_round.xml").toPath(),
+ FileWriter(
+ mipmapV33Directory.resolve("ic_launcher_twitter_round.xml"),
+ ).use {
"\n" +
- "\n" +
- " \n" +
- " \n" +
- " \n" +
- ""
- )
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ ""
+ }
return PatchResultSuccess()
}