From 25cf63200897b1207b9e5ba9ad4249c084a7d1f9 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 27 Nov 2022 22:19:40 +0100 Subject: [PATCH] maintenance -> :core:configuration --- .../rx/events/EventDiaconnG8PumpLogReset.kt | 3 + app/src/main/AndroidManifest.xml | 4 +- .../nightscout/androidaps/MainActivity.kt | 4 +- .../activities/MyPreferenceFragment.kt | 4 +- .../activities/PreferencesActivity.kt | 2 +- .../androidaps/di/ActivitiesModule.kt | 6 +- .../nightscout/androidaps/di/AppComponent.kt | 1 - .../nightscout/androidaps/di/AppModule.kt | 3 - .../androidaps/di/FragmentsModule.kt | 2 +- .../androidaps/di/PluginsListModule.kt | 2 +- .../nightscout/androidaps/di/WorkersModule.kt | 12 ---- .../implementations/ActivityNamesImpl.kt | 4 +- .../androidaps/implementations/ConfigImpl.kt | 4 ++ .../androidaps/receivers/KeepAliveWorker.kt | 4 +- app/src/main/res/values/strings.xml | 40 ------------- .../interfaces/ConstraintsCheckerTest.kt | 12 +++- .../maintenance/MaintenancePluginTest.kt | 1 + core/core-main/build.gradle | 2 +- .../nightscout/core/di/CoreFragmentsModule.kt | 15 ----- .../info/nightscout/core/di/CoreModule.kt | 1 - .../nightscout/core/di/PreferencesModule.kt | 4 -- .../java/info/nightscout/interfaces/Config.kt | 4 ++ .../interfaces/db/PersistenceLayer.kt | 4 ++ .../interfaces/plugin/OwnDatabasePlugin.kt | 5 ++ .../nightscout/interfaces/ui/ActivityNames.kt | 1 + core/ui/src/main/res/values/strings.xml | 6 ++ core/utils/build.gradle | 2 +- .../implementation/db/PersistenceLayerImpl.kt | 4 ++ .../implementation/di/ImplementationModule.kt | 6 -- .../src/main/res/values/strings.xml | 3 - .../pump/insight/LocalInsightPlugin.java | 12 +++- plugins/aps/src/main/res/values/strings.xml | 1 - plugins/configuration/build.gradle | 5 ++ .../src/main/AndroidManifest.xml | 1 + .../configuration}/AndroidPermissionImpl.kt | 4 +- .../DaggerAppCompatActivityWithResult.kt | 4 +- .../activities/SingleFragmentActivity.kt | 5 +- .../configuration/di/ConfigurationModule.kt | 15 +++++ .../maintenance/ImportExportPrefsImpl.kt | 41 +++++++------- .../maintenance/MaintenanceFragment.kt | 37 +++++------- .../maintenance/MaintenancePlugin.kt | 17 +++--- .../maintenance/PrefFileListProviderImpl.kt | 6 +- .../maintenance/PrefsFileContract.kt | 7 +-- .../activities/LogSettingActivity.kt | 6 +- .../activities/PrefImportListActivity.kt | 8 +-- .../dialogs}/PrefImportSummaryDialog.kt | 6 +- .../formats/EncryptedPrefsFormat.kt | 2 +- .../setupwizard/SetupWizardActivity.kt | 2 +- .../main/res/drawable/ic_database_cleanup.xml | 0 .../src/main/res/drawable/ic_excel.xml | 0 .../main/res/drawable/ic_export_settings.xml | 0 .../src/main/res/drawable/ic_header_error.xml | 0 .../main/res/drawable/ic_header_export.xml | 30 +++++----- .../main/res/drawable/ic_header_import.xml | 0 .../src/main/res/drawable/ic_header_log.xml | 0 .../main/res/drawable/ic_import_settings.xml | 0 .../src/main/res/drawable/ic_log_delete.xml | 0 .../src/main/res/drawable/ic_log_settings.xml | 0 .../main/res/drawable/ic_reset_database.xml | 0 .../src/main/res/drawable/ic_send_log.xml | 0 .../main/res/layout/activity_logsetting.xml | 4 +- .../res/layout/activity_single_fragment.xml | 0 .../layout/dialog_alert_import_summary.xml | 0 .../res/layout/import_summary_details.xml | 0 .../main/res/layout/import_summary_item.xml | 0 .../src/main/res/layout/logsettings_item.xml | 0 .../main/res/layout/maintenance_fragment.xml | 2 +- .../maintenance_import_list_activity.xml | 2 +- .../layout/maintenance_import_list_item.xml | 0 .../main/res/menu/menu_single_fragment.xml | 0 .../src/main/res/values/strings.xml | 56 ++++++++++++++++++- .../src/main/res/xml/pref_maintenance.xml | 0 .../info/nightscout/androidaps/TestBase.kt | 39 +++++++++++++ .../formats/EncryptedPrefsFormatTest.kt | 2 +- .../formats/SingleStringStorage.kt | 2 +- plugins/main/build.gradle | 1 - plugins/main/src/main/res/values/strings.xml | 1 - plugins/openhumans/build.gradle | 1 - .../danaRKorean/DanaRKoreanPlugin.kt | 6 +- .../androidaps/danaRv2/DanaRv2Plugin.java | 6 +- .../androidaps/danar/AbstractDanaRPlugin.java | 14 ++++- .../androidaps/danar/DanaRPlugin.java | 6 +- .../plugins/pump/danaR/DanaRPluginTest.kt | 5 +- .../pump/danaRKorean/DanaRKoreanPluginTest.kt | 4 +- .../plugins/pump/danaRv2/DanaRv2PluginTest.kt | 4 +- .../nightscout/pump/danars/DanaRSPlugin.kt | 9 ++- .../pump/danars/DanaRSPluginTest.kt | 5 +- .../DanaRsPacketBolusSetStepBolusStartTest.kt | 5 +- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 7 ++- .../pump/diaconn/DiaconnG8Plugin.kt | 9 ++- .../events/EventDiaconnG8PumpLogReset.kt | 5 -- .../omnipod/dash/OmnipodDashPumpPlugin.kt | 9 ++- .../omnipod/eros/OmnipodErosPumpPlugin.java | 12 +++- .../omnipod/eros/OmnipodErosPumpPluginTest.kt | 4 +- ui/src/main/AndroidManifest.xml | 4 +- ui/src/main/res/values/strings.xml | 12 ---- 96 files changed, 353 insertions(+), 257 deletions(-) create mode 100644 app-wear-shared/shared/src/main/java/info/nightscout/rx/events/EventDiaconnG8PumpLogReset.kt delete mode 100644 app/src/main/java/info/nightscout/androidaps/di/WorkersModule.kt delete mode 100644 core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt create mode 100644 core/interfaces/src/main/java/info/nightscout/interfaces/plugin/OwnDatabasePlugin.kt rename {implementation/src/main/java/info/nightscout/implementation => plugins/configuration/src/main/java/info/nightscout/configuration}/AndroidPermissionImpl.kt (98%) rename {core/core-main/src/main/java/info/nightscout/core => plugins/configuration/src/main/java/info/nightscout/configuration}/activities/DaggerAppCompatActivityWithResult.kt (96%) rename {ui/src/main/java/info/nightscout/ui => plugins/configuration/src/main/java/info/nightscout/configuration}/activities/SingleFragmentActivity.kt (94%) rename {app/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/ImportExportPrefsImpl.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/MaintenanceFragment.kt (84%) rename {app/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/MaintenancePlugin.kt (93%) rename {implementation/src/main/java/info/nightscout/implementation => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/PrefFileListProviderImpl.kt (98%) rename {core/core-main/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/PrefsFileContract.kt (84%) rename {app/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/activities/LogSettingActivity.kt (90%) rename {core/core-main/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/activities/PrefImportListActivity.kt (94%) rename {ui/src/main/java/info/nightscout/ui/alertDialogs => plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/dialogs}/PrefImportSummaryDialog.kt (98%) rename {core/core-main/src/main/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/main/java/info/nightscout/configuration}/maintenance/formats/EncryptedPrefsFormat.kt (99%) rename {app => plugins/configuration}/src/main/res/drawable/ic_database_cleanup.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_excel.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_export_settings.xml (100%) rename {ui => plugins/configuration}/src/main/res/drawable/ic_header_error.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_header_export.xml (97%) rename {ui => plugins/configuration}/src/main/res/drawable/ic_header_import.xml (100%) rename {ui => plugins/configuration}/src/main/res/drawable/ic_header_log.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_import_settings.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_log_delete.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_log_settings.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_reset_database.xml (100%) rename {app => plugins/configuration}/src/main/res/drawable/ic_send_log.xml (100%) rename {app => plugins/configuration}/src/main/res/layout/activity_logsetting.xml (95%) rename {ui => plugins/configuration}/src/main/res/layout/activity_single_fragment.xml (100%) rename {ui => plugins/configuration}/src/main/res/layout/dialog_alert_import_summary.xml (100%) rename {ui => plugins/configuration}/src/main/res/layout/import_summary_details.xml (100%) rename {ui => plugins/configuration}/src/main/res/layout/import_summary_item.xml (100%) rename {app => plugins/configuration}/src/main/res/layout/logsettings_item.xml (100%) rename {app => plugins/configuration}/src/main/res/layout/maintenance_fragment.xml (99%) rename {core/core-main => plugins/configuration}/src/main/res/layout/maintenance_import_list_activity.xml (85%) rename {core/core-main => plugins/configuration}/src/main/res/layout/maintenance_import_list_item.xml (100%) rename {ui => plugins/configuration}/src/main/res/menu/menu_single_fragment.xml (100%) rename {app => plugins/configuration}/src/main/res/xml/pref_maintenance.xml (100%) create mode 100644 plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt rename {core/core-main/src/test/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/test/java/info/nightscout/configuration}/maintenance/formats/EncryptedPrefsFormatTest.kt (99%) rename {core/core-main/src/test/java/info/nightscout/androidaps/plugins/general => plugins/configuration/src/test/java/info/nightscout/configuration}/maintenance/formats/SingleStringStorage.kt (84%) delete mode 100644 pump/diaconn/src/main/java/info/nightscout/pump/diaconn/events/EventDiaconnG8PumpLogReset.kt diff --git a/app-wear-shared/shared/src/main/java/info/nightscout/rx/events/EventDiaconnG8PumpLogReset.kt b/app-wear-shared/shared/src/main/java/info/nightscout/rx/events/EventDiaconnG8PumpLogReset.kt new file mode 100644 index 0000000000..410809ba6d --- /dev/null +++ b/app-wear-shared/shared/src/main/java/info/nightscout/rx/events/EventDiaconnG8PumpLogReset.kt @@ -0,0 +1,3 @@ +package info.nightscout.rx.events + +class EventDiaconnG8PumpLogReset : Event() \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f1d5a55e90..e063fd25dc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -70,7 +70,7 @@ android:exported="false" android:theme="@style/AppTheme"/> diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index abcb6f8dad..787b53a582 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -33,8 +33,9 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.databinding.ActivityMainBinding +import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult +import info.nightscout.configuration.activities.SingleFragmentActivity import info.nightscout.configuration.setupwizard.SetupWizardActivity -import info.nightscout.core.activities.DaggerAppCompatActivityWithResult import info.nightscout.core.ui.UIRunnable import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.locale.LocaleHelper @@ -67,7 +68,6 @@ import info.nightscout.rx.events.EventRebuildTabs import info.nightscout.rx.logging.LTag import info.nightscout.shared.sharedPreferences.SP import info.nightscout.ui.activities.ProfileHelperActivity -import info.nightscout.ui.activities.SingleFragmentActivity import info.nightscout.ui.activities.StatsActivity import info.nightscout.ui.activities.TreatmentsActivity import info.nightscout.ui.tabs.TabPageAdapter diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index a7832cbe91..88904de1f9 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -21,14 +21,15 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin -import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.automation.AutomationPlugin +import info.nightscout.configuration.maintenance.MaintenancePlugin import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.implementation.plugin.PluginStore import info.nightscout.interfaces.Config +import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction @@ -53,7 +54,6 @@ import info.nightscout.plugins.source.IntelligoPlugin import info.nightscout.plugins.source.PoctechPlugin import info.nightscout.plugins.source.TomatoPlugin import info.nightscout.plugins.sync.nsclient.NSClientPlugin -import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin import info.nightscout.plugins.sync.tidepool.TidepoolPlugin import info.nightscout.pump.combo.ComboPlugin diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt index 81d881e921..ddcf04344d 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt @@ -9,7 +9,7 @@ import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceScreen import info.nightscout.androidaps.R import info.nightscout.androidaps.databinding.ActivityPreferencesBinding -import info.nightscout.core.activities.DaggerAppCompatActivityWithResult +import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult import info.nightscout.core.ui.locale.LocaleHelper class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragmentCompat.OnPreferenceStartScreenCallback { diff --git a/app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt b/app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt index c0cc0dffe0..5d538365f6 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt @@ -5,8 +5,8 @@ import dagger.android.ContributesAndroidInjector import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.PreferencesActivity -import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity -import info.nightscout.ui.activities.SingleFragmentActivity +import info.nightscout.configuration.activities.SingleFragmentActivity +import info.nightscout.configuration.maintenance.activities.LogSettingActivity @Module @Suppress("unused") @@ -14,7 +14,7 @@ abstract class ActivitiesModule { @ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity @ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity - @ContributesAndroidInjector abstract fun contributeMainActivity(): MainActivity + @ContributesAndroidInjector abstract fun contributesMainActivity(): MainActivity @ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity @ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt index d352da9521..405b3641f7 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt @@ -47,7 +47,6 @@ import javax.inject.Singleton ReceiversModule::class, ServicesModule::class, WorkflowModule::class, - WorkersModule::class, // Gradle modules AutomationModule::class, diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt index be04c3d699..cea2d4d6b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt @@ -9,11 +9,9 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.implementations.ActivityNamesImpl import info.nightscout.androidaps.implementations.ConfigImpl -import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl import info.nightscout.androidaps.workflow.CalculationWorkflowImpl import info.nightscout.core.workflow.CalculationWorkflow import info.nightscout.interfaces.Config -import info.nightscout.interfaces.maintenance.ImportExportPrefs import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.ui.ActivityNames @@ -50,7 +48,6 @@ open class AppModule { @Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector @Binds fun bindConfigInterface(config: ConfigImpl): Config - @Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs @Binds fun bindActivityNamesInterface(activityNames: ActivityNamesImpl): ActivityNames @Binds fun bindCalculationWorkflowInterface(calculationWorkflow: CalculationWorkflowImpl): CalculationWorkflow } diff --git a/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt index 3216f2e6c2..d0e8fd0d67 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.di import dagger.Module import dagger.android.ContributesAndroidInjector import info.nightscout.androidaps.activities.MyPreferenceFragment -import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment +import info.nightscout.configuration.maintenance.MaintenanceFragment @Module @Suppress("unused") diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt index c9cdca5e6f..6a16ac7f92 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin -import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin @@ -17,6 +16,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugi import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin import info.nightscout.automation.AutomationPlugin import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin +import info.nightscout.configuration.maintenance.MaintenancePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.plugins.aps.loop.LoopPlugin import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin diff --git a/app/src/main/java/info/nightscout/androidaps/di/WorkersModule.kt b/app/src/main/java/info/nightscout/androidaps/di/WorkersModule.kt deleted file mode 100644 index bef97b4c04..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/di/WorkersModule.kt +++ /dev/null @@ -1,12 +0,0 @@ -package info.nightscout.androidaps.di - -import dagger.Module -import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl - -@Module -@Suppress("unused") -abstract class WorkersModule { - - @ContributesAndroidInjector abstract fun contributesCsvExportWorker(): ImportExportPrefsImpl.CsvExportWorker -} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt index cc22166bd2..84daab1543 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt @@ -7,17 +7,18 @@ import androidx.annotation.RawRes import androidx.annotation.StringRes import androidx.fragment.app.FragmentManager import info.nightscout.androidaps.MainActivity +import info.nightscout.androidaps.R import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.MyPreferenceFragment import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.services.AlarmSoundService +import info.nightscout.configuration.activities.SingleFragmentActivity import info.nightscout.core.events.EventNewNotification import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.rx.bus.RxBus import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity -import info.nightscout.ui.activities.SingleFragmentActivity import info.nightscout.ui.activities.TDDStatsActivity import info.nightscout.ui.dialogs.BolusProgressDialog import info.nightscout.ui.dialogs.CalibrationDialog @@ -47,6 +48,7 @@ class ActivityNamesImpl @Inject constructor( override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java override val preferencesActivity: Class<*> = PreferencesActivity::class.java override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java + override val prefGeneral: Int = R.xml.pref_general override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) { val i = Intent(ctx, errorHelperActivity) 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 2bfcd2b441..41e1798d64 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt @@ -22,6 +22,10 @@ class ConfigImpl @Inject constructor( override val FLAVOR = BuildConfig.FLAVOR override val VERSION_NAME = BuildConfig.VERSION_NAME override val BUILD_VERSION = BuildConfig.BUILDVERSION + override val REMOTE: String = BuildConfig.REMOTE + override val BUILD_TYPE: String = BuildConfig.BUILD_TYPE + override val VERSION: String = BuildConfig.VERSION + override val APPLICATION_ID: String = BuildConfig.APPLICATION_ID override val DEBUG = BuildConfig.DEBUG override val currentDeviceModelString = diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt index 34c0bbb41b..e9d0bbf244 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt @@ -14,7 +14,7 @@ import com.google.common.util.concurrent.ListenableFuture import dagger.android.HasAndroidInjector import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.R -import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin +import info.nightscout.configuration.maintenance.MaintenancePlugin import info.nightscout.core.profile.ProfileSealed import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.receivers.ReceiverStatusStore @@ -22,13 +22,13 @@ import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Config import info.nightscout.interfaces.LocalAlertUtils import info.nightscout.interfaces.aps.Loop +import info.nightscout.interfaces.configBuilder.RunningConfiguration import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.configBuilder.RunningConfiguration import info.nightscout.plugins.sync.nsclient.extensions.buildDeviceStatus import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventProfileSwitchChanged diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 90ca32b6ab..3ee9ac7488 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,31 +32,12 @@ protection last_cleanup_run %1$s Preferences - Preferences Refresh treatments from NS - Reset Databases - Do you really want to reset the databases? Exit Shows an ongoing notification with a short overview of what your loop is doing Delta Profile - Nightscout version: - Preferences exported - User Entries exported - Export settings to - Import settings from - Settings imported - File not found - Export settings Language - You will be asked for master password, which will be used to encrypt exported preferences. - Export canceled! Preferences were NOT exported! - Import canceled! Preferences were NOT imported! - Cannot import preferences! - Please go back to main screen and try again. - Old Master Password - This file was exported and encrypted with different master password. Provide old master password to decrypt file. - As a result of successful import current master password WILL BE REPLACED with that old master password! Save Reload profile Corr @@ -65,7 +46,6 @@ Wear Ongoing Notification OLD DATA - Exiting application to apply settings. About Missing phone state permission Alarm options @@ -87,29 +67,13 @@ Alert if pump is unreachable Pump unreachable threshold [min] Alert if carbs are required - Engineering mode enabled Open navigation Close navigation Remove items Sort items Treatment data incomplete - Maintenance Settings - Email recipient - maintenance_logs_email - maintenance_logs_amount - logshipper_amount - No of Logs to send - Maintenance - MAINT - Provides several functions for maintenance (eg. log sending, log deletion). - Send Logs by Email - Delete Logs A treatment (insulin: %1$.2f, carbs: %2$d, at: %3$s) could not be added to treatments. Please check and manually add a record as appropriate. eCarbs: %1$d g (%2$d h), delay: %3$d m - Log files - Miscellaneous - Log settings - Reset to defaults == ∑ %1$s U Units Show removed @@ -133,8 +97,4 @@ Sort Search - Database cleanup - Do you want to cleanup the database?\nIt will remove tracked changes and historic data older than 3 months. - Cleared entries - 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 29297f1052..9b945ec827 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -7,6 +7,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.implementations.ConfigImpl +import info.nightscout.androidaps.insight.database.InsightDatabase import info.nightscout.androidaps.insight.database.InsightDatabaseDao import info.nightscout.androidaps.insight.database.InsightDbHelper import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider @@ -41,6 +42,7 @@ import info.nightscout.plugins.source.GlimpPlugin import info.nightscout.pump.combo.ComboPlugin import info.nightscout.pump.combo.ruffyscripter.RuffyScripter import info.nightscout.pump.dana.DanaPump +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -68,6 +70,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var ruffyScripter: RuffyScripter @Mock lateinit var activityNames: ActivityNames @Mock lateinit var profileInstantiator: ProfileInstantiator + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase + @Mock lateinit var insightDatabase: InsightDatabase private lateinit var hardLimits: HardLimits private lateinit var danaPump: DanaPump @@ -139,7 +143,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config) comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames) - danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames) + danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, + activityNames, danaHistoryDatabase) danaRSPlugin = info.nightscout.pump.danars.DanaRSPlugin( injector, @@ -158,9 +163,10 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames + activityNames, + danaHistoryDatabase ) - insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, config, dateUtil, insightDbHelper, pumpSync) + insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, config, dateUtil, insightDbHelper, pumpSync, insightDatabase) openAPSSMBPlugin = OpenAPSSMBPlugin( injector, 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 8fecb66b48..f064ebe410 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 @@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.maintenance import android.content.Context import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase +import info.nightscout.configuration.maintenance.MaintenancePlugin import info.nightscout.interfaces.Config import info.nightscout.interfaces.logging.LoggerUtils import info.nightscout.interfaces.maintenance.PrefFileListProvider diff --git a/core/core-main/build.gradle b/core/core-main/build.gradle index 4506e7aa0a..683564ce67 100644 --- a/core/core-main/build.gradle +++ b/core/core-main/build.gradle @@ -32,7 +32,7 @@ dependencies { api "com.google.dagger:dagger-android-support:$dagger_version" //WorkManager - api "androidx.work:work-runtime:$work_version" // DataWorkerStorage + api "androidx.work:work-runtime-ktx:$work_version" // DataWorkerStorage } android { diff --git a/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt b/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt deleted file mode 100644 index 659912b7b5..0000000000 --- a/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt +++ /dev/null @@ -1,15 +0,0 @@ -package info.nightscout.core.di - -import dagger.Module -import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity -import info.nightscout.core.ui.elements.SingleClickButton - -@Module -@Suppress("unused") -abstract class CoreFragmentsModule { - - @ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity - @ContributesAndroidInjector abstract fun contributesSingleClickButton(): SingleClickButton - -} diff --git a/core/core-main/src/main/java/info/nightscout/core/di/CoreModule.kt b/core/core-main/src/main/java/info/nightscout/core/di/CoreModule.kt index 3566548b78..1b980e7d20 100644 --- a/core/core-main/src/main/java/info/nightscout/core/di/CoreModule.kt +++ b/core/core-main/src/main/java/info/nightscout/core/di/CoreModule.kt @@ -9,7 +9,6 @@ import dagger.Provides @Module( includes = [ CoreReceiversModule::class, - CoreFragmentsModule::class, CoreDataClassesModule::class, PreferencesModule::class ] 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 a98f055262..06a4fe6856 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,15 +2,11 @@ package info.nightscout.core.di import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat import info.nightscout.core.utils.CryptoUtil -import info.nightscout.interfaces.maintenance.PrefFileListProvider @Module @Suppress("unused") abstract class PreferencesModule { @ContributesAndroidInjector abstract fun cryptoUtilInjector(): CryptoUtil - @ContributesAndroidInjector abstract fun encryptedPrefsFormatInjector(): EncryptedPrefsFormat - @ContributesAndroidInjector abstract fun prefImportListProviderInjector(): PrefFileListProvider } \ No newline at end of file diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/Config.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/Config.kt index 9792306a0b..5abe15d207 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/Config.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/Config.kt @@ -10,6 +10,10 @@ interface Config { val FLAVOR: String val VERSION_NAME: String val BUILD_VERSION: String + val REMOTE: String + val BUILD_TYPE: String + val VERSION: String + val APPLICATION_ID: String val DEBUG: Boolean val currentDeviceModelString : String val appName: Int diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/db/PersistenceLayer.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/db/PersistenceLayer.kt index 216384ce5a..6e79d87efb 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/db/PersistenceLayer.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/db/PersistenceLayer.kt @@ -6,14 +6,18 @@ import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.Carbs import info.nightscout.database.entities.TemporaryTarget +import info.nightscout.database.entities.UserEntry import info.nightscout.interfaces.queue.Callback import io.reactivex.rxjava3.core.Single interface PersistenceLayer { + fun clearDatabases() + fun cleanupDatabase(keepDays: Long, deleteTrackedChanges: Boolean): String fun insertOrUpdate(bolusCalculatorResult: BolusCalculatorResult) fun insertOrUpdateCarbs(carbs: Carbs, callback: Callback? = null, injector: HasAndroidInjector? = null) fun insertOrUpdateBolus(bolus: Bolus) fun getTemporaryTargetActiveAt(timestamp: Long): Single> + fun getUserEntryFilteredDataFromTime(timestamp: Long): Single> } \ No newline at end of file diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/OwnDatabasePlugin.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/OwnDatabasePlugin.kt new file mode 100644 index 0000000000..9b7f194bf4 --- /dev/null +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/OwnDatabasePlugin.kt @@ -0,0 +1,5 @@ +package info.nightscout.interfaces.plugin + +interface OwnDatabasePlugin { + fun clearAllTables() +} \ No newline at end of file diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt index e3494f5c70..8dcd6c92df 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt @@ -20,6 +20,7 @@ interface ActivityNames { val preferencesActivity: Class<*> val myPreferenceFragment: Class<*> + val prefGeneral: Int /** * Show ErrorHelperActivity and start alarm * @param ctx Context diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index 5c8de724c8..f3adc1711c 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -29,6 +29,9 @@ Superbolus Pump paused And + User + Result + Settings Battery @@ -106,4 +109,7 @@ Location Is Not Enabled For Bluetooth discovery to work on newer devices, location must be enabled. AAPS does not track your location and it can be disabled after pairing is successful. + + Plugin preferences + \ No newline at end of file diff --git a/core/utils/build.gradle b/core/utils/build.gradle index be34aea2e7..9247471617 100644 --- a/core/utils/build.gradle +++ b/core/utils/build.gradle @@ -35,5 +35,5 @@ dependencies { api "com.google.crypto.tink:tink-android:$tink_version" //WorkManager - api "androidx.work:work-runtime:$work_version" // DataWorkerStorage + api "androidx.work:work-runtime-ktx:$work_version" // DataWorkerStorage } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/db/PersistenceLayerImpl.kt b/implementation/src/main/java/info/nightscout/implementation/db/PersistenceLayerImpl.kt index b0523e3245..a66b479b59 100644 --- a/implementation/src/main/java/info/nightscout/implementation/db/PersistenceLayerImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/db/PersistenceLayerImpl.kt @@ -7,6 +7,7 @@ import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.Carbs import info.nightscout.database.entities.TemporaryTarget +import info.nightscout.database.entities.UserEntry import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InsertOrUpdateBolusCalculatorResultTransaction import info.nightscout.database.impl.transactions.InsertOrUpdateBolusTransaction @@ -28,6 +29,8 @@ class PersistenceLayerImpl @Inject constructor( ) : PersistenceLayer { private val disposable = CompositeDisposable() + override fun clearDatabases() = repository.clearDatabases() + override fun cleanupDatabase(keepDays: Long, deleteTrackedChanges: Boolean): String = cleanupDatabase(keepDays, deleteTrackedChanges) override fun insertOrUpdate(bolusCalculatorResult: BolusCalculatorResult) { disposable += repository.runTransactionForResult(InsertOrUpdateBolusCalculatorResultTransaction(bolusCalculatorResult)) @@ -64,4 +67,5 @@ class PersistenceLayerImpl @Inject constructor( } override fun getTemporaryTargetActiveAt(timestamp: Long): Single> = repository.getTemporaryTargetActiveAt(timestamp) + override fun getUserEntryFilteredDataFromTime(timestamp: Long): Single> = repository.getUserEntryFilteredDataFromTime(timestamp) } 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 3a0028bad3..4730f67994 100644 --- a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt +++ b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt @@ -4,7 +4,6 @@ import dagger.Binds import dagger.Module import dagger.android.ContributesAndroidInjector import info.nightscout.core.graph.OverviewData -import info.nightscout.implementation.AndroidPermissionImpl import info.nightscout.implementation.BolusTimerImpl import info.nightscout.implementation.CarbTimerImpl import info.nightscout.implementation.DefaultValueHelperImpl @@ -18,7 +17,6 @@ import info.nightscout.implementation.androidNotification.NotificationHolderImpl import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.implementation.db.PersistenceLayerImpl import info.nightscout.implementation.logging.LoggerUtilsImpl -import info.nightscout.implementation.maintenance.PrefFileListProviderImpl import info.nightscout.implementation.overview.OverviewDataImpl import info.nightscout.implementation.plugin.PluginStore import info.nightscout.implementation.profile.ProfileFunctionImpl @@ -39,7 +37,6 @@ import info.nightscout.implementation.stats.DexcomTirCalculatorImpl import info.nightscout.implementation.stats.TddCalculatorImpl import info.nightscout.implementation.stats.TirCalculatorImpl import info.nightscout.implementation.storage.FileStorage -import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.BolusTimer import info.nightscout.interfaces.CarbTimer import info.nightscout.interfaces.LocalAlertUtils @@ -50,7 +47,6 @@ import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.db.PersistenceLayer import info.nightscout.interfaces.logging.LoggerUtils import info.nightscout.interfaces.logging.UserEntryLogger -import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.DefaultValueHelper import info.nightscout.interfaces.profile.ProfileFunction @@ -88,7 +84,6 @@ abstract class ImplementationModule { interface Bindings { @Binds fun bindPersistenceLayer(persistenceLayerImpl: PersistenceLayerImpl): PersistenceLayer @Binds fun bindActivePlugin(pluginStore: PluginStore): ActivePlugin - @Binds fun bindPrefFileListProvider(prefFileListProviderImpl: PrefFileListProviderImpl): PrefFileListProvider @Binds fun bindOverviewData(overviewData: OverviewDataImpl): OverviewData @Binds fun bindUserEntryLogger(userEntryLoggerImpl: UserEntryLoggerImpl): UserEntryLogger @Binds fun bindDetailedBolusInfoStorage(detailedBolusInfoStorageImpl: DetailedBolusInfoStorageImpl): DetailedBolusInfoStorage @@ -113,7 +108,6 @@ abstract class ImplementationModule { @Binds fun bindXDripBroadcastInterface(xDripBroadcastImpl: XDripBroadcastImpl): XDripBroadcast @Binds fun bindCarbTimerInterface(carbTimer: CarbTimerImpl): CarbTimer @Binds fun bindBolusTimerInterface(bolusTimer: BolusTimerImpl): BolusTimer - @Binds fun bindAndroidPermissionInterface(androidPermission: AndroidPermissionImpl): AndroidPermission @Binds fun bindLocalAlertUtilsInterface(localAlertUtils: LocalAlertUtilsImpl): LocalAlertUtils @Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider @Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder diff --git a/implementation/src/main/res/values/strings.xml b/implementation/src/main/res/values/strings.xml index 2c7e59e60b..ed7c769853 100644 --- a/implementation/src/main/res/values/strings.xml +++ b/implementation/src/main/res/values/strings.xml @@ -10,10 +10,7 @@ Time to bolus!\nRun Bolus wizard and do calculation again. Command is executed right now Basal value below minimum. Profile not set! - Request Permission - Error asking for permissions - This device does not appear to support battery optimization whitelisting - you may experience performance issues. %1$s needs battery optimization whitelisting for proper performance Application needs location permission for BT scan and WiFi identification Application needs storage permission to be able store log files and export settings diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 942a30f996..f8a856b110 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -29,6 +29,7 @@ import javax.inject.Singleton; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.insight.R; import info.nightscout.androidaps.insight.database.InsightBolusID; +import info.nightscout.androidaps.insight.database.InsightDatabase; import info.nightscout.androidaps.insight.database.InsightDbHelper; import info.nightscout.androidaps.insight.database.InsightHistoryOffset; import info.nightscout.androidaps.insight.database.InsightPumpID; @@ -104,6 +105,7 @@ import info.nightscout.interfaces.Config; import info.nightscout.interfaces.constraints.Constraint; import info.nightscout.interfaces.constraints.Constraints; import info.nightscout.interfaces.notifications.Notification; +import info.nightscout.interfaces.plugin.OwnDatabasePlugin; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; import info.nightscout.interfaces.profile.Profile; @@ -132,7 +134,7 @@ import info.nightscout.shared.utils.DateUtil; import info.nightscout.shared.utils.T; @Singleton -public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, Constraints, +public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, Constraints, OwnDatabasePlugin, InsightConnectionService.StateCallback { private final AAPSLogger aapsLogger; @@ -145,6 +147,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, private final DateUtil dateUtil; private final InsightDbHelper insightDbHelper; private final PumpSync pumpSync; + private final InsightDatabase insightDatabase; public static final String ALERT_CHANNEL_ID = "AAPS-InsightAlert"; @@ -205,7 +208,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, Config config, DateUtil dateUtil, InsightDbHelper insightDbHelper, - PumpSync pumpSync + PumpSync pumpSync, + InsightDatabase insightDatabase ) { super(new PluginDescription() .pluginIcon(R.drawable.ic_insight_128) @@ -228,6 +232,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, this.dateUtil = dateUtil; this.insightDbHelper = insightDbHelper; this.pumpSync = pumpSync; + this.insightDatabase = insightDatabase; pumpDescription = new PumpDescription(); pumpDescription.fillFor(PumpType.ACCU_CHEK_INSIGHT); @@ -1646,4 +1651,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, return true; } + @Override public void clearAllTables() { + insightDatabase.clearAllTables(); + } } diff --git a/plugins/aps/src/main/res/values/strings.xml b/plugins/aps/src/main/res/values/strings.xml index a9df533db6..5fbd56a2d2 100644 --- a/plugins/aps/src/main/res/values/strings.xml +++ b/plugins/aps/src/main/res/values/strings.xml @@ -60,7 +60,6 @@ IOB data Profile Meal data - Result Request Constraints Autosens data diff --git a/plugins/configuration/build.gradle b/plugins/configuration/build.gradle index 5032f4a7d4..9907586569 100644 --- a/plugins/configuration/build.gradle +++ b/plugins/configuration/build.gradle @@ -20,8 +20,13 @@ dependencies { implementation project(':app-wear-shared:shared') implementation project(':database:entities') implementation project(':core:core-main') + implementation project(':core:graph') implementation project(':core:interfaces') implementation project(':core:ns-sdk') implementation project(':core:utils') implementation project(':core:ui') + //WorkManager + api "androidx.work:work-runtime-ktx:$work_version" + // Maintenance + api "androidx.gridlayout:gridlayout:$gridlayout_version" } \ No newline at end of file diff --git a/plugins/configuration/src/main/AndroidManifest.xml b/plugins/configuration/src/main/AndroidManifest.xml index 28271548b7..556b49f0c2 100644 --- a/plugins/configuration/src/main/AndroidManifest.xml +++ b/plugins/configuration/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ + var result = "" OKDialog.showConfirmation(activity, rh.gs(R.string.maintenance), rh.gs(R.string.cleanup_db_confirm), Runnable { - disposable += Completable.fromAction { result = repository.cleanupDatabase(93, deleteTrackedChanges = true) } + disposable += Completable.fromAction { result = persistenceLayer.cleanupDatabase(93, deleteTrackedChanges = true) } .subscribeOn(aapsSchedulers.io) .observeOn(aapsSchedulers.main) .subscribeBy( diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenancePlugin.kt similarity index 93% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenancePlugin.kt index 9b7383b6a7..8179b90877 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenancePlugin.kt @@ -1,19 +1,18 @@ -package info.nightscout.androidaps.plugins.general.maintenance +package info.nightscout.configuration.maintenance import android.content.Context import android.content.Intent import android.net.Uri import androidx.core.content.FileProvider import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.BuildConfig -import info.nightscout.androidaps.R +import info.nightscout.configuration.R import info.nightscout.interfaces.Config import info.nightscout.interfaces.logging.LoggerUtils import info.nightscout.interfaces.maintenance.PrefFileListProvider +import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP @@ -63,7 +62,7 @@ class MaintenancePlugin @Inject constructor( aapsLogger.debug("zipFile: ${zipFile.absolutePath}") val zip = zipLogs(zipFile, logs) val attachmentUri = - FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", zip) + FileProvider.getUriForFile(context, config.APPLICATION_ID + ".fileprovider", zip) val emailIntent: Intent = this.sendMail(attachmentUri, recipient, "Log Export") aapsLogger.debug("sending emailIntent") context.startActivity(emailIntent) @@ -185,11 +184,11 @@ class MaintenancePlugin @Inject constructor( builder.append("If you want to provide logs for event older than a few hours," + System.lineSeparator()) builder.append("you have to do it manually)" + System.lineSeparator()) builder.append("-------------------------------------------------------" + System.lineSeparator()) - builder.append(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION + System.lineSeparator()) + builder.append(rh.gs(config.appName) + " " + config.VERSION + System.lineSeparator()) if (config.NSCLIENT) builder.append("NSCLIENT" + System.lineSeparator()) - builder.append("Build: " + BuildConfig.BUILDVERSION + System.lineSeparator()) - builder.append("Remote: " + BuildConfig.REMOTE + System.lineSeparator()) - builder.append("Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + System.lineSeparator()) + builder.append("Build: " + config.BUILD_VERSION + System.lineSeparator()) + builder.append("Remote: " + config.REMOTE + System.lineSeparator()) + builder.append("Flavor: " + config.FLAVOR + config.BUILD_TYPE + System.lineSeparator()) builder.append(rh.gs(R.string.configbuilder_nightscoutversion_label) + " " + nsSettingsStatus.getVersion() + System.lineSeparator()) if (config.isEngineeringMode()) builder.append(rh.gs(R.string.engineering_mode_enabled)) return sendMail(attachmentUri, recipient, subject, builder.toString()) diff --git a/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/PrefFileListProviderImpl.kt similarity index 98% rename from implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/PrefFileListProviderImpl.kt index 09554293aa..6394ec32c5 100644 --- a/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/PrefFileListProviderImpl.kt @@ -1,13 +1,12 @@ -package info.nightscout.implementation.maintenance +package info.nightscout.configuration.maintenance import android.content.Context import android.os.Environment import dagger.Lazy import dagger.Reusable import info.nightscout.androidaps.annotations.OpenForTesting -import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat +import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat import info.nightscout.core.main.R -import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.interfaces.Config import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefMetadata @@ -17,6 +16,7 @@ import info.nightscout.interfaces.maintenance.PrefsImportDir import info.nightscout.interfaces.maintenance.PrefsMetadataKey import info.nightscout.interfaces.maintenance.PrefsStatus import info.nightscout.interfaces.storage.Storage +import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.shared.interfaces.ResourceHelper import org.joda.time.DateTime import org.joda.time.Days diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/PrefsFileContract.kt similarity index 84% rename from core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/PrefsFileContract.kt index 1b48a03b11..88f899bbc9 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/PrefsFileContract.kt @@ -1,10 +1,10 @@ -package info.nightscout.androidaps.plugins.general.maintenance +package info.nightscout.configuration.maintenance import android.content.Context import android.content.Intent import androidx.activity.result.contract.ActivityResultContract import androidx.fragment.app.FragmentActivity -import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity +import info.nightscout.configuration.maintenance.activities.PrefImportListActivity import info.nightscout.core.utils.extensions.safeGetParcelableExtra import info.nightscout.interfaces.maintenance.PrefsFile @@ -25,5 +25,4 @@ class PrefsFileContract : ActivityResultContract() { override fun createIntent(context: Context, input: Void?): Intent { return Intent(context, PrefImportListActivity::class.java) } -} - +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/activities/LogSettingActivity.kt similarity index 90% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/activities/LogSettingActivity.kt index 77a2e07f29..890dcff920 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/activities/LogSettingActivity.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.maintenance.activities +package info.nightscout.configuration.maintenance.activities import android.os.Bundle import android.view.View @@ -6,8 +6,8 @@ import android.widget.CheckBox import android.widget.LinearLayout import android.widget.TextView import dagger.android.support.DaggerAppCompatActivity -import info.nightscout.androidaps.R -import info.nightscout.androidaps.databinding.ActivityLogsettingBinding +import info.nightscout.configuration.R +import info.nightscout.configuration.databinding.ActivityLogsettingBinding import info.nightscout.rx.interfaces.L import info.nightscout.rx.interfaces.LogElement import javax.inject.Inject diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/activities/PrefImportListActivity.kt similarity index 94% rename from core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/activities/PrefImportListActivity.kt index 370ac37d06..04dcb54f17 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/activities/PrefImportListActivity.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.maintenance.activities +package info.nightscout.configuration.maintenance.activities import android.content.Context import android.content.Intent @@ -11,10 +11,10 @@ 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.PrefsFileContract +import info.nightscout.configuration.databinding.MaintenanceImportListActivityBinding +import info.nightscout.configuration.databinding.MaintenanceImportListItemBinding +import info.nightscout.configuration.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.core.ui.locale.LocaleHelper import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefsFile diff --git a/ui/src/main/java/info/nightscout/ui/alertDialogs/PrefImportSummaryDialog.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/dialogs/PrefImportSummaryDialog.kt similarity index 98% rename from ui/src/main/java/info/nightscout/ui/alertDialogs/PrefImportSummaryDialog.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/dialogs/PrefImportSummaryDialog.kt index b0a003b169..fc2883e7c0 100644 --- a/ui/src/main/java/info/nightscout/ui/alertDialogs/PrefImportSummaryDialog.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/dialogs/PrefImportSummaryDialog.kt @@ -1,4 +1,4 @@ -package info.nightscout.ui.alertDialogs +package info.nightscout.configuration.maintenance.dialogs import android.annotation.SuppressLint import android.content.Context @@ -17,11 +17,11 @@ import androidx.annotation.StringRes import androidx.annotation.StyleRes import androidx.appcompat.view.ContextThemeWrapper import com.google.android.material.dialog.MaterialAlertDialogBuilder +import info.nightscout.configuration.R import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.interfaces.maintenance.Prefs import info.nightscout.interfaces.maintenance.PrefsStatus import info.nightscout.shared.extensions.runOnUiThread -import info.nightscout.ui.R import java.util.LinkedList object PrefImportSummaryDialog { @@ -136,4 +136,4 @@ object PrefImportSummaryDialog { dialog.setCanceledOnTouchOutside(false) } -} +} \ No newline at end of file diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormat.kt similarity index 99% rename from core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt rename to plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormat.kt index b27d306022..407b641cce 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormat.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.maintenance.formats +package info.nightscout.configuration.maintenance.formats import info.nightscout.core.main.R import info.nightscout.core.utils.CryptoUtil diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt index e064033d0f..9935cc5ce7 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt @@ -6,9 +6,9 @@ import android.view.View import android.widget.TextView import dagger.android.HasAndroidInjector import info.nightscout.configuration.R +import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult import info.nightscout.configuration.databinding.ActivitySetupwizardBinding import info.nightscout.configuration.setupwizard.elements.SWItem -import info.nightscout.core.activities.DaggerAppCompatActivityWithResult import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.locale.LocaleHelper.update import info.nightscout.core.utils.fabric.FabricPrivacy diff --git a/app/src/main/res/drawable/ic_database_cleanup.xml b/plugins/configuration/src/main/res/drawable/ic_database_cleanup.xml similarity index 100% rename from app/src/main/res/drawable/ic_database_cleanup.xml rename to plugins/configuration/src/main/res/drawable/ic_database_cleanup.xml diff --git a/app/src/main/res/drawable/ic_excel.xml b/plugins/configuration/src/main/res/drawable/ic_excel.xml similarity index 100% rename from app/src/main/res/drawable/ic_excel.xml rename to plugins/configuration/src/main/res/drawable/ic_excel.xml diff --git a/app/src/main/res/drawable/ic_export_settings.xml b/plugins/configuration/src/main/res/drawable/ic_export_settings.xml similarity index 100% rename from app/src/main/res/drawable/ic_export_settings.xml rename to plugins/configuration/src/main/res/drawable/ic_export_settings.xml diff --git a/ui/src/main/res/drawable/ic_header_error.xml b/plugins/configuration/src/main/res/drawable/ic_header_error.xml similarity index 100% rename from ui/src/main/res/drawable/ic_header_error.xml rename to plugins/configuration/src/main/res/drawable/ic_header_error.xml diff --git a/app/src/main/res/drawable/ic_header_export.xml b/plugins/configuration/src/main/res/drawable/ic_header_export.xml similarity index 97% rename from app/src/main/res/drawable/ic_header_export.xml rename to plugins/configuration/src/main/res/drawable/ic_header_export.xml index d59103ab07..d4bdbe841b 100644 --- a/app/src/main/res/drawable/ic_header_export.xml +++ b/plugins/configuration/src/main/res/drawable/ic_header_export.xml @@ -1,16 +1,16 @@ - - - - + + + + \ No newline at end of file diff --git a/ui/src/main/res/drawable/ic_header_import.xml b/plugins/configuration/src/main/res/drawable/ic_header_import.xml similarity index 100% rename from ui/src/main/res/drawable/ic_header_import.xml rename to plugins/configuration/src/main/res/drawable/ic_header_import.xml diff --git a/ui/src/main/res/drawable/ic_header_log.xml b/plugins/configuration/src/main/res/drawable/ic_header_log.xml similarity index 100% rename from ui/src/main/res/drawable/ic_header_log.xml rename to plugins/configuration/src/main/res/drawable/ic_header_log.xml diff --git a/app/src/main/res/drawable/ic_import_settings.xml b/plugins/configuration/src/main/res/drawable/ic_import_settings.xml similarity index 100% rename from app/src/main/res/drawable/ic_import_settings.xml rename to plugins/configuration/src/main/res/drawable/ic_import_settings.xml diff --git a/app/src/main/res/drawable/ic_log_delete.xml b/plugins/configuration/src/main/res/drawable/ic_log_delete.xml similarity index 100% rename from app/src/main/res/drawable/ic_log_delete.xml rename to plugins/configuration/src/main/res/drawable/ic_log_delete.xml diff --git a/app/src/main/res/drawable/ic_log_settings.xml b/plugins/configuration/src/main/res/drawable/ic_log_settings.xml similarity index 100% rename from app/src/main/res/drawable/ic_log_settings.xml rename to plugins/configuration/src/main/res/drawable/ic_log_settings.xml diff --git a/app/src/main/res/drawable/ic_reset_database.xml b/plugins/configuration/src/main/res/drawable/ic_reset_database.xml similarity index 100% rename from app/src/main/res/drawable/ic_reset_database.xml rename to plugins/configuration/src/main/res/drawable/ic_reset_database.xml diff --git a/app/src/main/res/drawable/ic_send_log.xml b/plugins/configuration/src/main/res/drawable/ic_send_log.xml similarity index 100% rename from app/src/main/res/drawable/ic_send_log.xml rename to plugins/configuration/src/main/res/drawable/ic_send_log.xml diff --git a/app/src/main/res/layout/activity_logsetting.xml b/plugins/configuration/src/main/res/layout/activity_logsetting.xml similarity index 95% rename from app/src/main/res/layout/activity_logsetting.xml rename to plugins/configuration/src/main/res/layout/activity_logsetting.xml index 4236005fd8..af5bf73195 100644 --- a/app/src/main/res/layout/activity_logsetting.xml +++ b/plugins/configuration/src/main/res/layout/activity_logsetting.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - tools:context=".plugins.general.maintenance.activities.LogSettingActivity"> + tools:context="info.nightscout.configuration.maintenance.activities.LogSettingActivity"> + app:srcCompat="@drawable/ic_aaps" /> + tools:context="info.nightscout.configuration.maintenance.MaintenanceFragment"> + tools:context="info.nightscout.configuration.maintenance.activities.PrefImportListActivity"> Application needs storage permission to be able store log files and export settings Ask for permission %1$s needs battery optimization whitelisting for proper performance - Import settings Stored settings found Master password is used for backup encryption and to override security in application. Remember it or store on a safe place. Current master password @@ -54,9 +53,11 @@ Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service. This identification will attached to crash reports so we can contact you in urgent cases. It\'s optional. Identification (email, FB or Discord nick etc) - + Request APS Mode Preferred APS mode + Error asking for permissions + This device does not appear to support battery optimization whitelisting - you may experience performance issues. Config Builder @@ -83,5 +84,56 @@ Attention: If you activate and connect to a hardware pump, AAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time. open settings + + Preferences + You will be asked for master password, which will be used to encrypt exported preferences. + Export canceled! Preferences were NOT exported! + Import canceled! Preferences were NOT imported! + Cannot import preferences! + Explain import issues… + Import issues details + Import + Import anyway (DANGEROUS!) + Import settings + Please check preferences before importing: + Preferences cannot be imported! + Preferences should not be imported! + Export settings + Export settings to + Import settings from + Settings imported + Old Master Password + This file was exported and encrypted with different master password. Provide old master password to decrypt file. + As a result of successful import current master password WILL BE REPLACED with that old master password! + Preferences exported + File not found + Please go back to main screen and try again. + Exiting application to apply settings. + User Entries exported + + + + Maintenance + MAINT + Provides several functions for maintenance (eg. log sending, log deletion). + Database cleanup + Do you want to cleanup the database?\nIt will remove tracked changes and historic data older than 3 months. + Cleared entries + Do you really want to reset the databases? + Maintenance Settings + Email recipient + maintenance_logs_email + maintenance_logs_amount + logshipper_amount + No of Logs to send + Send Logs by Email + Delete Logs + Nightscout version: + Engineering mode enabled + Log files + Log settings + Miscellaneous + Reset Databases + Reset to defaults \ No newline at end of file diff --git a/app/src/main/res/xml/pref_maintenance.xml b/plugins/configuration/src/main/res/xml/pref_maintenance.xml similarity index 100% rename from app/src/main/res/xml/pref_maintenance.xml rename to plugins/configuration/src/main/res/xml/pref_maintenance.xml diff --git a/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt new file mode 100644 index 0000000000..03d778b101 --- /dev/null +++ b/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -0,0 +1,39 @@ +package info.nightscout.androidaps + +import info.nightscout.rx.AapsSchedulers +import info.nightscout.rx.TestAapsSchedulers +import info.nightscout.rx.logging.AAPSLoggerTest +import org.junit.Before +import org.junit.Rule +import org.mockito.Mockito +import org.mockito.junit.MockitoJUnit +import org.mockito.junit.MockitoRule +import java.util.Locale + +open class TestBase { + + val aapsLogger = AAPSLoggerTest() + val aapsSchedulers: AapsSchedulers = TestAapsSchedulers() + + // Add a JUnit rule that will setup the @Mock annotated vars and log. + // Another possibility would be to add `MockitoAnnotations.initMocks(this) to the setup method. + @get:Rule + val mockitoRule: MockitoRule = MockitoJUnit.rule() + + @Before + fun setupLocale() { + Locale.setDefault(Locale.ENGLISH) + System.setProperty("disableFirebase", "true") + } + + // Workaround for Kotlin nullability. + // https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791 + // https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin + fun anyObject(): T { + Mockito.any() + return uninitialized() + } + + @Suppress("Unchecked_Cast") + fun uninitialized(): T = null as T +} \ No newline at end of file diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt b/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt similarity index 99% rename from core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt rename to plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt index 4081d688a2..d52806d895 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt +++ b/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.maintenance.formats +package info.nightscout.configuration.maintenance.formats import info.nightscout.androidaps.TestBase import info.nightscout.core.utils.CryptoUtil diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/SingleStringStorage.kt b/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/SingleStringStorage.kt similarity index 84% rename from core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/SingleStringStorage.kt rename to plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/SingleStringStorage.kt index 54da243ada..4d31311d77 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/SingleStringStorage.kt +++ b/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/SingleStringStorage.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.maintenance.formats +package info.nightscout.configuration.maintenance.formats import info.nightscout.interfaces.storage.Storage import java.io.File diff --git a/plugins/main/build.gradle b/plugins/main/build.gradle index bc6e3b5ca0..3dd658c912 100644 --- a/plugins/main/build.gradle +++ b/plugins/main/build.gradle @@ -54,7 +54,6 @@ dependencies { api 'com.google.android.flexbox:flexbox:3.0.0' // Food - api "androidx.work:work-runtime:$work_version" api "androidx.work:work-runtime-ktx:$work_version" // DataLayerListenerService diff --git a/plugins/main/src/main/res/values/strings.xml b/plugins/main/src/main/res/values/strings.xml index dea6863736..8b61fbccac 100644 --- a/plugins/main/src/main/res/values/strings.xml +++ b/plugins/main/src/main/res/values/strings.xml @@ -33,7 +33,6 @@ By resetting authenticator you make all already provisioned authenticators invalid. You will need to set up them again! Wrong code. Command cancelled. Timeout while waiting for finish of previous pump communication - User Allowed phone numbers +XXXXXXXXXX;+YYYYYYYYYY To deliver bolus %1$.2fU reply with code %2$s diff --git a/plugins/openhumans/build.gradle b/plugins/openhumans/build.gradle index aafebafc62..1175d53755 100644 --- a/plugins/openhumans/build.gradle +++ b/plugins/openhumans/build.gradle @@ -28,7 +28,6 @@ dependencies { api "androidx.browser:browser:1.4.0" //WorkManager - api "androidx.work:work-runtime:$work_version" api "androidx.work:work-runtime-ktx:$work_version" //api "androidx.work:work-rxjava3:$work_version" //api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index a43b613a71..bb7215cbb8 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -23,6 +23,7 @@ import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.utils.Round import info.nightscout.pump.dana.DanaPump +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventAppExit @@ -55,8 +56,9 @@ class DanaRKoreanPlugin @Inject constructor( dateUtil: DateUtil, private val fabricPrivacy: FabricPrivacy, pumpSync: PumpSync, - activityNames: ActivityNames -) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames) { + activityNames: ActivityNames, + danaHistoryDatabase: DanaHistoryDatabase +) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase) { init { pluginDescription.description(R.string.description_pump_dana_r_korean) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index dbdabca63a..a764fac26a 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -30,6 +30,7 @@ import info.nightscout.interfaces.queue.CommandQueue; import info.nightscout.interfaces.ui.ActivityNames; import info.nightscout.interfaces.utils.Round; import info.nightscout.pump.dana.DanaPump; +import info.nightscout.pump.dana.database.DanaHistoryDatabase; import info.nightscout.rx.AapsSchedulers; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventAppExit; @@ -74,9 +75,10 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { DateUtil dateUtil, FabricPrivacy fabricPrivacy, PumpSync pumpSync, - ActivityNames activityNames + ActivityNames activityNames, + DanaHistoryDatabase danaHistoryDatabase ) { - super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames); + super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase); this.aapsLogger = aapsLogger; this.context = context; this.rh = rh; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index cbfcbfbdf8..52cdcbf583 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -11,6 +11,7 @@ import info.nightscout.interfaces.constraints.Constraint; import info.nightscout.interfaces.constraints.Constraints; import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.plugin.ActivePlugin; +import info.nightscout.interfaces.plugin.OwnDatabasePlugin; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; import info.nightscout.interfaces.profile.Profile; @@ -28,6 +29,7 @@ import info.nightscout.interfaces.utils.Round; import info.nightscout.pump.dana.DanaFragment; import info.nightscout.pump.dana.DanaPump; import info.nightscout.pump.dana.comm.RecordTypes; +import info.nightscout.pump.dana.database.DanaHistoryDatabase; import info.nightscout.rx.AapsSchedulers; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventConfigBuilderChange; @@ -44,7 +46,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable; * Created by mike on 28.01.2018. */ -public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump, Dana, Constraints { +public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump, Dana, Constraints, OwnDatabasePlugin { protected AbstractDanaRExecutionService sExecutionService; protected CompositeDisposable disposable = new CompositeDisposable(); @@ -61,7 +63,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump protected AapsSchedulers aapsSchedulers; protected PumpSync pumpSync; protected ActivityNames activityNames; - + protected DanaHistoryDatabase danaHistoryDatabase; protected AbstractDanaRPlugin( HasAndroidInjector injector, DanaPump danaPump, @@ -75,7 +77,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump SP sp, DateUtil dateUtil, PumpSync pumpSync, - ActivityNames activityNames + ActivityNames activityNames, + DanaHistoryDatabase danaHistoryDatabase ) { super(new PluginDescription() .mainType(PluginType.PUMP) @@ -96,6 +99,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump this.aapsSchedulers = aapsSchedulers; this.pumpSync = pumpSync; this.activityNames = activityNames; + this.danaHistoryDatabase = danaHistoryDatabase; } @Override protected void onStart() { @@ -516,4 +520,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump @Override public void clearPairing() { } + + @Override public void clearAllTables() { + danaHistoryDatabase.clearAllTables(); + } } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 7b0bd7a89d..d4158c0a73 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -26,6 +26,7 @@ import info.nightscout.interfaces.queue.CommandQueue; import info.nightscout.interfaces.ui.ActivityNames; import info.nightscout.interfaces.utils.Round; import info.nightscout.pump.dana.DanaPump; +import info.nightscout.pump.dana.database.DanaHistoryDatabase; import info.nightscout.rx.AapsSchedulers; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventAppExit; @@ -64,9 +65,10 @@ public class DanaRPlugin extends AbstractDanaRPlugin { DateUtil dateUtil, FabricPrivacy fabricPrivacy, PumpSync pumpSync, - ActivityNames activityNames + ActivityNames activityNames, + DanaHistoryDatabase danaHistoryDatabase ) { - super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames); + super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase); this.aapsLogger = aapsLogger; this.context = context; this.rh = rh; diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index dbade82c4e..1ce4010a4b 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -14,6 +14,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.pump.dana.DanaPump +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -29,6 +30,7 @@ class DanaRPluginTest : TestBaseWithProfile() { @Mock lateinit var pumpSync: PumpSync @Mock lateinit var profileInstantiator: ProfileInstantiator @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase lateinit var danaPump: DanaPump @@ -46,7 +48,8 @@ class DanaRPluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) - danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames) + danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, + activityNames, danaHistoryDatabase) } @Test @Throws(Exception::class) diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index bbf5d12b7e..0cdc52f9f3 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -14,6 +14,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.pump.dana.DanaPump +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -29,6 +30,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { @Mock lateinit var pumpSync: PumpSync @Mock lateinit var profileInstantiator: ProfileInstantiator @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase lateinit var danaPump: DanaPump @@ -47,7 +49,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, - pumpSync, activityNames) + pumpSync, activityNames, danaHistoryDatabase) } @Test @Throws(Exception::class) diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index 0d24bdf37f..704f0f0040 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -16,6 +16,7 @@ import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.pump.dana.DanaPump +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Before import org.junit.Test @@ -32,6 +33,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() { @Mock lateinit var pumpSync: PumpSync @Mock lateinit var profileInstantiator: ProfileInstantiator @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase lateinit var danaPump: DanaPump @@ -50,7 +52,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump,detailedBolusInfoStorage, - temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames) + temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames, danaHistoryDatabase) } @Test diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt index 1e830206d1..3c68974e34 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt @@ -13,6 +13,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.plugin.OwnDatabasePlugin import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.Profile @@ -35,6 +36,7 @@ import info.nightscout.interfaces.utils.Round import info.nightscout.pump.dana.DanaFragment import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.comm.RecordTypes +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.pump.danars.events.EventDanaRSDeviceChange import info.nightscout.pump.danars.services.DanaRSService import info.nightscout.rx.AapsSchedulers @@ -76,7 +78,8 @@ class DanaRSPlugin @Inject constructor( private val temporaryBasalStorage: TemporaryBasalStorage, private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val activityNames: ActivityNames, + private val danaHistoryDatabase: DanaHistoryDatabase ) : PumpPluginBase( PluginDescription() .mainType(PluginType.PUMP) @@ -88,7 +91,7 @@ class DanaRSPlugin @Inject constructor( .preferencesId(R.xml.pref_danars) .description(R.string.description_pump_dana_rs), injector, aapsLogger, rh, commandQueue -), Pump, Dana, Constraints { +), Pump, Dana, Constraints, OwnDatabasePlugin { private val disposable = CompositeDisposable() private var danaRSService: DanaRSService? = null @@ -637,4 +640,6 @@ class DanaRSPlugin @Inject constructor( sp.remove(rh.gs(R.string.key_danars_v3_randomsynckey) + mDeviceName) sp.remove(rh.gs(R.string.key_dana_ble5_pairingkey) + mDeviceName) } + + override fun clearAllTables() = danaHistoryDatabase.clearAllTables() } \ No newline at end of file diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt index 5e4ca383b0..a9d9741088 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt @@ -10,6 +10,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.pump.dana.database.DanaHistoryDatabase import org.junit.Assert import org.junit.Before import org.junit.Test @@ -26,6 +27,7 @@ class DanaRSPluginTest : DanaRSTestBase() { @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage @Mock lateinit var pumpSync: PumpSync + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase private lateinit var danaRSPlugin: DanaRSPlugin @@ -77,7 +79,8 @@ class DanaRSPluginTest : DanaRSTestBase() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames + activityNames, + danaHistoryDatabase ) } } \ No newline at end of file diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index 6576908f86..6694eded09 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -9,6 +9,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert import org.junit.Before @@ -24,6 +25,7 @@ class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage @Mock lateinit var pumpSync: PumpSync + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase private lateinit var danaRSPlugin: info.nightscout.pump.danars.DanaRSPlugin @@ -71,7 +73,8 @@ class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames + activityNames, + danaHistoryDatabase ) Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index 3ca18f1841..a3de175d13 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -4,11 +4,11 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.interfaces.constraints.Constraints -import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.pump.danars.DanaRSTestBase import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert @@ -20,7 +20,7 @@ import org.mockito.Mockito.`when` class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { - @Mock lateinit var activePlugin: ActivePlugin + @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase @Mock lateinit var constraintChecker: Constraints @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var context: Context @@ -77,7 +77,8 @@ class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames + activityNames, + danaHistoryDatabase ) danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) } diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt index c0c2bb5346..7b55078a4f 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt @@ -14,6 +14,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.plugin.OwnDatabasePlugin import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.Profile @@ -35,6 +36,7 @@ import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.Round +import info.nightscout.pump.diaconn.database.DiaconnHistoryDatabase import info.nightscout.pump.diaconn.events.EventDiaconnG8DeviceChange import info.nightscout.pump.diaconn.service.DiaconnG8Service import info.nightscout.rx.AapsSchedulers @@ -75,7 +77,8 @@ class DiaconnG8Plugin @Inject constructor( private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil, private val aapsSchedulers: AapsSchedulers, - private val activityNames: ActivityNames + private val activityNames: ActivityNames, + private val diaconnHistoryDatabase: DiaconnHistoryDatabase ) : PumpPluginBase( PluginDescription() .mainType(PluginType.PUMP) @@ -86,7 +89,7 @@ class DiaconnG8Plugin @Inject constructor( .preferencesId(R.xml.pref_diaconn) .description(R.string.description_pump_diaconn_g8), injector, aapsLogger, rh, commandQueue -), Pump, Diaconn, Constraints { +), Pump, Diaconn, Constraints, OwnDatabasePlugin { private val disposable = CompositeDisposable() private var diaconnG8Service: DiaconnG8Service? = null @@ -605,4 +608,6 @@ class DiaconnG8Plugin @Inject constructor( } } + override fun clearAllTables() = diaconnHistoryDatabase.clearAllTables() + } diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/events/EventDiaconnG8PumpLogReset.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/events/EventDiaconnG8PumpLogReset.kt deleted file mode 100644 index 06d08dd8db..0000000000 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/events/EventDiaconnG8PumpLogReset.kt +++ /dev/null @@ -1,5 +0,0 @@ -package info.nightscout.pump.diaconn.events - -import info.nightscout.rx.events.Event - -class EventDiaconnG8PumpLogReset : Event() diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index a1c6414887..66354d3145 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -30,6 +30,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BasalVa import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BolusRecord import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BolusType import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.TempBasalRecord +import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOverviewFragment import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.Constants import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.mapProfileToBasalProgram @@ -37,6 +38,7 @@ import info.nightscout.core.events.EventNewNotification import info.nightscout.core.utils.DateTimeUtil import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.notifications.Notification +import info.nightscout.interfaces.plugin.OwnDatabasePlugin import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.Profile @@ -105,8 +107,9 @@ class OmnipodDashPumpPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, rh: ResourceHelper, - commandQueue: CommandQueue -) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, OmnipodDash { + commandQueue: CommandQueue, + private val dashHistoryDatabase: DashHistoryDatabase +) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, OmnipodDash, OwnDatabasePlugin { @Volatile var bolusCanceled = false @Volatile var bolusDeliveryInProgress = false @@ -1524,4 +1527,6 @@ class OmnipodDashPumpPlugin @Inject constructor( else -> true } } + + override fun clearAllTables() = dashHistoryDatabase.clearAllTables() } diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index ebedab282c..59c0635451 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -62,6 +62,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodEr import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosTbrChanged; import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosUncertainTbrRecovered; +import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase; import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager; import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandGetPodStatus; import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandReadPulseLog; @@ -76,6 +77,7 @@ import info.nightscout.core.utils.DateTimeUtil; import info.nightscout.core.utils.fabric.FabricPrivacy; import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.plugin.ActivePlugin; +import info.nightscout.interfaces.plugin.OwnDatabasePlugin; import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginType; import info.nightscout.interfaces.profile.Profile; @@ -120,7 +122,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable; * @author Andy Rozman (andy.rozman@gmail.com) */ @Singleton -public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, RileyLinkPumpDevice, OmnipodEros { +public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, RileyLinkPumpDevice, OmnipodEros, OwnDatabasePlugin { private static final long RILEY_LINK_CONNECT_TIMEOUT_MILLIS = 3 * 60 * 1_000L; // 3 minutes private static final long STATUS_CHECK_INTERVAL_MILLIS = 60 * 1_000L; // 1 minute public static final int STARTUP_STATUS_REQUEST_TRIES = 2; @@ -147,6 +149,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley private final PumpType pumpType = PumpType.OMNIPOD_EROS; private final PumpSync pumpSync; private final ActivityNames activityNames; + private final ErosHistoryDatabase erosHistoryDatabase; private final CompositeDisposable disposable = new CompositeDisposable(); @@ -186,7 +189,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley OmnipodAlertUtil omnipodAlertUtil, ProfileFunction profileFunction, PumpSync pumpSync, - ActivityNames activityNames + ActivityNames activityNames, + ErosHistoryDatabase erosHistoryDatabase ) { super(new PluginDescription() // .mainType(PluginType.PUMP) // @@ -215,6 +219,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley this.profileFunction = profileFunction; this.pumpSync = pumpSync; this.activityNames = activityNames; + this.erosHistoryDatabase = erosHistoryDatabase; pumpDescription = new PumpDescription(pumpType); @@ -1180,4 +1185,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(resourceId); } + @Override public void clearAllTables() { + erosHistoryDatabase.clearAllTables(); + } } diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt index 5b3767f07c..c412e72cbf 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt @@ -4,6 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil +import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.Profile @@ -38,6 +39,7 @@ class OmnipodErosPumpPluginTest : TestBase() { @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var rileyLinkUtil: RileyLinkUtil @Mock lateinit var pumpSync: PumpSync + @Mock lateinit var erosHistoryDatabase: ErosHistoryDatabase private var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger) @@ -54,7 +56,7 @@ class OmnipodErosPumpPluginTest : TestBase() { injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null, rh, activePlugin, null, null, aapsOmnipodErosManager, commandQueue, null, null, null, null, - rileyLinkUtil, null, null, pumpSync, activityNames + rileyLinkUtil, null, null, pumpSync, activityNames, erosHistoryDatabase ) val pumpState = PumpSync.PumpState(null, null, null, null, "") `when`(pumpSync.expectedPumpState()).thenReturn(pumpState) diff --git a/ui/src/main/AndroidManifest.xml b/ui/src/main/AndroidManifest.xml index 84f746ceb1..6df2670b1f 100644 --- a/ui/src/main/AndroidManifest.xml +++ b/ui/src/main/AndroidManifest.xml @@ -46,13 +46,13 @@ + android:theme="@style/AppTheme.NoActionBar" /> diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 9e5ae8031c..4780c0004c 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -147,16 +147,4 @@ STOP PRESSED - - Explain import issues… - Import issues details - Import - Import anyway (DANGEROUS!) - Import settings - Please check preferences before importing: - Preferences cannot be imported! - Preferences should not be imported! - - - Plugin preferences