Updated on 2026-08-14
This commit is contained in:
commit
08e122d2e2
1 changed files with 5 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package com.tangem.datasource.files
|
|||
|
||||
import android.content.Context
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import okio.use
|
||||
import javax.inject.Inject
|
||||
|
||||
class AndroidFileReader @Inject constructor(@ApplicationContext private val context: Context) : FileReader {
|
||||
|
|
@ -16,7 +17,10 @@ class AndroidFileReader @Inject constructor(@ApplicationContext private val cont
|
|||
|
||||
override fun rewriteFile(content: String, fileName: String) {
|
||||
context.openFileOutput(fileName, Context.MODE_PRIVATE).use { stream ->
|
||||
stream.write(content.toByteArray(), 0, content.length)
|
||||
stream.writer().use { writer ->
|
||||
// warning: don't write byteArray as json, its break cyrillic encoding
|
||||
writer.write(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue