diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt index aee3b56fde..2bfcd2b441 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt @@ -3,8 +3,8 @@ package info.nightscout.androidaps.implementations import android.os.Build import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.R -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.interfaces.Config +import info.nightscout.interfaces.maintenance.PrefFileListProvider import java.io.File import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt index 751195432d..b1c903e96e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt @@ -39,6 +39,7 @@ import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.Config import info.nightscout.interfaces.maintenance.ImportExportPrefs +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefFileNotFoundError import info.nightscout.interfaces.maintenance.PrefIOError import info.nightscout.interfaces.maintenance.PrefMetadata diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt index ed15820b72..8285c96d07 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt @@ -9,6 +9,7 @@ import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.R import info.nightscout.interfaces.Config import info.nightscout.interfaces.logging.LoggerUtils +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt index 90658f69df..7dae1122ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt @@ -20,8 +20,8 @@ import info.nightscout.androidaps.databinding.OverviewQuickwizardlistActivityBin import info.nightscout.androidaps.databinding.OverviewQuickwizardlistItemBinding import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.core.ui.dialogs.OKDialog +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.wizard.QuickWizard import info.nightscout.core.wizard.QuickWizardEntry diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index 8265235390..f2a88ca045 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -8,21 +8,21 @@ import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danars.DanaRSPlugin +import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.androidaps.insight.database.InsightDatabaseDao import info.nightscout.androidaps.insight.database.InsightDbHelper -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin -import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Objectives +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt index 1cb99a8312..141aa14003 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt @@ -5,6 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.Config import info.nightscout.interfaces.logging.LoggerUtils +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP diff --git a/core/core-main/build.gradle b/core/core-main/build.gradle index 098f8f72fb..3f6a2adf58 100644 --- a/core/core-main/build.gradle +++ b/core/core-main/build.gradle @@ -34,10 +34,6 @@ dependencies { api "com.google.dagger:dagger-android:$dagger_version" api "com.google.dagger:dagger-android-support:$dagger_version" - //CryptoUtil - api 'com.madgag.spongycastle:core:1.58.0.0' - api "com.google.crypto.tink:tink-android:$tink_version" - //WorkManager api "androidx.work:work-runtime:$work_version" // DataWorkerStorage } diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt index 767ac658ef..0b910055bc 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt @@ -11,12 +11,12 @@ import androidx.fragment.app.FragmentActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import dagger.android.support.DaggerAppCompatActivity -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract import info.nightscout.core.main.R import info.nightscout.core.main.databinding.MaintenanceImportListActivityBinding import info.nightscout.core.main.databinding.MaintenanceImportListItemBinding import info.nightscout.interfaces.locale.LocaleHelper +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefsFile import info.nightscout.interfaces.maintenance.PrefsMetadataKey import info.nightscout.interfaces.maintenance.PrefsStatus diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt index 3df1361adc..b27d306022 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.maintenance.formats -import info.nightscout.androidaps.utils.CryptoUtil import info.nightscout.core.main.R +import info.nightscout.core.utils.CryptoUtil import info.nightscout.core.utils.hexStringToByteArray import info.nightscout.core.utils.toHex import info.nightscout.interfaces.maintenance.PrefFileNotFoundError diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt index ff1af870d2..e73d6ed9cc 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt @@ -12,10 +12,10 @@ import android.widget.EditText import android.widget.TextView import androidx.annotation.StringRes import com.google.android.material.dialog.MaterialAlertDialogBuilder -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider -import info.nightscout.androidaps.utils.CryptoUtil import info.nightscout.core.main.R import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.CryptoUtil +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.shared.sharedPreferences.SP import java.io.File diff --git a/core/core-main/src/main/java/info/nightscout/core/di/PreferencesModule.kt b/core/core-main/src/main/java/info/nightscout/core/di/PreferencesModule.kt index 08c20d4822..a98f055262 100644 --- a/core/core-main/src/main/java/info/nightscout/core/di/PreferencesModule.kt +++ b/core/core-main/src/main/java/info/nightscout/core/di/PreferencesModule.kt @@ -2,9 +2,9 @@ package info.nightscout.core.di import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat -import info.nightscout.androidaps.utils.CryptoUtil +import info.nightscout.core.utils.CryptoUtil +import info.nightscout.interfaces.maintenance.PrefFileListProvider @Module @Suppress("unused") diff --git a/core/core-main/src/main/res/values/strings.xml b/core/core-main/src/main/res/values/strings.xml index 608871521a..c138750f01 100644 --- a/core/core-main/src/main/res/values/strings.xml +++ b/core/core-main/src/main/res/values/strings.xml @@ -479,11 +479,6 @@ %1$.0f%% Basal Basal % - %1$d selected - Sort - Remove Items - Sort Items - Remove Selected Items file user diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt index 63a1f3862f..4081d688a2 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.maintenance.formats import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.utils.CryptoUtil +import info.nightscout.core.utils.CryptoUtil import info.nightscout.interfaces.maintenance.PrefFormatError import info.nightscout.interfaces.maintenance.PrefMetadata import info.nightscout.interfaces.maintenance.Prefs diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt index 974b088041..8c1ae814e4 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.utils import info.nightscout.androidaps.TestBase +import info.nightscout.core.utils.CryptoUtil import org.hamcrest.CoreMatchers.containsString import org.hamcrest.CoreMatchers.not import org.junit.Assert diff --git a/core/utils/build.gradle b/core/utils/build.gradle index 6ddce702df..f29b5bea19 100644 --- a/core/utils/build.gradle +++ b/core/utils/build.gradle @@ -31,6 +31,10 @@ dependencies { // api 'com.google.firebase:firebase-auth-ktx' // api 'com.google.firebase:firebase-database-ktx' + //CryptoUtil + api 'com.madgag.spongycastle:core:1.58.0.0' + api "com.google.crypto.tink:tink-android:$tink_version" + //WorkManager api "androidx.work:work-runtime:$work_version" // DataWorkerStorage } \ No newline at end of file diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ActionModeHelper.kt b/core/utils/src/main/java/info/nightscout/core/utils/ActionModeHelper.kt similarity index 98% rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/ActionModeHelper.kt rename to core/utils/src/main/java/info/nightscout/core/utils/ActionModeHelper.kt index 01aafc2a4d..8de965d99e 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ActionModeHelper.kt +++ b/core/utils/src/main/java/info/nightscout/core/utils/ActionModeHelper.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.utils +package info.nightscout.core.utils import android.util.SparseArray import android.view.ActionMode @@ -7,8 +7,6 @@ import android.view.MenuInflater import android.view.MenuItem import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity -import info.nightscout.core.main.R - import info.nightscout.shared.interfaces.ResourceHelper class ActionModeHelper(val rh: ResourceHelper, val activity: FragmentActivity?, val fragment: Fragment?) { @@ -182,4 +180,4 @@ class ActionModeHelper(val rh: ResourceHelper, val activity: FragmentActivity } } -} +} \ No newline at end of file diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt b/core/utils/src/main/java/info/nightscout/core/utils/CryptoUtil.kt similarity index 98% rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt rename to core/utils/src/main/java/info/nightscout/core/utils/CryptoUtil.kt index 8b5c7727ca..d8a44d6c9f 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt +++ b/core/utils/src/main/java/info/nightscout/core/utils/CryptoUtil.kt @@ -1,6 +1,5 @@ -package info.nightscout.androidaps.utils +package info.nightscout.core.utils -import info.nightscout.core.utils.toHex import info.nightscout.rx.logging.AAPSLogger import org.spongycastle.util.encoders.Base64 import java.nio.ByteBuffer diff --git a/core/core-main/src/main/res/drawable/ic_sort.xml b/core/utils/src/main/res/drawable/ic_sort.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_sort.xml rename to core/utils/src/main/res/drawable/ic_sort.xml diff --git a/core/core-main/src/main/res/drawable/ic_trash.xml b/core/utils/src/main/res/drawable/ic_trash.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_trash.xml rename to core/utils/src/main/res/drawable/ic_trash.xml diff --git a/core/core-main/src/main/res/menu/menu_actions.xml b/core/utils/src/main/res/menu/menu_actions.xml similarity index 100% rename from core/core-main/src/main/res/menu/menu_actions.xml rename to core/utils/src/main/res/menu/menu_actions.xml diff --git a/core/core-main/src/main/res/menu/menu_delete_selection.xml b/core/utils/src/main/res/menu/menu_delete_selection.xml similarity index 100% rename from core/core-main/src/main/res/menu/menu_delete_selection.xml rename to core/utils/src/main/res/menu/menu_delete_selection.xml diff --git a/core/utils/src/main/res/values/strings.xml b/core/utils/src/main/res/values/strings.xml new file mode 100644 index 0000000000..246de562c5 --- /dev/null +++ b/core/utils/src/main/res/values/strings.xml @@ -0,0 +1,9 @@ + + + %1$d selected + Remove Items + Sort Items + Remove Selected Items + Sort + + \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt index cb2f107b8e..ed7319efbb 100644 --- a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt +++ b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt @@ -1,19 +1,25 @@ package info.nightscout.implementation.di import android.content.Context +import dagger.Lazy import dagger.Module import dagger.Provides -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider +import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils +import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.HardLimitsImpl import info.nightscout.implementation.logging.LoggerUtilsImpl +import info.nightscout.implementation.maintenance.PrefFileListProviderImpl import info.nightscout.implementation.profiling.ProfilerImpl import info.nightscout.implementation.pump.WarnColorsImpl import info.nightscout.implementation.resources.ResourceHelperImpl +import info.nightscout.interfaces.Config import info.nightscout.interfaces.logging.LoggerUtils +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.profiling.Profiler import info.nightscout.interfaces.pump.WarnColors +import info.nightscout.interfaces.storage.Storage import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger @@ -51,4 +57,15 @@ open class ImplementationModule { @Provides @Singleton fun provideLoggerUtils(prefFileListProvider: PrefFileListProvider): LoggerUtils = LoggerUtilsImpl(prefFileListProvider) + + @Provides + @Singleton + fun providePrefFileListProvider( + rh: ResourceHelper, + config: Lazy, + encryptedPrefsFormat: EncryptedPrefsFormat, + storage: Storage, + versionCheckerUtils: VersionCheckerUtils, + context: Context + ): PrefFileListProvider = PrefFileListProviderImpl(rh, config, encryptedPrefsFormat, storage, versionCheckerUtils, context) } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/logging/LoggerUtilsImpl.kt b/implementation/src/main/java/info/nightscout/implementation/logging/LoggerUtilsImpl.kt index bba76296dc..2a2b350e06 100644 --- a/implementation/src/main/java/info/nightscout/implementation/logging/LoggerUtilsImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/logging/LoggerUtilsImpl.kt @@ -2,8 +2,8 @@ package info.nightscout.implementation.logging import dagger.Reusable import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import info.nightscout.interfaces.logging.LoggerUtils +import info.nightscout.interfaces.maintenance.PrefFileListProvider import javax.inject.Inject /** diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt b/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt similarity index 90% rename from core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt rename to implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt index 0693614551..9db657a70d 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt +++ b/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.maintenance +package info.nightscout.implementation.maintenance import android.content.Context import android.os.Environment @@ -8,6 +8,7 @@ import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionChec import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat import info.nightscout.core.main.R import info.nightscout.interfaces.Config +import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefMetadata import info.nightscout.interfaces.maintenance.PrefMetadataMap import info.nightscout.interfaces.maintenance.PrefsFile @@ -29,20 +30,20 @@ import kotlin.math.abs @Suppress("SpellCheckingInspection") @OpenForTesting @Singleton -class PrefFileListProvider @Inject constructor( +class PrefFileListProviderImpl @Inject constructor( private val rh: ResourceHelper, private val config: Lazy, private val encryptedPrefsFormat: EncryptedPrefsFormat, private val storage: Storage, private val versionCheckerUtils: VersionCheckerUtils, context: Context -) { +) : PrefFileListProvider { private val path = File(Environment.getExternalStorageDirectory().toString()) private val aapsPath = File(path, "AAPS" + File.separator + "preferences") private val exportsPath = File(path, "AAPS" + File.separator + "exports") private val tempPath = File(path, "AAPS" + File.separator + "temp") private val extraPath = File(path, "AAPS" + File.separator + "extra") - val logsPath: String = File(path, "AAPS" + File.separator + "logs" + File.separator + context.packageName).absolutePath + override val logsPath: String = File(path, "AAPS" + File.separator + "logs" + File.separator + context.packageName).absolutePath companion object { @@ -56,7 +57,7 @@ class PrefFileListProvider @Inject constructor( * - file name and extension * - predicted file contents */ - fun listPreferenceFiles(loadMetadata: Boolean = false): MutableList { + override fun listPreferenceFiles(loadMetadata: Boolean): MutableList { val prefFiles = mutableListOf() // searching rood dir for legacy files @@ -94,7 +95,7 @@ class PrefFileListProvider @Inject constructor( return checkMetadata(encryptedPrefsFormat.loadMetadata(contents)) } - fun ensureExportDirExists(): File { + override fun ensureExportDirExists(): File { if (!aapsPath.exists()) { aapsPath.mkdirs() } @@ -104,32 +105,32 @@ class PrefFileListProvider @Inject constructor( return exportsPath } - fun ensureTempDirExists(): File { + override fun ensureTempDirExists(): File { if (!tempPath.exists()) { tempPath.mkdirs() } return tempPath } - fun ensureExtraDirExists(): File { + override fun ensureExtraDirExists(): File { if (!extraPath.exists()) { extraPath.mkdirs() } return extraPath } - fun newExportFile(): File { + override fun newExportFile(): File { val timeLocal = LocalDateTime.now().toString(DateTimeFormat.forPattern("yyyy-MM-dd'_'HHmmss")) return File(aapsPath, timeLocal + "_" + config.get().FLAVOR + ".json") } - fun newExportCsvFile(): File { + override fun newExportCsvFile(): File { val timeLocal = LocalDateTime.now().toString(DateTimeFormat.forPattern("yyyy-MM-dd'_'HHmmss")) return File(exportsPath, timeLocal + "_UserEntry.csv") } // check metadata for known issues, change their status and add info with explanations - fun checkMetadata(metadata: Map): Map { + override fun checkMetadata(metadata: Map): Map { val meta = metadata.toMutableMap() meta[PrefsMetadataKey.AAPS_FLAVOUR]?.let { flavour -> @@ -182,7 +183,7 @@ class PrefFileListProvider @Inject constructor( return meta } - fun formatExportedAgo(utcTime: String): String { + override fun formatExportedAgo(utcTime: String): String { val refTime = DateTime.now() val itTime = DateTime.parse(utcTime) val days = Days.daysBetween(itTime, refTime).days diff --git a/interfaces/src/main/java/info/nightscout/interfaces/maintenance/PrefFileListProvider.kt b/interfaces/src/main/java/info/nightscout/interfaces/maintenance/PrefFileListProvider.kt new file mode 100644 index 0000000000..8bf0d497dd --- /dev/null +++ b/interfaces/src/main/java/info/nightscout/interfaces/maintenance/PrefFileListProvider.kt @@ -0,0 +1,16 @@ +package info.nightscout.interfaces.maintenance + +import java.io.File + +interface PrefFileListProvider { + + val logsPath: String + fun ensureTempDirExists(): File + fun ensureExportDirExists(): File + fun ensureExtraDirExists(): File + fun newExportFile(): File + fun newExportCsvFile(): File + fun listPreferenceFiles(loadMetadata: Boolean = false): MutableList + fun checkMetadata(metadata: Map): Map + fun formatExportedAgo(utcTime: String): String +} \ No newline at end of file diff --git a/plugins/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt b/plugins/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt index 7e3ff69478..2c35a55da0 100644 --- a/plugins/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt +++ b/plugins/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt @@ -24,7 +24,6 @@ import androidx.recyclerview.widget.RecyclerView import dagger.android.HasAndroidInjector import dagger.android.support.DaggerFragment import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.automation.databinding.AutomationEventItemBinding import info.nightscout.automation.databinding.AutomationFragmentBinding import info.nightscout.automation.dialogs.EditEventDialog @@ -32,6 +31,7 @@ import info.nightscout.automation.events.EventAutomationDataChanged import info.nightscout.automation.events.EventAutomationUpdateGui import info.nightscout.automation.triggers.TriggerConnector import info.nightscout.core.ui.dialogs.OKDialog +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources diff --git a/plugins/automation/src/main/res/values/strings.xml b/plugins/automation/src/main/res/values/strings.xml index cde299b865..e0a2068cd5 100644 --- a/plugins/automation/src/main/res/values/strings.xml +++ b/plugins/automation/src/main/res/values/strings.xml @@ -118,7 +118,6 @@ Remove selected items %1$d selected Are you sure you want to remove %1$d items - Sort System automation Run automations Add rule diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt index 03d6313407..201a449771 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt @@ -8,7 +8,6 @@ import android.provider.Settings import androidx.appcompat.app.AppCompatActivity import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.androidaps.utils.CryptoUtil import info.nightscout.configuration.R import info.nightscout.configuration.setupwizard.elements.SWBreak import info.nightscout.configuration.setupwizard.elements.SWButton @@ -23,6 +22,7 @@ import info.nightscout.configuration.setupwizard.elements.SWInfoText import info.nightscout.configuration.setupwizard.elements.SWPlugin import info.nightscout.configuration.setupwizard.elements.SWPreference import info.nightscout.configuration.setupwizard.elements.SWRadioButton +import info.nightscout.core.utils.CryptoUtil import info.nightscout.core.utils.isRunningTest import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.Config diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWEditEncryptedPassword.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWEditEncryptedPassword.kt index a23f37217c..008da5ee62 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWEditEncryptedPassword.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWEditEncryptedPassword.kt @@ -10,9 +10,9 @@ import android.widget.EditText import android.widget.LinearLayout import android.widget.TextView import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.utils.CryptoUtil import info.nightscout.configuration.R import info.nightscout.configuration.setupwizard.SWTextValidator +import info.nightscout.core.utils.CryptoUtil import info.nightscout.shared.extensions.toVisibility class SWEditEncryptedPassword(injector: HasAndroidInjector, private val cryptoUtil: CryptoUtil) : SWItem(injector, Type.STRING) { diff --git a/plugins/main/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt index 21c3617bc3..661723f2c3 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt @@ -18,8 +18,8 @@ import info.nightscout.androidaps.events.EventNewBG import info.nightscout.androidaps.extensions.directionToIcon import info.nightscout.androidaps.extensions.valueToUnitsString import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.core.ui.dialogs.OKDialog +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.GlucoseValue import info.nightscout.database.entities.UserEntry.Action diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt index 9a1a9d975c..ce401580d9 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt @@ -19,9 +19,9 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.events.EventNewHistoryData import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.BolusCalculatorResult diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt index 8f95aaa5ae..f0933471b4 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt @@ -15,10 +15,10 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import dagger.android.support.DaggerFragment import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.androidaps.utils.Translator import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.UserEntry.Action diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt index 25e779c2f5..2afd3a0655 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt @@ -18,9 +18,9 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.extensions.isInProgress import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.ExtendedBolus import info.nightscout.database.entities.UserEntry.Action diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt index be69abf1c7..86d9282604 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt @@ -21,9 +21,9 @@ import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged import info.nightscout.androidaps.events.EventNewHistoryData import info.nightscout.androidaps.extensions.getCustomizedName import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt index ecdeab5a01..75f4a1fa12 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt @@ -21,10 +21,10 @@ import info.nightscout.androidaps.extensions.friendlyDescription import info.nightscout.androidaps.extensions.highValueToUnitsToString import info.nightscout.androidaps.extensions.lowValueToUnitsToString import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.androidaps.utils.Translator import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry.Action diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt index 0feb98e3a5..e64945d921 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -19,9 +19,9 @@ import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.extensions.toStringFull import info.nightscout.androidaps.extensions.toTemporaryBasal import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.utils.ActionModeHelper import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils +import info.nightscout.core.utils.ActionModeHelper import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.entities.ExtendedBolus import info.nightscout.database.entities.TemporaryBasal