From 1a9f6474e5f1c9af16d77a6cadc0cbaaa33ebc4c Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 8 Dec 2022 17:59:29 +0100 Subject: [PATCH] consolidate constraints plugins --- app/build.gradle | 2 +- .../nightscout/androidaps/di/AppComponent.kt | 4 +- .../interfaces/ConstraintsCheckerTest.kt | 21 +++++----- .../plugins/safety/SafetyPluginTest.kt | 21 +++++----- .../nightscout/interfaces/actions/Actions.kt | 3 ++ .../interfaces/db/PersistenceLayer.kt | 2 + .../src/main/res/drawable/ic_graduation.xml | 0 .../drawable/ic_trending_flat_white_48dp.xml | 10 +++++ core/ui/src/main/res/values/strings.xml | 3 ++ .../core/utils}/extensions/JSONObjectExt.kt | 0 core/utils/src/main/res/values/keys.xml | 3 ++ crowdin.yml | 4 +- .../implementation/db/PersistenceLayerImpl.kt | 2 + .../implementation/di/ImplementationModule.kt | 3 -- .../UserEntryPresentationHelperImpl.kt | 2 +- plugins/{support => constraints}/.gitignore | 0 plugins/{support => constraints}/build.gradle | 3 +- .../consumer-rules.pro | 0 .../proguard-rules.pro | 0 .../constraints/src/main/AndroidManifest.xml | 4 ++ .../plugins}/constraints/ConstraintsImpl.kt | 2 +- .../bgQualityCheck/BgQualityCheckPlugin.kt | 2 +- .../constraints/di/ObjectivesModule.kt | 25 ++++++++++++ .../di/PluginsConstraintsModule.kt} | 9 +++-- .../constraints/dstHelper/DstHelperPlugin.kt | 2 +- .../objectives/ObjectivesFragment.kt | 6 +-- .../objectives/ObjectivesPlugin.kt | 8 ++-- .../constraints/objectives/SntpClient.kt | 0 .../activities/ObjectivesExamDialog.kt | 4 +- .../objectives/dialogs/NtpProgressDialog.kt | 2 +- .../events/EventObjectivesUpdateGui.kt | 0 .../objectives/objectives/Objective.kt | 2 +- .../objectives/objectives/Objective0.kt | 16 ++++---- .../objectives/objectives/Objective1.kt | 14 ++++--- .../objectives/objectives/Objective10.kt | 2 +- .../objectives/objectives/Objective2.kt | 4 +- .../objectives/objectives/Objective3.kt | 2 +- .../objectives/objectives/Objective4.kt | 2 +- .../objectives/objectives/Objective5.kt | 2 +- .../objectives/objectives/Objective6.kt | 2 +- .../objectives/objectives/Objective7.kt | 2 +- .../objectives/objectives/Objective9.kt | 2 +- .../objectives/objectives/SntpClient.kt | 0 .../phoneChecker/PhoneCheckerPlugin.kt | 2 +- .../constraints/safety/SafetyPlugin.kt | 10 ++--- .../SignatureVerifierPlugin.kt | 2 +- .../storage/StorageConstraintPlugin.kt | 2 +- .../versionChecker/VersionCheckerPlugin.kt | 2 +- .../versionChecker/VersionCheckerUtilsImpl.kt | 2 +- .../drawable/ic_baseline_trending_flat_24.xml | 0 .../drawable/ic_baseline_warning_24_red.xml | 0 .../ic_baseline_warning_24_yellow.xml | 0 .../main/res/layout/dialog_ntp_progress.xml | 0 .../res/layout/objectives_exam_fragment.xml | 2 +- .../main/res/layout/objectives_fragment.xml | 0 .../src/main/res/layout/objectives_item.xml | 0 .../src/main/res/values-af-rZA/exam.xml | 0 .../src/main/res/values-af-rZA/objectives.xml | 0 .../src/main/res/values-af-rZA/strings.xml | 0 .../src/main/res/values-bg-rBG/exam.xml | 0 .../src/main/res/values-bg-rBG/objectives.xml | 0 .../src/main/res/values-bg-rBG/strings.xml | 0 .../src/main/res/values-ca-rES/exam.xml | 0 .../src/main/res/values-ca-rES/objectives.xml | 0 .../src/main/res/values-ca-rES/strings.xml | 0 .../src/main/res/values-cs-rCZ/exam.xml | 0 .../src/main/res/values-cs-rCZ/objectives.xml | 0 .../src/main/res/values-cs-rCZ/strings.xml | 0 .../src/main/res/values-da-rDK/exam.xml | 0 .../src/main/res/values-da-rDK/objectives.xml | 0 .../src/main/res/values-da-rDK/strings.xml | 0 .../src/main/res/values-de-rDE/exam.xml | 0 .../src/main/res/values-de-rDE/objectives.xml | 0 .../src/main/res/values-de-rDE/strings.xml | 0 .../src/main/res/values-el-rGR/exam.xml | 0 .../src/main/res/values-el-rGR/objectives.xml | 0 .../src/main/res/values-el-rGR/strings.xml | 0 .../src/main/res/values-es-rES/exam.xml | 0 .../src/main/res/values-es-rES/objectives.xml | 0 .../src/main/res/values-es-rES/strings.xml | 0 .../src/main/res/values-fr-rFR/exam.xml | 0 .../src/main/res/values-fr-rFR/objectives.xml | 0 .../src/main/res/values-fr-rFR/strings.xml | 0 .../src/main/res/values-ga-rIE/exam.xml | 0 .../src/main/res/values-ga-rIE/objectives.xml | 0 .../src/main/res/values-ga-rIE/strings.xml | 0 .../src/main/res/values-hr-rHR/exam.xml | 0 .../src/main/res/values-hr-rHR/objectives.xml | 0 .../src/main/res/values-hr-rHR/strings.xml | 0 .../src/main/res/values-hu-rHU/exam.xml | 0 .../src/main/res/values-hu-rHU/objectives.xml | 0 .../src/main/res/values-hu-rHU/strings.xml | 0 .../src/main/res/values-it-rIT/exam.xml | 0 .../src/main/res/values-it-rIT/objectives.xml | 0 .../src/main/res/values-it-rIT/strings.xml | 0 .../src/main/res/values-iw-rIL/exam.xml | 0 .../src/main/res/values-iw-rIL/objectives.xml | 0 .../src/main/res/values-iw-rIL/strings.xml | 0 .../src/main/res/values-ja-rJP/exam.xml | 0 .../src/main/res/values-ja-rJP/objectives.xml | 0 .../src/main/res/values-ja-rJP/strings.xml | 0 .../src/main/res/values-ko-rKR/exam.xml | 0 .../src/main/res/values-ko-rKR/objectives.xml | 0 .../src/main/res/values-ko-rKR/strings.xml | 0 .../src/main/res/values-lt-rLT/exam.xml | 0 .../src/main/res/values-lt-rLT/objectives.xml | 0 .../src/main/res/values-lt-rLT/strings.xml | 0 .../src/main/res/values-nl-rNL/exam.xml | 0 .../src/main/res/values-nl-rNL/objectives.xml | 0 .../src/main/res/values-nl-rNL/strings.xml | 0 .../src/main/res/values-no-rNO/exam.xml | 0 .../src/main/res/values-no-rNO/objectives.xml | 0 .../src/main/res/values-no-rNO/strings.xml | 0 .../src/main/res/values-pl-rPL/exam.xml | 0 .../src/main/res/values-pl-rPL/objectives.xml | 0 .../src/main/res/values-pl-rPL/strings.xml | 0 .../src/main/res/values-pt-rBR/exam.xml | 0 .../src/main/res/values-pt-rBR/objectives.xml | 0 .../src/main/res/values-pt-rBR/strings.xml | 0 .../src/main/res/values-pt-rPT/exam.xml | 0 .../src/main/res/values-pt-rPT/objectives.xml | 0 .../src/main/res/values-pt-rPT/strings.xml | 0 .../src/main/res/values-ro-rRO/exam.xml | 0 .../src/main/res/values-ro-rRO/objectives.xml | 0 .../src/main/res/values-ro-rRO/strings.xml | 0 .../src/main/res/values-ru-rRU/exam.xml | 0 .../src/main/res/values-ru-rRU/objectives.xml | 0 .../src/main/res/values-ru-rRU/strings.xml | 0 .../src/main/res/values-sk-rSK/exam.xml | 0 .../src/main/res/values-sk-rSK/objectives.xml | 0 .../src/main/res/values-sk-rSK/strings.xml | 0 .../src/main/res/values-sr-rCS/exam.xml | 0 .../src/main/res/values-sr-rCS/objectives.xml | 0 .../src/main/res/values-sr-rCS/strings.xml | 0 .../src/main/res/values-sv-rSE/exam.xml | 0 .../src/main/res/values-sv-rSE/objectives.xml | 0 .../src/main/res/values-sv-rSE/strings.xml | 0 .../src/main/res/values-tr-rTR/exam.xml | 0 .../src/main/res/values-tr-rTR/objectives.xml | 0 .../src/main/res/values-tr-rTR/strings.xml | 0 .../src/main/res/values-zh-rCN/exam.xml | 0 .../src/main/res/values-zh-rCN/objectives.xml | 0 .../src/main/res/values-zh-rCN/strings.xml | 0 .../src/main/res/values/exam.xml | 2 - .../src/main/res/values/objectives.xml | 2 - .../src/main/res/values/strings.xml | 34 ++++++++++++++++ .../src/main/res/xml/pref_safety.xml | 0 .../info/nightscout/androidaps/TestBase.kt | 0 .../BgQualityCheckPluginTest.kt | 2 +- .../dstHelper/DstHelperPluginTest.kt | 0 .../objectives/ObjectivesPluginTest.kt | 23 ++++++----- .../constraints/objectives/SntpClientTest.kt | 4 +- .../SignatureVerifierPluginTest.kt | 0 .../VersionCheckerUtilsKtTest.kt | 0 .../storage/StorageConstraintPluginTest.kt | 0 .../versionChecker/AllowedVersionsTest.kt | 0 .../nightscout/plugins/di/ObjectivesModule.kt | 39 ------------------- .../nightscout/plugins/di/PluginsModule.kt | 1 - .../general/actions/ActionsFragment.kt | 2 +- .../plugins/general/actions/ActionsPlugin.kt | 3 +- .../general/overview/OverviewFragment.kt | 6 +-- .../plugins/pump/virtual/VirtualPumpPlugin.kt | 4 +- plugins/main/src/main/res/values/strings.xml | 35 ----------------- plugins/support/src/main/AndroidManifest.xml | 4 -- settings.gradle | 2 +- 165 files changed, 196 insertions(+), 186 deletions(-) create mode 100644 core/interfaces/src/main/java/info/nightscout/interfaces/actions/Actions.kt rename core/{main => ui}/src/main/res/drawable/ic_graduation.xml (100%) create mode 100644 core/ui/src/main/res/drawable/ic_trending_flat_white_48dp.xml rename core/{main/src/main/java/info/nightscout/core => utils/src/main/java/info/nightscout/core/utils}/extensions/JSONObjectExt.kt (100%) rename plugins/{support => constraints}/.gitignore (100%) rename plugins/{support => constraints}/build.gradle (89%) rename plugins/{support => constraints}/consumer-rules.pro (100%) rename plugins/{support => constraints}/proguard-rules.pro (100%) create mode 100644 plugins/constraints/src/main/AndroidManifest.xml rename {implementation/src/main/java/info/nightscout/implementation => plugins/constraints/src/main/java/info/nightscout/plugins}/constraints/ConstraintsImpl.kt (99%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt (99%) create mode 100644 plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/ObjectivesModule.kt rename plugins/{support/src/main/java/info/nightscout/plugins/support/di/PluginsSupportModule.kt => constraints/src/main/java/info/nightscout/plugins/constraints/di/PluginsConstraintsModule.kt} (64%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt (98%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt (98%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt (95%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/SntpClient.kt (100%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt (97%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt (97%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/events/EventObjectivesUpdateGui.kt (100%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt (99%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt (80%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt (76%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt (89%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt (98%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt (96%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt (86%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt (95%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt (95%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt (89%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt (89%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/SntpClient.kt (100%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt (97%) rename plugins/{main => constraints}/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt (96%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt (99%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt (98%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt (99%) rename plugins/{support => constraints}/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt (99%) rename plugins/{support => constraints}/src/main/res/drawable/ic_baseline_trending_flat_24.xml (100%) rename plugins/{support => constraints}/src/main/res/drawable/ic_baseline_warning_24_red.xml (100%) rename plugins/{support => constraints}/src/main/res/drawable/ic_baseline_warning_24_yellow.xml (100%) rename plugins/{main => constraints}/src/main/res/layout/dialog_ntp_progress.xml (100%) rename plugins/{main => constraints}/src/main/res/layout/objectives_exam_fragment.xml (98%) rename plugins/{main => constraints}/src/main/res/layout/objectives_fragment.xml (100%) rename plugins/{main => constraints}/src/main/res/layout/objectives_item.xml (100%) rename plugins/{main => constraints}/src/main/res/values-af-rZA/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-af-rZA/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-af-rZA/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-bg-rBG/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-bg-rBG/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-bg-rBG/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ca-rES/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ca-rES/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-ca-rES/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-cs-rCZ/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-cs-rCZ/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-cs-rCZ/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-da-rDK/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-da-rDK/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-da-rDK/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-de-rDE/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-de-rDE/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-de-rDE/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-el-rGR/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-el-rGR/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-el-rGR/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-es-rES/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-es-rES/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-es-rES/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-fr-rFR/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-fr-rFR/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-fr-rFR/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ga-rIE/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ga-rIE/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-ga-rIE/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-hr-rHR/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-hr-rHR/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-hr-rHR/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-hu-rHU/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-hu-rHU/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-hu-rHU/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-it-rIT/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-it-rIT/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-it-rIT/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-iw-rIL/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-iw-rIL/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-iw-rIL/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ja-rJP/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ja-rJP/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-ja-rJP/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ko-rKR/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ko-rKR/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-ko-rKR/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-lt-rLT/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-lt-rLT/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-lt-rLT/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-nl-rNL/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-nl-rNL/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-nl-rNL/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-no-rNO/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-no-rNO/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-no-rNO/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-pl-rPL/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-pl-rPL/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-pl-rPL/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-pt-rBR/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-pt-rBR/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-pt-rBR/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-pt-rPT/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-pt-rPT/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-pt-rPT/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ro-rRO/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ro-rRO/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-ro-rRO/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ru-rRU/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-ru-rRU/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-ru-rRU/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-sk-rSK/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-sk-rSK/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-sk-rSK/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-sr-rCS/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-sr-rCS/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-sr-rCS/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-sv-rSE/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-sv-rSE/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-sv-rSE/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-tr-rTR/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-tr-rTR/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-tr-rTR/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values-zh-rCN/exam.xml (100%) rename plugins/{main => constraints}/src/main/res/values-zh-rCN/objectives.xml (100%) rename plugins/{support => constraints}/src/main/res/values-zh-rCN/strings.xml (100%) rename plugins/{main => constraints}/src/main/res/values/exam.xml (99%) rename plugins/{main => constraints}/src/main/res/values/objectives.xml (97%) rename plugins/{support => constraints}/src/main/res/values/strings.xml (55%) rename plugins/{main => constraints}/src/main/res/xml/pref_safety.xml (100%) rename plugins/{support => constraints}/src/test/java/info/nightscout/androidaps/TestBase.kt (100%) rename plugins/{support => constraints}/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt (99%) rename plugins/{support => constraints}/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt (100%) rename plugins/{main => constraints}/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt (77%) rename plugins/{main => constraints}/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt (69%) rename plugins/{support => constraints}/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt (100%) rename plugins/{support => constraints}/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt (100%) rename plugins/{support => constraints}/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt (100%) rename plugins/{support => constraints}/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt (100%) delete mode 100644 plugins/main/src/main/java/info/nightscout/plugins/di/ObjectivesModule.kt delete mode 100644 plugins/support/src/main/AndroidManifest.xml diff --git a/app/build.gradle b/app/build.gradle index 79d8cc32b9..034941a068 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -198,10 +198,10 @@ dependencies { implementation project(':plugins:aps') implementation project(':plugins:automation') implementation project(':plugins:configuration') + implementation project(':plugins:constraints') implementation project(':plugins:main') implementation project(':plugins:openhumans') implementation project(':plugins:sensitivity') - implementation project(':plugins:support') implementation project(':plugins:sync') implementation project(':implementation') implementation project(':database:entities') 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 b69132a683..0acbea340a 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt @@ -21,8 +21,8 @@ import info.nightscout.core.validators.di.ValidatorsModule import info.nightscout.database.impl.DatabaseModule import info.nightscout.implementation.di.ImplementationModule import info.nightscout.plugins.aps.di.ApsModule +import info.nightscout.plugins.constraints.di.PluginsConstraintsModule import info.nightscout.plugins.di.PluginsModule -import info.nightscout.plugins.support.di.PluginsSupportModule import info.nightscout.plugins.sync.di.SyncModule import info.nightscout.pump.combo.di.ComboModule import info.nightscout.pump.combov2.di.ComboV2Module @@ -62,7 +62,7 @@ import javax.inject.Singleton SharedImplModule::class, UiModule::class, ValidatorsModule::class, - PluginsSupportModule::class, + PluginsConstraintsModule::class, SyncModule::class, WorkflowModule::class, 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 b56861ef42..848cf738a2 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -11,7 +11,6 @@ import info.nightscout.androidaps.insight.database.InsightDatabaseDao import info.nightscout.androidaps.insight.database.InsightDbHelper import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.database.impl.AppRepository -import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.implementation.iob.GlucoseStatusProviderImpl import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck import info.nightscout.interfaces.constraints.Constraint @@ -34,6 +33,7 @@ import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin +import info.nightscout.plugins.constraints.ConstraintsImpl import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.safety.SafetyPlugin @@ -103,33 +103,33 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @BeforeEach fun prepare() { - `when`(rh.gs(info.nightscout.plugins.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") - `when`(rh.gs(info.nightscout.plugins.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") `when`(rh.gs(info.nightscout.core.ui.R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump") `when`(rh.gs(info.nightscout.plugins.aps.R.string.autosens_disabled_in_preferences)).thenReturn("Autosens disabled in preferences") `when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value") - `when`(rh.gs(info.nightscout.plugins.R.string.maxvalueinpreferences)).thenReturn("max value in preferences") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s") - `when`(rh.gs(info.nightscout.plugins.R.string.hardlimit)).thenReturn("hard limit") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit") `when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child") - `when`(rh.gs(info.nightscout.plugins.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s") `when`(rh.gs(info.nightscout.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value") - `when`(rh.gs(info.nightscout.plugins.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") - `when`(rh.gs(info.nightscout.plugins.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(context.getString(info.nightscout.pump.combo.R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump") - `when`(rh.gs(info.nightscout.plugins.R.string.objectivenotstarted)).thenReturn("Objective %1\$d not started") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.objectivenotstarted)).thenReturn("Objective %1\$d not started") // RS constructor `when`(sp.getString(R.string.key_danars_name, "")).thenReturn("") @@ -242,7 +242,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { hardLimits, ConfigImpl(fileListProvider), iobCobCalculator, - dateUtil + dateUtil, + uiInteraction ) val constraintsPluginsList = ArrayList() constraintsPluginsList.add(safetyPlugin) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt index e87048c860..2f121b9197 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt @@ -14,8 +14,8 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profiling.Profiler import info.nightscout.interfaces.pump.defs.PumpDescription +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits -import info.nightscout.plugins.R import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin @@ -39,6 +39,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Mock lateinit var repository: AppRepository @Mock lateinit var glucoseStatusProvider: GlucoseStatusProvider @Mock lateinit var bgQualityCheck: BgQualityCheck + @Mock lateinit var uiInteraction: UiInteraction private lateinit var hardLimits: HardLimits private lateinit var safetyPlugin: SafetyPlugin @@ -50,24 +51,24 @@ class SafetyPluginTest : TestBaseWithProfile() { @BeforeEach fun prepare() { - `when`(rh.gs(R.string.hardlimit)).thenReturn("hard limit") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit") `when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") - `when`(rh.gs(R.string.maxvalueinpreferences)).thenReturn("max value in preferences") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limiting_iob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s") - `when`(rh.gs(R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") - `when`(rh.gs(R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable") `when`(rh.gs(info.nightscout.plugins.aps.R.string.increasing_max_basal)).thenReturn("Increasing max basal value because setting is lower than your max basal in profile") `when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences") - `when`(rh.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") - `when`(rh.gs(R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") - `when`(rh.gs(R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") - `when`(rh.gs(R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") + `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") `when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child") `when`(rh.gs(info.nightscout.core.ui.R.string.lowglucosesuspend)).thenReturn("Low Glucose Suspend") @@ -75,7 +76,7 @@ class SafetyPluginTest : TestBaseWithProfile() { `when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription) `when`(config.APS).thenReturn(true) hardLimits = HardLimitsMock(sp, rh) - safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, config, iobCobCalculator, dateUtil) + safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, config, iobCobCalculator, dateUtil, uiInteraction) openAPSAMAPlugin = OpenAPSAMAPlugin( injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy, dateUtil, repository, glucoseStatusProvider, sp diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/actions/Actions.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/actions/Actions.kt new file mode 100644 index 0000000000..5aea890d62 --- /dev/null +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/actions/Actions.kt @@ -0,0 +1,3 @@ +package info.nightscout.interfaces.actions + +interface Actions \ No newline at end of file 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 6e79d87efb..265dfd1e38 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 @@ -5,6 +5,7 @@ import info.nightscout.database.ValueWrapper import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.Carbs +import info.nightscout.database.entities.EffectiveProfileSwitch import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry import info.nightscout.interfaces.queue.Callback @@ -20,4 +21,5 @@ interface PersistenceLayer { fun getTemporaryTargetActiveAt(timestamp: Long): Single> fun getUserEntryFilteredDataFromTime(timestamp: Long): Single> + fun getEffectiveProfileSwitchActiveAt(timestamp: Long): Single> } \ No newline at end of file diff --git a/core/main/src/main/res/drawable/ic_graduation.xml b/core/ui/src/main/res/drawable/ic_graduation.xml similarity index 100% rename from core/main/src/main/res/drawable/ic_graduation.xml rename to core/ui/src/main/res/drawable/ic_graduation.xml diff --git a/core/ui/src/main/res/drawable/ic_trending_flat_white_48dp.xml b/core/ui/src/main/res/drawable/ic_trending_flat_white_48dp.xml new file mode 100644 index 0000000000..616da59765 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_trending_flat_white_48dp.xml @@ -0,0 +1,10 @@ + + + diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index ab131ced6f..fff892689b 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -165,6 +165,9 @@ ISF Canceling of temporary basal failed Canceling of extended bolus failed + Upload status to NS + Disabled/Suspended loop + Insulin on Board (IOB) Wrong password diff --git a/core/main/src/main/java/info/nightscout/core/extensions/JSONObjectExt.kt b/core/utils/src/main/java/info/nightscout/core/utils/extensions/JSONObjectExt.kt similarity index 100% rename from core/main/src/main/java/info/nightscout/core/extensions/JSONObjectExt.kt rename to core/utils/src/main/java/info/nightscout/core/utils/extensions/JSONObjectExt.kt diff --git a/core/utils/src/main/res/values/keys.xml b/core/utils/src/main/res/values/keys.xml index 0625a13e03..8377c4b5d7 100644 --- a/core/utils/src/main/res/values/keys.xml +++ b/core/utils/src/main/res/values/keys.xml @@ -145,5 +145,8 @@ protection_timeout ObjectivesLoopUsed ObjectivesmanualEnacts + ObjectivesActionsUsed + ObjectivesScaleUsed + virtualpump_uploadstatus \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml index f74a364df2..cc973cac47 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -27,8 +27,8 @@ files: translation: /plugins/sync/src/main/res/values-%android_code%/strings.xml translate_attributes: 0 content_segmentation: 0 - - source: /plugins/support/src/main/res/values/strings.xml - translation: /plugins/support/src/main/res/values-%android_code%/strings.xml + - source: /plugins/constraints/src/main/res/values/strings.xml + translation: /plugins/constraints/src/main/res/values-%android_code%/strings.xml - source: /core/graph/src/main/res/values/strings.xml translation: /core/graph/src/main/res/values-%android_code%/strings.xml - source: /core/interfaces/src/main/res/values/strings.xml 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 a66b479b59..6b99d9a8ca 100644 --- a/implementation/src/main/java/info/nightscout/implementation/db/PersistenceLayerImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/db/PersistenceLayerImpl.kt @@ -6,6 +6,7 @@ import info.nightscout.database.ValueWrapper import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.Carbs +import info.nightscout.database.entities.EffectiveProfileSwitch import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.UserEntry import info.nightscout.database.impl.AppRepository @@ -68,4 +69,5 @@ class PersistenceLayerImpl @Inject constructor( override fun getTemporaryTargetActiveAt(timestamp: Long): Single> = repository.getTemporaryTargetActiveAt(timestamp) override fun getUserEntryFilteredDataFromTime(timestamp: Long): Single> = repository.getUserEntryFilteredDataFromTime(timestamp) + override fun getEffectiveProfileSwitchActiveAt(timestamp: Long): Single> = repository.getEffectiveProfileSwitchActiveAt(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 cf5844835e..d230e45523 100644 --- a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt +++ b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt @@ -14,7 +14,6 @@ import info.nightscout.implementation.TrendCalculatorImpl import info.nightscout.implementation.UserEntryLoggerImpl import info.nightscout.implementation.XDripBroadcastImpl import info.nightscout.implementation.androidNotification.NotificationHolderImpl -import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.implementation.db.PersistenceLayerImpl import info.nightscout.implementation.iob.GlucoseStatusProviderImpl import info.nightscout.implementation.logging.LoggerUtilsImpl @@ -47,7 +46,6 @@ import info.nightscout.interfaces.LocalAlertUtils import info.nightscout.interfaces.NotificationHolder import info.nightscout.interfaces.Translator import info.nightscout.interfaces.XDripBroadcast -import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.db.PersistenceLayer import info.nightscout.interfaces.iob.GlucoseStatusProvider import info.nightscout.interfaces.logging.LoggerUtils @@ -121,7 +119,6 @@ abstract class ImplementationModule { @Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider @Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder @Binds fun bindCommandQueue(commandQueue: CommandQueueImplementation): CommandQueue - @Binds fun bindsConstraints(constraintsImpl: ConstraintsImpl): Constraints @Binds fun bindsProfileFunction(profileFunctionImpl: ProfileFunctionImpl): ProfileFunction @Binds fun bindsStorage(fileStorage: FileStorage): Storage @Binds fun bindsReceiverStatusStore(receiverStatusStoreImpl: ReceiverStatusStoreImpl): ReceiverStatusStore diff --git a/implementation/src/main/java/info/nightscout/implementation/userEntry/UserEntryPresentationHelperImpl.kt b/implementation/src/main/java/info/nightscout/implementation/userEntry/UserEntryPresentationHelperImpl.kt index c39b5ede07..e3b0417edd 100644 --- a/implementation/src/main/java/info/nightscout/implementation/userEntry/UserEntryPresentationHelperImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/userEntry/UserEntryPresentationHelperImpl.kt @@ -81,7 +81,7 @@ class UserEntryPresentationHelperImpl @Inject constructor( Sources.Maintenance -> info.nightscout.core.ui.R.drawable.ic_maintenance Sources.NSClient -> info.nightscout.core.ui.R.drawable.ic_nightscout_syncs Sources.NSProfile -> R.drawable.ic_nightscout_profile - Sources.Objectives -> R.drawable.ic_graduation + Sources.Objectives -> info.nightscout.core.ui.R.drawable.ic_graduation Sources.Pump -> info.nightscout.core.ui.R.drawable.ic_generic_icon Sources.Dana -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.DanaR -> info.nightscout.core.ui.R.drawable.ic_danars_128 diff --git a/plugins/support/.gitignore b/plugins/constraints/.gitignore similarity index 100% rename from plugins/support/.gitignore rename to plugins/constraints/.gitignore diff --git a/plugins/support/build.gradle b/plugins/constraints/build.gradle similarity index 89% rename from plugins/support/build.gradle rename to plugins/constraints/build.gradle index 628361f6ae..84ee406dd7 100644 --- a/plugins/support/build.gradle +++ b/plugins/constraints/build.gradle @@ -12,7 +12,7 @@ apply from: "${project.rootDir}/core/main/test_dependencies.gradle" apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle" apply from: "${project.rootDir}/core/main/jacoco_global.gradle" android { - namespace 'info.nightscout.plugins.support' + namespace 'info.nightscout.plugins.constraints' } dependencies { @@ -20,6 +20,7 @@ dependencies { implementation project(':core:interfaces') implementation project(':core:ui') implementation project(':core:utils') + implementation project(':core:validators') implementation project(':database:entities') // Phone checker diff --git a/plugins/support/consumer-rules.pro b/plugins/constraints/consumer-rules.pro similarity index 100% rename from plugins/support/consumer-rules.pro rename to plugins/constraints/consumer-rules.pro diff --git a/plugins/support/proguard-rules.pro b/plugins/constraints/proguard-rules.pro similarity index 100% rename from plugins/support/proguard-rules.pro rename to plugins/constraints/proguard-rules.pro diff --git a/plugins/constraints/src/main/AndroidManifest.xml b/plugins/constraints/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..44008a4332 --- /dev/null +++ b/plugins/constraints/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/ConstraintsImpl.kt similarity index 99% rename from implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/ConstraintsImpl.kt index c589264403..923619063e 100644 --- a/implementation/src/main/java/info/nightscout/implementation/constraints/ConstraintsImpl.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/ConstraintsImpl.kt @@ -1,4 +1,4 @@ -package info.nightscout.implementation.constraints +package info.nightscout.plugins.constraints import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraints diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt similarity index 99% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt index 769c318936..744c215204 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPlugin.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.source.DexcomBoyda -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventBucketedDataCreated diff --git a/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/ObjectivesModule.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/ObjectivesModule.kt new file mode 100644 index 0000000000..00cc3d6825 --- /dev/null +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/ObjectivesModule.kt @@ -0,0 +1,25 @@ +package info.nightscout.plugins.constraints.di + +import dagger.Module +import dagger.android.ContributesAndroidInjector + +@Module +@Suppress("unused") +abstract class ObjectivesModule { + + @ContributesAndroidInjector abstract fun contributesObjectivesFragment(): info.nightscout.plugins.constraints.objectives.ObjectivesFragment + @ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog + @ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog + + @ContributesAndroidInjector abstract fun objectiveInjector(): info.nightscout.plugins.constraints.objectives.objectives.Objective + @ContributesAndroidInjector abstract fun objective0Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective0 + @ContributesAndroidInjector abstract fun objective1Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective1 + @ContributesAndroidInjector abstract fun objective2Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective2 + @ContributesAndroidInjector abstract fun objective3Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective3 + @ContributesAndroidInjector abstract fun objective4Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective4 + @ContributesAndroidInjector abstract fun objective5Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective5 + @ContributesAndroidInjector abstract fun objective6Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective6 + @ContributesAndroidInjector abstract fun objective7Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective7 + @ContributesAndroidInjector abstract fun objective9Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective9 + @ContributesAndroidInjector abstract fun objective10Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective10 +} \ No newline at end of file diff --git a/plugins/support/src/main/java/info/nightscout/plugins/support/di/PluginsSupportModule.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/PluginsConstraintsModule.kt similarity index 64% rename from plugins/support/src/main/java/info/nightscout/plugins/support/di/PluginsSupportModule.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/PluginsConstraintsModule.kt index 17ed884fd1..c3da1e525a 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/support/di/PluginsSupportModule.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/di/PluginsConstraintsModule.kt @@ -1,25 +1,28 @@ -package info.nightscout.plugins.support.di +package info.nightscout.plugins.constraints.di import dagger.Binds import dagger.Module import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck +import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin import info.nightscout.plugins.constraints.versionChecker.VersionCheckerUtilsImpl @Module( includes = [ - PluginsSupportModule.Bindings::class + PluginsConstraintsModule.Bindings::class, + ObjectivesModule::class ] ) @Suppress("unused") -abstract class PluginsSupportModule { +abstract class PluginsConstraintsModule { @Module interface Bindings { @Binds fun bindProcessedDeviceStatusData(versionCheckerUtils: VersionCheckerUtilsImpl): VersionCheckerUtils @Binds fun bindBgQualityCheck(bgQualityCheck: BgQualityCheckPlugin): BgQualityCheck + @Binds fun bindsConstraints(constraintsImpl: info.nightscout.plugins.constraints.ConstraintsImpl): Constraints } } \ No newline at end of file diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt similarity index 98% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt index 67c7d4350b..ba7293a6ee 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPlugin.kt @@ -9,7 +9,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag import info.nightscout.shared.interfaces.ResourceHelper diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt similarity index 98% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt index 09086dbdb7..4988d893d3 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesFragment.kt @@ -24,13 +24,13 @@ import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.utils.HtmlHelper -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R +import info.nightscout.plugins.constraints.databinding.ObjectivesFragmentBinding +import info.nightscout.plugins.constraints.databinding.ObjectivesItemBinding import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask -import info.nightscout.plugins.databinding.ObjectivesFragmentBinding -import info.nightscout.plugins.databinding.ObjectivesItemBinding import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventNtpStatus diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt similarity index 95% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt index 87bac53864..5495d609a6 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/ObjectivesPlugin.kt @@ -15,7 +15,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.objectives.objectives.Objective0 import info.nightscout.plugins.constraints.objectives.objectives.Objective1 @@ -47,7 +47,7 @@ class ObjectivesPlugin @Inject constructor( .fragmentClass(ObjectivesFragment::class.qualifiedName) .alwaysEnabled(config.APS) .showInList(config.APS) - .pluginIcon(info.nightscout.core.main.R.drawable.ic_graduation) + .pluginIcon(info.nightscout.core.ui.R.drawable.ic_graduation) .pluginName(info.nightscout.core.ui.R.string.objectives) .shortName(R.string.objectives_shortname) .description(R.string.description_objectives), @@ -91,9 +91,9 @@ class ObjectivesPlugin @Inject constructor( sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, false) - sp.putBoolean(R.string.key_objectiveuseactions, false) + sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false) - sp.putBoolean(R.string.key_objectiveusescale, false) + sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false) } fun allPriorAccomplished(position: Int): Boolean { diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/SntpClient.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/SntpClient.kt similarity index 100% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/SntpClient.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/SntpClient.kt diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt similarity index 97% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt index 12ff59c4a6..3ac4ebfdda 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt @@ -6,12 +6,12 @@ import android.view.View import android.view.ViewGroup import dagger.android.support.DaggerDialogFragment import info.nightscout.core.ui.toast.ToastUtils -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R +import info.nightscout.plugins.constraints.databinding.ObjectivesExamFragmentBinding import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask import info.nightscout.plugins.constraints.objectives.objectives.Objective.Option -import info.nightscout.plugins.databinding.ObjectivesExamFragmentBinding import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt similarity index 97% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt index 57ccf39b78..0c8b0738e8 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt @@ -7,7 +7,7 @@ import android.view.View import android.view.ViewGroup import dagger.android.support.DaggerDialogFragment import info.nightscout.core.utils.fabric.FabricPrivacy -import info.nightscout.plugins.databinding.DialogNtpProgressBinding +import info.nightscout.plugins.constraints.databinding.DialogNtpProgressBinding import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventNtpStatus diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/events/EventObjectivesUpdateGui.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/events/EventObjectivesUpdateGui.kt similarity index 100% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/events/EventObjectivesUpdateGui.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/events/EventObjectivesUpdateGui.kt diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt similarity index 99% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt index 2997e5205a..1240acc248 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective.kt @@ -7,7 +7,7 @@ import android.widget.TextView import androidx.annotation.StringRes import androidx.fragment.app.FragmentActivity import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt similarity index 80% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt index d9cf32069d..d995f6e897 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective0.kt @@ -2,20 +2,20 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.database.ValueWrapper -import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.aps.Loop +import info.nightscout.interfaces.db.PersistenceLayer import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase -import info.nightscout.plugins.R -import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin +import info.nightscout.interfaces.pump.VirtualPump +import info.nightscout.plugins.constraints.R import javax.inject.Inject class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R.string.objectives_0_objective, R.string.objectives_0_gate) { @Inject lateinit var activePlugin: ActivePlugin - @Inject lateinit var virtualPumpPlugin: VirtualPumpPlugin - @Inject lateinit var repository: AppRepository + @Inject lateinit var virtualPumpPlugin: VirtualPump + @Inject lateinit var persistenceLayer: PersistenceLayer @Inject lateinit var loop: Loop @Inject lateinit var iobCobCalculator: IobCobCalculator @@ -30,9 +30,9 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R return activePlugin.firstActiveSync?.hasWritePermission == true } }) - tasks.add(object : Task(this, R.string.virtualpump_uploadstatus_title) { + tasks.add(object : Task(this, info.nightscout.core.ui.R.string.virtualpump_uploadstatus_title) { override fun isCompleted(): Boolean { - return sp.getBoolean(R.string.key_virtual_pump_upload_status, false) + return sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false) } override fun shouldBeIgnored(): Boolean { @@ -62,7 +62,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R }) tasks.add(object : Task(this, info.nightscout.core.ui.R.string.activate_profile) { override fun isCompleted(): Boolean { - return repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing + return persistenceLayer.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing } }) } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt similarity index 76% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt index bc396d2757..63f9fee48c 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective1.kt @@ -1,13 +1,17 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R -import info.nightscout.plugins.general.actions.ActionsPlugin +import info.nightscout.interfaces.actions.Actions +import info.nightscout.interfaces.plugin.ActivePlugin +import info.nightscout.interfaces.plugin.PluginBase +import info.nightscout.plugins.constraints.R import javax.inject.Inject class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(injector, "usage", R.string.objectives_usage_objective, R.string.objectives_usage_gate) { - @Inject lateinit var actionsPlugin: ActionsPlugin + @Inject lateinit var activePlugin: ActivePlugin + val actionsPlugin: PluginBase + get() = activePlugin.getSpecificPluginsListByInterface(Actions::class.java)[0] init { tasks.add(object : Task(this, R.string.objectives_useprofileswitch) { @@ -32,7 +36,7 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i }.hint(Hint(R.string.usetemptarget_hint))) tasks.add(object : Task(this, R.string.objectives_useactions) { override fun isCompleted(): Boolean { - return sp.getBoolean(R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible() + return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible() } }.hint(Hint(R.string.useaction_hint))) tasks.add(object : Task(this, R.string.objectives_useloop) { @@ -42,7 +46,7 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i }.hint(Hint(R.string.useaction_hint))) tasks.add(object : Task(this, R.string.objectives_usescale) { override fun isCompleted(): Boolean { - return sp.getBoolean(R.string.key_objectiveusescale, false) + return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false) } }.hint(Hint(R.string.usescale_hint))) } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt similarity index 89% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt index 45e9375d78..191a39e3af 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective10.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.shared.utils.T class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R.string.objectives_auto_objective, R.string.objectives_auto_gate) { diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt similarity index 98% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt index 827870976b..d4df12668a 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective2.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R @Suppress("SpellCheckingInspection") class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.string.objectives_exam_objective, R.string.objectives_exam_gate) { @@ -172,7 +172,7 @@ class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.s .option(Option(R.string.wronginsulin_prime, true)) .option(Option(R.string.wrongcarbs_donothing, false)) ) - tasks.add(ExamTask(this, R.string.iob_label, R.string.blank, "iob") + tasks.add(ExamTask(this, info.nightscout.core.ui.R.string.iob_label, R.string.blank, "iob") .option(Option(R.string.iob_value, true)) .option(Option(R.string.iob_hightemp, false)) .option(Option(R.string.iob_negiob, true)) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt similarity index 96% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt index 8ca5e8334c..d2b7c83a1c 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective3.kt @@ -2,7 +2,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.interfaces.plugin.ActivePlugin -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.shared.utils.T import javax.inject.Inject diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt similarity index 86% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt index 1871038194..83f6ec9603 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective4.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R @Suppress("SpellCheckingInspection") class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate) \ No newline at end of file diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt similarity index 95% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt index 35b5024cc0..3ce315df93 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective5.kt @@ -2,7 +2,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.interfaces.constraints.Constraint -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.shared.utils.T import javax.inject.Inject diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt similarity index 95% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt index 3e03e9782d..2411aa7697 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective6.kt @@ -2,7 +2,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.interfaces.constraints.Constraints -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.shared.utils.T import javax.inject.Inject diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt similarity index 89% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt index 4ace165453..6893df0814 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective7.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.shared.utils.T class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", R.string.objectives_autosens_objective, R.string.objectives_autosens_gate) { diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt similarity index 89% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt index 3031f9d283..340e451162 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/Objective9.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.shared.utils.T class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.string.objectives_smb_objective, R.string.objectives_smb_gate) { diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/SntpClient.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/SntpClient.kt similarity index 100% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/SntpClient.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/objectives/objectives/SntpClient.kt diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt similarity index 97% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt index 351738d076..689bdd57a0 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt @@ -8,7 +8,7 @@ import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import javax.inject.Inject diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt similarity index 96% rename from plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt index 8d79bf7d42..7dfaa68fcb 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt @@ -1,7 +1,6 @@ package info.nightscout.plugins.constraints.safety import dagger.android.HasAndroidInjector -import info.nightscout.core.events.EventNewNotification import info.nightscout.core.extensions.putDouble import info.nightscout.core.extensions.putInt import info.nightscout.core.extensions.putString @@ -20,10 +19,11 @@ import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.defs.PumpDescription +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.Round -import info.nightscout.plugins.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper @@ -45,7 +45,8 @@ class SafetyPlugin @Inject constructor( private val hardLimits: HardLimits, private val config: Config, private val iobCobCalculator: IobCobCalculator, - private val dateUtil: DateUtil + private val dateUtil: DateUtil, + private val uiInteraction: UiInteraction ) : PluginBase( PluginDescription() .mainType(PluginType.CONSTRAINTS) @@ -70,8 +71,7 @@ class SafetyPlugin @Inject constructor( if (mode == "open") value.set(aapsLogger, false, rh.gs(R.string.closedmodedisabledinpreferences), this) if (!config.isEngineeringModeOrRelease()) { if (value.value()) { - val n = Notification(Notification.TOAST_ALARM, rh.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL) - rxBus.send(EventNewNotification(n)) + uiInteraction.addNotification(Notification.TOAST_ALARM, rh.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL) } value.set(aapsLogger, false, rh.gs(R.string.closed_loop_disabled_on_dev_branch), this) } diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt similarity index 99% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt index 6283c3c6bb..6aaff96f09 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.ui.UiInteraction -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt similarity index 98% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt index 801b43c4c2..7fbc119539 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.ui.UiInteraction -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag import info.nightscout.shared.interfaces.ResourceHelper diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt similarity index 99% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt index 0022644fb1..47b67fa3ab 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt @@ -10,7 +10,7 @@ import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt similarity index 99% rename from plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt rename to plugins/constraints/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt index 2996bf6562..c688ec10d9 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt +++ b/plugins/constraints/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt @@ -8,7 +8,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag import info.nightscout.shared.interfaces.ResourceHelper diff --git a/plugins/support/src/main/res/drawable/ic_baseline_trending_flat_24.xml b/plugins/constraints/src/main/res/drawable/ic_baseline_trending_flat_24.xml similarity index 100% rename from plugins/support/src/main/res/drawable/ic_baseline_trending_flat_24.xml rename to plugins/constraints/src/main/res/drawable/ic_baseline_trending_flat_24.xml diff --git a/plugins/support/src/main/res/drawable/ic_baseline_warning_24_red.xml b/plugins/constraints/src/main/res/drawable/ic_baseline_warning_24_red.xml similarity index 100% rename from plugins/support/src/main/res/drawable/ic_baseline_warning_24_red.xml rename to plugins/constraints/src/main/res/drawable/ic_baseline_warning_24_red.xml diff --git a/plugins/support/src/main/res/drawable/ic_baseline_warning_24_yellow.xml b/plugins/constraints/src/main/res/drawable/ic_baseline_warning_24_yellow.xml similarity index 100% rename from plugins/support/src/main/res/drawable/ic_baseline_warning_24_yellow.xml rename to plugins/constraints/src/main/res/drawable/ic_baseline_warning_24_yellow.xml diff --git a/plugins/main/src/main/res/layout/dialog_ntp_progress.xml b/plugins/constraints/src/main/res/layout/dialog_ntp_progress.xml similarity index 100% rename from plugins/main/src/main/res/layout/dialog_ntp_progress.xml rename to plugins/constraints/src/main/res/layout/dialog_ntp_progress.xml diff --git a/plugins/main/src/main/res/layout/objectives_exam_fragment.xml b/plugins/constraints/src/main/res/layout/objectives_exam_fragment.xml similarity index 98% rename from plugins/main/src/main/res/layout/objectives_exam_fragment.xml rename to plugins/constraints/src/main/res/layout/objectives_exam_fragment.xml index d4a0f4d59b..6e1334a7da 100644 --- a/plugins/main/src/main/res/layout/objectives_exam_fragment.xml +++ b/plugins/constraints/src/main/res/layout/objectives_exam_fragment.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="constraints.objectives.activities.ObjectivesExamDialog"> + tools:context=".constraints.objectives.activities.ObjectivesExamDialog"> Leave your blood glucose target unchanged. Wait until blood glucose drops below your hypo temp target and then eat 15 g of fast acting carbohydrates. https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target - Disabled/Suspended loop Do I receive insulin when the loop is disabled/suspended? Yes, basal insulin continues to be delivered. No, delivery of insulin is stopped. @@ -149,7 +148,6 @@ Setting profile to 150% will take absorbing carbs a longer time Setting profile to 150% will take absorbing carbs a shorter time Setting profile to 150% will not affect calculated carbs absorption - Insulin on Board (IOB) IOB value is affected by issued temporary basals. High temp basal will not be given when your blood sugar is below target. Negative IOB for a substantial period in the absence of exercise suggests your profile is too strong and less insulin is needed in your settings. diff --git a/plugins/main/src/main/res/values/objectives.xml b/plugins/constraints/src/main/res/values/objectives.xml similarity index 97% rename from plugins/main/src/main/res/values/objectives.xml rename to plugins/constraints/src/main/res/values/objectives.xml index 20a67d7b8a..578c31677a 100644 --- a/plugins/main/src/main/res/values/objectives.xml +++ b/plugins/constraints/src/main/res/values/objectives.xml @@ -1,7 +1,5 @@ - ObjectivesActionsUsed - ObjectivesScaleUsed objectives_request_code Start diff --git a/plugins/support/src/main/res/values/strings.xml b/plugins/constraints/src/main/res/values/strings.xml similarity index 55% rename from plugins/support/src/main/res/values/strings.xml rename to plugins/constraints/src/main/res/values/strings.xml index fd881037b8..c6aa95b54d 100644 --- a/plugins/support/src/main/res/values/strings.xml +++ b/plugins/constraints/src/main/res/values/strings.xml @@ -41,4 +41,38 @@ double entries Flat data. Considered to be wrong + + Limiting extended bolus to %1$.1f U because of %2$s + Limiting carbs to %1$d g because of %2$s + + Safety + Pump is not temp basal capable + Closed loop mode disabled in preferences + Running dev version. Closed loop is disabled. + Closed loop disabled because of running Extended bolus + SMB always and after carbs disabled because active BG source doesn\'t support advanced filtering + SMB not allowed in open loop mode + max value in preferences + hard limit + Treatments safety + + + Completed, well done! + Not completed yet + Time elapsed + Maximal IOB set properly + BG available from selected source + Synchronization service has write permission + Loop enabled + APS selected + Closed mode enabled + OBJ + Learning program + Do you want reset objective start? You may lose your progress. + Next + Prev + Clear finished + Clear started + + \ No newline at end of file diff --git a/plugins/main/src/main/res/xml/pref_safety.xml b/plugins/constraints/src/main/res/xml/pref_safety.xml similarity index 100% rename from plugins/main/src/main/res/xml/pref_safety.xml rename to plugins/constraints/src/main/res/xml/pref_safety.xml diff --git a/plugins/support/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/constraints/src/test/java/info/nightscout/androidaps/TestBase.kt similarity index 100% rename from plugins/support/src/test/java/info/nightscout/androidaps/TestBase.kt rename to plugins/constraints/src/test/java/info/nightscout/androidaps/TestBase.kt diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt similarity index 99% rename from plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt index 6cd80f9448..308804fed9 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt +++ b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.source.BgSource import info.nightscout.interfaces.source.DexcomBoyda -import info.nightscout.plugins.support.R +import info.nightscout.plugins.constraints.R import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt similarity index 100% rename from plugins/support/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt diff --git a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt similarity index 77% rename from plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt index dccee93785..ca38062636 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt +++ b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt @@ -7,12 +7,11 @@ import info.nightscout.interfaces.Config import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Objectives import info.nightscout.interfaces.plugin.ActivePlugin -import info.nightscout.plugins.R -import info.nightscout.plugins.constraints.objectives.objectives.Objective +import info.nightscout.plugins.constraints.R import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil -import org.junit.Assert +import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.Mock @@ -30,7 +29,7 @@ class ObjectivesPluginTest : TestBase() { val injector = HasAndroidInjector { AndroidInjector { - if (it is Objective) { + if (it is info.nightscout.plugins.constraints.objectives.objectives.Objective) { it.sp = sp it.rh = rh it.dateUtil = dateUtil @@ -51,8 +50,8 @@ class ObjectivesPluginTest : TestBase() { objectivesPlugin.objectives[Objectives.FIRST_OBJECTIVE].startedOn = 0 var c = Constraint(true) c = objectivesPlugin.isLoopInvocationAllowed(c) - Assert.assertEquals("Objectives: Objective 1 not started", c.getReasons(aapsLogger)) - Assert.assertEquals(false, c.value()) + Assertions.assertEquals("Objectives: Objective 1 not started", c.getReasons(aapsLogger)) + Assertions.assertEquals(false, c.value()) objectivesPlugin.objectives[Objectives.FIRST_OBJECTIVE].startedOn = dateUtil.now() } @@ -60,23 +59,23 @@ class ObjectivesPluginTest : TestBase() { objectivesPlugin.objectives[Objectives.MAXIOB_ZERO_CL_OBJECTIVE].startedOn = 0 var c = Constraint(true) c = objectivesPlugin.isClosedLoopAllowed(c) - Assert.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 6 not started")) - Assert.assertEquals(false, c.value()) + Assertions.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 6 not started")) + Assertions.assertEquals(false, c.value()) } @Test fun notStartedObjective8ShouldLimitAutosensMode() { objectivesPlugin.objectives[Objectives.AUTOSENS_OBJECTIVE].startedOn = 0 var c = Constraint(true) c = objectivesPlugin.isAutosensModeEnabled(c) - Assert.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 8 not started")) - Assert.assertEquals(false, c.value()) + Assertions.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 8 not started")) + Assertions.assertEquals(false, c.value()) } @Test fun notStartedObjective10ShouldLimitSMBMode() { objectivesPlugin.objectives[Objectives.SMB_OBJECTIVE].startedOn = 0 var c = Constraint(true) c = objectivesPlugin.isSMBModeEnabled(c) - Assert.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 9 not started")) - Assert.assertEquals(false, c.value()) + Assertions.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 9 not started")) + Assertions.assertEquals(false, c.value()) } } \ No newline at end of file diff --git a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt similarity index 69% rename from plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt index 520bebd1b3..8f7382d271 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt +++ b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt @@ -13,7 +13,7 @@ class SntpClientTest : TestBase() { @Test fun ntpTimeTest() { // no internet - SntpClient(aapsLogger, dateUtil).ntpTime(object : SntpClient.Callback() { + info.nightscout.plugins.constraints.objectives.SntpClient(aapsLogger, dateUtil).ntpTime(object : info.nightscout.plugins.constraints.objectives.SntpClient.Callback() { override fun run() { Assert.assertFalse(networkConnected) Assert.assertFalse(success) @@ -21,7 +21,7 @@ class SntpClientTest : TestBase() { } }, false) // internet - SntpClient(aapsLogger, dateUtil).doNtpTime(object : SntpClient.Callback() { + info.nightscout.plugins.constraints.objectives.SntpClient(aapsLogger, dateUtil).doNtpTime(object : info.nightscout.plugins.constraints.objectives.SntpClient.Callback() { override fun run() { Assert.assertTrue(success) Assert.assertTrue(abs(time - System.currentTimeMillis()) < 60000) diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt similarity index 100% rename from plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt similarity index 100% rename from plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt similarity index 100% rename from plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt similarity index 100% rename from plugins/support/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt diff --git a/plugins/main/src/main/java/info/nightscout/plugins/di/ObjectivesModule.kt b/plugins/main/src/main/java/info/nightscout/plugins/di/ObjectivesModule.kt deleted file mode 100644 index c6adf3c874..0000000000 --- a/plugins/main/src/main/java/info/nightscout/plugins/di/ObjectivesModule.kt +++ /dev/null @@ -1,39 +0,0 @@ -package info.nightscout.plugins.di - -import dagger.Module -import dagger.android.ContributesAndroidInjector -import info.nightscout.plugins.constraints.objectives.ObjectivesFragment -import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog -import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog -import info.nightscout.plugins.constraints.objectives.objectives.Objective -import info.nightscout.plugins.constraints.objectives.objectives.Objective0 -import info.nightscout.plugins.constraints.objectives.objectives.Objective1 -import info.nightscout.plugins.constraints.objectives.objectives.Objective10 -import info.nightscout.plugins.constraints.objectives.objectives.Objective2 -import info.nightscout.plugins.constraints.objectives.objectives.Objective3 -import info.nightscout.plugins.constraints.objectives.objectives.Objective4 -import info.nightscout.plugins.constraints.objectives.objectives.Objective5 -import info.nightscout.plugins.constraints.objectives.objectives.Objective6 -import info.nightscout.plugins.constraints.objectives.objectives.Objective7 -import info.nightscout.plugins.constraints.objectives.objectives.Objective9 - -@Module -@Suppress("unused") -abstract class ObjectivesModule { - - @ContributesAndroidInjector abstract fun contributesObjectivesFragment(): ObjectivesFragment - @ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog - @ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): NtpProgressDialog - - @ContributesAndroidInjector abstract fun objectiveInjector(): Objective - @ContributesAndroidInjector abstract fun objective0Injector(): Objective0 - @ContributesAndroidInjector abstract fun objective1Injector(): Objective1 - @ContributesAndroidInjector abstract fun objective2Injector(): Objective2 - @ContributesAndroidInjector abstract fun objective3Injector(): Objective3 - @ContributesAndroidInjector abstract fun objective4Injector(): Objective4 - @ContributesAndroidInjector abstract fun objective5Injector(): Objective5 - @ContributesAndroidInjector abstract fun objective6Injector(): Objective6 - @ContributesAndroidInjector abstract fun objective7Injector(): Objective7 - @ContributesAndroidInjector abstract fun objective9Injector(): Objective9 - @ContributesAndroidInjector abstract fun objective10Injector(): Objective10 -} \ No newline at end of file diff --git a/plugins/main/src/main/java/info/nightscout/plugins/di/PluginsModule.kt b/plugins/main/src/main/java/info/nightscout/plugins/di/PluginsModule.kt index 3d20e2e34a..ea1fe6c73b 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/di/PluginsModule.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/di/PluginsModule.kt @@ -19,7 +19,6 @@ import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin ProfileModule::class, SourceModule::class, VirtualPumpModule::class, - ObjectivesModule::class, SkinsModule::class, SkinsUiModule::class, ActionsModule::class, diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt index 0ad254168d..6db0614ff5 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt @@ -193,7 +193,7 @@ class ActionsFragment : DaggerFragment() { uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.ANNOUNCEMENT, info.nightscout.core.ui.R.string.careportal_announcement) } - sp.putBoolean(R.string.key_objectiveuseactions, true) + sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, true) } @Synchronized diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsPlugin.kt index 906af9a50d..c4d93b566b 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsPlugin.kt @@ -2,6 +2,7 @@ package info.nightscout.plugins.general.actions import dagger.android.HasAndroidInjector import info.nightscout.interfaces.Config +import info.nightscout.interfaces.actions.Actions import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType @@ -28,4 +29,4 @@ class ActionsPlugin @Inject constructor( .shortName(R.string.actions_shortname) .description(R.string.description_actions), aapsLogger, rh, injector -) +), Actions diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt index b8da15234c..3b5f145058 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt @@ -209,7 +209,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList overviewData.rangeToDisplay = if (overviewData.rangeToDisplay > 24) 6 else overviewData.rangeToDisplay sp.putInt(info.nightscout.core.utils.R.string.key_rangetodisplay, overviewData.rangeToDisplay) rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_rangetodisplay))) - sp.putBoolean(R.string.key_objectiveusescale, true) + sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, true) false } prepareGraphsIfNeeded(overviewMenus.setting.size) @@ -273,7 +273,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList overviewData.rangeToDisplay = it.hours sp.putInt(info.nightscout.core.utils.R.string.key_rangetodisplay, it.hours) rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_rangetodisplay))) - sp.putBoolean(R.string.key_objectiveusescale, true) + sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, true) }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventNewBG::class.java) @@ -659,7 +659,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList (loop as PluginBase).isEnabled() && loop.isSuspended -> { binding.infoLayout.apsMode.setImageResource(info.nightscout.core.ui.R.drawable.ic_loop_paused) - apsModeSetA11yLabel(R.string.suspendloop_label) + apsModeSetA11yLabel(info.nightscout.core.ui.R.string.suspendloop_label) binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) binding.infoLayout.apsModeText.visibility = View.VISIBLE } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt index 6aace87e40..0bf57732be 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt @@ -124,7 +124,7 @@ open class VirtualPumpPlugin @Inject constructor( override fun preprocessPreferences(preferenceFragment: PreferenceFragmentCompat) { super.preprocessPreferences(preferenceFragment) - val uploadStatus = preferenceFragment.findPreference(rh.gs(R.string.key_virtual_pump_upload_status)) as SwitchPreference? + val uploadStatus = preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status)) as SwitchPreference? ?: return uploadStatus.isVisible = !config.NSCLIENT } @@ -340,7 +340,7 @@ open class VirtualPumpPlugin @Inject constructor( override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject { val now = System.currentTimeMillis() - if (!sp.getBoolean(R.string.key_virtual_pump_upload_status, false)) { + if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false)) { return JSONObject() } val pump = JSONObject() diff --git a/plugins/main/src/main/res/values/strings.xml b/plugins/main/src/main/res/values/strings.xml index 7cf8ce96cf..8ad09cd9e3 100644 --- a/plugins/main/src/main/res/values/strings.xml +++ b/plugins/main/src/main/res/values/strings.xml @@ -195,24 +195,6 @@ TARG BAS - - Completed, well done! - Not completed yet - Time elapsed - Maximal IOB set properly - BG available from selected source - Synchronization service has write permission - Loop enabled - APS selected - Closed mode enabled - OBJ - Learning program - Do you want reset objective start? You may lose your progress. - Next - Prev - Clear finished - Clear started - Actions Some buttons to quickly access common features @@ -233,21 +215,6 @@ patch pump age Patch pump - - Limiting extended bolus to %1$.1f U because of %2$s - Limiting carbs to %1$d g because of %2$s - - Safety - Pump is not temp basal capable - Closed loop mode disabled in preferences - Running dev version. Closed loop is disabled. - Closed loop disabled because of running Extended bolus - SMB always and after carbs disabled because active BG source doesn\'t support advanced filtering - SMB not allowed in open loop mode - max value in preferences - hard limit - Treatments safety - show_calibration_button show_cgm_button @@ -397,7 +364,6 @@ Graph - virtualpump_uploadstatus Virtual Pump Type Pump Definition Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s @@ -406,7 +372,6 @@ Pump integration for pumps which don\'t have any driver yet (Open Loop) VIRTUAL PUMP Virtual pump settings - Upload status to NS dexcom_lognssensorchange diff --git a/plugins/support/src/main/AndroidManifest.xml b/plugins/support/src/main/AndroidManifest.xml deleted file mode 100644 index a5918e68ab..0000000000 --- a/plugins/support/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 6a419e7a21..a7ff95a7d4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,7 +21,7 @@ include ':plugins:configuration' include ':plugins:main' include ':plugins:openhumans' include ':plugins:sensitivity' -include ':plugins:support' +include ':plugins:constraints' include ':pump:combo' include ':pump:combov2' include ':pump:combov2:comboctl'