Skip to content
Snippets Groups Projects
Commit e52703ca authored by Alexander Lussier-Cullen's avatar Alexander Lussier-Cullen
Browse files

fix ez-vcard on api <26

Change-Id: I3a0c5f92f0067e71596a0e0ab021453da82fa1c1
parent 17f1829a
No related branches found
No related tags found
No related merge requests found
......@@ -31,10 +31,7 @@ import ezvcard.property.Uid
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.schedulers.Schedulers
import net.jami.utils.FileUtils.moveFile
import java.io.File
import java.io.IOException
import java.io.StringWriter
import kotlin.io.path.Path
import java.io.*
object VCardUtils {
val TAG = VCardUtils::class.simpleName!!
......@@ -123,7 +120,7 @@ object VCardUtils {
}
val file = File(path, filename)
try {
VCardWriter(Path(file.absolutePath), VCardVersion.V2_1).use { writer ->
VCardWriter(BufferedOutputStream(FileOutputStream((file))), VCardVersion.V2_1).use { writer ->
writer.vObjectWriter.foldedLineWriter.lineLength = null
writer.write(vcard)
}
......@@ -164,7 +161,7 @@ object VCardUtils {
Log.w(TAG, "vcardPath too big: " + path.length() / 1024 + " kB")
return null
}
return Ezvcard.parse(Path(path.absolutePath)).first()
return Ezvcard.parse(BufferedInputStream(FileInputStream((path.absolutePath)))).first()
}
fun vcardToString(vcard: VCard?): String? {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment