update my list on home screen, when changed

This commit is contained in:
2020-10-16 11:23:32 +02:00
parent 085b2013ab
commit 9f1717e646
7 changed files with 68 additions and 48 deletions

View File

@ -1,16 +1,16 @@
package org.mosad.teapod.util
import android.content.Context
import android.util.Log
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import kotlinx.coroutines.*
import java.io.File
/**
* myList should be saved in a db
* This controller contains the logic for permanently saved data.
* On load, it loads the saved files into the variables
*/
object CacheHelper {
object StorageController {
private const val fileNameMyList = "my_list.json"
@ -27,7 +27,6 @@ object CacheHelper {
)
}
fun saveMyList(context: Context): Job {
val file = File(context.filesDir, fileNameMyList)
@ -36,12 +35,4 @@ object CacheHelper {
}
}
private fun save(file: File, text: String) {
try {
file.writeText(text)
} catch (ex: Exception) {
Log.e(javaClass.name, "failed to write file \"${file.absoluteFile}\"", ex)
}
}
}