- storage fix (new key)
This commit is contained in:
parent
6fd1a8bd8d
commit
95326a2894
2 changed files with 15 additions and 1 deletions
|
@ -8,8 +8,8 @@ import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.BuildConfig
|
import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.interfaces.Config
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription
|
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||||
import info.nightscout.androidaps.interfaces.PluginType
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
@ -67,6 +67,10 @@ class MaintenancePlugin @Inject constructor(
|
||||||
//todo replace this with a call on startup of the application, specifically to remove
|
//todo replace this with a call on startup of the application, specifically to remove
|
||||||
// unnecessary garbage from the log exports
|
// unnecessary garbage from the log exports
|
||||||
fun deleteLogs(keep: Int) {
|
fun deleteLogs(keep: Int) {
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
return
|
||||||
|
|
||||||
val logDir = File(loggerUtils.logDirectory)
|
val logDir = File(loggerUtils.logDirectory)
|
||||||
val files = logDir.listFiles { _: File?, name: String ->
|
val files = logDir.listFiles { _: File?, name: String ->
|
||||||
(name.startsWith("AndroidAPS") && name.endsWith(".zip"))
|
(name.startsWith("AndroidAPS") && name.endsWith(".zip"))
|
||||||
|
|
|
@ -32,6 +32,7 @@ class PumpSyncStorage @Inject constructor(
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initStorage()
|
initStorage()
|
||||||
|
cleanOldStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initStorage() {
|
fun initStorage() {
|
||||||
|
@ -66,6 +67,15 @@ class PumpSyncStorage @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun cleanOldStorage(): Unit {
|
||||||
|
val oldSpKeys = setOf("pump_sync_storage", "pump_sync_storage_xstream")
|
||||||
|
|
||||||
|
for (oldSpKey in oldSpKeys) {
|
||||||
|
if (sp.contains(oldSpKey))
|
||||||
|
sp.remove(oldSpKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun isStorageEmpty(): Boolean {
|
fun isStorageEmpty(): Boolean {
|
||||||
return pumpSyncStorage[BOLUS]!!.isEmpty() && pumpSyncStorage[TBR]!!.isEmpty()
|
return pumpSyncStorage[BOLUS]!!.isEmpty() && pumpSyncStorage[TBR]!!.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue