update my list on home screen, when changed
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user