This commit is contained in:
@@ -85,6 +85,10 @@ object AccountCache {
|
||||
} catch (e: Exception) { emptyList() }
|
||||
}
|
||||
|
||||
fun clear(context: Context) {
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().clear().apply()
|
||||
}
|
||||
|
||||
fun load(context: Context): List<MibAccount> {
|
||||
val json = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
.getString(KEY_MIB, null) ?: return emptyList()
|
||||
|
||||
@@ -10,6 +10,11 @@ object ContactImageCache {
|
||||
private fun file(context: Context, hash: String) =
|
||||
File(context.cacheDir, "cimg_${hash.replace(Regex("[^A-Za-z0-9]"), "_")}.png")
|
||||
|
||||
fun clearAll(context: Context) {
|
||||
context.cacheDir.listFiles { f -> f.name.startsWith("cimg_") && f.name.endsWith(".png") }
|
||||
?.forEach { it.delete() }
|
||||
}
|
||||
|
||||
fun save(context: Context, hash: String, bitmap: Bitmap) {
|
||||
try {
|
||||
file(context, hash).outputStream().use {
|
||||
|
||||
@@ -51,6 +51,10 @@ object ContactsCache {
|
||||
prefs.apply()
|
||||
}
|
||||
|
||||
fun clear(context: Context) {
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().clear().apply()
|
||||
}
|
||||
|
||||
fun loadContacts(context: Context): List<MibBeneficiary> {
|
||||
val json = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
.getString(KEY_CONTACTS, null) ?: return emptyList()
|
||||
|
||||
@@ -34,6 +34,10 @@ object FinancingCache {
|
||||
.edit().putString(KEY_MIB, arr.toString()).apply()
|
||||
}
|
||||
|
||||
fun clear(context: Context) {
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().clear().apply()
|
||||
}
|
||||
|
||||
fun load(context: Context): List<MibFinanceDeal> {
|
||||
val json = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
.getString(KEY_MIB, null) ?: return emptyList()
|
||||
|
||||
@@ -42,6 +42,10 @@ object ForeignLimitsCache {
|
||||
.edit().putString(KEY, arr.toString()).apply()
|
||||
}
|
||||
|
||||
fun clear(context: Context) {
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().clear().apply()
|
||||
}
|
||||
|
||||
fun load(context: Context): List<HomeViewModel.BmlLimitsData> {
|
||||
val json = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
.getString(KEY, null) ?: return emptyList()
|
||||
|
||||
@@ -57,6 +57,10 @@ object RecentsCache {
|
||||
.edit().putString(KEY, arr.toString()).apply()
|
||||
}
|
||||
|
||||
fun clear(context: Context) {
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().clear().apply()
|
||||
}
|
||||
|
||||
fun load(context: Context): List<RecentPick> {
|
||||
val json = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
.getString(KEY, null) ?: return emptyList()
|
||||
|
||||
Reference in New Issue
Block a user