From 87cd4b354f21338ebae26a2f9db91f8170c999ce Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 27 Sep 2023 12:32:47 +0200 Subject: [PATCH] forgotten namespace --- app/src/main/kotlin/app/aaps/MainActivity.kt | 4 +- app/src/main/kotlin/app/aaps/MainApp.kt | 2 +- .../aaps/activities/MyPreferenceFragment.kt | 92 +++++++++---------- .../app/aaps/core/main/wizard/QuickWizard.kt | 4 +- .../aaps/core/main/wizard/QuickWizardEntry.kt | 4 +- .../aaps/core/main/wizard/QuickWizardTest.kt | 2 +- core/utils/build.gradle | 2 +- .../alerts/LocalAlertUtilsImpl.kt | 14 +-- .../overview/OverviewDataImpl.kt | 2 +- .../profile/DefaultValueHelperImpl.kt | 16 ++-- .../profile/ProfileFunctionImpl.kt | 2 +- .../implementation/profile/ProfileUtilImpl.kt | 2 +- .../protection/BiometricCheck.kt | 6 +- .../protection/ProtectionCheckImpl.kt | 24 ++--- .../pump/PumpSyncImplementation.kt | 24 ++--- .../aaps/implementation/queue/QueueThread.kt | 6 +- .../implementation/utils/HardLimitsImpl.kt | 14 +-- .../utils/fabric/FabricPrivacyImpl.kt | 2 +- .../app/aaps/plugins/aps/APSResultObject.kt | 4 +- .../aaps/plugins/aps/autotune/AutotuneCore.kt | 6 +- .../plugins/aps/autotune/AutotuneFragment.kt | 18 ++-- .../aaps/plugins/aps/autotune/AutotuneIob.kt | 2 +- .../plugins/aps/autotune/AutotunePlugin.kt | 22 ++--- .../aaps/plugins/aps/autotune/AutotunePrep.kt | 6 +- .../plugins/aps/autotune/data/ATProfile.kt | 6 +- .../app/aaps/plugins/aps/loop/LoopFragment.kt | 2 +- .../app/aaps/plugins/aps/loop/LoopPlugin.kt | 12 +-- .../openAPSAMA/DetermineBasalAdapterAMAJS.kt | 2 +- .../aps/openAPSAMA/OpenAPSAMAPlugin.kt | 2 +- .../openAPSSMB/DetermineBasalAdapterSMBJS.kt | 2 +- .../aps/openAPSSMB/OpenAPSSMBPlugin.kt | 2 +- .../DetermineBasalAdapterSMBDynamicISFJS.kt | 8 +- .../plugins/aps/autotune/AutotuneCoreTest.kt | 12 +-- .../plugins/aps/autotune/AutotunePrepTest.kt | 12 +-- .../aaps/plugins/aps/loop/LoopPluginTest.kt | 2 +- .../automation/actions/ActionRunAutotune.kt | 6 +- .../triggers/TriggerAutosensValue.kt | 4 +- .../plugins/automation/triggers/TriggerCOB.kt | 2 +- .../triggers/TriggerAutosensValueTest.kt | 4 +- .../configBuilder/RunningConfigurationImpl.kt | 4 +- .../maintenance/ImportExportPrefsImpl.kt | 8 +- .../maintenance/MaintenanceFragment.kt | 2 +- .../maintenance/PrefFileListProviderImpl.kt | 2 +- .../CustomWatchfaceImportListActivity.kt | 2 +- .../configuration/setupwizard/SWDefinition.kt | 32 +++---- .../elements/SWEditEncryptedPassword.kt | 4 +- .../objectives/ObjectivesPlugin.kt | 20 ++-- .../objectives/objectives/Objective0.kt | 6 +- .../objectives/objectives/Objective1.kt | 14 +-- .../objectives/objectives/Objective3.kt | 6 +- .../objectives/objectives/Objective6.kt | 2 +- .../constraints/safety/SafetyPlugin.kt | 22 ++--- .../versionChecker/VersionCheckerPlugin.kt | 4 +- .../versionChecker/VersionCheckerUtilsImpl.kt | 4 +- .../constraints/ConstraintsCheckerImplTest.kt | 28 +++--- .../constraints/safety/SafetyPluginTest.kt | 30 +++--- .../insulin/InsulinOrefFreePeakPlugin.kt | 6 +- .../insulin/InsulinOrefFreePeakPluginTest.kt | 4 +- .../main/general/actions/ActionsFragment.kt | 2 +- .../main/general/overview/OverviewFragment.kt | 14 +-- .../main/general/overview/OverviewPlugin.kt | 86 ++++++++--------- .../notifications/NotificationWithAction.kt | 4 +- .../general/overview/ui/StatusLightHandler.kt | 16 ++-- .../smsCommunicator/SmsCommunicatorPlugin.kt | 22 ++--- .../smsCommunicator/otp/OneTimePassword.kt | 2 +- .../general/themes/ThemeSwitcherPlugin.kt | 4 +- .../plugins/main/general/wear/WearPlugin.kt | 4 +- .../wear/activities/CwfInfosActivity.kt | 2 +- .../wear/wearintegration/DataHandlerMobile.kt | 24 ++--- .../IobCobCalculatorPlugin.kt | 18 ++-- .../data/AutosensDataObject.kt | 4 +- .../plugins/main/profile/ProfilePlugin.kt | 4 +- .../SmsCommunicatorPluginTest.kt | 12 +-- .../sensitivity/AbstractSensitivityPlugin.kt | 4 +- .../sensitivity/SensitivityAAPSPlugin.kt | 44 ++++----- .../sensitivity/SensitivityOref1Plugin.kt | 36 ++++---- .../SensitivityWeightedAveragePlugin.kt | 44 ++++----- .../sync/nsShared/NsIncomingDataProcessor.kt | 20 ++-- .../sync/nsShared/StoreDataForDbImpl.kt | 18 ++-- .../sync/nsclient/DataSyncSelectorV1.kt | 4 +- .../plugins/sync/nsclient/NSClientPlugin.kt | 4 +- .../nsclient/data/NSDeviceStatusHandler.kt | 2 +- .../nsclient/data/NSSettingsStatusImpl.kt | 16 ++-- .../data/ProcessedDeviceStatusDataImpl.kt | 4 +- .../sync/nsclient/services/NSClientService.kt | 20 ++-- .../workers/NSClientAddUpdateWorker.kt | 14 +-- .../nsclient/workers/NSClientMbgWorker.kt | 2 +- .../sync/nsclientV3/DataSyncSelectorV3.kt | 4 +- .../sync/nsclientV3/NSClientV3Plugin.kt | 52 +++++------ .../sync/nsclientV3/workers/LoadBgWorker.kt | 4 +- .../sync/xdrip/DataSyncSelectorXdripImpl.kt | 4 +- .../aaps/plugins/sync/xdrip/XdripPlugin.kt | 2 +- .../nsclientV3/workers/LoadBgWorkerTest.kt | 3 +- .../danaRKorean/DanaRKoreanPlugin.kt | 4 +- .../androidaps/danar/DanaRPlugin.java | 4 +- .../dash/ui/OmnipodDashOverviewFragment.kt | 2 +- .../eros/ui/OmnipodErosOverviewFragment.kt | 2 +- .../aaps/pump/virtual/VirtualPumpPlugin.kt | 8 +- .../pump/virtual/VirtualPumpPluginUTest.kt | 6 +- .../app/aaps/shared/tests/HardLimitsMock.kt | 12 +-- .../aaps/shared/tests/TestBaseWithProfile.kt | 2 +- .../aaps/ui/activities/ErrorHelperActivity.kt | 2 +- .../kotlin/app/aaps/ui/dialogs/CarbsDialog.kt | 16 ++-- .../aaps/ui/dialogs/DialogFragmentWithDate.kt | 2 +- .../aaps/ui/dialogs/EditQuickWizardDialog.kt | 12 +-- .../kotlin/app/aaps/ui/dialogs/LoopDialog.kt | 12 +-- .../aaps/ui/dialogs/ProfileSwitchDialog.kt | 2 +- .../app/aaps/ui/dialogs/TempTargetDialog.kt | 2 +- .../app/aaps/ui/dialogs/WizardDialog.kt | 18 ++-- .../app/aaps/ui/services/AlarmSoundService.kt | 2 +- .../aaps/workflow/CalculationWorkflowImpl.kt | 4 +- .../aaps/workflow/iob/CarbsInPastExtension.kt | 4 +- .../aaps/workflow/iob/IobCobOref1Worker.kt | 4 +- .../app/aaps/workflow/iob/IobCobOrefWorker.kt | 2 +- 114 files changed, 599 insertions(+), 600 deletions(-) diff --git a/app/src/main/kotlin/app/aaps/MainActivity.kt b/app/src/main/kotlin/app/aaps/MainActivity.kt index fdc5b20cfc..735d4699cf 100644 --- a/app/src/main/kotlin/app/aaps/MainActivity.kt +++ b/app/src/main/kotlin/app/aaps/MainActivity.kt @@ -477,7 +477,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() { FirebaseCrashlytics.getInstance().setCustomKey("Remote", remote) FirebaseCrashlytics.getInstance().setCustomKey("Committed", BuildConfig.COMMITTED) FirebaseCrashlytics.getInstance().setCustomKey("Hash", hashes[0]) - FirebaseCrashlytics.getInstance().setCustomKey("Email", sp.getString(info.nightscout.core.utils.R.string.key_email_for_crash_report, "")) + FirebaseCrashlytics.getInstance().setCustomKey("Email", sp.getString(app.aaps.core.utils.R.string.key_email_for_crash_report, "")) } /** @@ -488,7 +488,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() { val passwordReset = File(fileListProvider.ensureExtraDirExists(), "PasswordReset") if (passwordReset.exists()) { val sn = activePlugin.activePump.serialNumber() - sp.putString(info.nightscout.core.utils.R.string.key_master_password, cryptoUtil.hashPassword(sn)) + sp.putString(app.aaps.core.utils.R.string.key_master_password, cryptoUtil.hashPassword(sn)) passwordReset.delete() ToastUtils.okToast(context, context.getString(app.aaps.core.ui.R.string.password_set)) } diff --git a/app/src/main/kotlin/app/aaps/MainApp.kt b/app/src/main/kotlin/app/aaps/MainApp.kt index 6534d0e2be..ec13f49f43 100644 --- a/app/src/main/kotlin/app/aaps/MainApp.kt +++ b/app/src/main/kotlin/app/aaps/MainApp.kt @@ -125,7 +125,7 @@ class MainApp : DaggerApplication() { handler.postDelayed( { // check if identification is set - if (config.isDev() && sp.getStringOrNull(info.nightscout.core.utils.R.string.key_email_for_crash_report, null).isNullOrBlank()) + if (config.isDev() && sp.getStringOrNull(app.aaps.core.utils.R.string.key_email_for_crash_report, null).isNullOrBlank()) notificationStore.add(Notification(Notification.IDENTIFICATION_NOT_SET, rh.get().gs(R.string.identification_not_set), Notification.INFO)) // log version disposable += repository.runTransaction(VersionChangeTransaction(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, gitRemote, commitHash)).subscribe() diff --git a/app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt b/app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt index 2355f56d02..530b990657 100644 --- a/app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt @@ -246,11 +246,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang if (key == rh.gs(app.aaps.plugins.main.R.string.key_short_tabtitles)) { rxBus.send(EventRebuildTabs()) } - if (key == rh.gs(info.nightscout.core.utils.R.string.key_units)) { + if (key == rh.gs(app.aaps.core.utils.R.string.key_units)) { activity?.recreate() return } - if (key == rh.gs(info.nightscout.core.utils.R.string.key_use_autosens) && sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false)) { + if (key == rh.gs(app.aaps.core.utils.R.string.key_use_autosens) && sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false)) { activity?.let { OKDialog.show(it, rh.gs(app.aaps.plugins.configuration.R.string.configbuilder_sensitivity), rh.gs(R.string.sensitivity_warning)) } @@ -269,10 +269,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang private fun checkForBiometricFallback(key: String) { // Biometric protection activated without set master password - if ((rh.gs(info.nightscout.core.utils.R.string.key_settings_protection) == key || - rh.gs(info.nightscout.core.utils.R.string.key_application_protection) == key || - rh.gs(info.nightscout.core.utils.R.string.key_bolus_protection) == key) && - sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") == "" && + if ((rh.gs(app.aaps.core.utils.R.string.key_settings_protection) == key || + rh.gs(app.aaps.core.utils.R.string.key_application_protection) == key || + rh.gs(app.aaps.core.utils.R.string.key_bolus_protection) == key) && + sp.getString(app.aaps.core.utils.R.string.key_master_password, "") == "" && sp.getInt(key, NONE.ordinal) == BIOMETRIC.ordinal ) { activity?.let { @@ -288,10 +288,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } // Master password erased with activated Biometric protection - val isBiometricActivated = sp.getInt(info.nightscout.core.utils.R.string.key_settings_protection, NONE.ordinal) == BIOMETRIC.ordinal || - sp.getInt(info.nightscout.core.utils.R.string.key_application_protection, NONE.ordinal) == BIOMETRIC.ordinal || - sp.getInt(info.nightscout.core.utils.R.string.key_bolus_protection, NONE.ordinal) == BIOMETRIC.ordinal - if (rh.gs(info.nightscout.core.utils.R.string.key_master_password) == key && sp.getString(key, "") == "" && isBiometricActivated) { + val isBiometricActivated = sp.getInt(app.aaps.core.utils.R.string.key_settings_protection, NONE.ordinal) == BIOMETRIC.ordinal || + sp.getInt(app.aaps.core.utils.R.string.key_application_protection, NONE.ordinal) == BIOMETRIC.ordinal || + sp.getInt(app.aaps.core.utils.R.string.key_bolus_protection, NONE.ordinal) == BIOMETRIC.ordinal + if (rh.gs(app.aaps.core.utils.R.string.key_master_password) == key && sp.getString(key, "") == "" && isBiometricActivated) { activity?.let { val title = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_biometric) val message = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_descriotion_biometric) @@ -324,11 +324,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang private fun adjustUnitDependentPrefs(pref: Preference) { // convert preferences values to current units val unitDependent = arrayOf( - rh.gs(info.nightscout.core.utils.R.string.key_hypo_target), - rh.gs(info.nightscout.core.utils.R.string.key_activity_target), - rh.gs(info.nightscout.core.utils.R.string.key_eatingsoon_target), - rh.gs(info.nightscout.core.utils.R.string.key_high_mark), - rh.gs(info.nightscout.core.utils.R.string.key_low_mark) + rh.gs(app.aaps.core.utils.R.string.key_hypo_target), + rh.gs(app.aaps.core.utils.R.string.key_activity_target), + rh.gs(app.aaps.core.utils.R.string.key_eatingsoon_target), + rh.gs(app.aaps.core.utils.R.string.key_high_mark), + rh.gs(app.aaps.core.utils.R.string.key_low_mark) ) if (unitDependent.toList().contains(pref.key) && pref is EditTextPreference) { val converted = profileUtil.valueInCurrentUnitsDetect(SafeParse.stringToDouble(pref.text)) @@ -359,29 +359,29 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang if (pref is ListPreference) { pref.setSummary(pref.entry) // Preferences - if (pref.getKey() == rh.gs(info.nightscout.core.utils.R.string.key_settings_protection)) { - val pass: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_settings_password)) + if (pref.getKey() == rh.gs(app.aaps.core.utils.R.string.key_settings_protection)) { + val pass: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_settings_password)) val usePassword = pref.value == CUSTOM_PASSWORD.ordinal.toString() pass?.let { it.isVisible = usePassword } - val pin: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_settings_pin)) + val pin: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_settings_pin)) val usePin = pref.value == CUSTOM_PIN.ordinal.toString() pin?.let { it.isVisible = usePin } } // Application - if (pref.getKey() == rh.gs(info.nightscout.core.utils.R.string.key_application_protection)) { - val pass: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_application_password)) + if (pref.getKey() == rh.gs(app.aaps.core.utils.R.string.key_application_protection)) { + val pass: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_application_password)) val usePassword = pref.value == CUSTOM_PASSWORD.ordinal.toString() pass?.let { it.isVisible = usePassword } - val pin: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_application_pin)) + val pin: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_application_pin)) val usePin = pref.value == CUSTOM_PIN.ordinal.toString() pin?.let { it.isVisible = usePin } } // Bolus - if (pref.getKey() == rh.gs(info.nightscout.core.utils.R.string.key_bolus_protection)) { - val pass: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_bolus_password)) + if (pref.getKey() == rh.gs(app.aaps.core.utils.R.string.key_bolus_protection)) { + val pass: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_bolus_password)) val usePassword = pref.value == CUSTOM_PASSWORD.ordinal.toString() pass?.let { it.isVisible = usePassword } - val pin: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin)) + val pin: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_bolus_pin)) val usePin = pref.value == CUSTOM_PIN.ordinal.toString() pin?.let { it.isVisible = usePin } } @@ -399,13 +399,13 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } val hmacPasswords = arrayOf( - rh.gs(info.nightscout.core.utils.R.string.key_bolus_password), - rh.gs(info.nightscout.core.utils.R.string.key_master_password), - rh.gs(info.nightscout.core.utils.R.string.key_application_password), - rh.gs(info.nightscout.core.utils.R.string.key_settings_password), - rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin), - rh.gs(info.nightscout.core.utils.R.string.key_application_pin), - rh.gs(info.nightscout.core.utils.R.string.key_settings_pin) + rh.gs(app.aaps.core.utils.R.string.key_bolus_password), + rh.gs(app.aaps.core.utils.R.string.key_master_password), + rh.gs(app.aaps.core.utils.R.string.key_application_password), + rh.gs(app.aaps.core.utils.R.string.key_settings_password), + rh.gs(app.aaps.core.utils.R.string.key_bolus_pin), + rh.gs(app.aaps.core.utils.R.string.key_application_pin), + rh.gs(app.aaps.core.utils.R.string.key_settings_pin) ) if (pref is Preference && (pref.key != null) && (hmacPasswords.contains(pref.key))) { @@ -442,40 +442,40 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang override fun onPreferenceTreeClick(preference: Preference): Boolean = context?.let { context -> when (preference.key) { - rh.gs(info.nightscout.core.utils.R.string.key_master_password) -> { - passwordCheck.queryPassword(context, app.aaps.plugins.configuration.R.string.current_master_password, info.nightscout.core.utils.R.string.key_master_password, { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password) + rh.gs(app.aaps.core.utils.R.string.key_master_password) -> { + passwordCheck.queryPassword(context, app.aaps.plugins.configuration.R.string.current_master_password, app.aaps.core.utils.R.string.key_master_password, { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.master_password, app.aaps.core.utils.R.string.key_master_password) }) true } - rh.gs(info.nightscout.core.utils.R.string.key_settings_password) -> { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_password, info.nightscout.core.utils.R.string.key_settings_password) + rh.gs(app.aaps.core.utils.R.string.key_settings_password) -> { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_password, app.aaps.core.utils.R.string.key_settings_password) true } - rh.gs(info.nightscout.core.utils.R.string.key_bolus_password) -> { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_password, info.nightscout.core.utils.R.string.key_bolus_password) + rh.gs(app.aaps.core.utils.R.string.key_bolus_password) -> { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_password, app.aaps.core.utils.R.string.key_bolus_password) true } - rh.gs(info.nightscout.core.utils.R.string.key_application_password) -> { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_password, info.nightscout.core.utils.R.string.key_application_password) + rh.gs(app.aaps.core.utils.R.string.key_application_password) -> { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_password, app.aaps.core.utils.R.string.key_application_password) true } - rh.gs(info.nightscout.core.utils.R.string.key_settings_pin) -> { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_pin, info.nightscout.core.utils.R.string.key_settings_pin, pinInput = true) + rh.gs(app.aaps.core.utils.R.string.key_settings_pin) -> { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_pin, app.aaps.core.utils.R.string.key_settings_pin, pinInput = true) true } - rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin) -> { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_pin, info.nightscout.core.utils.R.string.key_bolus_pin, pinInput = true) + rh.gs(app.aaps.core.utils.R.string.key_bolus_pin) -> { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_pin, app.aaps.core.utils.R.string.key_bolus_pin, pinInput = true) true } - rh.gs(info.nightscout.core.utils.R.string.key_application_pin) -> { - passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_pin, info.nightscout.core.utils.R.string.key_application_pin, pinInput = true) + rh.gs(app.aaps.core.utils.R.string.key_application_pin) -> { + passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_pin, app.aaps.core.utils.R.string.key_application_pin, pinInput = true) true } // NSClient copy settings diff --git a/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizard.kt b/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizard.kt index ae10ccd68b..f3f9d9624d 100644 --- a/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizard.kt +++ b/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizard.kt @@ -17,7 +17,7 @@ class QuickWizard @Inject constructor( private var storage = JSONArray() init { - setData(JSONArray(sp.getString(info.nightscout.core.utils.R.string.key_quickwizard, "[]"))) + setData(JSONArray(sp.getString(app.aaps.core.utils.R.string.key_quickwizard, "[]"))) setGuidsForOldEntries() } @@ -45,7 +45,7 @@ class QuickWizard @Inject constructor( } fun save() { - sp.putString(info.nightscout.core.utils.R.string.key_quickwizard, storage.toString()) + sp.putString(app.aaps.core.utils.R.string.key_quickwizard, storage.toString()) } fun size(): Int = storage.length() diff --git a/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizardEntry.kt b/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizardEntry.kt index f60ef5cd89..48d5fb3b18 100644 --- a/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizardEntry.kt +++ b/core/main/src/main/kotlin/app/aaps/core/main/wizard/QuickWizardEntry.kt @@ -137,7 +137,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec } // SuperBolus var superBolus = false - if (useSuperBolus() == YES && sp.getBoolean(info.nightscout.core.utils.R.string.key_usesuperbolus, false)) { + if (useSuperBolus() == YES && sp.getBoolean(app.aaps.core.utils.R.string.key_usesuperbolus, false)) { superBolus = true } if (loop.isEnabled() && loop.isSuperBolus) superBolus = false @@ -151,7 +151,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec } else if (useTrend() == NEGATIVE_ONLY && glucoseStatus != null && glucoseStatus.shortAvgDelta < 0) { trend = true } - val percentage = if (usePercentage() == DEFAULT) sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100) else percentage() + val percentage = if (usePercentage() == DEFAULT) sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100) else percentage() return BolusWizard(injector).doCalc( profile, profileName, diff --git a/core/main/src/test/kotlin/app/aaps/core/main/wizard/QuickWizardTest.kt b/core/main/src/test/kotlin/app/aaps/core/main/wizard/QuickWizardTest.kt index af84efa524..cdb62d3d3e 100644 --- a/core/main/src/test/kotlin/app/aaps/core/main/wizard/QuickWizardTest.kt +++ b/core/main/src/test/kotlin/app/aaps/core/main/wizard/QuickWizardTest.kt @@ -48,7 +48,7 @@ class QuickWizardTest : TestBase() { @BeforeEach fun setup() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_quickwizard, "[]")).thenReturn("[]") + `when`(sp.getString(app.aaps.core.utils.R.string.key_quickwizard, "[]")).thenReturn("[]") quickWizard = QuickWizard(sp, injector) } diff --git a/core/utils/build.gradle b/core/utils/build.gradle index 6ef6d4a957..02d06b54d7 100644 --- a/core/utils/build.gradle +++ b/core/utils/build.gradle @@ -13,7 +13,7 @@ apply from: "${project.rootDir}/core/main/jacoco_global.gradle" android { - namespace 'info.nightscout.core.utils' + namespace 'app.aaps.core.utils' } dependencies { diff --git a/implementation/src/main/kotlin/app/aaps/implementation/alerts/LocalAlertUtilsImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/alerts/LocalAlertUtilsImpl.kt index 716007167c..d722aeaaec 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/alerts/LocalAlertUtilsImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/alerts/LocalAlertUtilsImpl.kt @@ -51,18 +51,18 @@ class LocalAlertUtilsImpl @Inject constructor( private val disposable = CompositeDisposable() private fun missedReadingsThreshold(): Long { - return T.mins(sp.getInt(info.nightscout.core.utils.R.string.key_missed_bg_readings_threshold_minutes, Constants.DEFAULT_MISSED_BG_READINGS_THRESHOLD_MINUTES).toLong()).msecs() + return T.mins(sp.getInt(app.aaps.core.utils.R.string.key_missed_bg_readings_threshold_minutes, Constants.DEFAULT_MISSED_BG_READINGS_THRESHOLD_MINUTES).toLong()).msecs() } private fun pumpUnreachableThreshold(): Long { - return T.mins(sp.getInt(info.nightscout.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong()).msecs() + return T.mins(sp.getInt(app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong()).msecs() } override fun checkPumpUnreachableAlarm(lastConnection: Long, isStatusOutdated: Boolean, isDisconnected: Boolean) { val alarmTimeoutExpired = isAlarmTimeoutExpired(lastConnection, pumpUnreachableThreshold()) val nextAlarmOccurrenceReached = sp.getLong("nextPumpDisconnectedAlarm", 0L) < System.currentTimeMillis() if (config.APS && isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !isDisconnected) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_enable_pump_unreachable_alert, true)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_enable_pump_unreachable_alert, true)) { aapsLogger.debug(LTag.CORE, "Generating pump unreachable alarm. lastConnection: " + dateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated) sp.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold()) rxBus.send(EventNewNotification(Notification(Notification.PUMP_UNREACHABLE, rh.gs(app.aaps.core.ui.R.string.pump_unreachable), Notification.URGENT).also { @@ -70,10 +70,10 @@ class LocalAlertUtilsImpl @Inject constructor( app.aaps.core.ui.R.raw.alarm })) uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(app.aaps.core.ui.R.string.pump_unreachable), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors, true)) disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(rh.gs(app.aaps.core.ui.R.string.pump_unreachable))).subscribe() } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_smscommunicator_report_pump_unreachable, true)) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_smscommunicator_report_pump_unreachable, true)) smsCommunicator.sendNotificationToAllNumbers(rh.gs(app.aaps.core.ui.R.string.pump_unreachable)) } if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE)) @@ -123,7 +123,7 @@ class LocalAlertUtilsImpl @Inject constructor( override fun checkStaleBGAlert() { val bgReadingWrapped = repository.getLastGlucoseValueWrapped().blockingGet() val bgReading = if (bgReadingWrapped is ValueWrapper.Existing) bgReadingWrapped.value else return - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_enable_missed_bg_readings_alert, false) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_enable_missed_bg_readings_alert, false) && bgReading.timestamp + missedReadingsThreshold() < System.currentTimeMillis() && sp.getLong("nextMissedReadingsAlarm", 0L) < System.currentTimeMillis() ) { @@ -132,7 +132,7 @@ class LocalAlertUtilsImpl @Inject constructor( sp.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold()) rxBus.send(EventNewNotification(n)) uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(app.aaps.core.ui.R.string.missed_bg_readings), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors, true)) { disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(n.text)).subscribe() } } else if (dateUtil.isOlderThan(bgReading.timestamp, 5).not()) { diff --git a/implementation/src/main/kotlin/app/aaps/implementation/overview/OverviewDataImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/overview/OverviewDataImpl.kt index d5654ba01e..b1b131dc53 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/overview/OverviewDataImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/overview/OverviewDataImpl.kt @@ -108,7 +108,7 @@ class OverviewDataImpl @Inject constructor( } override fun initRange() { - rangeToDisplay = sp.getInt(info.nightscout.core.utils.R.string.key_rangetodisplay, 6) + rangeToDisplay = sp.getInt(app.aaps.core.utils.R.string.key_rangetodisplay, 6) val calendar = Calendar.getInstance().also { it.timeInMillis = System.currentTimeMillis() diff --git a/implementation/src/main/kotlin/app/aaps/implementation/profile/DefaultValueHelperImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/profile/DefaultValueHelperImpl.kt index 0ad91a518e..37ec3f23e2 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/profile/DefaultValueHelperImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/profile/DefaultValueHelperImpl.kt @@ -53,13 +53,13 @@ class DefaultValueHelperImpl @Inject constructor( */ override fun determineEatingSoonTT(): Double { val units = profileUtil.units - var value = sp.getDouble(info.nightscout.core.utils.R.string.key_eatingsoon_target, getDefaultEatingSoonTT(units)) + var value = sp.getDouble(app.aaps.core.utils.R.string.key_eatingsoon_target, getDefaultEatingSoonTT(units)) value = profileUtil.valueInCurrentUnitsDetect(value) return if (value > 0) value else getDefaultEatingSoonTT(units) } override fun determineEatingSoonTTDuration(): Int { - val value = sp.getInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration) + val value = sp.getInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration) return if (value > 0) value else Constants.defaultEatingSoonTTDuration } @@ -70,13 +70,13 @@ class DefaultValueHelperImpl @Inject constructor( */ override fun determineActivityTT(): Double { val units = profileUtil.units - var value = sp.getDouble(info.nightscout.core.utils.R.string.key_activity_target, getDefaultActivityTT(units)) + var value = sp.getDouble(app.aaps.core.utils.R.string.key_activity_target, getDefaultActivityTT(units)) value = profileUtil.valueInCurrentUnitsDetect(value) return if (value > 0) value else getDefaultActivityTT(units) } override fun determineActivityTTDuration(): Int { - val value = sp.getInt(info.nightscout.core.utils.R.string.key_activity_duration, Constants.defaultActivityTTDuration) + val value = sp.getInt(app.aaps.core.utils.R.string.key_activity_duration, Constants.defaultActivityTTDuration) return if (value > 0) value else Constants.defaultActivityTTDuration } @@ -87,13 +87,13 @@ class DefaultValueHelperImpl @Inject constructor( */ override fun determineHypoTT(): Double { val units = profileUtil.units - var value = sp.getDouble(info.nightscout.core.utils.R.string.key_hypo_target, getDefaultHypoTT(units)) + var value = sp.getDouble(app.aaps.core.utils.R.string.key_hypo_target, getDefaultHypoTT(units)) value = profileUtil.valueInCurrentUnitsDetect(value) return if (value > 0) value else getDefaultHypoTT(units) } override fun determineHypoTTDuration(): Int { - val value = sp.getInt(info.nightscout.core.utils.R.string.key_hypo_duration, Constants.defaultHypoTTDuration) + val value = sp.getInt(app.aaps.core.utils.R.string.key_hypo_duration, Constants.defaultHypoTTDuration) return if (value > 0) value else Constants.defaultHypoTTDuration } @@ -101,14 +101,14 @@ class DefaultValueHelperImpl @Inject constructor( override var bgTargetHigh = 180.0 override fun determineHighLine(): Double { - var highLineSetting = sp.getDouble(info.nightscout.core.utils.R.string.key_high_mark, bgTargetHigh) + var highLineSetting = sp.getDouble(app.aaps.core.utils.R.string.key_high_mark, bgTargetHigh) if (highLineSetting < 1) highLineSetting = Constants.HIGH_MARK highLineSetting = profileUtil.valueInCurrentUnitsDetect(highLineSetting) return highLineSetting } override fun determineLowLine(): Double { - var lowLineSetting = sp.getDouble(info.nightscout.core.utils.R.string.key_low_mark, bgTargetLow) + var lowLineSetting = sp.getDouble(app.aaps.core.utils.R.string.key_low_mark, bgTargetLow) if (lowLineSetting < 1) lowLineSetting = Constants.LOW_MARK lowLineSetting = profileUtil.valueInCurrentUnitsDetect(lowLineSetting) return lowLineSetting diff --git a/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt index 92db8d8728..94d8603af7 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt @@ -142,7 +142,7 @@ class ProfileFunctionImpl @Inject constructor( } override fun getUnits(): GlucoseUnit = - if (sp.getString(info.nightscout.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL + if (sp.getString(app.aaps.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL else GlucoseUnit.MMOL override fun buildProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): ProfileSwitch? { diff --git a/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileUtilImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileUtilImpl.kt index 990af1515f..cddd8f3ea2 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileUtilImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileUtilImpl.kt @@ -15,7 +15,7 @@ class ProfileUtilImpl @Inject constructor( override val units: GlucoseUnit get() = - if (sp.getString(info.nightscout.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL + if (sp.getString(app.aaps.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL else GlucoseUnit.MMOL override fun fromMgdlToUnits(valueInMgdl: Double, targetUnits: GlucoseUnit): Double = diff --git a/implementation/src/main/kotlin/app/aaps/implementation/protection/BiometricCheck.kt b/implementation/src/main/kotlin/app/aaps/implementation/protection/BiometricCheck.kt index 0a7f208904..8da0e7cf68 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/protection/BiometricCheck.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/protection/BiometricCheck.kt @@ -42,7 +42,7 @@ object BiometricCheck { ToastUtils.errorToast(activity.baseContext, errString.toString()) // fallback to master password runOnUiThread { - passwordCheck.queryPassword(activity, R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + passwordCheck.queryPassword(activity, R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) } } @@ -54,7 +54,7 @@ object BiometricCheck { // no pin set // fallback to master password runOnUiThread { - passwordCheck.queryPassword(activity, R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + passwordCheck.queryPassword(activity, R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) } } @@ -63,7 +63,7 @@ object BiometricCheck { ERROR_HW_NOT_PRESENT, ERROR_NO_BIOMETRICS -> runOnUiThread { - passwordCheck.queryPassword(activity, R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + passwordCheck.queryPassword(activity, R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) } } } diff --git a/implementation/src/main/kotlin/app/aaps/implementation/protection/ProtectionCheckImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/protection/ProtectionCheckImpl.kt index 89d753bdfe..45f403c813 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/protection/ProtectionCheckImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/protection/ProtectionCheckImpl.kt @@ -19,21 +19,21 @@ class ProtectionCheckImpl @Inject constructor( private var lastAuthorization = mutableListOf(0L, 0L, 0L) private val passwordsResourceIDs = listOf( - info.nightscout.core.utils.R.string.key_settings_password, - info.nightscout.core.utils.R.string.key_application_password, - info.nightscout.core.utils.R.string.key_bolus_password + app.aaps.core.utils.R.string.key_settings_password, + app.aaps.core.utils.R.string.key_application_password, + app.aaps.core.utils.R.string.key_bolus_password ) private val pinsResourceIDs = listOf( - info.nightscout.core.utils.R.string.key_settings_pin, - info.nightscout.core.utils.R.string.key_application_pin, - info.nightscout.core.utils.R.string.key_bolus_pin + app.aaps.core.utils.R.string.key_settings_pin, + app.aaps.core.utils.R.string.key_application_pin, + app.aaps.core.utils.R.string.key_bolus_pin ) private val protectionTypeResourceIDs = listOf( - info.nightscout.core.utils.R.string.key_settings_protection, - info.nightscout.core.utils.R.string.key_application_protection, - info.nightscout.core.utils.R.string.key_bolus_protection + app.aaps.core.utils.R.string.key_settings_protection, + app.aaps.core.utils.R.string.key_application_protection, + app.aaps.core.utils.R.string.key_bolus_protection ) private val titlePassResourceIDs = listOf( @@ -55,7 +55,7 @@ class ProtectionCheckImpl @Inject constructor( return when (ProtectionCheck.ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionCheck.ProtectionType.NONE.ordinal)]) { ProtectionCheck.ProtectionType.NONE -> false ProtectionCheck.ProtectionType.BIOMETRIC -> true - ProtectionCheck.ProtectionType.MASTER_PASSWORD -> sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") != "" + ProtectionCheck.ProtectionType.MASTER_PASSWORD -> sp.getString(app.aaps.core.utils.R.string.key_master_password, "") != "" ProtectionCheck.ProtectionType.CUSTOM_PASSWORD -> sp.getString(passwordsResourceIDs[protection.ordinal], "") != "" ProtectionCheck.ProtectionType.CUSTOM_PIN -> sp.getString(pinsResourceIDs[protection.ordinal], "") != "" } @@ -66,7 +66,7 @@ class ProtectionCheckImpl @Inject constructor( } private fun activeSession(protection: ProtectionCheck.Protection): Boolean { - var timeout = TimeUnit.SECONDS.toMillis(sp.getInt(info.nightscout.core.utils.R.string.key_protection_timeout, 0).toLong()) + var timeout = TimeUnit.SECONDS.toMillis(sp.getInt(app.aaps.core.utils.R.string.key_protection_timeout, 0).toLong()) // Default timeout to pass the resume check at start of an activity timeout = if (timeout < 1000) 1000 else timeout val last = lastAuthorization[protection.ordinal] @@ -96,7 +96,7 @@ class ProtectionCheckImpl @Inject constructor( passwordCheck.queryPassword( activity, app.aaps.core.ui.R.string.master_password, - info.nightscout.core.utils.R.string.key_master_password, + app.aaps.core.utils.R.string.key_master_password, { onOk(protection); ok?.run() }, { cancel?.run() }, { fail?.run() }) diff --git a/implementation/src/main/kotlin/app/aaps/implementation/pump/PumpSyncImplementation.kt b/implementation/src/main/kotlin/app/aaps/implementation/pump/PumpSyncImplementation.kt index fdcd4bdad5..1db60cde05 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/pump/PumpSyncImplementation.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/pump/PumpSyncImplementation.kt @@ -73,14 +73,14 @@ class PumpSyncImplementation @Inject constructor( syncStopExtendedBolusWithPumpId(dateUtil.now(), dateUtil.now(), it.pumpType, it.pumpSerial) } } - sp.remove(info.nightscout.core.utils.R.string.key_active_pump_type) - sp.remove(info.nightscout.core.utils.R.string.key_active_pump_serial_number) - sp.remove(info.nightscout.core.utils.R.string.key_active_pump_change_timestamp) + sp.remove(app.aaps.core.utils.R.string.key_active_pump_type) + sp.remove(app.aaps.core.utils.R.string.key_active_pump_serial_number) + sp.remove(app.aaps.core.utils.R.string.key_active_pump_change_timestamp) } override fun verifyPumpIdentification(type: PumpType, serialNumber: String): Boolean { - val storedType = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_type, "") - val storedSerial = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, "") + val storedType = sp.getString(app.aaps.core.utils.R.string.key_active_pump_type, "") + val storedSerial = sp.getString(app.aaps.core.utils.R.string.key_active_pump_serial_number, "") if (activePlugin.activePump is VirtualPump) return true if (type.description == storedType && serialNumber == storedSerial) return true aapsLogger.debug(LTag.PUMP, "verifyPumpIdentification failed for $type $serialNumber") @@ -96,16 +96,16 @@ class PumpSyncImplementation @Inject constructor( * @return true if data is allowed */ private fun confirmActivePump(timestamp: Long, type: PumpType, serialNumber: String, showNotification: Boolean = true): Boolean { - val storedType = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_type, "") - val storedSerial = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, "") - val storedTimestamp = sp.getLong(info.nightscout.core.utils.R.string.key_active_pump_change_timestamp, 0L) + val storedType = sp.getString(app.aaps.core.utils.R.string.key_active_pump_type, "") + val storedSerial = sp.getString(app.aaps.core.utils.R.string.key_active_pump_serial_number, "") + val storedTimestamp = sp.getLong(app.aaps.core.utils.R.string.key_active_pump_change_timestamp, 0L) // If no value stored assume we start using new pump from now if (storedType.isEmpty() || storedSerial.isEmpty()) { aapsLogger.debug(LTag.PUMP, "Registering new pump ${type.description} $serialNumber") - sp.putString(info.nightscout.core.utils.R.string.key_active_pump_type, type.description) - sp.putString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, serialNumber) - sp.putLong(info.nightscout.core.utils.R.string.key_active_pump_change_timestamp, dateUtil.now()) // allow only data newer than register time (ie. ignore older history) + sp.putString(app.aaps.core.utils.R.string.key_active_pump_type, type.description) + sp.putString(app.aaps.core.utils.R.string.key_active_pump_serial_number, serialNumber) + sp.putLong(app.aaps.core.utils.R.string.key_active_pump_change_timestamp, dateUtil.now()) // allow only data newer than register time (ie. ignore older history) return timestamp > dateUtil.now() - T.mins(1).msecs() // allow first record to be 1 min old } @@ -166,7 +166,7 @@ class PumpSyncImplementation @Inject constructor( } else null, profile = profileFunction.getProfile(), - serialNumber = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, "") + serialNumber = sp.getString(app.aaps.core.utils.R.string.key_active_pump_serial_number, "") ) } diff --git a/implementation/src/main/kotlin/app/aaps/implementation/queue/QueueThread.kt b/implementation/src/main/kotlin/app/aaps/implementation/queue/QueueThread.kt index 46c5531285..a2ebee5d9f 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/queue/QueueThread.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/queue/QueueThread.kt @@ -68,13 +68,13 @@ class QueueThread internal constructor( pump.stopConnecting() //BLUETOOTH-WATCHDOG - var watchdog = sp.getBoolean(info.nightscout.core.utils.R.string.key_btwatchdog, false) - val lastWatchdog = sp.getLong(info.nightscout.core.utils.R.string.key_btwatchdog_lastbark, 0L) + var watchdog = sp.getBoolean(app.aaps.core.utils.R.string.key_btwatchdog, false) + val lastWatchdog = sp.getLong(app.aaps.core.utils.R.string.key_btwatchdog_lastbark, 0L) watchdog = watchdog && System.currentTimeMillis() - lastWatchdog > Constants.MIN_WATCHDOG_INTERVAL_IN_SECONDS * 1000 if (watchdog) { aapsLogger.debug(LTag.PUMPQUEUE, "BT watchdog - toggling the phone bluetooth") //write time - sp.putLong(info.nightscout.core.utils.R.string.key_btwatchdog_lastbark, System.currentTimeMillis()) + sp.putLong(app.aaps.core.utils.R.string.key_btwatchdog_lastbark, System.currentTimeMillis()) //toggle BT pump.disconnect("watchdog") SystemClock.sleep(1000) diff --git a/implementation/src/main/kotlin/app/aaps/implementation/utils/HardLimitsImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/utils/HardLimitsImpl.kt index 6f08a52b05..58ed2d1aff 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/utils/HardLimitsImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/utils/HardLimitsImpl.kt @@ -64,13 +64,13 @@ class HardLimitsImpl @Inject constructor( } - private fun loadAge(): Int = when (sp.getString(info.nightscout.core.utils.R.string.key_age, "")) { - rh.gs(info.nightscout.core.utils.R.string.key_child) -> CHILD - rh.gs(info.nightscout.core.utils.R.string.key_teenage) -> TEENAGE - rh.gs(info.nightscout.core.utils.R.string.key_adult) -> ADULT - rh.gs(info.nightscout.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT - rh.gs(info.nightscout.core.utils.R.string.key_pregnant) -> PREGNANT - else -> ADULT + private fun loadAge(): Int = when (sp.getString(app.aaps.core.utils.R.string.key_age, "")) { + rh.gs(app.aaps.core.utils.R.string.key_child) -> CHILD + rh.gs(app.aaps.core.utils.R.string.key_teenage) -> TEENAGE + rh.gs(app.aaps.core.utils.R.string.key_adult) -> ADULT + rh.gs(app.aaps.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT + rh.gs(app.aaps.core.utils.R.string.key_pregnant) -> PREGNANT + else -> ADULT } override fun maxBolus(): Double = MAX_BOLUS[loadAge()] diff --git a/implementation/src/main/kotlin/app/aaps/implementation/utils/fabric/FabricPrivacyImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/utils/fabric/FabricPrivacyImpl.kt index 7caeedd42d..2b6d0a6820 100644 --- a/implementation/src/main/kotlin/app/aaps/implementation/utils/fabric/FabricPrivacyImpl.kt +++ b/implementation/src/main/kotlin/app/aaps/implementation/utils/fabric/FabricPrivacyImpl.kt @@ -7,11 +7,11 @@ import app.aaps.core.interfaces.logging.LTag import app.aaps.core.interfaces.rx.weardata.EventData import app.aaps.core.interfaces.sharedPreferences.SP import app.aaps.core.interfaces.utils.fabric.FabricPrivacy +import app.aaps.core.utils.R import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.ktx.analytics import com.google.firebase.crashlytics.FirebaseCrashlytics import com.google.firebase.ktx.Firebase -import info.nightscout.core.utils.R import java.io.ByteArrayInputStream import java.io.IOException import java.io.ObjectInputStream diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/APSResultObject.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/APSResultObject.kt index ae01105a55..61a372493e 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/APSResultObject.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/APSResultObject.kt @@ -322,7 +322,7 @@ open class APSResultObject @Inject constructor(val injector: HasAndroidInjector) } } // report change bigger than 30% - var percentMinChangeChange = sp.getDouble(info.nightscout.core.utils.R.string.key_loop_openmode_min_change, 30.0) + var percentMinChangeChange = sp.getDouble(app.aaps.core.utils.R.string.key_loop_openmode_min_change, 30.0) percentMinChangeChange /= 100.0 val lowThreshold = 1 - percentMinChangeChange val highThreshold = 1 + percentMinChangeChange @@ -358,7 +358,7 @@ open class APSResultObject @Inject constructor(val injector: HasAndroidInjector) } } // report change bigger than 30% - var percentMinChangeChange = sp.getDouble(info.nightscout.core.utils.R.string.key_loop_openmode_min_change, 30.0) + var percentMinChangeChange = sp.getDouble(app.aaps.core.utils.R.string.key_loop_openmode_min_change, 30.0) percentMinChangeChange /= 100.0 val lowThreshold = 1 - percentMinChangeChange val highThreshold = 1 + percentMinChangeChange diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneCore.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneCore.kt index a6a77df8f7..fb71e1b2d6 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneCore.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneCore.kt @@ -41,9 +41,9 @@ class AutotuneCore @Inject constructor( val pumpCarbRatio = pumpProfile.ic val pumpCSF = pumpISF / pumpCarbRatio // Autosens constraints - val autotuneMax = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2) - val autotuneMin = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7) - val min5minCarbImpact = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0) + val autotuneMax = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2) + val autotuneMin = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7) + val min5minCarbImpact = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0) // tune DIA var newDia = dia diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneFragment.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneFragment.kt index eed1cecc12..63bb21b51f 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneFragment.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneFragment.kt @@ -96,12 +96,12 @@ class AutotuneFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - sp.putBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false) // put to false tune insulin curve - sp.putBoolean(info.nightscout.core.utils.R.string.key_autotune_additional_log, false) // put to false additional log + sp.putBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false) // put to false tune insulin curve + sp.putBoolean(app.aaps.core.utils.R.string.key_autotune_additional_log, false) // put to false additional log autotunePlugin.loadLastRun() if (autotunePlugin.lastNbDays.isEmpty()) - autotunePlugin.lastNbDays = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5).toString() - val defaultValue = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5).toDouble() + autotunePlugin.lastNbDays = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5).toString() + val defaultValue = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5).toDouble() profileStore = activePlugin.activeProfileSource.profile ?: instantiator.provideProfileStore(JSONObject()) profileName = if (binding.profileList.text.toString() == rh.gs(app.aaps.core.ui.R.string.active)) "" else binding.profileList.text.toString() profileFunction.getProfile()?.let { currentProfile -> @@ -150,7 +150,7 @@ class AutotuneFragment : DaggerFragment() { binding.autotuneCopyLocal.setOnClickListener { val localName = rh.gs(app.aaps.core.ui.R.string.autotune_tunedprofile_name) + " " + dateUtil.dateAndTimeString(autotunePlugin.lastRun) - val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false) + val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false) autotunePlugin.tunedProfile?.let { tunedProfile -> OKDialog.showConfirmation(requireContext(), rh.gs(app.aaps.core.ui.R.string.autotune_copy_localprofile_button), @@ -233,7 +233,7 @@ class AutotuneFragment : DaggerFragment() { binding.autotuneCompare.setOnClickListener { val pumpProfile = autotunePlugin.pumpProfile - val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false) + val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false) val tunedProfile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile uiInteraction.runProfileViewerDialog( fragmentManager = childFragmentManager, @@ -248,7 +248,7 @@ class AutotuneFragment : DaggerFragment() { binding.autotuneProfileswitch.setOnClickListener { val tunedProfile = autotunePlugin.tunedProfile autotunePlugin.updateProfile(tunedProfile) - val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false) + val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false) tunedProfile?.let { tunedP -> tunedP.profileStore(circadian)?.let { OKDialog.showConfirmation(requireContext(), @@ -400,7 +400,7 @@ class AutotuneFragment : DaggerFragment() { private fun resetParam(resetDay: Boolean) { binding.tuneWarning.text = addWarnings() if (resetDay) { - autotunePlugin.lastNbDays = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5).toString() + autotunePlugin.lastNbDays = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5).toString() days.setAll(true) } autotunePlugin.result = "" @@ -452,7 +452,7 @@ class AutotuneFragment : DaggerFragment() { }) autotunePlugin.tunedProfile?.let { tuned -> layout.addView(toTableRowHeader(context)) - val tuneInsulin = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false) + val tuneInsulin = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false) if (tuneInsulin) { layout.addView( toTableRowValue( diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneIob.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneIob.kt index 7e9577dad6..2b6c1de6d9 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneIob.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotuneIob.kt @@ -255,7 +255,7 @@ open class AutotuneIob @Inject constructor( private fun getCalculationToTimeTreatments(time: Long, localInsulin: LocalInsulin): IobTotal { val total = IobTotal(time) - val detailedLog = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_additional_log, false) + val detailedLog = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_additional_log, false) for (pos in boluses.indices) { val t = boluses[pos] if (!t.isValid) continue diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePlugin.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePlugin.kt index 32e1443c78..623ceb64f2 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePlugin.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePlugin.kt @@ -120,7 +120,7 @@ class AutotunePlugin @Inject constructor( calculationRunning = false return } - val detailedLog = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_additional_log, false) + val detailedLog = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_additional_log, false) calculationRunning = true lastNbDays = "" + daysBack lastRun = dateUtil.now() @@ -223,7 +223,7 @@ class AutotunePlugin @Inject constructor( updateButtonVisibility = View.VISIBLE if (autoSwitch) { - val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false) + val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false) tunedProfile?.let { tunedP -> tunedP.profileName = pumpProfile.profileName updateProfile(tunedP) @@ -277,7 +277,7 @@ class AutotunePlugin @Inject constructor( var strResult = line strResult += rh.gs(app.aaps.core.ui.R.string.autotune_log_title) strResult += line - val tuneInsulin = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false) + val tuneInsulin = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false) if (tuneInsulin) { strResult += rh.gs(app.aaps.core.ui.R.string.autotune_log_peak, rh.gs(R.string.insulin_peak), pumpProfile.localInsulin.peak, tunedProfile.localInsulin.peak) strResult += rh.gs(app.aaps.core.ui.R.string.autotune_log_dia, rh.gs(app.aaps.core.ui.R.string.ic_short), pumpProfile.localInsulin.dia, tunedProfile.localInsulin.dia) @@ -308,16 +308,16 @@ class AutotunePlugin @Inject constructor( val utcOffset = T.msecs(TimeZone.getDefault().getOffset(dateUtil.now()).toLong()).hours() val startDateString = dateUtil.toISOString(firstLoopStart).substring(0, 10) val endDateString = dateUtil.toISOString(lastLoopEnd - 24 * 60 * 60 * 1000L).substring(0, 10) - val nsUrl = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "") - val optCategorizeUam = if (sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) "-c=true" else "" - val optInsulinCurve = if (sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false)) "-i=true" else "" + val nsUrl = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "") + val optCategorizeUam = if (sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) "-c=true" else "" + val optInsulinCurve = if (sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false)) "-i=true" else "" try { jsonSettings.put("datestring", dateUtil.toISOString(runDate)) jsonSettings.put("dateutc", dateUtil.toISOAsUTC(runDate)) jsonSettings.put("utcOffset", utcOffset) jsonSettings.put("units", profileFunction.getUnits().asText) jsonSettings.put("timezone", TimeZone.getDefault().id) - jsonSettings.put("url_nightscout", sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "")) + jsonSettings.put("url_nightscout", sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "")) jsonSettings.put("nbdays", nbDays) jsonSettings.put("startdate", startDateString) jsonSettings.put("enddate", endDateString) @@ -327,7 +327,7 @@ class AutotunePlugin @Inject constructor( jsonSettings.put("oref0_command", "oref0-autotune -d=~/aaps -n=$nsUrl -s=$startDateString -e=$endDateString $optCategorizeUam $optInsulinCurve") // aaps_command is for running modified oref0-autotune with exported data from aaps (ns-entries and ns-treatment json files copied in ~/aaps/autotune folder and pumpprofile.json copied in ~/aaps/settings/ jsonSettings.put("aaps_command", "aaps-autotune -d=~/aaps -s=$startDateString -e=$endDateString $optCategorizeUam $optInsulinCurve") - jsonSettings.put("categorize_uam_as_basal", sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) + jsonSettings.put("categorize_uam_as_basal", sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) jsonSettings.put("tune_insulin_curve", false) val peakTime: Int = insulinInterface.peak @@ -354,7 +354,7 @@ class AutotunePlugin @Inject constructor( fun updateProfile(newProfile: ATProfile?) { if (newProfile == null) return val profilePlugin = activePlugin.activeProfileSource - val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false) + val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false) val profileStore = activePlugin.activeProfileSource.profile ?: instantiator.provideProfileStore(JSONObject()) val profileList: ArrayList = profileStore.getProfileList() var indexLocalProfile = -1 @@ -396,14 +396,14 @@ class AutotunePlugin @Inject constructor( } json.put("result", result) json.put("updateButtonVisibility", updateButtonVisibility) - sp.putString(info.nightscout.core.utils.R.string.key_autotune_last_run, json.toString()) + sp.putString(app.aaps.core.utils.R.string.key_autotune_last_run, json.toString()) } fun loadLastRun() { result = "" lastRunSuccess = false try { - val json = JSONObject(sp.getString(info.nightscout.core.utils.R.string.key_autotune_last_run, "")) + val json = JSONObject(sp.getString(app.aaps.core.utils.R.string.key_autotune_last_run, "")) lastNbDays = JsonHelper.safeGetString(json, "lastNbDays", "") lastRun = JsonHelper.safeGetLong(json, "lastRun") val pumpPeak = JsonHelper.safeGetInt(json, "pumpPeak") diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePrep.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePrep.kt index eccb5c7bf5..f5e5d07f20 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePrep.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/AutotunePrep.kt @@ -32,7 +32,7 @@ class AutotunePrep @Inject constructor( fun categorize(tunedProfile: ATProfile): PreppedGlucose? { val preppedGlucose = categorizeBGDatums(tunedProfile, tunedProfile.localInsulin) - val tuneInsulin = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false) + val tuneInsulin = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false) if (tuneInsulin) { var minDeviations = 1000000.0 val diaDeviations: MutableList = ArrayList() @@ -312,7 +312,7 @@ class AutotunePrep @Inject constructor( // Then, calculate carb absorption for that 5m interval using the deviation. if (mealCOB > 0) { - val ci = max(deviation, sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)) + val ci = max(deviation, sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)) val absorbed = ci * tunedProfile.ic / sens // Store the COB, and use it as the starting point for the next data point. mealCOB = max(0.0, mealCOB - absorbed) @@ -463,7 +463,7 @@ class AutotunePrep @Inject constructor( var isfLength = isfGlucoseData.size val uamLength = uamGlucoseData.size var basalLength = basalGlucoseData.size - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) { //aapsLogger.debug(LTag.AUTOTUNE, "Categorizing all UAM data as basal.") if (verbose) log("Categorizing all UAM data as basal.") diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/data/ATProfile.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/data/ATProfile.kt index ad8e09fcb5..9ca320ff7f 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/data/ATProfile.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/autotune/data/ATProfile.kt @@ -114,7 +114,7 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector: json.put("useCustomPeakTime", true) json.put("insulinPeakTime", 45) } else if (insulinInterface.id === Insulin.InsulinType.OREF_FREE_PEAK) { - val peakTime: Int = sp.getInt(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak), 75) + val peakTime: Int = sp.getInt(rh.gs(app.aaps.core.utils.R.string.key_insulin_oref_peak), 75) json.put("curve", if (peakTime > 50) "rapid-acting" else "ultra-rapid") json.put("useCustomPeakTime", true) json.put("insulinPeakTime", peakTime) @@ -142,8 +142,8 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector: ) ) json.put("carb_ratio", avgIC) - json.put("autosens_max", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2"))) - json.put("autosens_min", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, "0.7"))) + json.put("autosens_max", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2"))) + json.put("autosens_min", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_min, "0.7"))) json.put("units", GlucoseUnit.MGDL.asText) json.put("timezone", TimeZone.getDefault().id) jsonString = json.toString(2).replace("\\/", "/") diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopFragment.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopFragment.kt index 9ca349bbe8..d3ff6f9d3f 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopFragment.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopFragment.kt @@ -116,7 +116,7 @@ class LoopFragment : DaggerFragment(), MenuProvider { }, fabricPrivacy::logException) updateGUI() - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseloop, true) } @Synchronized diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopPlugin.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopPlugin.kt index 678403d4c2..fa6cd4cdd5 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopPlugin.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/loop/LoopPlugin.kt @@ -183,7 +183,7 @@ class LoopPlugin @Inject constructor( get() { val closedLoopEnabled = constraintChecker.isClosedLoopAllowed() val maxIobAllowed = constraintChecker.getMaxIOBAllowed().value() - val apsMode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) + val apsMode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) val pump = activePlugin.activePump var isLGS = false if (!isSuspended && !pump.isSuspended()) if (closedLoopEnabled.value()) if (maxIobAllowed == HardLimits.MAX_IOB_LGS || apsMode == ApsMode.LGS) isLGS = true @@ -322,18 +322,18 @@ class LoopPlugin @Inject constructor( ) && carbsSuggestionsSuspendedUntil < System.currentTimeMillis() && !treatmentTimeThreshold(-15) ) { if (sp.getBoolean( - info.nightscout.core.utils.R.string.key_enable_carbs_required_alert_local, + app.aaps.core.utils.R.string.key_enable_carbs_required_alert_local, true ) && !sp.getBoolean(app.aaps.core.ui.R.string.key_raise_notifications_as_android_notifications, true) ) { val carbReqLocal = Notification(Notification.CARBS_REQUIRED, resultAfterConstraints.carbsRequiredText, Notification.NORMAL) rxBus.send(EventNewNotification(carbReqLocal)) } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_carbs_req, false)) { disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(resultAfterConstraints.carbsRequiredText)).subscribe() } if (sp.getBoolean( - info.nightscout.core.utils.R.string.key_enable_carbs_required_alert_local, + app.aaps.core.utils.R.string.key_enable_carbs_required_alert_local, true ) && sp.getBoolean(app.aaps.core.ui.R.string.key_raise_notifications_as_android_notifications, true) ) { @@ -442,7 +442,7 @@ class LoopPlugin @Inject constructor( .setPriority(Notification.IMPORTANCE_HIGH) .setCategory(Notification.CATEGORY_ALARM) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_control, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_wear_control, false)) { builder.setLocalOnly(true) } presentSuggestion(builder) @@ -519,7 +519,7 @@ class LoopPlugin @Inject constructor( lastRun.lastTBREnact = dateUtil.now() lastRun.lastOpenModeAccept = dateUtil.now() buildAndStoreDeviceStatus() - sp.incInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts) + sp.incInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts) } rxBus.send(EventAcceptOpenLoopChange()) } diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt index 92afad7a3e..21ab94c24f 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.kt @@ -191,7 +191,7 @@ class DetermineBasalAdapterAMAJS internal constructor(scriptReader: ScriptReader if (mealData.usedMinCarbsImpact > 0) { this.profile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact) } else { - this.profile.put("min_5m_carbimpact", sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)) + this.profile.put("min_5m_carbimpact", sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)) } if (profileFunction.getUnits() == GlucoseUnit.MMOL) { this.profile.put("out_units", "mmol/L") diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt index 12cc40dc73..c1c289b315 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt @@ -270,7 +270,7 @@ class OpenAPSAMAPlugin @Inject constructor( } override fun isAutosensModeEnabled(value: Constraint): Constraint { - val enabled = sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false) + val enabled = sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false) if (!enabled) value.set(false, rh.gs(R.string.autosens_disabled_in_preferences), this) return value } diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt index 08b9a418bd..b6ff8365b5 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.kt @@ -230,7 +230,7 @@ class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader: this.profile.put("carbsReqThreshold", sp.getInt(R.string.key_carbsReqThreshold, SMBDefaults.carbsReqThreshold)) this.profile.put("current_basal", basalRate) this.profile.put("temptargetSet", tempTargetSet) - this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2"))) + this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2"))) if (profileFunction.getUnits() == GlucoseUnit.MMOL) { this.profile.put("out_units", "mmol/L") } diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt index 36c52fdde5..8671217cea 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt @@ -348,7 +348,7 @@ open class OpenAPSSMBPlugin @Inject constructor( } override fun isAutosensModeEnabled(value: Constraint): Constraint { - val enabled = sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false) + val enabled = sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false) if (!enabled) value.set(false, rh.gs(R.string.autosens_disabled_in_preferences), this) return value } diff --git a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt index 8c6196d5ad..bebead855b 100644 --- a/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt +++ b/plugins/aps/src/main/kotlin/app/aaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt @@ -209,10 +209,10 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri //mProfile.put("high_temptarget_raises_sensitivity", SP.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)); this.profile.put( "high_temptarget_raises_sensitivity", - sp.getBoolean(info.nightscout.core.utils.R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity) + sp.getBoolean(app.aaps.core.utils.R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity) ) //mProfile.put("low_temptarget_lowers_sensitivity", SP.getBoolean(R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity)); - this.profile.put("low_temptarget_lowers_sensitivity", sp.getBoolean(info.nightscout.core.utils.R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity)) + this.profile.put("low_temptarget_lowers_sensitivity", sp.getBoolean(app.aaps.core.utils.R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity)) this.profile.put("sensitivity_raises_target", sp.getBoolean(R.string.key_sensitivity_raises_target, SMBDefaults.sensitivity_raises_target)) this.profile.put("resistance_lowers_target", sp.getBoolean(R.string.key_resistance_lowers_target, SMBDefaults.resistance_lowers_target)) this.profile.put("adv_target_adjustments", SMBDefaults.adv_target_adjustments) @@ -244,8 +244,8 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.profile.put("carbsReqThreshold", sp.getInt(R.string.key_carbsReqThreshold, SMBDefaults.carbsReqThreshold)) this.profile.put("current_basal", basalRate) this.profile.put("temptargetSet", tempTargetSet) - this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2"))) - this.profile.put("autosens_min", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, "0.7"))) + this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2"))) + this.profile.put("autosens_min", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_min, "0.7"))) //set the min SMB amount to be the amount set by the pump. if (profileFunction.getUnits() == GlucoseUnit.MMOL) { this.profile.put("out_units", "mmol/L") diff --git a/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotuneCoreTest.kt b/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotuneCoreTest.kt index bcba36f3a0..3036fa45f1 100644 --- a/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotuneCoreTest.kt +++ b/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotuneCoreTest.kt @@ -44,9 +44,9 @@ class AutotuneCoreTest : TestBaseWithProfile() { val inputProfile = atProfileFromOapsJson(JSONObject(inputProfileJson), dateUtil)!! val prep = PreppedGlucose(JSONObject(prepJson), dateUtil) - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax) - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin) - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) val oapsOutputProfileJson = File("src/test/res/autotune/test1/aapsorefprofile.json").readText() val oapsOutputProfile = atProfileFromOapsJson(JSONObject(oapsOutputProfileJson), dateUtil)!! val outProfile = autotuneCore.tuneAllTheThings(prep, inputProfile, inputProfile) @@ -66,9 +66,9 @@ class AutotuneCoreTest : TestBaseWithProfile() { val pumpProfileJson = File("src/test/res/autotune/test4/profile.pump.json").readText() val pumpProfile = atProfileFromOapsJson(JSONObject(pumpProfileJson), dateUtil)!! val prep = PreppedGlucose(JSONObject(prepJson), dateUtil) - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax) - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin) - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) val oapsOutputProfileJson = File("src/test/res/autotune/test4/newprofile.2022-05-30.json").readText() val oapsOutputProfile = atProfileFromOapsJson(JSONObject(oapsOutputProfileJson), dateUtil)!! val outProfile = autotuneCore.tuneAllTheThings(prep, inputProfile, pumpProfile) diff --git a/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotunePrepTest.kt b/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotunePrepTest.kt index 4049a991ed..5bae809365 100644 --- a/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotunePrepTest.kt +++ b/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/autotune/AutotunePrepTest.kt @@ -63,8 +63,8 @@ class AutotunePrepTest : TestBaseWithProfile() { val oapsTreatmentsJson = File("src/test/res/autotune/test1/aaps-treatments.2022-05-21.json").readText() autotuneIob.meals = buildMeals(JSONArray(oapsTreatmentsJson)) //Only meals is used in unit test, Insulin only used for iob calculation autotuneIob.boluses = buildBoluses(oapsPreppedGlucose) //Values from oapsPrepData because linked to iob calculation method for TBR - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) - `when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false) + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) + `when`(sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false) val aapsPreppedGlucose = autotunePrep.categorizeBGDatums(inputProfile, inputProfile.localInsulin, false)!! // compare all categorization calculated by aaps plugin (aapsPreppedGlucose) with categorization calculated by OpenAPS (oapsPreppedGlucose) for (i in aapsPreppedGlucose.crData.indices) @@ -96,8 +96,8 @@ class AutotunePrepTest : TestBaseWithProfile() { val oapsTreatmentsJson = File("src/test/res/autotune/test2/aaps-treatments.2022-05-21.json").readText() autotuneIob.meals = buildMeals(JSONArray(oapsTreatmentsJson)) //Only meals is used in unit test, Insulin only used for iob calculation autotuneIob.boluses = buildBoluses(oapsPreppedGlucose) //Values from oapsPrepData because linked to iob calculation method for TBR - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) - `when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false) // CategorizeUAM as Basal = False + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) + `when`(sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false) // CategorizeUAM as Basal = False val aapsPreppedGlucose = autotunePrep.categorizeBGDatums(inputProfile, inputProfile.localInsulin, false)!! // compare all categorization calculated by aaps plugin (aapsPreppedGlucose) with categorization calculated by OpenAPS (oapsPreppedGlucose) for (i in aapsPreppedGlucose.crData.indices) @@ -129,8 +129,8 @@ class AutotunePrepTest : TestBaseWithProfile() { val oapsTreatmentsJson = File("src/test/res/autotune/test3/aaps-treatments.2022-05-21.json").readText() autotuneIob.meals = buildMeals(JSONArray(oapsTreatmentsJson)) //Only meals is used in unit test, Insulin only used for iob calculation autotuneIob.boluses = buildBoluses(oapsPreppedGlucose) //Values from oapsPrepData because linked to iob calculation method for TBR - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) - `when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(true) // CategorizeUAM as Basal = True + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact) + `when`(sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(true) // CategorizeUAM as Basal = True val aapsPreppedGlucose = autotunePrep.categorizeBGDatums(inputProfile, inputProfile.localInsulin, false)!! // compare all categorization calculated by aaps plugin (aapsPreppedGlucose) with categorization calculated by OpenAPS (oapsPreppedGlucose) for (i in aapsPreppedGlucose.crData.indices) diff --git a/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/loop/LoopPluginTest.kt b/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/loop/LoopPluginTest.kt index 0ea1f954b7..f47fc2a356 100644 --- a/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/loop/LoopPluginTest.kt +++ b/plugins/aps/src/test/kotlin/app/aaps/plugins/aps/loop/LoopPluginTest.kt @@ -69,7 +69,7 @@ class LoopPluginTest : TestBase() { fun testPluginInterface() { `when`(rh.gs(app.aaps.core.ui.R.string.loop)).thenReturn("Loop") `when`(rh.gs(app.aaps.plugins.aps.R.string.loop_shortname)).thenReturn("LOOP") - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) val pumpDescription = PumpDescription() `when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription) assertThat(loopPlugin.pluginDescription.fragmentClass).isEqualTo(LoopFragment::class.java.name) diff --git a/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/actions/ActionRunAutotune.kt b/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/actions/ActionRunAutotune.kt index d493f2559c..eb9b396bf9 100644 --- a/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/actions/ActionRunAutotune.kt +++ b/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/actions/ActionRunAutotune.kt @@ -39,7 +39,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) { @DrawableRes override fun icon(): Int = app.aaps.core.ui.R.drawable.ic_actions_profileswitch override fun doAction(callback: Callback) { - val autoSwitch = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_auto, false) + val autoSwitch = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_auto, false) val profileName = if (inputProfileName.value == rh.gs(app.aaps.core.ui.R.string.active)) "" else inputProfileName.value var message = if (autoSwitch) app.aaps.core.ui.R.string.autotune_run_with_autoswitch else app.aaps.core.ui.R.string.autotune_run_without_autoswitch Thread { @@ -62,7 +62,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) { override fun generateDialog(root: LinearLayout) { if (defaultValue == 0) - defaultValue = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5) + defaultValue = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5) daysBack.value = defaultValue LayoutBuilder() .add(LabelWithElement(rh, rh.gs(app.aaps.core.ui.R.string.autotune_select_profile), "", inputProfileName)) @@ -93,7 +93,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) { inputProfileName.value = JsonHelper.safeGetString(o, "profileToTune", "") defaultValue = JsonHelper.safeGetInt(o, "tunedays") if (defaultValue == 0) - defaultValue = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5) + defaultValue = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5) daysBack.value = defaultValue return this } diff --git a/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValue.kt b/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValue.kt index f49529494f..e3918da015 100644 --- a/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValue.kt +++ b/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValue.kt @@ -17,8 +17,8 @@ import java.util.Optional class TriggerAutosensValue(injector: HasAndroidInjector) : Trigger(injector) { - private val minValue = (sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7) * 100).toInt() - private val maxValue = (sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2) * 100).toInt() + private val minValue = (sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7) * 100).toInt() + private val maxValue = (sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2) * 100).toInt() private val step = 1.0 private val decimalFormat = DecimalFormat("1") var autosens: InputDouble = InputDouble(100.0, minValue.toDouble(), maxValue.toDouble(), step, decimalFormat) diff --git a/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerCOB.kt b/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerCOB.kt index 5e466f01ae..9af30cc8fe 100644 --- a/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerCOB.kt +++ b/plugins/automation/src/main/kotlin/app/aaps/plugins/automation/triggers/TriggerCOB.kt @@ -18,7 +18,7 @@ import java.util.Optional class TriggerCOB(injector: HasAndroidInjector) : Trigger(injector) { private val minValue = 0 - private val maxValue = sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48) + private val maxValue = sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48) var cob: InputDouble = InputDouble(0.0, minValue.toDouble(), maxValue.toDouble(), 1.0, DecimalFormat("1")) var comparator: Comparator = Comparator(rh) diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt index e443185ef5..35ba9e53d8 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt @@ -14,8 +14,8 @@ import org.mockito.Mockito.`when` class TriggerAutosensValueTest : TriggerTestBase() { @Test fun shouldRunTest() { - `when`(sp.getDouble(Mockito.eq(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), ArgumentMatchers.anyDouble())).thenReturn(1.2) - `when`(sp.getDouble(Mockito.eq(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), ArgumentMatchers.anyDouble())).thenReturn(0.7) + `when`(sp.getDouble(Mockito.eq(app.aaps.core.utils.R.string.key_openapsama_autosens_max), ArgumentMatchers.anyDouble())).thenReturn(1.2) + `when`(sp.getDouble(Mockito.eq(app.aaps.core.utils.R.string.key_openapsama_autosens_min), ArgumentMatchers.anyDouble())).thenReturn(0.7) `when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(generateAutosensData()) var t = TriggerAutosensValue(injector) t.autosens.value = 110.0 diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/configBuilder/RunningConfigurationImpl.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/configBuilder/RunningConfigurationImpl.kt index ce7f5d9988..ae49dbf88f 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/configBuilder/RunningConfigurationImpl.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/configBuilder/RunningConfigurationImpl.kt @@ -120,8 +120,8 @@ class RunningConfigurationImpl @Inject constructor( } configuration.pump?.let { - if (sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "fake") != it) { - sp.putString(info.nightscout.core.utils.R.string.key_virtualpump_type, it) + if (sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "fake") != it) { + sp.putString(app.aaps.core.utils.R.string.key_virtualpump_type, it) activePlugin.activePump.pumpDescription.fillFor(PumpType.getByDescription(it)) pumpSync.connectNewPump(endRunning = false) // do not end running TBRs, we call this only to accept data properly aapsLogger.debug(LTag.CORE, "Changing pump type to $it") diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/ImportExportPrefsImpl.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/ImportExportPrefsImpl.kt index 88b50cd70c..9689deecad 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/ImportExportPrefsImpl.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/ImportExportPrefsImpl.kt @@ -141,7 +141,7 @@ class ImportExportPrefsImpl @Inject constructor( val n6 = Settings.Global.getString(context.contentResolver, "device_name") // name provided (hopefully) by user - val patientName = sp.getString(info.nightscout.core.utils.R.string.key_patient_name, "") + val patientName = sp.getString(app.aaps.core.utils.R.string.key_patient_name, "") val defaultPatientName = rh.gs(app.aaps.core.ui.R.string.patient_name_default) // name we detect from OS @@ -150,7 +150,7 @@ class ImportExportPrefsImpl @Inject constructor( } private fun askForMasterPass(activity: FragmentActivity, @StringRes canceledMsg: Int, then: ((password: String) -> Unit)) { - passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { password -> + passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { password -> then(password) }, { ToastUtils.warnToast(activity, rh.gs(canceledMsg)) @@ -162,7 +162,7 @@ class ImportExportPrefsImpl @Inject constructor( activity: FragmentActivity, @StringRes canceledMsg: Int, @StringRes passwordName: Int, @StringRes passwordExplanation: Int?, @StringRes passwordWarning: Int?, then: ((password: String) -> Unit) ) { - passwordCheck.queryAnyPassword(activity, passwordName, info.nightscout.core.utils.R.string.key_master_password, passwordExplanation, passwordWarning, { password -> + passwordCheck.queryAnyPassword(activity, passwordName, app.aaps.core.utils.R.string.key_master_password, passwordExplanation, passwordWarning, { password -> then(password) }, { ToastUtils.warnToast(activity, rh.gs(canceledMsg)) @@ -175,7 +175,7 @@ class ImportExportPrefsImpl @Inject constructor( } private fun assureMasterPasswordSet(activity: FragmentActivity, @StringRes wrongPwdTitle: Int): Boolean { - if (!sp.contains(info.nightscout.core.utils.R.string.key_master_password) || (sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") == "")) { + if (!sp.contains(app.aaps.core.utils.R.string.key_master_password) || (sp.getString(app.aaps.core.utils.R.string.key_master_password, "") == "")) { WarningDialog.showWarning(activity, rh.gs(wrongPwdTitle), rh.gs(R.string.master_password_missing, rh.gs(R.string.configbuilder_general), rh.gs(R.string.protection)), diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/MaintenanceFragment.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/MaintenanceFragment.kt index 61bc51211b..ff90aab320 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/MaintenanceFragment.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/MaintenanceFragment.kt @@ -105,7 +105,7 @@ class MaintenanceFragment : DaggerFragment() { .subscribeBy( onError = { aapsLogger.error("Error clearing databases", it) }, onComplete = { - rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_units))) + rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.utils.R.string.key_units))) runOnUiThread { activity.recreate() } } ) diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/PrefFileListProviderImpl.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/PrefFileListProviderImpl.kt index a903ec8973..fe466ef4e9 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/PrefFileListProviderImpl.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/PrefFileListProviderImpl.kt @@ -99,7 +99,7 @@ class PrefFileListProviderImpl @Inject constructor( override fun listCustomWatchfaceFiles(): MutableList { val customWatchfaceFiles = mutableListOf() - val customAwtchfaceAuthorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false) + val customAwtchfaceAuthorization = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false) exportsPath.walk().filter { it.isFile && it.name.endsWith(ZipWatchfaceFormat.CWF_EXTENTION) }.forEach { file -> ZipWatchfaceFormat.loadCustomWatchface(ZipInputStream(file.inputStream()), file.name, customAwtchfaceAuthorization)?.also { customWatchface -> customWatchfaceFiles.add(customWatchface) diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt index f03eead2f7..eaf2807842 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt @@ -107,7 +107,7 @@ class CustomWatchfaceImportListActivity : TranslatedDaggerAppCompatActivity() { val colorAttr = if (checkCustomVersion(metadata)) app.aaps.core.ui.R.attr.metadataTextOkColor else app.aaps.core.ui.R.attr.metadataTextWarningColor cwfVersion.setTextColor(rh.gac(cwfVersion.context, colorAttr)) val prefExisting = metadata.keys.any { it.isPref } - val prefSetting = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false) + val prefSetting = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false) val prefColor = if (prefSetting) app.aaps.core.ui.R.attr.metadataTextWarningColor else app.aaps.core.ui.R.attr.importListFileNameColor prefWarning.visibility = (prefExisting && prefSetting).toVisibility() prefInfo.visibility = (prefExisting && !prefSetting).toVisibility() diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/SWDefinition.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/SWDefinition.kt index 59893a6672..34f5f3e054 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/SWDefinition.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/SWDefinition.kt @@ -114,17 +114,17 @@ class SWDefinition @Inject constructor( .add( SWRadioButton(injector) .option(R.array.unitsArray, R.array.unitsValues) - .preferenceId(info.nightscout.core.utils.R.string.key_units).label(R.string.units) + .preferenceId(app.aaps.core.utils.R.string.key_units).label(R.string.units) .comment(R.string.setupwizard_units_prompt) ) - .validator { sp.contains(info.nightscout.core.utils.R.string.key_units) } + .validator { sp.contains(app.aaps.core.utils.R.string.key_units) } private val displaySettings get() = SWScreen(injector, R.string.display_settings) .skippable(false) .add( SWEditNumberWithUnits(injector, Constants.LOW_MARK * Constants.MGDL_TO_MMOLL, 3.0, 8.0) - .preferenceId(info.nightscout.core.utils.R.string.key_low_mark) + .preferenceId(app.aaps.core.utils.R.string.key_low_mark) .updateDelay(5) .label(R.string.low_mark) .comment(R.string.low_mark_comment) @@ -132,7 +132,7 @@ class SWDefinition @Inject constructor( .add(SWBreak(injector)) .add( SWEditNumberWithUnits(injector, Constants.HIGH_MARK * Constants.MGDL_TO_MMOLL, 5.0, 20.0) - .preferenceId(info.nightscout.core.utils.R.string.key_high_mark) + .preferenceId(app.aaps.core.utils.R.string.key_high_mark) .updateDelay(5) .label(R.string.high_mark) .comment(R.string.high_mark_comment) @@ -207,7 +207,7 @@ class SWDefinition @Inject constructor( get() = SWScreen(injector, R.string.patient_name) .skippable(true) .add(SWInfoText(injector).label(R.string.patient_name_summary)) - .add(SWEditString(injector).validator(String::isNotEmpty).preferenceId(info.nightscout.core.utils.R.string.key_patient_name)) + .add(SWEditString(injector).validator(String::isNotEmpty).preferenceId(app.aaps.core.utils.R.string.key_patient_name)) private val privacy get() = SWScreen(injector, R.string.privacy_settings) @@ -219,10 +219,10 @@ class SWDefinition @Inject constructor( get() = SWScreen(injector, app.aaps.core.ui.R.string.master_password) .skippable(false) .add(SWInfoText(injector).label(app.aaps.core.ui.R.string.master_password)) - .add(SWEditEncryptedPassword(injector, cryptoUtil).preferenceId(info.nightscout.core.utils.R.string.key_master_password)) + .add(SWEditEncryptedPassword(injector, cryptoUtil).preferenceId(app.aaps.core.utils.R.string.key_master_password)) .add(SWBreak(injector)) .add(SWInfoText(injector).label(R.string.master_password_summary)) - .validator { !cryptoUtil.checkPassword("", sp.getString(info.nightscout.core.utils.R.string.key_master_password, "")) } + .validator { !cryptoUtil.checkPassword("", sp.getString(app.aaps.core.utils.R.string.key_master_password, "")) } private val screenAge get() = SWScreen(injector, app.aaps.core.ui.R.string.patient_type) @@ -230,30 +230,30 @@ class SWDefinition @Inject constructor( .add(SWBreak(injector)) .add( SWRadioButton(injector) - .option(app.aaps.core.ui.R.array.ageArray, info.nightscout.core.utils.R.array.ageValues) - .preferenceId(info.nightscout.core.utils.R.string.key_age) + .option(app.aaps.core.ui.R.array.ageArray, app.aaps.core.utils.R.array.ageValues) + .preferenceId(app.aaps.core.utils.R.string.key_age) .label(app.aaps.core.ui.R.string.patient_type) .comment(app.aaps.core.ui.R.string.patient_age_summary) ) .add(SWBreak(injector)) .add( SWEditNumber(injector, 3.0, 0.1, 25.0) - .preferenceId(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus) + .preferenceId(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus) .updateDelay(5) .label(app.aaps.core.ui.R.string.max_bolus_title) .comment(R.string.common_values) ) .add( SWEditIntNumber(injector, 48, 1, 100) - .preferenceId(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs) + .preferenceId(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs) .updateDelay(5) .label(app.aaps.core.ui.R.string.max_carbs_title) .comment(R.string.common_values) ) .validator { - sp.contains(info.nightscout.core.utils.R.string.key_age) - && sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 0.0) > 0 - && sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 0) > 0 + sp.contains(app.aaps.core.utils.R.string.key_age) + && sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 0.0) > 0 + && sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 0) > 0 } private val screenInsulin @@ -354,10 +354,10 @@ class SWDefinition @Inject constructor( .add( SWRadioButton(injector) .option(app.aaps.core.ui.R.array.aps_modeArray, app.aaps.core.ui.R.array.aps_modeValues) - .preferenceId(info.nightscout.core.utils.R.string.key_aps_mode).label(R.string.apsmode_title) + .preferenceId(app.aaps.core.utils.R.string.key_aps_mode).label(R.string.apsmode_title) .comment(R.string.setupwizard_preferred_aps_mode) ) - .validator { sp.contains(info.nightscout.core.utils.R.string.key_aps_mode) } + .validator { sp.contains(app.aaps.core.utils.R.string.key_aps_mode) } private val screenLoop get() = SWScreen(injector, R.string.configbuilder_loop) diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/elements/SWEditEncryptedPassword.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/elements/SWEditEncryptedPassword.kt index 81ebb93e8e..1ce0ffdf03 100644 --- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/elements/SWEditEncryptedPassword.kt +++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/setupwizard/elements/SWEditEncryptedPassword.kt @@ -26,13 +26,13 @@ class SWEditEncryptedPassword(injector: HasAndroidInjector, private val cryptoUt override fun generateDialog(layout: LinearLayout) { val context = layout.context - val isPasswordSet = sp.contains(info.nightscout.core.utils.R.string.key_master_password) && sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") != "" + val isPasswordSet = sp.contains(app.aaps.core.utils.R.string.key_master_password) && sp.getString(app.aaps.core.utils.R.string.key_master_password, "") != "" button = Button(context) button?.setText(app.aaps.core.ui.R.string.unlock_settings) button?.setOnClickListener { scanForActivity(context)?.let { activity -> - passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { + passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { button?.visibility = View.GONE editText?.visibility = View.VISIBLE editText2?.visibility = View.VISIBLE diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/ObjectivesPlugin.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/ObjectivesPlugin.kt index 906cdd558c..de159b20f2 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/ObjectivesPlugin.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/ObjectivesPlugin.kt @@ -87,16 +87,16 @@ class ObjectivesPlugin @Inject constructor( objective.startedOn = 0 objective.accomplishedOn = 0 } - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) - sp.putInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseprofileswitch, false) - 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(info.nightscout.core.utils.R.string.key_objectiveuseactions, false) - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false) - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) + sp.putInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseprofileswitch, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusedisconnect, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusereconnect, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusetemptarget, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseactions, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseloop, false) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, false) } fun allPriorAccomplished(position: Int): Boolean { diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt index 36cf8c128d..b838236ddf 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt @@ -24,7 +24,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R init { tasks.add(object : Task(this, R.string.objectives_bgavailableinns) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true } }) tasks.add(object : Task(this, R.string.synchaswritepermission) { @@ -34,7 +34,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R }) tasks.add(object : Task(this, app.aaps.core.ui.R.string.virtualpump_uploadstatus_title) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false) || tidepoolPlugin?.hasWritePermission == true + return sp.getBoolean(app.aaps.core.utils.R.string.key_virtual_pump_upload_status, false) || tidepoolPlugin?.hasWritePermission == true } override fun shouldBeIgnored(): Boolean { @@ -44,7 +44,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R tasks.add( object : Task(this, R.string.objectives_pumpstatusavailableinns) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true } }.learned(Learned(R.string.objectives_0_learned)) ) diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective1.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective1.kt index b04d6deafe..1967a64f94 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective1.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective1.kt @@ -15,38 +15,38 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i init { tasks.add(object : Task(this, R.string.objectives_useprofileswitch) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseprofileswitch, false) + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveuseprofileswitch, false) } }) tasks.add(object : Task(this, R.string.objectives_usedisconnectpump) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, false) + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusedisconnect, false) } }.hint(Hint(R.string.disconnectpump_hint))) tasks.add(object : Task(this, R.string.objectives_usereconnectpump) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, false) + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusereconnect, false) } }.hint(Hint(R.string.disconnectpump_hint))) tasks.add(object : Task(this, R.string.objectives_usetemptarget) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, false) + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusetemptarget, false) } }.hint(Hint(R.string.usetemptarget_hint))) tasks.add(object : Task(this, R.string.objectives_useactions) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible() + return sp.getBoolean(app.aaps.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) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false) + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveuseloop, false) } }.hint(Hint(R.string.useaction_hint))) tasks.add( object : Task(this, R.string.objectives_usescale) { override fun isCompleted(): Boolean { - return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false) + return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, false) } }.hint(Hint(R.string.usescale_hint)) .learned(Learned(R.string.objectives_usage_learned)) diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt index 1f7bfea3c9..516cbf8f71 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt @@ -16,14 +16,14 @@ class Objective3 @Inject constructor(injector: HasAndroidInjector) : Objective(i tasks.add( object : Task(this, R.string.objectives_manualenacts) { override fun isCompleted(): Boolean { - return sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED + return sp.getInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED } override val progress: String get() = - if (sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED) + if (sp.getInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED) rh.gs(R.string.completed_well_done) - else sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0).toString() + " / " + MANUAL_ENACTS_NEEDED + else sp.getInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0).toString() + " / " + MANUAL_ENACTS_NEEDED }.learned(Learned(R.string.objectives_openloop_learned)) ) } diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt index 74a0035a22..4288c4622a 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt @@ -16,7 +16,7 @@ class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R tasks.add(MinimumDurationTask(this, T.days(1).msecs())) tasks.add( object : Task(this, R.string.closedmodeenabled) { - override fun isCompleted(): Boolean = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) == ApsMode.CLOSED + override fun isCompleted(): Boolean = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) == ApsMode.CLOSED }) tasks.add( object : Task(this, R.string.maxiobset) { diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/safety/SafetyPlugin.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/safety/SafetyPlugin.kt index 72517a4e20..f7395004b9 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/safety/SafetyPlugin.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/safety/SafetyPlugin.kt @@ -69,7 +69,7 @@ class SafetyPlugin @Inject constructor( } override fun isClosedLoopAllowed(value: Constraint): Constraint { - val mode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) + val mode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) if (mode == ApsMode.OPEN) value.set(false, rh.gs(R.string.closedmodedisabledinpreferences), this) if (!config.isEngineeringModeOrRelease()) { if (value.value()) { @@ -139,7 +139,7 @@ class SafetyPlugin @Inject constructor( override fun applyBolusConstraints(insulin: Constraint): Constraint { insulin.setIfGreater(0.0, rh.gs(app.aaps.core.ui.R.string.limitingbolus, 0.0, rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)), this) - val maxBolus = sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0) + val maxBolus = sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0) insulin.setIfSmaller(maxBolus, rh.gs(app.aaps.core.ui.R.string.limitingbolus, maxBolus, rh.gs(R.string.maxvalueinpreferences)), this) insulin.setIfSmaller(hardLimits.maxBolus(), rh.gs(app.aaps.core.ui.R.string.limitingbolus, hardLimits.maxBolus(), rh.gs(R.string.hardlimit)), this) val pump = activePlugin.activePump @@ -150,7 +150,7 @@ class SafetyPlugin @Inject constructor( override fun applyExtendedBolusConstraints(insulin: Constraint): Constraint { insulin.setIfGreater(0.0, rh.gs(R.string.limitingextendedbolus, 0.0, rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)), this) - val maxBolus = sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0) + val maxBolus = sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0) insulin.setIfSmaller(maxBolus, rh.gs(R.string.limitingextendedbolus, maxBolus, rh.gs(R.string.maxvalueinpreferences)), this) insulin.setIfSmaller(hardLimits.maxBolus(), rh.gs(R.string.limitingextendedbolus, hardLimits.maxBolus(), rh.gs(R.string.hardlimit)), this) val pump = activePlugin.activePump @@ -161,13 +161,13 @@ class SafetyPlugin @Inject constructor( override fun applyCarbsConstraints(carbs: Constraint): Constraint { carbs.setIfGreater(0, rh.gs(R.string.limitingcarbs, 0, rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)), this) - val maxCarbs = sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48) + val maxCarbs = sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48) carbs.setIfSmaller(maxCarbs, rh.gs(R.string.limitingcarbs, maxCarbs, rh.gs(R.string.maxvalueinpreferences)), this) return carbs } override fun applyMaxIOBConstraints(maxIob: Constraint): Constraint { - val apsMode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) + val apsMode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) if (apsMode == ApsMode.LGS) maxIob.setIfSmaller( HardLimits.MAX_IOB_LGS, rh.gs(app.aaps.core.ui.R.string.limiting_iob, HardLimits.MAX_IOB_LGS, rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend)), @@ -178,13 +178,13 @@ class SafetyPlugin @Inject constructor( override fun configuration(): JSONObject = JSONObject() - .putString(info.nightscout.core.utils.R.string.key_age, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh) - .putInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh) + .putString(app.aaps.core.utils.R.string.key_age, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh) + .putInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh) override fun applyConfiguration(configuration: JSONObject) { - configuration.storeString(info.nightscout.core.utils.R.string.key_age, sp, rh) - configuration.storeDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh) - configuration.storeInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh) + configuration.storeString(app.aaps.core.utils.R.string.key_age, sp, rh) + configuration.storeDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh) + configuration.storeInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh) } } diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt index bc81e6936a..7f66263497 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt @@ -65,7 +65,7 @@ class VersionCheckerPlugin @Inject constructor( versionCheckerUtils.triggerCheckVersion() if (lastCheckOlderThan(gracePeriod.veryOld.daysToMillis())) value.set(false, rh.gs(R.string.very_old_version), this) - val endDate = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0) + val endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0) if (endDate != 0L && dateUtil.now() > endDate) value.set(false, rh.gs(R.string.application_expired), this) return value @@ -99,7 +99,7 @@ class VersionCheckerPlugin @Inject constructor( uiInteraction.addNotification(Notification.OLD_VERSION, message, Notification.NORMAL) } - val endDate = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0) + val endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0) if (endDate != 0L && dateUtil.now() > endDate && shouldWarnAgain()) { // store last notification time sp.putLong(R.string.key_last_versionchecker_plugin_warning_timestamp, now) diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt index de3e651a41..72e69ac6d5 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt @@ -55,11 +55,11 @@ class VersionCheckerUtilsImpl @Inject constructor( compareWithCurrentVersion(version, config.get().VERSION_NAME) // App expiration - var endDate = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, 0) + var endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, 0) AllowedVersions().findByVersion(definition, config.get().VERSION_NAME)?.let { expirationJson -> AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed -> endDate = ed + T.days(1).msecs() - sp.putLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate) + sp.putLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate) } } if (endDate != 0L) onExpireDateDetected(config.get().VERSION_NAME, dateUtil.dateString(endDate)) diff --git a/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/ConstraintsCheckerImplTest.kt b/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/ConstraintsCheckerImplTest.kt index 0f8d3c614e..9d9ce076bc 100644 --- a/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/ConstraintsCheckerImplTest.kt +++ b/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/ConstraintsCheckerImplTest.kt @@ -109,7 +109,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { `when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(app.aaps.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s") `when`(rh.gs(app.aaps.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit") - `when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child") + `when`(rh.gs(app.aaps.core.utils.R.string.key_child)).thenReturn("child") `when`(rh.gs(app.aaps.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s") `when`(rh.gs(app.aaps.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s") `when`(rh.gs(app.aaps.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") @@ -243,13 +243,13 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { // 2x Safety & Objectives @Test fun isClosedLoopAllowedTest() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) objectivesPlugin.objectives[Objectives.MAXIOB_ZERO_CL_OBJECTIVE].startedOn = 0 var c: Constraint = constraintChecker.isClosedLoopAllowed() aapsLogger.debug("Reason list: " + c.reasonList.toString()) // assertThat(c.reasonList[0].toString()).contains("Closed loop is disabled") // Safety & Objectives assertThat(c.value()).isFalse() - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) c = constraintChecker.isClosedLoopAllowed() assertThat(c.reasonList[0]).contains("Closed loop mode disabled in preferences") // Safety & Objectives // assertThat(c.reasonList).hasThat(3) // 2x Safety & Objectives @@ -261,7 +261,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { fun isAutosensModeEnabledTest() { openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true) objectivesPlugin.objectives[Objectives.AUTOSENS_OBJECTIVE].startedOn = 0 - `when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false)).thenReturn(false) + `when`(sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false)).thenReturn(false) val c = constraintChecker.isAutosensModeEnabled() assertThat(c.reasonList).hasSize(2) // Safety & Objectives assertThat(c.mostLimitedReasonList).hasSize(2) // Safety & Objectives @@ -292,7 +292,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true) objectivesPlugin.objectives[Objectives.SMB_OBJECTIVE].startedOn = 0 `when`(sp.getBoolean(app.aaps.plugins.aps.R.string.key_use_smb, false)).thenReturn(false) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) // `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(ConstraintObject(true)) val c = constraintChecker.isSMBModeEnabled() assertThat(c.reasonList).hasSize(3) // 2x Safety & Objectives @@ -319,7 +319,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") // Apply all limits val d = constraintChecker.getMaxBasalAllowed(validProfile) @@ -346,7 +346,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") // Apply all limits val i = constraintChecker.getMaxBasalPercentAllowed(validProfile) @@ -372,8 +372,8 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { // insightPlugin.setStatusResult(result); // No limit by default - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") // Apply all limits val d = constraintChecker.getMaxBolusAllowed() @@ -386,7 +386,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { @Test fun carbsAmountShouldBeLimited() { // No limit by default - `when`(sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48) + `when`(sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48) // Apply all limits val i = constraintChecker.getMaxCarbsAllowed() @@ -399,9 +399,9 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { @Test fun iobAMAShouldBeLimited() { // No limit by default - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("teenage") openAPSAMAPlugin.setPluginEnabled(PluginType.APS, true) openAPSSMBPlugin.setPluginEnabled(PluginType.APS, false) @@ -415,9 +415,9 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() { @Test fun iobSMBShouldBeLimited() { // No limit by default - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("teenage") openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true) openAPSAMAPlugin.setPluginEnabled(PluginType.APS, false) diff --git a/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/safety/SafetyPluginTest.kt b/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/safety/SafetyPluginTest.kt index 91e6ef5828..d990ba7893 100644 --- a/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/safety/SafetyPluginTest.kt +++ b/plugins/constraints/src/test/kotlin/app/aaps/plugins/constraints/safety/SafetyPluginTest.kt @@ -68,7 +68,7 @@ class SafetyPluginTest : TestBaseWithProfile() { `when`(rh.gs(app.aaps.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") `when`(rh.gs(app.aaps.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") `when`(rh.gs(app.aaps.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(app.aaps.core.utils.R.string.key_child)).thenReturn("child") `when`(rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend)).thenReturn("Low Glucose Suspend") `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) @@ -95,7 +95,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Test fun disabledEngineeringModeShouldLimitClosedLoop() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) `when`(config.isEngineeringModeOrRelease()).thenReturn(false) val c = safetyPlugin.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)) assertThat(c.getReasons()).contains("Running dev version. Closed loop is disabled.") @@ -104,7 +104,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Test fun setOpenLoopInPreferencesShouldLimitClosedLoop() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) val c = safetyPlugin.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)) assertThat(c.getReasons()).contains("Closed loop mode disabled in preferences") assertThat(c.value()).isFalse() @@ -141,7 +141,7 @@ class SafetyPluginTest : TestBaseWithProfile() { `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") val c = ConstraintObject(Double.MAX_VALUE, aapsLogger) safetyPlugin.applyBasalConstraints(c, validProfile) assertThat(c.value()).isWithin(0.01).of(2.0) @@ -155,7 +155,7 @@ class SafetyPluginTest : TestBaseWithProfile() { @Test fun doNotAllowNegativeBasalRate() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") val d = ConstraintObject(-0.5, aapsLogger) safetyPlugin.applyBasalConstraints(d, validProfile) assertThat(d.value()).isWithin(0.01).of(0.0) @@ -170,7 +170,7 @@ class SafetyPluginTest : TestBaseWithProfile() { `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") val i = ConstraintObject(Int.MAX_VALUE, aapsLogger) safetyPlugin.applyBasalPercentConstraints(i, validProfile) assertThat(i.value()).isEqualTo(200) @@ -193,7 +193,7 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true) val i = ConstraintObject(Double.MAX_VALUE, aapsLogger) openAPSSMBPlugin.applyBasalConstraints(i, validProfile) @@ -210,7 +210,7 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit @Test fun doNotAllowNegativePercentBasalRate() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") val i = ConstraintObject(-22, aapsLogger) safetyPlugin.applyBasalPercentConstraints(i, validProfile) assertThat(i.value()).isEqualTo(0) @@ -226,8 +226,8 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit @Test fun bolusAmountShouldBeLimited() { - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") val d = safetyPlugin.applyBolusConstraints(ConstraintObject(Double.MAX_VALUE, aapsLogger)) assertThat(d.value()).isWithin(0.01).of(3.0) assertThat(d.getReasons()).isEqualTo( @@ -241,8 +241,8 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit @Test fun doNotAllowNegativeBolusAmount() { - `when`(sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child") + `when`(sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0) + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child") val d = safetyPlugin.applyBolusConstraints(ConstraintObject(-22.0, aapsLogger)) assertThat(d.value()).isWithin(0.01).of(0.0) assertThat(d.getReasons()).isEqualTo("Safety: Limiting bolus to 0.0 U because of it must be positive value") @@ -252,7 +252,7 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit @Test fun carbsAmountShouldBeLimited() { // No limit by default - `when`(sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48) + `when`(sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48) // Negative carbs not allowed var i: Constraint = ConstraintObject(-22, aapsLogger) @@ -272,10 +272,10 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true) //`when`(openAPSSMBPlugin.isEnabled()).thenReturn(true) //`when`(openAPSAMAPlugin.isEnabled()).thenReturn(false) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5) `when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage") + `when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("teenage") // Apply all limits var d: Constraint = ConstraintObject(Double.MAX_VALUE, aapsLogger) diff --git a/plugins/insulin/src/main/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt b/plugins/insulin/src/main/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt index 4875daa8b3..237aed8557 100644 --- a/plugins/insulin/src/main/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt +++ b/plugins/insulin/src/main/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt @@ -36,9 +36,9 @@ class InsulinOrefFreePeakPlugin @Inject constructor( override val friendlyName get(): String = rh.gs(R.string.free_peak_oref) - override fun configuration(): JSONObject = JSONObject().putInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, sp, rh) + override fun configuration(): JSONObject = JSONObject().putInt(app.aaps.core.utils.R.string.key_insulin_oref_peak, sp, rh) override fun applyConfiguration(configuration: JSONObject) { - configuration.storeInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, sp, rh) + configuration.storeInt(app.aaps.core.utils.R.string.key_insulin_oref_peak, sp, rh) } override fun commentStandardText(): String { @@ -46,7 +46,7 @@ class InsulinOrefFreePeakPlugin @Inject constructor( } override val peak: Int - get() = sp.getInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, DEFAULT_PEAK) + get() = sp.getInt(app.aaps.core.utils.R.string.key_insulin_oref_peak, DEFAULT_PEAK) companion object { diff --git a/plugins/insulin/src/test/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt b/plugins/insulin/src/test/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt index d32676659b..e797c40f20 100644 --- a/plugins/insulin/src/test/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt +++ b/plugins/insulin/src/test/kotlin/app/aaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt @@ -45,7 +45,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { @Test fun `simple peak test`() { - `when`(sp.getInt(eq(info.nightscout.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90) + `when`(sp.getInt(eq(app.aaps.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90) assertThat(sut.peak).isEqualTo(90) } @@ -56,7 +56,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { @Test fun commentStandardTextTest() { - `when`(sp.getInt(eq(info.nightscout.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90) + `when`(sp.getInt(eq(app.aaps.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90) `when`(rh.gs(eq(R.string.insulin_peak_time))).thenReturn("Peak Time [min]") assertThat(sut.commentStandardText()).isEqualTo("Peak Time [min]: 90") } diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/actions/ActionsFragment.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/actions/ActionsFragment.kt index c7b9601999..a76514c382 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/actions/ActionsFragment.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/actions/ActionsFragment.kt @@ -183,7 +183,7 @@ class ActionsFragment : DaggerFragment() { uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.ANNOUNCEMENT, app.aaps.core.ui.R.string.careportal_announcement) } - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseactions, true) } @Synchronized diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewFragment.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewFragment.kt index 275cce6216..8f5f834e1f 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewFragment.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewFragment.kt @@ -208,9 +208,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList binding.graphsLayout.bgGraph.setOnLongClickListener { overviewData.rangeToDisplay += 6 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(info.nightscout.core.utils.R.string.key_objectiveusescale, true) + sp.putInt(app.aaps.core.utils.R.string.key_rangetodisplay, overviewData.rangeToDisplay) + rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.utils.R.string.key_rangetodisplay))) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, true) false } prepareGraphsIfNeeded(overviewMenus.setting.size) @@ -272,9 +272,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList .observeOn(aapsSchedulers.main) .subscribe({ 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(info.nightscout.core.utils.R.string.key_objectiveusescale, true) + sp.putInt(app.aaps.core.utils.R.string.key_rangetodisplay, it.hours) + rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.utils.R.string.key_rangetodisplay))) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, true) }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventBucketedDataCreated::class.java) @@ -1088,7 +1088,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList private fun updateSensitivity() { _binding ?: return val lastAutosensData = overviewData.lastAutosensData(iobCobCalculator) - if (config.NSCLIENT && sp.getBoolean(info.nightscout.core.utils.R.string.key_used_autosens_on_main_phone, false) || + if (config.NSCLIENT && sp.getBoolean(app.aaps.core.utils.R.string.key_used_autosens_on_main_phone, false) || !config.NSCLIENT && constraintChecker.isAutosensModeEnabled().value() ) { binding.infoLayout.sensitivityIcon.setImageResource(app.aaps.core.main.R.drawable.ic_swap_vert_black_48dp_green) diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewPlugin.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewPlugin.kt index 5cdadaed99..5e773f79f2 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewPlugin.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/OverviewPlugin.kt @@ -157,7 +157,7 @@ class OverviewPlugin @Inject constructor( } } if (!config.isEngineeringMode()) - (preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_reset_boluswizard_percentage_time)) as ValidatingEditTextPreference?)?.let { + (preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_reset_boluswizard_percentage_time)) as ValidatingEditTextPreference?)?.let { it.isVisible = false it.isEnabled = false } @@ -165,64 +165,64 @@ class OverviewPlugin @Inject constructor( override fun configuration(): JSONObject = JSONObject() - .putString(info.nightscout.core.utils.R.string.key_units, sp, rh) - .putString(info.nightscout.core.utils.R.string.key_quickwizard, sp, rh) - .putInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_eatingsoon_target, sp, rh) - .putInt(info.nightscout.core.utils.R.string.key_activity_duration, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_activity_target, sp, rh) - .putInt(info.nightscout.core.utils.R.string.key_hypo_duration, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_hypo_target, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_low_mark, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_high_mark, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_warning, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_critical, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_warning, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_critical, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_warning, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_critical, sp, rh) + .putString(app.aaps.core.utils.R.string.key_units, sp, rh) + .putString(app.aaps.core.utils.R.string.key_quickwizard, sp, rh) + .putInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_eatingsoon_target, sp, rh) + .putInt(app.aaps.core.utils.R.string.key_activity_duration, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_activity_target, sp, rh) + .putInt(app.aaps.core.utils.R.string.key_hypo_duration, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_hypo_target, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_low_mark, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_high_mark, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_warning, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_critical, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_warning, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_critical, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_warning, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_critical, sp, rh) .putDouble(R.string.key_statuslights_sbat_warning, sp, rh) .putDouble(R.string.key_statuslights_sbat_critical, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_warning, sp, rh) - .putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_critical, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_warning, sp, rh) + .putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_critical, sp, rh) .putDouble(R.string.key_statuslights_res_warning, sp, rh) .putDouble(R.string.key_statuslights_res_critical, sp, rh) .putDouble(R.string.key_statuslights_bat_warning, sp, rh) .putDouble(R.string.key_statuslights_bat_critical, sp, rh) - .putInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, sp, rh) - .put(rh.gs(info.nightscout.core.utils.R.string.key_used_autosens_on_main_phone), constraintsChecker.isAutosensModeEnabled().value()) // can be disabled by activated DynISF + .putInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, sp, rh) + .put(rh.gs(app.aaps.core.utils.R.string.key_used_autosens_on_main_phone), constraintsChecker.isAutosensModeEnabled().value()) // can be disabled by activated DynISF override fun applyConfiguration(configuration: JSONObject) { - val previousUnits = sp.getString(info.nightscout.core.utils.R.string.key_units, "random") + val previousUnits = sp.getString(app.aaps.core.utils.R.string.key_units, "random") configuration - .storeString(info.nightscout.core.utils.R.string.key_units, sp, rh) - .storeString(info.nightscout.core.utils.R.string.key_quickwizard, sp, rh) - .storeInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_eatingsoon_target, sp, rh) - .storeInt(info.nightscout.core.utils.R.string.key_activity_duration, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_activity_target, sp, rh) - .storeInt(info.nightscout.core.utils.R.string.key_hypo_duration, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_hypo_target, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_low_mark, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_high_mark, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_warning, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_critical, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_warning, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_critical, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_warning, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_critical, sp, rh) + .storeString(app.aaps.core.utils.R.string.key_units, sp, rh) + .storeString(app.aaps.core.utils.R.string.key_quickwizard, sp, rh) + .storeInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_eatingsoon_target, sp, rh) + .storeInt(app.aaps.core.utils.R.string.key_activity_duration, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_activity_target, sp, rh) + .storeInt(app.aaps.core.utils.R.string.key_hypo_duration, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_hypo_target, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_low_mark, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_high_mark, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_cage_warning, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_cage_critical, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_iage_warning, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_iage_critical, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_sage_warning, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_sage_critical, sp, rh) .storeDouble(R.string.key_statuslights_sbat_warning, sp, rh) .storeDouble(R.string.key_statuslights_sbat_critical, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_warning, sp, rh) - .storeDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_critical, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_bage_warning, sp, rh) + .storeDouble(app.aaps.core.utils.R.string.key_statuslights_bage_critical, sp, rh) .storeDouble(R.string.key_statuslights_res_warning, sp, rh) .storeDouble(R.string.key_statuslights_res_critical, sp, rh) .storeDouble(R.string.key_statuslights_bat_warning, sp, rh) .storeDouble(R.string.key_statuslights_bat_critical, sp, rh) - .storeInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, sp, rh) - .storeBoolean(info.nightscout.core.utils.R.string.key_used_autosens_on_main_phone, sp, rh) + .storeInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, sp, rh) + .storeBoolean(app.aaps.core.utils.R.string.key_used_autosens_on_main_phone, sp, rh) - val newUnits = sp.getString(info.nightscout.core.utils.R.string.key_units, "new") + val newUnits = sp.getString(app.aaps.core.utils.R.string.key_units, "new") if (previousUnits != newUnits) { overviewData.reset() rxBus.send(EventNewHistoryData(0L, reloadBgData = true)) diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/notifications/NotificationWithAction.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/notifications/NotificationWithAction.kt index 3018fca7b1..34a2421bc5 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/notifications/NotificationWithAction.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/notifications/NotificationWithAction.kt @@ -62,9 +62,9 @@ class NotificationWithAction( activePlugin.activeNsClient?.handleClearAlarm(nsAlarm, 60 * 60 * 1000L) // Adding current time to snooze if we got staleData aapsLogger.debug(LTag.NOTIFICATION, "Notification text is: $text") - val msToSnooze = sp.getInt(info.nightscout.core.utils.R.string.key_ns_alarm_stale_data_value, 15) * 60 * 1000L + val msToSnooze = sp.getInt(app.aaps.core.utils.R.string.key_ns_alarm_stale_data_value, 15) * 60 * 1000L aapsLogger.debug(LTag.NOTIFICATION, "snooze nsalarm_staledatavalue in minutes is ${T.msecs(msToSnooze).mins()} currentTimeMillis is: ${System.currentTimeMillis()}") - sp.putLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + nsAlarm.level(), System.currentTimeMillis() + msToSnooze) + sp.putLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + nsAlarm.level(), System.currentTimeMillis() + msToSnooze) } } diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/ui/StatusLightHandler.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/ui/StatusLightHandler.kt index c57b5c49e5..6c40fe08a8 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/ui/StatusLightHandler.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/overview/ui/StatusLightHandler.kt @@ -56,34 +56,34 @@ class StatusLightHandler @Inject constructor( handleAge( cannulaAge, TherapyEvent.Type.CANNULA_CHANGE, - info.nightscout.core.utils.R.string.key_statuslights_cage_warning, + app.aaps.core.utils.R.string.key_statuslights_cage_warning, 48.0, - info.nightscout.core.utils.R.string.key_statuslights_cage_critical, + app.aaps.core.utils.R.string.key_statuslights_cage_critical, 72.0 ) handleAge( insulinAge, TherapyEvent.Type.INSULIN_CHANGE, - info.nightscout.core.utils.R.string.key_statuslights_iage_warning, + app.aaps.core.utils.R.string.key_statuslights_iage_warning, 72.0, - info.nightscout.core.utils.R.string.key_statuslights_iage_critical, + app.aaps.core.utils.R.string.key_statuslights_iage_critical, 144.0 ) handleAge( sensorAge, TherapyEvent.Type.SENSOR_CHANGE, - info.nightscout.core.utils.R.string.key_statuslights_sage_warning, + app.aaps.core.utils.R.string.key_statuslights_sage_warning, 216.0, - info.nightscout.core.utils.R.string.key_statuslights_sage_critical, + app.aaps.core.utils.R.string.key_statuslights_sage_critical, 240.0 ) if (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()) { handleAge( batteryAge, TherapyEvent.Type.PUMP_BATTERY_CHANGE, - info.nightscout.core.utils.R.string.key_statuslights_bage_warning, + app.aaps.core.utils.R.string.key_statuslights_bage_warning, 216.0, - info.nightscout.core.utils.R.string.key_statuslights_bage_critical, + app.aaps.core.utils.R.string.key_statuslights_bage_critical, 240.0 ) } diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPlugin.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPlugin.kt index ac8d67dbc4..67bd789803 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -512,7 +512,7 @@ class SmsCommunicatorPlugin @Inject constructor( messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) { override fun run() { uel.log(Action.LGS_LOOP_MODE, Sources.SMS) - sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.LGS.name) + sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.LGS.name) rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend))) val replyText = rh.gs(R.string.smscommunicator_current_loop_mode, getApsModeText()) sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText)) @@ -527,7 +527,7 @@ class SmsCommunicatorPlugin @Inject constructor( messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) { override fun run() { uel.log(Action.CLOSED_LOOP_MODE, Sources.SMS) - sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.CLOSED.name) + sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.CLOSED.name) rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.closedloop))) val replyText = rh.gs(R.string.smscommunicator_current_loop_mode, getApsModeText()) sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText)) @@ -947,13 +947,13 @@ class SmsCommunicatorPlugin @Inject constructor( lastRemoteBolusTime = dateUtil.now() if (isMeal) { profileFunction.getProfile()?.let { currentProfile -> - var eatingSoonTTDuration = sp.getInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration) + var eatingSoonTTDuration = sp.getInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration) eatingSoonTTDuration = if (eatingSoonTTDuration > 0) eatingSoonTTDuration else Constants.defaultEatingSoonTTDuration var eatingSoonTT = sp.getDouble( - info.nightscout.core.utils.R.string.key_eatingsoon_target, + app.aaps.core.utils.R.string.key_eatingsoon_target, if (currentProfile.units == GlucoseUnit.MMOL) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl ) eatingSoonTT = @@ -1088,27 +1088,27 @@ class SmsCommunicatorPlugin @Inject constructor( var reason = TemporaryTarget.Reason.EATING_SOON when { isMeal -> { - keyDuration = info.nightscout.core.utils.R.string.key_eatingsoon_duration + keyDuration = app.aaps.core.utils.R.string.key_eatingsoon_duration defaultTargetDuration = Constants.defaultEatingSoonTTDuration - keyTarget = info.nightscout.core.utils.R.string.key_eatingsoon_target + keyTarget = app.aaps.core.utils.R.string.key_eatingsoon_target defaultTargetMMOL = Constants.defaultEatingSoonTTmmol defaultTargetMGDL = Constants.defaultEatingSoonTTmgdl reason = TemporaryTarget.Reason.EATING_SOON } isActivity -> { - keyDuration = info.nightscout.core.utils.R.string.key_activity_duration + keyDuration = app.aaps.core.utils.R.string.key_activity_duration defaultTargetDuration = Constants.defaultActivityTTDuration - keyTarget = info.nightscout.core.utils.R.string.key_activity_target + keyTarget = app.aaps.core.utils.R.string.key_activity_target defaultTargetMMOL = Constants.defaultActivityTTmmol defaultTargetMGDL = Constants.defaultActivityTTmgdl reason = TemporaryTarget.Reason.ACTIVITY } isHypo -> { - keyDuration = info.nightscout.core.utils.R.string.key_hypo_duration + keyDuration = app.aaps.core.utils.R.string.key_hypo_duration defaultTargetDuration = Constants.defaultHypoTTDuration - keyTarget = info.nightscout.core.utils.R.string.key_hypo_target + keyTarget = app.aaps.core.utils.R.string.key_hypo_target defaultTargetMMOL = Constants.defaultHypoTTmmol defaultTargetMGDL = Constants.defaultHypoTTmgdl reason = TemporaryTarget.Reason.HYPOGLYCEMIA @@ -1291,7 +1291,7 @@ class SmsCommunicatorPlugin @Inject constructor( } private fun getApsModeText(): String = - when (ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))) { + when (ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))) { ApsMode.OPEN -> rh.gs(app.aaps.core.ui.R.string.openloop) ApsMode.CLOSED -> rh.gs(app.aaps.core.ui.R.string.closedloop) ApsMode.LGS -> rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend) diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/otp/OneTimePassword.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/otp/OneTimePassword.kt index 49361d8a55..4546d7c86d 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/otp/OneTimePassword.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/smsCommunicator/otp/OneTimePassword.kt @@ -37,7 +37,7 @@ class OneTimePassword @Inject constructor( */ fun name(): String { val defaultUserName = rh.gs(app.aaps.core.ui.R.string.patient_name_default) - var userName = sp.getString(info.nightscout.core.utils.R.string.key_patient_name, defaultUserName).replace(":", "").trim() + var userName = sp.getString(app.aaps.core.utils.R.string.key_patient_name, defaultUserName).replace(":", "").trim() if (userName.isEmpty()) userName = defaultUserName return userName diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/themes/ThemeSwitcherPlugin.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/themes/ThemeSwitcherPlugin.kt index 41865a854c..2272bd54f5 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/themes/ThemeSwitcherPlugin.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/themes/ThemeSwitcherPlugin.kt @@ -40,7 +40,7 @@ class ThemeSwitcherPlugin @Inject constructor( override fun onStart() { compositeDisposable.add(rxBus.toObservable(EventPreferenceChange::class.java).subscribe { - if (it.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_use_dark_mode))) { + if (it.isChanged(rh.gs(app.aaps.core.utils.R.string.key_use_dark_mode))) { setThemeMode() rxBus.send(EventThemeSwitch()) } @@ -49,7 +49,7 @@ class ThemeSwitcherPlugin @Inject constructor( fun setThemeMode() { val mode = try { - when (sp.getString(info.nightscout.core.utils.R.string.key_use_dark_mode, "dark")) { + when (sp.getString(app.aaps.core.utils.R.string.key_use_dark_mode, "dark")) { sp.getString(R.string.value_dark_theme, "dark") -> MODE_NIGHT_YES sp.getString(R.string.value_light_theme, "light") -> MODE_NIGHT_NO else -> MODE_NIGHT_FOLLOW_SYSTEM diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/WearPlugin.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/WearPlugin.kt index dca07701f7..391a731c9c 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/WearPlugin.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/WearPlugin.kt @@ -112,11 +112,11 @@ class WearPlugin @Inject constructor( fun checkCustomWatchfacePreferences() { savedCustomWatchface?.let { cwf -> - val cwf_authorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false) + val cwf_authorization = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false) if (cwf_authorization != cwf.metadata[CwfMetadataKey.CWF_AUTHORIZATION]?.toBooleanStrictOrNull()) { // resend new customWatchface to Watch with updated authorization for preferences update val newCwf = cwf.copy() - newCwf.metadata[CwfMetadataKey.CWF_AUTHORIZATION] = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false).toString() + newCwf.metadata[CwfMetadataKey.CWF_AUTHORIZATION] = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false).toString() rxBus.send(EventMobileDataToWear(EventData.ActionSetCustomWatchface(newCwf))) } } diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/activities/CwfInfosActivity.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/activities/CwfInfosActivity.kt index da5087d9ad..f12b2975bc 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/activities/CwfInfosActivity.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/activities/CwfInfosActivity.kt @@ -85,7 +85,7 @@ class CwfInfosActivity : TranslatedDaggerAppCompatActivity() { private fun updateGui() { wearPlugin.savedCustomWatchface?.let { - val cwfAuthorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false) + val cwfAuthorization = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false) val metadata = it.metadata val drawable = it.resDatas[ResFileMap.CUSTOM_WATCHFACE.fileName]?.toDrawable(resources) binding.customWatchface.setImageDrawable(drawable) diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt index c656803333..e742bd3728 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt @@ -417,13 +417,13 @@ class DataHandlerMobile @Inject constructor( bg = bgReading.valueToUnits(profileFunction.getUnits()), correction = 0.0, percentageCorrection = percentage, - useBg = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_bg, true), - useCob = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_cob, true), - includeBolusIOB = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_iob, true), - includeBasalIOB = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_iob, true), + useBg = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_bg, true), + useCob = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_cob, true), + includeBolusIOB = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_iob, true), + includeBasalIOB = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_iob, true), useSuperBolus = false, - useTT = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_tt, false), - useTrend = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_trend, false), + useTT = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_tt, false), + useTrend = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_trend, false), useAlarm = false ) val insulinAfterConstraints = bolusWizard.insulinAfterConstraints @@ -745,15 +745,15 @@ class DataHandlerMobile @Inject constructor( EventMobileToWear( EventData.Preferences( timeStamp = System.currentTimeMillis(), - wearControl = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_control, false), + wearControl = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_control, false), unitsMgdl = profileFunction.getUnits() == GlucoseUnit.MGDL, - bolusPercentage = sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100), - maxCarbs = sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48), - maxBolus = sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0), + bolusPercentage = sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100), + maxCarbs = sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48), + maxBolus = sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0), insulinButtonIncrement1 = sp.getDouble(app.aaps.core.interfaces.R.string.key_insulin_button_increment_1, Constants.INSULIN_PLUS1_DEFAULT), insulinButtonIncrement2 = sp.getDouble(app.aaps.core.interfaces.R.string.key_insulin_button_increment_2, Constants.INSULIN_PLUS2_DEFAULT), - carbsButtonIncrement1 = sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_1, Constants.CARBS_FAV1_DEFAULT), - carbsButtonIncrement2 = sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_2, Constants.CARBS_FAV2_DEFAULT) + carbsButtonIncrement1 = sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_1, Constants.CARBS_FAV1_DEFAULT), + carbsButtonIncrement2 = sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_2, Constants.CARBS_FAV2_DEFAULT) ) ) ) diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/IobCobCalculatorPlugin.kt index a3935e7ed0..4207aef89f 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/IobCobCalculatorPlugin.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/IobCobCalculatorPlugin.kt @@ -122,14 +122,14 @@ class IobCobCalculatorPlugin @Inject constructor( .toObservable(EventPreferenceChange::class.java) .observeOn(aapsSchedulers.io) .subscribe({ event -> - if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_age)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak)) + if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_age)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_absorption_cutoff)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_insulin_oref_peak)) ) { resetDataAndRunCalculation("onEventPreferenceChange", event) } @@ -490,7 +490,7 @@ class IobCobCalculatorPlugin @Inject constructor( val total = IobTotal(toTime) val profile = profileFunction.getProfile() ?: return total val dia = profile.dia - val divisor = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_bolus_snooze_dia_divisor, 2.0) + val divisor = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_bolus_snooze_dia_divisor, 2.0) assert(divisor > 0) val boluses = repository.getBolusesDataFromTime(toTime - range(), true).blockingGet() diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/data/AutosensDataObject.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/data/AutosensDataObject.kt index 758220dd3f..878bb7a411 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/data/AutosensDataObject.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/iob/iobCobCalculator/data/AutosensDataObject.kt @@ -92,8 +92,8 @@ class AutosensDataObject(injector: HasAndroidInjector) : AutosensData { // remove carbs older than timeframe override fun removeOldCarbs(toTime: Long, isAAPSOrWeighted: Boolean) { val maxAbsorptionHours: Double = - if (isAAPSOrWeighted) sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) - else sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME) + if (isAAPSOrWeighted) sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) + else sp.getDouble(app.aaps.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME) var i = 0 while (i < activeCarbsList.size) { val c = activeCarbsList[i] diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/profile/ProfilePlugin.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/profile/ProfilePlugin.kt index ada99a1314..24b94586b1 100644 --- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/profile/ProfilePlugin.kt +++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/profile/ProfilePlugin.kt @@ -187,7 +187,7 @@ class ProfilePlugin @Inject constructor( } sp.putInt(Constants.LOCAL_PROFILE + "_profiles", numOfProfiles) - sp.putLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, timestamp) + sp.putLong(app.aaps.core.utils.R.string.key_local_profile_last_change, timestamp) createAndStoreConvertedProfile() isEdited = false aapsLogger.debug(LTag.PROFILE, "Storing settings: " + rawProfile?.data.toString()) @@ -406,7 +406,7 @@ class ProfilePlugin @Inject constructor( } } if (numOfProfiles > 0) json.put("defaultProfile", currentProfile()?.name) - val startDate = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, dateUtil.now()) + val startDate = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, dateUtil.now()) json.put("date", startDate) json.put("created_at", dateUtil.toISOAsUTC(startDate)) json.put("startDate", dateUtil.toISOAsUTC(startDate)) diff --git a/plugins/main/src/test/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/plugins/main/src/test/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPluginTest.kt index 5ba9a2e1bd..e59e204760 100644 --- a/plugins/main/src/test/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPluginTest.kt +++ b/plugins/main/src/test/kotlin/app/aaps/plugins/main/general/smsCommunicator/SmsCommunicatorPluginTest.kt @@ -327,7 +327,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { //LOOP STATUS : enabled - APS mode - Closed `when`(loop.enabled).thenReturn(true) `when`(loop.isSuspended).thenReturn(false) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP STATUS") smsCommunicatorPlugin.processSms(sms) @@ -336,7 +336,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { assertThat(smsCommunicatorPlugin.messages[1].text).isEqualTo("Loop is enabled - $modeClosed") //LOOP STATUS : enabled - APS mode - Open - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name) smsCommunicatorPlugin.messages = ArrayList() smsCommunicatorPlugin.processSms(sms) assertThat(sms.ignored).isFalse() @@ -344,7 +344,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { assertThat(smsCommunicatorPlugin.messages[1].text).isEqualTo("Loop is enabled - $modeOpen") //LOOP STATUS : enabled - APS mode - LGS - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name) smsCommunicatorPlugin.messages = ArrayList() smsCommunicatorPlugin.processSms(sms) assertThat(sms.ignored).isFalse() @@ -352,7 +352,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { assertThat(smsCommunicatorPlugin.messages[1].text).isEqualTo("Loop is enabled - $modeLgs") //LOOP STATUS : enabled - APS mode - unknown - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn("some wrong value") + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn("some wrong value") smsCommunicatorPlugin.messages = ArrayList() smsCommunicatorPlugin.processSms(sms) assertThat(sms.ignored).isFalse() @@ -504,7 +504,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { var smsCommand = "LOOP CLOSED" val replyClosed = "In order to switch Loop mode to Closed loop reply with code " `when`(loop.enabled).thenReturn(true) - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", smsCommand) smsCommunicatorPlugin.processSms(sms) @@ -519,7 +519,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { //LOOP LGS smsCommand = "LOOP LGS" val replyLgs = "In order to switch Loop mode to LGS (Low Glucose Suspend) reply with code " - `when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name) + `when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", smsCommand) smsCommunicatorPlugin.processSms(sms) diff --git a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/AbstractSensitivityPlugin.kt b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/AbstractSensitivityPlugin.kt index 6afb9962d4..45f4c2cadd 100644 --- a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/AbstractSensitivityPlugin.kt +++ b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/AbstractSensitivityPlugin.kt @@ -32,8 +32,8 @@ abstract class AbstractSensitivityPlugin( return fillResult( ratio, carbsAbsorbed, pastSensitivity, ratioLimit, sensResult, deviationsArraySize, - SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, "0.7")), - SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2")) + SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_min, "0.7")), + SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2")) ) } diff --git a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityAAPSPlugin.kt b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityAAPSPlugin.kt index e77ba5cd2c..90b4ef0b7e 100644 --- a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityAAPSPlugin.kt +++ b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityAAPSPlugin.kt @@ -49,12 +49,12 @@ class SensitivityAAPSPlugin @Inject constructor( ) { override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult { - val age = sp.getString(info.nightscout.core.utils.R.string.key_age, "") + val age = sp.getString(app.aaps.core.utils.R.string.key_age, "") var defaultHours = 24 - if (age == rh.gs(info.nightscout.core.utils.R.string.key_adult)) defaultHours = 24 - if (age == rh.gs(info.nightscout.core.utils.R.string.key_teenage)) defaultHours = 4 - if (age == rh.gs(info.nightscout.core.utils.R.string.key_child)) defaultHours = 4 - val hoursForDetection = sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, defaultHours) + if (age == rh.gs(app.aaps.core.utils.R.string.key_adult)) defaultHours = 24 + if (age == rh.gs(app.aaps.core.utils.R.string.key_teenage)) defaultHours = 4 + if (age == rh.gs(app.aaps.core.utils.R.string.key_child)) defaultHours = 4 + val hoursForDetection = sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, defaultHours) val profile = profileFunction.getProfile() if (profile == null) { aapsLogger.error("No profile") @@ -139,7 +139,7 @@ class SensitivityAAPSPlugin @Inject constructor( return output } - override fun maxAbsorptionHours(): Double = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) + override fun maxAbsorptionHours(): Double = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) override val isMinCarbsAbsorptionDynamic: Boolean = true override val isOref1: Boolean = false @@ -149,10 +149,10 @@ class SensitivityAAPSPlugin @Inject constructor( override fun configuration(): JSONObject { val c = JSONObject() try { - c.put(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime), sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, 24)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime), sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, 24)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)) } catch (e: JSONException) { e.printStackTrace() } @@ -161,28 +161,28 @@ class SensitivityAAPSPlugin @Inject constructor( override fun applyConfiguration(configuration: JSONObject) { try { - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime))) sp.putDouble( - info.nightscout.core.utils.R.string.key_absorption_maxtime, configuration.getDouble( + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime))) sp.putDouble( + app.aaps.core.utils.R.string.key_absorption_maxtime, configuration.getDouble( rh.gs( - info.nightscout.core.utils.R.string.key_absorption_maxtime + app.aaps.core.utils.R.string.key_absorption_maxtime ) ) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_period, - configuration.getDouble(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period)) + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_period, + configuration.getDouble(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period)) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble( + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble( rh.gs( - info.nightscout.core.utils.R.string.key_openapsama_autosens_max + app.aaps.core.utils.R.string.key_openapsama_autosens_max ) ) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble( + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble( rh.gs( - info.nightscout.core.utils.R.string.key_openapsama_autosens_min + app.aaps.core.utils.R.string.key_openapsama_autosens_min ) ) ) diff --git a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityOref1Plugin.kt b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityOref1Plugin.kt index 51a90debd2..f811a31004 100644 --- a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityOref1Plugin.kt +++ b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityOref1Plugin.kt @@ -204,7 +204,7 @@ class SensitivityOref1Plugin @Inject constructor( return output } - override fun maxAbsorptionHours(): Double = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME) + override fun maxAbsorptionHours(): Double = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME) override val isMinCarbsAbsorptionDynamic: Boolean = false override val isOref1: Boolean = true @@ -212,12 +212,12 @@ class SensitivityOref1Plugin @Inject constructor( val c = JSONObject() try { c.put( - rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact), - sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) + rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact), + sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) ) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff), sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_absorption_cutoff), sp.getDouble(app.aaps.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)) } catch (e: JSONException) { e.printStackTrace() } @@ -226,28 +226,28 @@ class SensitivityOref1Plugin @Inject constructor( override fun applyConfiguration(configuration: JSONObject) { try { - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact))) sp.putDouble( - info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, - configuration.getDouble(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact)) + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact))) sp.putDouble( + app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, + configuration.getDouble(rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact)) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff))) sp.putDouble( - info.nightscout.core.utils.R.string.key_absorption_cutoff, configuration.getDouble( + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_absorption_cutoff))) sp.putDouble( + app.aaps.core.utils.R.string.key_absorption_cutoff, configuration.getDouble( rh.gs( - info.nightscout.core.utils.R.string.key_absorption_cutoff + app.aaps.core.utils.R.string.key_absorption_cutoff ) ) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble( + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble( rh.gs( - info.nightscout.core.utils.R.string.key_openapsama_autosens_max + app.aaps.core.utils.R.string.key_openapsama_autosens_max ) ) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble( + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble( rh.gs( - info.nightscout.core.utils.R.string.key_openapsama_autosens_min + app.aaps.core.utils.R.string.key_openapsama_autosens_min ) ) ) diff --git a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt index b068503e81..d62ff34441 100644 --- a/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt +++ b/plugins/sensitivity/src/main/kotlin/app/aaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt @@ -48,12 +48,12 @@ class SensitivityWeightedAveragePlugin @Inject constructor( ) { override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult { - val age = sp.getString(info.nightscout.core.utils.R.string.key_age, "") + val age = sp.getString(app.aaps.core.utils.R.string.key_age, "") var defaultHours = 24 - if (age == rh.gs(info.nightscout.core.utils.R.string.key_adult)) defaultHours = 24 - if (age == rh.gs(info.nightscout.core.utils.R.string.key_teenage)) defaultHours = 4 - if (age == rh.gs(info.nightscout.core.utils.R.string.key_child)) defaultHours = 4 - val hoursForDetection = sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, defaultHours) + if (age == rh.gs(app.aaps.core.utils.R.string.key_adult)) defaultHours = 24 + if (age == rh.gs(app.aaps.core.utils.R.string.key_teenage)) defaultHours = 4 + if (age == rh.gs(app.aaps.core.utils.R.string.key_child)) defaultHours = 4 + val hoursForDetection = sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, defaultHours) if (ads.autosensDataTable.size() < 4) { aapsLogger.debug(LTag.AUTOSENS, "No autosens data available. lastDataTime=" + ads.lastDataTime(dateUtil)) return AutosensResult() @@ -159,7 +159,7 @@ class SensitivityWeightedAveragePlugin @Inject constructor( return output } - override fun maxAbsorptionHours(): Double = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) + override fun maxAbsorptionHours(): Double = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) override val isMinCarbsAbsorptionDynamic: Boolean = true override val isOref1: Boolean = false @@ -169,10 +169,10 @@ class SensitivityWeightedAveragePlugin @Inject constructor( override fun configuration(): JSONObject { val c = JSONObject() try { - c.put(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime), sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, 24)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)) - c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime), sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, 24)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)) + c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)) } catch (e: JSONException) { e.printStackTrace() } @@ -181,23 +181,23 @@ class SensitivityWeightedAveragePlugin @Inject constructor( override fun applyConfiguration(configuration: JSONObject) { try { - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime))) sp.putDouble( - info.nightscout.core.utils.R.string.key_absorption_maxtime, configuration.getDouble( - rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime) + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime))) sp.putDouble( + app.aaps.core.utils.R.string.key_absorption_maxtime, configuration.getDouble( + rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime) ) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_period, - configuration.getDouble(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period)) + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_period, + configuration.getDouble(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period)) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble( - rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max) + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble( + rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max) ) ) - if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble( - info.nightscout.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble( - rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min) + if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble( + app.aaps.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble( + rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min) ) ) } catch (e: JSONException) { diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt index 837ea457f2..4051ca563f 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt @@ -84,7 +84,7 @@ class NsIncomingDataProcessor @Inject constructor( @Suppress("SpellCheckingInspection") fun processSgvs(sgvs: Any) { - if (!nsClientSource.isEnabled() && !sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false)) return + if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return var latestDateInReceivedData: Long = 0 aapsLogger.debug(LTag.NSCLIENT, "Received NS Data: $sgvs") @@ -123,15 +123,15 @@ class NsIncomingDataProcessor @Inject constructor( when (treatment) { is NSBolus -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) storeDataForDb.boluses.add(treatment.toBolus()) is NSCarbs -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) storeDataForDb.carbs.add(treatment.toCarbs()) is NSTemporaryTarget -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) { if (treatment.duration > 0L) { // not ending event if (treatment.targetBottomAsMgdl() < Constants.MIN_TT_MGDL @@ -152,14 +152,14 @@ class NsIncomingDataProcessor @Inject constructor( storeDataForDb.temporaryBasals.add(treatment.toTemporaryBasal()) is NSEffectiveProfileSwitch -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { treatment.toEffectiveProfileSwitch(dateUtil)?.let { effectiveProfileSwitch -> storeDataForDb.effectiveProfileSwitches.add(effectiveProfileSwitch) } } is NSProfileSwitch -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { treatment.toProfileSwitch(activePlugin, dateUtil)?.let { profileSwitch -> storeDataForDb.profileSwitches.add(profileSwitch) } @@ -171,13 +171,13 @@ class NsIncomingDataProcessor @Inject constructor( } is NSTherapyEvent -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) treatment.toTherapyEvent().let { therapyEvent -> storeDataForDb.therapyEvents.add(therapyEvent) } is NSOfflineEvent -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) treatment.toOfflineEvent().let { offlineEvent -> storeDataForDb.offlineEvents.add(offlineEvent) } @@ -237,10 +237,10 @@ class NsIncomingDataProcessor @Inject constructor( } fun processProfile(profileJson: JSONObject) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) { val store = instantiator.provideProfileStore(profileJson) val createdAt = store.getStartDate() - val lastLocalChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0) + val lastLocalChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0) aapsLogger.debug(LTag.PROFILE, "Received profileStore: createdAt: $createdAt Local last modification: $lastLocalChange") if (createdAt > lastLocalChange || createdAt % 1000 == 0L) { // whole second means edited in NS profileSource.loadFromStore(store) diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/StoreDataForDbImpl.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/StoreDataForDbImpl.kt index 2cb0faafbc..4336aea51d 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/StoreDataForDbImpl.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/StoreDataForDbImpl.kt @@ -555,13 +555,13 @@ class StoreDataForDbImpl @Inject constructor( sendLog("BolusCalculatorResult", BolusCalculatorResult::class.java.simpleName) SystemClock.sleep(pause) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) therapyEvents.filter { it.type == TherapyEvent.Type.ANNOUNCEMENT }.forEach { if (it.timestamp > dateUtil.now() - 15 * 60 * 1000L && it.note?.isNotEmpty() == true && it.enteredBy != sp.getString("careportal_enteredby", "AndroidAPS") ) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, config.NSCLIENT)) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, config.NSCLIENT)) uiInteraction.addNotificationValidFor(Notification.NS_ANNOUNCEMENT, it.note ?: "", Notification.ANNOUNCEMENT, 60) } } @@ -977,7 +977,7 @@ class StoreDataForDbImpl @Inject constructor( override fun updateDeletedTreatmentsInDb() { deleteTreatment.forEach { id -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) repository.findBolusByNSId(id)?.let { bolus -> repository.runTransactionForResult(InvalidateBolusTransaction(bolus.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating Bolus", it) } @@ -989,7 +989,7 @@ class StoreDataForDbImpl @Inject constructor( } } } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) repository.findCarbsByNSId(id)?.let { carb -> repository.runTransactionForResult(InvalidateCarbsTransaction(carb.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating Carbs", it) } @@ -1001,7 +1001,7 @@ class StoreDataForDbImpl @Inject constructor( } } } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) repository.findTemporaryTargetByNSId(id)?.let { gv -> repository.runTransactionForResult(InvalidateTemporaryTargetTransaction(gv.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating TemporaryTarget", it) } @@ -1025,7 +1025,7 @@ class StoreDataForDbImpl @Inject constructor( } } } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) repository.findEffectiveProfileSwitchByNSId(id)?.let { gv -> repository.runTransactionForResult(InvalidateEffectiveProfileSwitchTransaction(gv.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating EffectiveProfileSwitch", it) } @@ -1037,7 +1037,7 @@ class StoreDataForDbImpl @Inject constructor( } } } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) repository.findProfileSwitchByNSId(id)?.let { gv -> repository.runTransactionForResult(InvalidateProfileSwitchTransaction(gv.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating ProfileSwitch", it) } @@ -1060,7 +1060,7 @@ class StoreDataForDbImpl @Inject constructor( } } } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) repository.findTherapyEventByNSId(id)?.let { gv -> repository.runTransactionForResult(InvalidateTherapyEventTransaction(gv.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating TherapyEvent", it) } @@ -1072,7 +1072,7 @@ class StoreDataForDbImpl @Inject constructor( } } } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) repository.findOfflineEventByNSId(id)?.let { gv -> repository.runTransactionForResult(InvalidateOfflineEventTransaction(gv.id)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating OfflineEvent", it) } diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/DataSyncSelectorV1.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/DataSyncSelectorV1.kt index 2107b405ff..cffb698099 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/DataSyncSelectorV1.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/DataSyncSelectorV1.kt @@ -76,7 +76,7 @@ class DataSyncSelectorV1 @Inject constructor( private var running = false private val sync = Any() - private val bgUploadEnabled get() = sp.getBoolean(info.nightscout.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource + private val bgUploadEnabled get() = sp.getBoolean(app.aaps.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource override suspend fun doUpload() { synchronized(sync) { @@ -782,7 +782,7 @@ class DataSyncSelectorV1 @Inject constructor( private suspend fun processChangedProfileStore() { if (isPaused) return val lastSync = sp.getLong(R.string.key_ns_profile_store_last_synced_timestamp, 0) - val lastChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0) + val lastChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0) if (lastChange == 0L) return if (lastChange > lastSync) { if (activePlugin.activeProfileSource.profile?.allProfilesValid != true) return diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/NSClientPlugin.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/NSClientPlugin.kt index bd14432a61..0665033ea2 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/NSClientPlugin.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/NSClientPlugin.kt @@ -124,8 +124,8 @@ class NSClientPlugin @Inject constructor( if (config.NSCLIENT) { preferenceFragment.findPreference(rh.gs(R.string.ns_sync_options))?.isVisible = false - preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false - preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false + preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false + preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false } preferenceFragment.findPreference(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode() } diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt index eeb3dea744..9488c200ad 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt @@ -83,7 +83,7 @@ class NSDeviceStatusHandler @Inject constructor( updateDeviceData(nsDeviceStatus) updateOpenApsData(nsDeviceStatus) updateUploaderData(nsDeviceStatus) - nsDeviceStatus.pump?.let { sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } // Objective 0 + nsDeviceStatus.pump?.let { sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } // Objective 0 if (config.NSCLIENT && !configurationDetected) nsDeviceStatus.configuration?.let { // copy configuration of Insulin and Sensitivity from main AAPS diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt index ec08c0c1e4..e33cefe62e 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt @@ -238,14 +238,14 @@ class NSSettingsStatusImpl @Inject constructor( override fun copyStatusLightsNsSettings(context: Context?) { val action = Runnable { - getExtendedWarnValue("cage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_warning, it) } - getExtendedWarnValue("cage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_critical, it) } - getExtendedWarnValue("iage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_warning, it) } - getExtendedWarnValue("iage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_critical, it) } - getExtendedWarnValue("sage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_warning, it) } - getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_critical, it) } - getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_warning, it) } - getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_critical, it) } + getExtendedWarnValue("cage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_warning, it) } + getExtendedWarnValue("cage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_critical, it) } + getExtendedWarnValue("iage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_warning, it) } + getExtendedWarnValue("iage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_critical, it) } + getExtendedWarnValue("sage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_warning, it) } + getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_critical, it) } + getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_warning, it) } + getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_critical, it) } uel.log(Action.NS_SETTINGS_COPIED, UserEntry.Sources.NSClient) } diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/ProcessedDeviceStatusDataImpl.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/ProcessedDeviceStatusDataImpl.kt index 2fea300f15..0e6f497d42 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/ProcessedDeviceStatusDataImpl.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/ProcessedDeviceStatusDataImpl.kt @@ -101,10 +101,10 @@ class ProcessedDeviceStatusDataImpl @Inject constructor( // test warning level val level = when { - openAPSData.clockSuggested + T.mins(sp.getLong(info.nightscout.core.utils.R.string.key_ns_alarm_urgent_stale_data_value, 31)) + openAPSData.clockSuggested + T.mins(sp.getLong(app.aaps.core.utils.R.string.key_ns_alarm_urgent_stale_data_value, 31)) .msecs() < dateUtil.now() -> ProcessedDeviceStatusData.Levels.URGENT - openAPSData.clockSuggested + T.mins(sp.getLong(info.nightscout.core.utils.R.string.key_ns_alarm_stale_data_value, 16)).msecs() < dateUtil.now() -> ProcessedDeviceStatusData.Levels.WARN + openAPSData.clockSuggested + T.mins(sp.getLong(app.aaps.core.utils.R.string.key_ns_alarm_stale_data_value, 16)).msecs() < dateUtil.now() -> ProcessedDeviceStatusData.Levels.WARN else -> ProcessedDeviceStatusData.Levels.INFO } string.append("") diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt index eba0405a56..7aa3e013c1 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt @@ -137,8 +137,8 @@ import javax.inject.Inject .toObservable(EventPreferenceChange::class.java) .observeOn(aapsSchedulers.io) .subscribe({ event: EventPreferenceChange -> - if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_url)) || - event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_api_secret)) || + if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_nsclientinternal_url)) || + event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_nsclientinternal_api_secret)) || event.isChanged(rh.gs(R.string.key_ns_paused)) ) { latestDateInReceivedData = 0 @@ -360,8 +360,8 @@ import javax.inject.Inject private fun readPreferences() { nsEnabled = nsClientPlugin.isEnabled() - nsURL = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "") - nsAPISecret = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_api_secret, "") + nsURL = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "") + nsAPISecret = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_api_secret, "") nsDevice = sp.getString("careportal_enteredby", "") } @@ -557,7 +557,7 @@ import javax.inject.Inject if (sgvs.length() > 0) { rxBus.send(EventNSClientNewLog("◄ DATA", "received " + sgvs.length() + " sgvs")) // Objective0 - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) nsIncomingDataProcessor.processSgvs(sgvs) storeDataForDb.storeGlucoseValuesToDb() } @@ -635,7 +635,7 @@ import javax.inject.Inject private fun handleAnnouncement(announcement: JSONObject) { val defaultVal = config.NSCLIENT - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, defaultVal)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, defaultVal)) { val nsAlarm = NSAlarmObject(announcement) uiInteraction.addNotificationWithAction(injector, nsAlarm) rxBus.send(EventNSClientNewLog("◄ ANNOUNCEMENT", safeGetString(announcement, "message", "received"))) @@ -645,8 +645,8 @@ import javax.inject.Inject private fun handleAlarm(alarm: JSONObject) { val defaultVal = config.NSCLIENT - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, defaultVal)) { - val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, defaultVal)) { + val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L) if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) { val nsAlarm = NSAlarmObject(alarm) uiInteraction.addNotificationWithAction(injector, nsAlarm) @@ -658,8 +658,8 @@ import javax.inject.Inject private fun handleUrgentAlarm(alarm: JSONObject) { val defaultVal = config.NSCLIENT - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, defaultVal)) { - val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, defaultVal)) { + val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L) if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) { val nsAlarm = NSAlarmObject(alarm) uiInteraction.addNotificationWithAction(injector, nsAlarm) diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt index 7196b90303..c2905fae53 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt @@ -72,14 +72,14 @@ class NSClientAddUpdateWorker( if (mills > latestDateInReceivedData) latestDateInReceivedData = mills if (insulin > 0) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) { Bolus.fromJson(json)?.let { bolus -> storeDataForDb.boluses.add(bolus) } ?: aapsLogger.error("Error parsing bolus json $json") } } if (carbs > 0) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) { Carbs.fromJson(json)?.let { carb -> storeDataForDb.carbs.add(carb) } ?: aapsLogger.error("Error parsing bolus json $json") @@ -99,14 +99,14 @@ class NSClientAddUpdateWorker( when { insulin > 0 || carbs > 0 -> Any() eventType == TherapyEvent.Type.TEMPORARY_TARGET.text -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) { TemporaryTarget.fromJson(json, profileUtil)?.let { temporaryTarget -> storeDataForDb.temporaryTargets.add(temporaryTarget) } ?: aapsLogger.error("Error parsing TT json $json") } eventType == TherapyEvent.Type.NOTE.text && json.isEffectiveProfileSwitch() -> // replace this by new Type when available in NS - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { EffectiveProfileSwitch.fromJson(json, dateUtil)?.let { effectiveProfileSwitch -> storeDataForDb.effectiveProfileSwitches.add(effectiveProfileSwitch) } ?: aapsLogger.error("Error parsing EffectiveProfileSwitch json $json") @@ -127,7 +127,7 @@ class NSClientAddUpdateWorker( eventType == TherapyEvent.Type.EXERCISE.text || eventType == TherapyEvent.Type.NOTE.text || eventType == TherapyEvent.Type.PUMP_BATTERY_CHANGE.text -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) { TherapyEvent.fromJson(json)?.let { therapyEvent -> storeDataForDb.therapyEvents.add(therapyEvent) } ?: aapsLogger.error("Error parsing TherapyEvent json $json") @@ -148,14 +148,14 @@ class NSClientAddUpdateWorker( } eventType == TherapyEvent.Type.PROFILE_SWITCH.text -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { ProfileSwitch.fromJson(json, dateUtil, activePlugin)?.let { profileSwitch -> storeDataForDb.profileSwitches.add(profileSwitch) } ?: aapsLogger.error("Error parsing ProfileSwitch json $json") } eventType == TherapyEvent.Type.APS_OFFLINE.text -> - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) { OfflineEvent.fromJson(json)?.let { offlineEvent -> storeDataForDb.offlineEvents.add(offlineEvent) } ?: aapsLogger.error("Error parsing OfflineEvent json $json") diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientMbgWorker.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientMbgWorker.kt index 33fdf30918..ba1f812327 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientMbgWorker.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/workers/NSClientMbgWorker.kt @@ -26,7 +26,7 @@ class NSClientMbgWorker( override suspend fun doWorkAndLog(): Result { val ret = Result.success() - val acceptNSData = sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT + val acceptNSData = sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT if (!acceptNSData) return Result.success(workDataOf("Result" to "Sync not enabled")) val mbgArray = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1)) diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/DataSyncSelectorV3.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/DataSyncSelectorV3.kt index 4a6cd8e599..399f93a67e 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/DataSyncSelectorV3.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/DataSyncSelectorV3.kt @@ -71,7 +71,7 @@ class DataSyncSelectorV3 @Inject constructor( override fun queueSize(): Long = queueCounter.size() - private val bgUploadEnabled get() = sp.getBoolean(info.nightscout.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource + private val bgUploadEnabled get() = sp.getBoolean(app.aaps.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource override suspend fun doUpload() { rxBus.send(EventNSClientUpdateGuiStatus()) @@ -675,7 +675,7 @@ class DataSyncSelectorV3 @Inject constructor( private suspend fun processChangedProfileStore() { if (isPaused) return val lastSync = sp.getLong(R.string.key_ns_profile_store_last_synced_timestamp, 0) - val lastChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0) + val lastChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0) if (lastChange == 0L) return if (lastChange > lastSync) { if (activePlugin.activeProfileSource.profile?.allProfilesValid != true) return diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/NSClientV3Plugin.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/NSClientV3Plugin.kt index e86004cb1e..ae351b9260 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/NSClientV3Plugin.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/NSClientV3Plugin.kt @@ -158,8 +158,8 @@ class NSClientV3Plugin @Inject constructor( when { sp.getBoolean(R.string.key_ns_paused, false) -> rh.gs(app.aaps.core.ui.R.string.paused) isAllowed.not() -> blockingReason - sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && wsConnected -> "WS: " + rh.gs(app.aaps.core.interfaces.R.string.connected) - sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && !wsConnected -> "WS: " + rh.gs(R.string.not_connected) + sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && wsConnected -> "WS: " + rh.gs(app.aaps.core.interfaces.R.string.connected) + sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && !wsConnected -> "WS: " + rh.gs(R.string.not_connected) lastOperationError != null -> rh.gs(app.aaps.core.ui.R.string.error) nsAndroidClient?.lastStatus == null -> rh.gs(R.string.not_connected) workIsRunning() -> rh.gs(R.string.working) @@ -206,14 +206,14 @@ class NSClientV3Plugin @Inject constructor( .observeOn(aapsSchedulers.io) .subscribe({ ev -> if (ev.isChanged(rh.gs(R.string.key_ns_client_token)) || - ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_url)) || - ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_ns_use_ws)) || + ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_nsclientinternal_url)) || + ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_ns_use_ws)) || ev.isChanged(rh.gs(R.string.key_ns_paused)) || - ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_ns_alarms)) || - ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_ns_announcements)) + ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_ns_alarms)) || + ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_ns_announcements)) ) setClient("SETTING CHANGE") - if (ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_local_profile_last_change))) + if (ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_local_profile_last_change))) executeUpload("PROFILE_CHANGE", forceNew = true) }, fabricPrivacy::logException) @@ -268,7 +268,7 @@ class NSClientV3Plugin @Inject constructor( } } } - if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true)) + if (!sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true)) executeLoop("MAIN_LOOP", forceNew = true) else rxBus.send(EventNSClientNewLog("● TICK", "")) @@ -311,8 +311,8 @@ class NSClientV3Plugin @Inject constructor( if (config.NSCLIENT) { preferenceFragment.findPreference(rh.gs(R.string.ns_sync_options))?.isVisible = false - preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false - preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false + preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false + preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false } preferenceFragment.findPreference(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode() } @@ -332,7 +332,7 @@ class NSClientV3Plugin @Inject constructor( private fun setClient(reason: String) { nsAndroidClient = NSAndroidClientImpl( - baseUrl = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace("https://", "").replace(Regex("/$"), ""), + baseUrl = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace("https://", "").replace(Regex("/$"), ""), accessToken = sp.getString(R.string.key_ns_client_token, ""), context = context, logging = true, @@ -357,10 +357,10 @@ class NSClientV3Plugin @Inject constructor( var wsConnected = false internal var initialLoadFinished = false private fun initializeWebSockets(reason: String) { - if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true)) return - if (sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").isEmpty()) return - val urlStorage = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/storage" - val urlAlarm = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/alarm" + if (!sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true)) return + if (sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").isEmpty()) return + val urlStorage = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/storage" + val urlAlarm = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/alarm" if (!isAllowed) { rxBus.send(EventNSClientNewLog("● WS", blockingReason)) } else if (sp.getBoolean(R.string.key_ns_paused, false)) { @@ -377,8 +377,8 @@ class NSClientV3Plugin @Inject constructor( socket.on("update", onDataCreateUpdate) socket.on("delete", onDataDelete) } - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, config.NSCLIENT) || - sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, config.NSCLIENT) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, config.NSCLIENT) || + sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, config.NSCLIENT) ) alarmSocket = IO.socket(urlAlarm).also { socket -> socket.on(Socket.EVENT_CONNECT, onConnectAlarms) @@ -525,7 +525,7 @@ class NSClientV3Plugin @Inject constructor( val data = args[0] as JSONObject rxBus.send(EventNSClientNewLog("◄ ANNOUNCEMENT", data.optString("message"))) aapsLogger.debug(LTag.NSCLIENT, data.toString()) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, config.NSCLIENT)) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, config.NSCLIENT)) uiInteraction.addNotificationWithAction(injector, NSAlarmObject(data)) } private val onAlarm = Emitter.Listener { args -> @@ -546,8 +546,8 @@ class NSClientV3Plugin @Inject constructor( val data = args[0] as JSONObject rxBus.send(EventNSClientNewLog("◄ ALARM", data.optString("message"))) aapsLogger.debug(LTag.NSCLIENT, data.toString()) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) { - val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) { + val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L) if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) uiInteraction.addNotificationWithAction(injector, NSAlarmObject(data)) } @@ -557,8 +557,8 @@ class NSClientV3Plugin @Inject constructor( val data = args[0] as JSONObject rxBus.send(EventNSClientNewLog("◄ URGENT ALARM", data.optString("message"))) aapsLogger.debug(LTag.NSCLIENT, data.toString()) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) { - val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) { + val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L) if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) uiInteraction.addNotificationWithAction(injector, NSAlarmObject(data)) } @@ -599,7 +599,7 @@ class NSClientV3Plugin @Inject constructor( // If WS is enabled, download is triggered by changes in NS. Thus uploadOnly // Exception is after reset to full sync (initialLoadFinished == false), where // older data must be loaded directly and then continue over WS - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished) executeUpload("START $reason", forceNew = true) else executeLoop("START $reason", forceNew = true) @@ -612,7 +612,7 @@ class NSClientV3Plugin @Inject constructor( override fun detectedNsVersion(): String? = nsAndroidClient?.lastStatus?.version - override val address: String get() = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "") + override val address: String get() = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "") override fun isFirstLoad(collection: NsClient.Collection) = when (collection) { @@ -695,7 +695,7 @@ class NSClientV3Plugin @Inject constructor( result.identifier?.let { dataPair.value.interfaceIDs.nightscoutId = it storeDataForDb.nsIdDeviceStatuses.add(dataPair.value) - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } } } catch (e: Exception) { @@ -931,7 +931,7 @@ class NSClientV3Plugin @Inject constructor( } private fun executeLoop(origin: String, forceNew: Boolean) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished) return + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished) return if (sp.getBoolean(R.string.key_ns_paused, false)) { rxBus.send(EventNSClientNewLog("● RUN", "paused $origin")) return diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt index e462bdbe15..e2bbe80482 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt @@ -34,7 +34,7 @@ class LoadBgWorker( @Inject lateinit var storeDataForDb: StoreDataForDb override suspend fun doWorkAndLog(): Result { - if (!nsClientSource.isEnabled() && !sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false)) + if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return Result.success(workDataOf("Result" to "Load not enabled")) val nsAndroidClient = nsClientV3Plugin.nsAndroidClient ?: return Result.failure(workDataOf("Error" to "AndroidClient is null")) @@ -62,7 +62,7 @@ class LoadBgWorker( val action = if (isFirstLoad) "RCV-F" else "RCV" rxBus.send(EventNSClientNewLog("◄ $action", "${sgvs.size} SVGs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}")) // Objective0 - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) // Schedule processing of fetched data and continue of loading continueLoading = response.code != 304 nsIncomingDataProcessor.processSgvs(sgvs) diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt index ecc0cd2a59..315a5e9957 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt @@ -61,7 +61,7 @@ class DataSyncSelectorXdripImpl @Inject constructor( } private val queueCounter = QueueCounter() - private val isEnabled get() = sp.getBoolean(info.nightscout.core.utils.R.string.key_xdrip_local_broadcasts, false) + private val isEnabled get() = sp.getBoolean(app.aaps.core.utils.R.string.key_xdrip_local_broadcasts, false) private val xdripPlugin get() = xdripBroadcast.get() private val maxAge get() = T.days(1).msecs() @@ -538,7 +538,7 @@ class DataSyncSelectorXdripImpl @Inject constructor( private fun processChangedProfileStore() { if (!isEnabled) return val lastSync = sp.getLong(R.string.key_xdrip_profile_store_last_synced_timestamp, 0) - val lastChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0) + val lastChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0) if (lastChange == 0L) return if (lastChange > lastSync) { if (activePlugin.activeProfileSource.profile?.allProfilesValid != true) return diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/XdripPlugin.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/XdripPlugin.kt index 9e02360d10..745f56e77f 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/XdripPlugin.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/XdripPlugin.kt @@ -288,7 +288,7 @@ class XdripPlugin @Inject constructor( // sent in 640G mode // com.eveningoutpost.dexdrip.NSEmulatorReceiver override fun sendIn640gMode(glucoseValue: GlucoseValue) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_dexcomg5_xdripupload, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_dexcomg5_xdripupload, false)) { val format = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US) try { val entriesBody = JSONArray() diff --git a/plugins/sync/src/test/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt b/plugins/sync/src/test/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt index 6883fa2b1d..0517d119bc 100644 --- a/plugins/sync/src/test/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt +++ b/plugins/sync/src/test/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt @@ -22,7 +22,6 @@ import app.aaps.core.nssdk.remotemodel.LastModified import app.aaps.core.utils.receivers.DataWorkerStorage import app.aaps.database.entities.GlucoseValue import app.aaps.database.entities.embedments.InterfaceIDs -import app.aaps.database.impl.AppRepository import app.aaps.implementation.utils.DecimalFormatterImpl import app.aaps.plugins.sync.nsShared.NsIncomingDataProcessor import app.aaps.plugins.sync.nsclient.ReceiverDelegate @@ -120,7 +119,7 @@ internal class LoadBgWorkerTest : TestBase() { fun notEnabledNSClientSource() = runTest { sut = TestListenableWorkerBuilder(context).build() Mockito.`when`(nsClientSource.isEnabled()).thenReturn(false) - Mockito.`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false)).thenReturn(false) + Mockito.`when`(sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)).thenReturn(false) val result = sut.doWorkAndLog() assertIs(result) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index 3ccd7348b3..3676a77d3e 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -82,7 +82,7 @@ class DanaRKoreanPlugin @Inject constructor( init { pluginDescription.description(info.nightscout.pump.dana.R.string.description_pump_dana_r_korean) - useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false) + useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false) pumpDescription.fillFor(PumpType.DANA_R_KOREAN) } @@ -94,7 +94,7 @@ class DanaRKoreanPlugin @Inject constructor( .subscribe({ if (isEnabled()) { val previousValue = useExtendedBoluses - useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false) + useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false) if (useExtendedBoluses != previousValue && pumpSync.expectedPumpState().extendedBolus != null) { sExecutionService.extendedBolusStop() } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 6740bef327..9463c6c121 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -87,7 +87,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { this.rh = rh; this.fabricPrivacy = fabricPrivacy; - useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false); + useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false); pumpDescription.fillFor(PumpType.DANA_R); } @@ -101,7 +101,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { .subscribe(event -> { if (isEnabled()) { boolean previousValue = useExtendedBoluses; - useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false); + useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false); if (useExtendedBoluses != previousValue && pumpSync.expectedPumpState().getExtendedBolus() != null) { sExecutionService.extendedBolusStop(); diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 31266c0a8c..4e3dea8f8a 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -767,7 +767,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun getPumpUnreachableTimeout(): Duration { return Duration.ofMinutes( sp.getInt( - info.nightscout.core.utils.R.string.key_pump_unreachable_threshold_minutes, + app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES ).toLong() ) diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt index 6f0ffd5450..e7762f64b3 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt @@ -703,7 +703,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() { // FIXME ideally we should just have access to LocalAlertUtils here private fun getPumpUnreachableTimeout(): Duration { - return Duration.standardMinutes(sp.getInt(info.nightscout.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong()) + return Duration.standardMinutes(sp.getInt(app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong()) } inner class DisplayResultDialogCallback(private val errorMessagePrefix: String, private val withSoundOnError: Boolean) : Callback() { diff --git a/pump/virtual/src/main/kotlin/app/aaps/pump/virtual/VirtualPumpPlugin.kt b/pump/virtual/src/main/kotlin/app/aaps/pump/virtual/VirtualPumpPlugin.kt index 42984a8397..48d9eff923 100644 --- a/pump/virtual/src/main/kotlin/app/aaps/pump/virtual/VirtualPumpPlugin.kt +++ b/pump/virtual/src/main/kotlin/app/aaps/pump/virtual/VirtualPumpPlugin.kt @@ -116,7 +116,7 @@ open class VirtualPumpPlugin @Inject constructor( disposable += rxBus .toObservable(EventPreferenceChange::class.java) .observeOn(aapsSchedulers.io) - .subscribe({ event: EventPreferenceChange -> if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_virtualpump_type))) refreshConfiguration() }, fabricPrivacy::logException) + .subscribe({ event: EventPreferenceChange -> if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_virtualpump_type))) refreshConfiguration() }, fabricPrivacy::logException) refreshConfiguration() } @@ -127,7 +127,7 @@ open class VirtualPumpPlugin @Inject constructor( override fun preprocessPreferences(preferenceFragment: PreferenceFragmentCompat) { super.preprocessPreferences(preferenceFragment) - val uploadStatus = preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status)) as SwitchPreference? + val uploadStatus = preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_virtual_pump_upload_status)) as SwitchPreference? ?: return uploadStatus.isVisible = !config.NSCLIENT } @@ -341,7 +341,7 @@ open class VirtualPumpPlugin @Inject constructor( override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject { val now = System.currentTimeMillis() - if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false)) { + if (!sp.getBoolean(app.aaps.core.utils.R.string.key_virtual_pump_upload_status, false)) { return JSONObject() } val pump = JSONObject() @@ -391,7 +391,7 @@ open class VirtualPumpPlugin @Inject constructor( override fun canHandleDST(): Boolean = true fun refreshConfiguration() { - val pumpType = sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, PumpType.GENERIC_AAPS.description) + val pumpType = sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, PumpType.GENERIC_AAPS.description) val pumpTypeNew = PumpType.getByDescription(pumpType) aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew") if (this.pumpType == pumpTypeNew) return diff --git a/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt b/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt index 81fb050616..ce9dad23db 100644 --- a/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt +++ b/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt @@ -47,16 +47,16 @@ class VirtualPumpPluginUTest : TestBase() { @Test fun refreshConfiguration() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") + `when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") virtualPumpPlugin.refreshConfiguration() Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType) } @Test fun refreshConfigurationTwice() { - `when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") + `when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") virtualPumpPlugin.refreshConfiguration() - `when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") + `when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") virtualPumpPlugin.refreshConfiguration() Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType) } diff --git a/shared/tests/src/main/kotlin/app/aaps/shared/tests/HardLimitsMock.kt b/shared/tests/src/main/kotlin/app/aaps/shared/tests/HardLimitsMock.kt index 1222891de4..2ee29ca488 100644 --- a/shared/tests/src/main/kotlin/app/aaps/shared/tests/HardLimitsMock.kt +++ b/shared/tests/src/main/kotlin/app/aaps/shared/tests/HardLimitsMock.kt @@ -47,12 +47,12 @@ import kotlin.math.min } - private fun loadAge(): Int = when (sp.getString(info.nightscout.core.utils.R.string.key_age, "")) { - rh.gs(info.nightscout.core.utils.R.string.key_child) -> CHILD - rh.gs(info.nightscout.core.utils.R.string.key_teenage) -> TEENAGE - rh.gs(info.nightscout.core.utils.R.string.key_adult) -> ADULT - rh.gs(info.nightscout.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT - rh.gs(info.nightscout.core.utils.R.string.key_pregnant) -> PREGNANT + private fun loadAge(): Int = when (sp.getString(app.aaps.core.utils.R.string.key_age, "")) { + rh.gs(app.aaps.core.utils.R.string.key_child) -> CHILD + rh.gs(app.aaps.core.utils.R.string.key_teenage) -> TEENAGE + rh.gs(app.aaps.core.utils.R.string.key_adult) -> ADULT + rh.gs(app.aaps.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT + rh.gs(app.aaps.core.utils.R.string.key_pregnant) -> PREGNANT else -> ADULT } diff --git a/shared/tests/src/main/kotlin/app/aaps/shared/tests/TestBaseWithProfile.kt b/shared/tests/src/main/kotlin/app/aaps/shared/tests/TestBaseWithProfile.kt index 7adbd5f31f..3a170fb5f2 100644 --- a/shared/tests/src/main/kotlin/app/aaps/shared/tests/TestBaseWithProfile.kt +++ b/shared/tests/src/main/kotlin/app/aaps/shared/tests/TestBaseWithProfile.kt @@ -87,7 +87,7 @@ open class TestBaseWithProfile : TestBase() { testPumpPlugin = TestPumpPlugin(profileInjector) Mockito.`when`(dateUtil.now()).thenReturn(now) Mockito.`when`(activePlugin.activePump).thenReturn(testPumpPlugin) - Mockito.`when`(sp.getString(info.nightscout.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText)).thenReturn(GlucoseUnit.MGDL.asText) + Mockito.`when`(sp.getString(app.aaps.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText)).thenReturn(GlucoseUnit.MGDL.asText) hardLimits = HardLimitsMock(sp, rh) validProfile = ProfileSealed.Pure(pureProfileFromJson(JSONObject(validProfileJSON), dateUtil)!!) effectiveProfileSwitch = EffectiveProfileSwitch( diff --git a/ui/src/main/kotlin/app/aaps/ui/activities/ErrorHelperActivity.kt b/ui/src/main/kotlin/app/aaps/ui/activities/ErrorHelperActivity.kt index 3df1c0651d..11f3748ecc 100644 --- a/ui/src/main/kotlin/app/aaps/ui/activities/ErrorHelperActivity.kt +++ b/ui/src/main/kotlin/app/aaps/ui/activities/ErrorHelperActivity.kt @@ -28,7 +28,7 @@ class ErrorHelperActivity : TranslatedDaggerAppCompatActivity() { errorDialog.title = intent.getStringExtra(AlarmSoundService.TITLE) ?: "" errorDialog.show(supportFragmentManager, "Error") - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) + if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors, true)) disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(intent.getStringExtra(AlarmSoundService.STATUS) ?: "")).subscribe() } } diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/CarbsDialog.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/CarbsDialog.kt index b9edab17a8..8eab3353cf 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/CarbsDialog.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/CarbsDialog.kt @@ -130,7 +130,7 @@ class CarbsDialog : DialogFragmentWithDate() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_usebolusreminder, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_usebolusreminder, false)) { glucoseStatusProvider.glucoseStatusData?.let { glucoseStatus -> if (glucoseStatus.glucose + 3 * glucoseStatus.delta < 70.0) binding.bolusReminder.visibility = View.VISIBLE @@ -151,36 +151,36 @@ class CarbsDialog : DialogFragmentWithDate() { savedInstanceState?.getDouble("carbs") ?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher ) - val plus1text = toSignedString(sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_1, CARBS_FAV1_DEFAULT)) + val plus1text = toSignedString(sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_1, CARBS_FAV1_DEFAULT)) binding.plus1.text = plus1text binding.plus1.contentDescription = rh.gs(app.aaps.core.ui.R.string.carbs) + " " + plus1text binding.plus1.setOnClickListener { binding.carbs.value = max( 0.0, binding.carbs.value - + sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_1, CARBS_FAV1_DEFAULT) + + sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_1, CARBS_FAV1_DEFAULT) ) validateInputs() binding.carbs.announceValue() } - val plus2text = toSignedString(sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_2, CARBS_FAV2_DEFAULT)) + val plus2text = toSignedString(sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_2, CARBS_FAV2_DEFAULT)) binding.plus2.text = plus2text binding.plus2.contentDescription = rh.gs(app.aaps.core.ui.R.string.carbs) + " " + plus2text binding.plus2.setOnClickListener { binding.carbs.value = max( 0.0, binding.carbs.value - + sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_2, CARBS_FAV2_DEFAULT) + + sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_2, CARBS_FAV2_DEFAULT) ) validateInputs() binding.carbs.announceValue() } - val plus3text = toSignedString(sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_3, CARBS_FAV3_DEFAULT)) + val plus3text = toSignedString(sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_3, CARBS_FAV3_DEFAULT)) binding.plus3.text = plus3text binding.plus2.contentDescription = rh.gs(app.aaps.core.ui.R.string.carbs) + " " + plus3text binding.plus3.setOnClickListener { binding.carbs.value = max( 0.0, binding.carbs.value - + sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_3, CARBS_FAV3_DEFAULT) + + sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_3, CARBS_FAV3_DEFAULT) ) validateInputs() binding.carbs.announceValue() @@ -388,7 +388,7 @@ class CarbsDialog : DialogFragmentWithDate() { automation.removeAutomationEventEatReminder() if (!result.success) { uiInteraction.runAlarm(result.comment, rh.gs(app.aaps.core.ui.R.string.treatmentdeliveryerror), app.aaps.core.ui.R.raw.boluserror) - } else if (sp.getBoolean(info.nightscout.core.utils.R.string.key_usebolusreminder, false) && remindBolus) + } else if (sp.getBoolean(app.aaps.core.utils.R.string.key_usebolusreminder, false) && remindBolus) automation.scheduleAutomationEventBolusReminder() } }) diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/DialogFragmentWithDate.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/DialogFragmentWithDate.kt index 168021894b..4488d8f9df 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/DialogFragmentWithDate.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/DialogFragmentWithDate.kt @@ -117,7 +117,7 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() { } (view.findViewById(app.aaps.core.ui.R.id.notes_layout) as View?)?.visibility = - sp.getBoolean(info.nightscout.core.utils.R.string.key_show_notes_entry_dialogs, false).toVisibility() + sp.getBoolean(app.aaps.core.utils.R.string.key_show_notes_entry_dialogs, false).toVisibility() (view.findViewById(app.aaps.core.ui.R.id.ok) as Button?)?.setOnClickListener { synchronized(okClicked) { diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/EditQuickWizardDialog.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/EditQuickWizardDialog.kt index a0e4578ed8..f047c3c62d 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/EditQuickWizardDialog.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/EditQuickWizardDialog.kt @@ -7,23 +7,23 @@ import android.view.View import android.view.ViewGroup import android.view.Window import android.view.WindowManager -import app.aaps.core.main.wizard.QuickWizard -import app.aaps.core.main.wizard.QuickWizardEntry import app.aaps.core.interfaces.logging.AAPSLogger import app.aaps.core.interfaces.rx.bus.RxBus import app.aaps.core.interfaces.sharedPreferences.SP import app.aaps.core.interfaces.utils.DateUtil import app.aaps.core.interfaces.utils.SafeParse import app.aaps.core.interfaces.utils.T -import com.google.android.material.timepicker.MaterialTimePicker -import com.google.android.material.timepicker.TimeFormat -import dagger.android.support.DaggerDialogFragment +import app.aaps.core.main.wizard.QuickWizard +import app.aaps.core.main.wizard.QuickWizardEntry import app.aaps.core.ui.extensions.selectedItemPosition import app.aaps.core.ui.extensions.setEnableForChildren import app.aaps.core.ui.extensions.setSelection import app.aaps.ui.R import app.aaps.ui.databinding.DialogEditQuickwizardBinding import app.aaps.ui.events.EventQuickWizardChange +import com.google.android.material.timepicker.MaterialTimePicker +import com.google.android.material.timepicker.TimeFormat +import dagger.android.support.DaggerDialogFragment import org.json.JSONException import javax.inject.Inject @@ -61,7 +61,7 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener { position = bundle.getInt("position", -1) } val entry = if (position == -1) quickWizard.newEmptyItem() else quickWizard[position] - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_control, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_wear_control, false)) { binding.deviceLabel.visibility = View.VISIBLE binding.device.visibility = View.VISIBLE } else { diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/LoopDialog.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/LoopDialog.kt index 96fd063b3a..736ea86b43 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/LoopDialog.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/LoopDialog.kt @@ -162,7 +162,7 @@ class LoopDialog : DaggerDialogFragment() { val closedLoopAllowed = constraintChecker.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)) val closedLoopAllowed2 = activePlugin.activeObjectives?.isAccomplished(Objectives.MAXIOB_OBJECTIVE) ?: false val lgsEnabled = constraintChecker.isLgsAllowed(ConstraintObject(true, aapsLogger)) - val apsMode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) + val apsMode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) val pump = activePlugin.activePump binding.overviewDisconnect15m.visibility = pumpDescription.tempDurationStep15mAllowed.toVisibility() @@ -283,21 +283,21 @@ class LoopDialog : DaggerDialogFragment() { when (v.id) { R.id.overview_closeloop -> { uel.log(UserEntry.Action.CLOSED_LOOP_MODE, UserEntry.Sources.LoopDialog) - sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.CLOSED.name) + sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.CLOSED.name) rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.closedloop))) return true } R.id.overview_lgsloop -> { uel.log(UserEntry.Action.LGS_LOOP_MODE, UserEntry.Sources.LoopDialog) - sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.LGS.name) + sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.LGS.name) rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend))) return true } R.id.overview_openloop -> { uel.log(UserEntry.Action.OPEN_LOOP_MODE, UserEntry.Sources.LoopDialog) - sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name) + sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name) rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend))) return true } @@ -356,7 +356,7 @@ class LoopDialog : DaggerDialogFragment() { } } }) - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusereconnect, true) return true } @@ -412,7 +412,7 @@ class LoopDialog : DaggerDialogFragment() { loop.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP) rxBus.send(EventRefreshOverview("suspend_menu")) } - sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, true) + sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusedisconnect, true) return true } diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/ProfileSwitchDialog.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/ProfileSwitchDialog.kt index fcbe571341..b9acfb1899 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/ProfileSwitchDialog.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/ProfileSwitchDialog.kt @@ -214,7 +214,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { ValueWithUnit.Percent(percent), ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 }, ValueWithUnit.Minute(duration).takeIf { duration != 0 }) - if (percent == 90 && duration == 10) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseprofileswitch, true) + if (percent == 90 && duration == 10) sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseprofileswitch, true) if (isTT) { disposable += repository.runTransactionForResult( InsertAndCancelCurrentTemporaryTargetTransaction( diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/TempTargetDialog.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/TempTargetDialog.kt index 91dd6dea87..e3f4c64fd9 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/TempTargetDialog.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/TempTargetDialog.kt @@ -244,7 +244,7 @@ class TempTargetDialog : DialogFragmentWithDate() { }) } - if (duration == 10) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, true) + if (duration == 10) sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusetemptarget, true) }) } return true diff --git a/ui/src/main/kotlin/app/aaps/ui/dialogs/WizardDialog.kt b/ui/src/main/kotlin/app/aaps/ui/dialogs/WizardDialog.kt index a9b36c150f..cb66b906b9 100644 --- a/ui/src/main/kotlin/app/aaps/ui/dialogs/WizardDialog.kt +++ b/ui/src/main/kotlin/app/aaps/ui/dialogs/WizardDialog.kt @@ -150,10 +150,10 @@ class WizardDialog : DaggerDialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { loadCheckedStates() processCobCheckBox() - val useSuperBolus = sp.getBoolean(info.nightscout.core.utils.R.string.key_usesuperbolus, false) + val useSuperBolus = sp.getBoolean(app.aaps.core.utils.R.string.key_usesuperbolus, false) binding.sbCheckbox.visibility = useSuperBolus.toVisibility() binding.superBolusRow.visibility = useSuperBolus.toVisibility() - binding.notesLayout.root.visibility = sp.getBoolean(info.nightscout.core.utils.R.string.key_show_notes_entry_dialogs, false).toVisibility() + binding.notesLayout.root.visibility = sp.getBoolean(app.aaps.core.utils.R.string.key_show_notes_entry_dialogs, false).toVisibility() val maxCarbs = constraintChecker.getMaxCarbsAllowed().value() val maxCorrection = constraintChecker.getMaxBolusAllowed().value() @@ -177,8 +177,8 @@ class WizardDialog : DaggerDialogFragment() { // If there is no BG using % lower that 100% leads to high BGs // because loop doesn't add missing insulin - var percentage = sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100).toDouble() - val time = sp.getLong(info.nightscout.core.utils.R.string.key_reset_boluswizard_percentage_time, 16) + var percentage = sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100).toDouble() + val time = sp.getLong(app.aaps.core.utils.R.string.key_reset_boluswizard_percentage_time, 16) repository.getLastGlucoseValueWrapped().blockingGet().let { // if last value is older or there is no bg if (it is ValueWrapper.Existing) { @@ -211,9 +211,9 @@ class WizardDialog : DaggerDialogFragment() { ?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, timeTextWatcher ) handler.post { initDialog() } - calculatedPercentage = sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100).toDouble() - binding.percentUsed.text = rh.gs(app.aaps.core.ui.R.string.format_percent, sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100)) - binding.percentUsed.visibility = (sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100) != 100 || usePercentage).toVisibility() + calculatedPercentage = sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100).toDouble() + binding.percentUsed.text = rh.gs(app.aaps.core.ui.R.string.format_percent, sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100)) + binding.percentUsed.visibility = (sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100) != 100 || usePercentage).toVisibility() // ok button binding.okcancel.ok.setOnClickListener { if (okClicked) { @@ -443,7 +443,7 @@ class WizardDialog : DaggerDialogFragment() { else SafeParse.stringToDouble(binding.correctionInput.text) } else - sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100).toDouble() + sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100).toDouble() val carbsAfterConstraint = constraintChecker.applyCarbsConstraints(ConstraintObject(carbs, aapsLogger)).value() if (abs(carbs - carbsAfterConstraint) > 0.01) { binding.carbsInput.value = 0.0 @@ -465,7 +465,7 @@ class WizardDialog : DaggerDialogFragment() { val carbTime = SafeParse.stringToInt(binding.carbTimeInput.text) wizard = BolusWizard(injector).doCalc( - specificProfile, profileName, tempTarget, carbsAfterConstraint, cob, bg, correction, sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100), + specificProfile, profileName, tempTarget, carbsAfterConstraint, cob, bg, correction, sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100), binding.bgCheckbox.isChecked, binding.cobCheckbox.isChecked, binding.iobCheckbox.isChecked, diff --git a/ui/src/main/kotlin/app/aaps/ui/services/AlarmSoundService.kt b/ui/src/main/kotlin/app/aaps/ui/services/AlarmSoundService.kt index d853d6cc52..e78a245a57 100644 --- a/ui/src/main/kotlin/app/aaps/ui/services/AlarmSoundService.kt +++ b/ui/src/main/kotlin/app/aaps/ui/services/AlarmSoundService.kt @@ -82,7 +82,7 @@ class AlarmSoundService : DaggerService() { player?.isLooping = true val audioManager = getAudioManager() if (!audioManager.isMusicActive) { - if (sp.getBoolean(info.nightscout.core.utils.R.string.key_gradually_increase_notification_volume, false)) { + if (sp.getBoolean(app.aaps.core.utils.R.string.key_gradually_increase_notification_volume, false)) { currentVolumeLevel = 0 player?.setVolume(0f, 0f) increaseVolumeHandler.postDelayed(volumeUpdater, VOLUME_INCREASE_INITIAL_SILENT_TIME_MILLIS) diff --git a/workflow/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt b/workflow/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt index 2faba8d77b..2bdf8c14df 100644 --- a/workflow/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt +++ b/workflow/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt @@ -77,11 +77,11 @@ class CalculationWorkflowImpl @Inject constructor( .toObservable(EventPreferenceChange::class.java) .observeOn(aapsSchedulers.io) .subscribe({ event -> - if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_units))) { + if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_units))) { overviewData.reset() rxBus.send(EventNewHistoryData(0, false)) } - if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_rangetodisplay))) { + if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_rangetodisplay))) { overviewData.initRange() runOnScaleChanged() rxBus.send(EventNewHistoryData(0, false)) diff --git a/workflow/src/main/kotlin/app/aaps/workflow/iob/CarbsInPastExtension.kt b/workflow/src/main/kotlin/app/aaps/workflow/iob/CarbsInPastExtension.kt index 7a0452b2e9..5d4cc70638 100644 --- a/workflow/src/main/kotlin/app/aaps/workflow/iob/CarbsInPastExtension.kt +++ b/workflow/src/main/kotlin/app/aaps/workflow/iob/CarbsInPastExtension.kt @@ -17,7 +17,7 @@ fun fromCarbs(t: Carbs, isAAPSOrWeighted: Boolean, profileFunction: ProfileFunct val min5minCarbImpact: Double val profile = profileFunction.getProfile(t.timestamp) if (isAAPSOrWeighted && profile != null) { - val maxAbsorptionHours = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) + val maxAbsorptionHours = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME) val sens = profile.getIsfMgdl(t.timestamp) val ic = profile.getIc(t.timestamp) min5minCarbImpact = t.amount / (maxAbsorptionHours * 60 / 5) * sens / ic @@ -26,7 +26,7 @@ fun fromCarbs(t: Carbs, isAAPSOrWeighted: Boolean, profileFunction: ProfileFunct """Min 5m carbs impact for ${carbs}g @${dateUtil.dateAndTimeString(t.timestamp)} for ${maxAbsorptionHours}h calculated to $min5minCarbImpact ISF: $sens IC: $ic""" ) } else { - min5minCarbImpact = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) + min5minCarbImpact = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) } return AutosensData.CarbsInPast(time, carbs, min5minCarbImpact, remaining) } diff --git a/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOref1Worker.kt b/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOref1Worker.kt index d53e43b44f..d18b35c447 100644 --- a/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOref1Worker.kt +++ b/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOref1Worker.kt @@ -200,7 +200,7 @@ class IobCobOref1Worker( // if we are absorbing carbs if (previous != null && previous.cob > 0) { // calculate sum of min carb impact from all active treatments - val totalMinCarbsImpact = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) + val totalMinCarbsImpact = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) // figure out how many carbs that represents // but always assume at least 3mg/dL/5m (default) absorption per active treatment @@ -293,7 +293,7 @@ class IobCobOref1Worker( // add an extra negative deviation if a high temp target is running and exercise mode is set // TODO AS-FIX @Suppress("SimplifyBooleanWithConstants", "KotlinConstantConditions") - if (false && sp.getBoolean(info.nightscout.core.utils.R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)) { + if (false && sp.getBoolean(app.aaps.core.utils.R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)) { val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet() if (tempTarget is ValueWrapper.Existing && tempTarget.value.target() >= 100) { autosensData.extraDeviation.add(-(tempTarget.value.target() - 100) / 20) diff --git a/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOrefWorker.kt b/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOrefWorker.kt index fd24e32d75..a6fbd02409 100644 --- a/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOrefWorker.kt +++ b/workflow/src/main/kotlin/app/aaps/workflow/iob/IobCobOrefWorker.kt @@ -202,7 +202,7 @@ class IobCobOrefWorker @Inject internal constructor( } } else { //Oref sensitivity - totalMinCarbsImpact = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) + totalMinCarbsImpact = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact) } // figure out how many carbs that represents