From 11f71d8cb4df9d63e7e0de807be855795e6ceeef Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 28 Nov 2022 21:12:41 +0100 Subject: [PATCH] ActivityNames -> UiInteraction --- .../info/nightscout/androidaps/MainApp.kt | 6 +- .../nightscout/androidaps/di/AppModule.kt | 6 +- ...ivityNamesImpl.kt => UiInteractionImpl.kt} | 10 +-- .../interfaces/ConstraintsCheckerTest.kt | 10 +-- .../plugins/aps/loop/LoopPluginTest.kt | 6 +- .../nightscout/core/wizard/BolusWizard.kt | 12 +-- .../core-main/src/main/res/values/strings.xml | 1 - .../ui/{ActivityNames.kt => UiInteraction.kt} | 2 +- core/ui/src/main/res/values/strings.xml | 1 + .../implementation/HardLimitsImpl.kt | 6 +- .../NotificationHolderImpl.kt | 8 +- .../queue/CommandQueueImplementation.kt | 12 +-- .../queue/CommandQueueImplementationTest.kt | 12 +-- .../implementation/queue/QueueThreadTest.kt | 6 +- .../general/autotune/AutotuneFragment.kt | 12 +-- .../activities/SingleFragmentActivity.kt | 6 +- .../configBuilder/ConfigBuilderFragment.kt | 8 +- .../configBuilder/RunningConfigurationImpl.kt | 6 +- .../maintenance/ImportExportPrefsImpl.kt | 8 +- .../maintenance/MaintenanceFragment.kt | 6 +- .../configuration/setupwizard/SWDefinition.kt | 6 +- .../setupwizard/SetupWizardActivity.kt | 6 +- .../setupwizard/elements/SWPlugin.kt | 6 +- .../setupwizard/elements/SWPreference.kt | 6 +- .../nightscout/plugins/aps/loop/LoopPlugin.kt | 16 ++-- .../general/actions/ActionsFragment.kt | 36 ++++---- .../plugins/general/food/FoodFragment.kt | 6 +- .../general/overview/OverviewFragment.kt | 26 +++--- .../notifications/NotificationStore.kt | 10 +-- .../wear/wearintegration/DataHandlerMobile.kt | 6 +- .../plugins/profile/ProfileFragment.kt | 8 +- .../SignatureVerifierPlugin.kt | 6 +- .../storage/StorageConstraintPlugin.kt | 4 +- .../versionChecker/VersionCheckerPlugin.kt | 8 +- .../versionChecker/VersionCheckerUtilsImpl.kt | 8 +- .../SignatureVerifierPluginTest.kt | 4 +- .../VersionCheckerUtilsKtTest.kt | 46 +++++------ .../storage/StorageConstraintPluginTest.kt | 12 +-- .../sync/nsShared/StoreDataForDbImpl.kt | 6 +- .../plugins/sync/nsclient/NSClientPlugin.kt | 6 +- .../nsclient/data/NSSettingsStatusImpl.kt | 6 +- .../sync/nsclient/services/NSClientService.kt | 11 ++- .../sync/nsclientV3/NSClientV3Plugin.kt | 6 +- .../plugins/sync/tidepool/TidepoolPlugin.kt | 6 +- .../nightscout/pump/combo/ComboPlugin.java | 42 +++++----- .../nightscout/pump/combo/ComboPluginTest.kt | 6 +- .../nightscout/pump/combov2/ComboV2Plugin.kt | 26 +++--- .../info/nightscout/pump/dana/DanaFragment.kt | 10 +-- .../activities/DanaUserOptionsActivity.kt | 6 +- .../danaRKorean/DanaRKoreanPlugin.kt | 6 +- .../comm/MsgInitConnStatusBasic_k.kt | 4 +- .../comm/MsgInitConnStatusBolus_k.kt | 2 +- .../comm/MsgInitConnStatusTime_k.kt | 2 +- .../services/DanaRKoreanExecutionService.java | 7 +- .../androidaps/danaRv2/DanaRv2Plugin.java | 6 +- .../danaRv2/comm/MsgCheckValue_v2.kt | 4 +- .../services/DanaRv2ExecutionService.java | 10 +-- .../androidaps/danar/AbstractDanaRPlugin.java | 14 ++-- .../androidaps/danar/DanaRPlugin.java | 6 +- .../androidaps/danar/comm/MessageBase.kt | 4 +- .../danar/comm/MsgInitConnStatusBolus.kt | 2 +- .../danar/comm/MsgInitConnStatusOption.kt | 2 +- .../danar/comm/MsgInitConnStatusTime.kt | 2 +- .../danar/comm/MsgSetBasalProfile.kt | 4 +- .../danar/comm/MsgSetSingleBasalProfile.kt | 4 +- .../androidaps/danar/comm/MsgSettingMeal.kt | 4 +- .../AbstractDanaRExecutionService.java | 16 ++-- .../danar/services/DanaRExecutionService.java | 2 +- .../plugins/pump/danaR/DanaRPluginTest.kt | 6 +- .../plugins/pump/danaR/comm/DanaRTestBase.kt | 6 +- .../pump/danaRKorean/DanaRKoreanPluginTest.kt | 6 +- .../plugins/pump/danaRv2/DanaRv2PluginTest.kt | 8 +- .../nightscout/pump/danars/DanaRSPlugin.kt | 10 +-- .../pump/danars/comm/DanaRSPacket.kt | 4 +- .../comm/DanaRSPacketBasalGetBasalRate.kt | 2 +- .../comm/DanaRSPacketBolusGetBolusOption.kt | 2 +- .../comm/DanaRSPacketGeneralGetPumpCheck.kt | 2 +- .../danars/comm/DanaRSPacketNotifyAlarm.kt | 2 +- .../pump/danars/services/BLEComm.kt | 12 +-- .../pump/danars/services/DanaRSService.kt | 10 +-- .../pump/danars/DanaRSPluginTest.kt | 2 +- .../nightscout/pump/danars/DanaRSTestBase.kt | 4 +- .../comm/DanaRsPacketBasalGetBasalRateTest.kt | 2 +- .../DanaRsPacketBolusGetBolusOptionTest.kt | 2 +- .../DanaRsPacketBolusSetStepBolusStartTest.kt | 2 +- .../DanaRsPacketGeneralGetPumpCheckTest.kt | 2 +- .../comm/DanaRsPacketNotifyAlarmTest.kt | 2 +- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 2 +- .../pump/diaconn/DiaconnG8Fragment.kt | 6 +- .../pump/diaconn/DiaconnG8Plugin.kt | 10 +-- .../DiaconnG8UserOptionsActivity.kt | 6 +- .../pump/diaconn/service/BLECommonService.kt | 10 +-- .../pump/diaconn/service/DiaconnG8Service.kt | 8 +- .../plugins/pump/eopatch/EopatchPumpPlugin.kt | 8 +- .../pump/eopatch/alarm/AlarmManager.kt | 8 +- .../pump/eopatch/ui/dialogs/AlarmDialog.kt | 8 +- .../pump/medtronic/MedtronicPumpPlugin.kt | 10 +-- .../medtronic/data/MedtronicHistoryData.kt | 10 +-- .../pump/medtronic/util/MedtronicUtil.kt | 8 +- .../comm/MedtronicHistoryDataUTest.kt | 8 +- .../pump/MedtronicPumpHistoryDecoderUTest.kt | 6 +- .../data/MedtronicHistoryDataUTest.kt | 10 +-- .../omnipod/dash/OmnipodDashPumpPlugin.kt | 12 +-- .../dash/ui/DashPodManagementActivity.kt | 6 +- .../dash/ui/OmnipodDashOverviewFragment.kt | 6 +- .../omnipod/eros/OmnipodErosPumpPlugin.java | 28 +++---- .../eros/manager/AapsOmnipodErosManager.java | 12 +-- .../eros/ui/ErosPodManagementActivity.kt | 6 +- .../eros/ui/OmnipodErosOverviewFragment.kt | 6 +- .../omnipod/eros/OmnipodErosPumpPluginTest.kt | 6 +- .../ui/activities/ProfileHelperActivity.kt | 4 +- .../ui/activities/SurveyActivity.kt | 8 +- .../TreatmentsProfileSwitchFragment.kt | 6 +- .../nightscout/ui/alertDialogs/ErrorDialog.kt | 8 +- .../info/nightscout/ui/dialogs/CarbsDialog.kt | 6 +- .../info/nightscout/ui/dialogs/CareDialog.kt | 82 +++++++++---------- .../ui/dialogs/ExtendedBolusDialog.kt | 6 +- .../info/nightscout/ui/dialogs/FillDialog.kt | 6 +- .../nightscout/ui/dialogs/InsulinDialog.kt | 6 +- .../info/nightscout/ui/dialogs/LoopDialog.kt | 6 +- .../ui/dialogs/ProfileViewerDialog.kt | 20 ++--- .../nightscout/ui/dialogs/TempBasalDialog.kt | 6 +- .../nightscout/ui/dialogs/TreatmentDialog.kt | 6 +- .../java/info/nightscout/ui/widget/Widget.kt | 6 +- 124 files changed, 528 insertions(+), 530 deletions(-) rename app/src/main/java/info/nightscout/androidaps/implementations/{ActivityNamesImpl.kt => UiInteractionImpl.kt} (97%) rename core/interfaces/src/main/java/info/nightscout/interfaces/ui/{ActivityNames.kt => UiInteraction.kt} (99%) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt index 166b84d1e5..5ba7d668c3 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt @@ -36,7 +36,7 @@ import info.nightscout.interfaces.LocalAlertUtils import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.plugins.general.overview.notifications.NotificationStore import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin @@ -74,7 +74,7 @@ class MainApp : DaggerApplication() { @Inject lateinit var dateUtil: DateUtil @Suppress("unused") @Inject lateinit var staticInjector: info.nightscout.plugins.aps.utils.StaticInjector// TODO avoid , here fake only to initialize @Inject lateinit var uel: UserEntryLogger - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var notificationStore: NotificationStore @Inject lateinit var processLifecycleListener: Provider @Inject lateinit var profileSwitchPlugin: ThemeSwitcherPlugin @@ -247,7 +247,7 @@ class MainApp : DaggerApplication() { override fun onTerminate() { aapsLogger.debug(LTag.CORE, "onTerminate") unregisterActivityLifecycleCallbacks(activityMonitor) - activityNames.stopAlarm("onTerminate") + uiInteraction.stopAlarm("onTerminate") super.onTerminate() } } diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt index bbe362f669..1611893464 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt @@ -7,14 +7,14 @@ import dagger.Module import dagger.Provides import dagger.android.HasAndroidInjector import info.nightscout.androidaps.MainApp -import info.nightscout.androidaps.implementations.ActivityNamesImpl +import info.nightscout.androidaps.implementations.UiInteractionImpl import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.androidaps.workflow.CalculationWorkflowImpl import info.nightscout.androidaps.workflow.WorkerClassesImpl import info.nightscout.core.workflow.CalculationWorkflow import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.PluginBase -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.workflow.WorkerClasses @Suppress("unused") @@ -50,7 +50,7 @@ open class AppModule { @Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector @Binds fun bindConfigInterface(config: ConfigImpl): Config - @Binds fun bindActivityNames(activityNames: ActivityNamesImpl): ActivityNames + @Binds fun bindActivityNames(activityNames: UiInteractionImpl): UiInteraction @Binds fun bindWorkerClasses(workerClassesImpl: WorkerClassesImpl): WorkerClasses @Binds fun bindCalculationWorkflow(calculationWorkflow: CalculationWorkflowImpl): CalculationWorkflow } diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt rename to app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt index 62713ba4d7..a8f9c228ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt @@ -19,7 +19,7 @@ import info.nightscout.core.services.AlarmSoundServiceHelper import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.nsclient.NSAlarm -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.general.overview.notifications.NotificationWithAction import info.nightscout.rx.bus.RxBus import info.nightscout.ui.activities.BolusProgressHelperActivity @@ -41,12 +41,12 @@ import info.nightscout.ui.dialogs.TreatmentDialog import info.nightscout.ui.dialogs.WizardDialog import javax.inject.Inject -class ActivityNamesImpl @Inject constructor( +class UiInteractionImpl @Inject constructor( private val context: Context, private val rxBus: RxBus, private val injector: HasAndroidInjector, private val alarmSoundServiceHelper: AlarmSoundServiceHelper -) : ActivityNames { +) : UiInteraction { override val mainActivity: Class<*> = MainActivity::class.java override val tddStatsActivity: Class<*> = TDDStatsActivity::class.java @@ -129,7 +129,7 @@ class ActivityNamesImpl @Inject constructor( .show(fragmentManager, "FillDialog") } - override fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: ActivityNames.Mode, customProfile: String?, customProfileName: String?, customProfile2: String?) { + override fun runProfileViewerDialog(fragmentManager: FragmentManager, time: Long, mode: UiInteraction.Mode, customProfile: String?, customProfileName: String?, customProfile2: String?) { ProfileViewerDialog() .also { it.arguments = Bundle().also { bundle -> @@ -143,7 +143,7 @@ class ActivityNamesImpl @Inject constructor( .show(fragmentManager, "ProfileViewer") } - override fun runCareDialog(fragmentManager: FragmentManager, options: ActivityNames.EventType, @StringRes event: Int) { + override fun runCareDialog(fragmentManager: FragmentManager, options: UiInteraction.EventType, @StringRes event: Int) { CareDialog() .also { it.arguments = Bundle().also { bundle -> diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index c2e31a3562..da5d29a6db 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -29,7 +29,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin @@ -68,7 +68,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var pumpSync: PumpSync @Mock lateinit var insightDatabaseDao: InsightDatabaseDao @Mock lateinit var ruffyScripter: RuffyScripter - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var profileInstantiator: ProfileInstantiator @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase @Mock lateinit var insightDatabase: InsightDatabase @@ -142,9 +142,9 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { insightDbHelper = InsightDbHelper(insightDatabaseDao) danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config) - comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames) + comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, uiInteraction) danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, - activityNames, danaHistoryDatabase) + uiInteraction, danaHistoryDatabase) danaRSPlugin = info.nightscout.pump.danars.DanaRSPlugin( injector, @@ -163,7 +163,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames, + uiInteraction, danaHistoryDatabase ) insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, config, dateUtil, insightDbHelper, pumpSync, insightDatabase) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt index 9df7c71921..771e780350 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt @@ -18,7 +18,7 @@ import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.aps.loop.LoopFragment import info.nightscout.plugins.aps.loop.LoopPlugin import info.nightscout.interfaces.configBuilder.RunningConfiguration @@ -53,7 +53,7 @@ class LoopPluginTest : TestBase() { @Mock lateinit var dateUtil: DateUtil @Mock lateinit var runningConfiguration: RunningConfiguration @Mock lateinit var config: Config - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction private lateinit var loopPlugin: LoopPlugin @@ -62,7 +62,7 @@ class LoopPluginTest : TestBase() { loopPlugin = LoopPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, config, constraintChecker, rh, profileFunction, context, commandQueue, activePlugin, virtualPumpPlugin, iobCobCalculator, receiverStatusStore, fabricPrivacy, dateUtil, uel, - repository, runningConfiguration, activityNames) + repository, runningConfiguration, uiInteraction) `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) `when`(context.getSystemService(Context.NOTIFICATION_SERVICE)).thenReturn(notificationManager) } diff --git a/core/core-main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt b/core/core-main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt index edf468380a..b9edd13e08 100644 --- a/core/core-main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt +++ b/core/core-main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt @@ -36,7 +36,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.Round import info.nightscout.rx.bus.RxBus @@ -73,7 +73,7 @@ class BolusWizard @Inject constructor( @Inject lateinit var carbTimer: CarbTimer @Inject lateinit var bolusTimer: BolusTimer @Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var persistenceLayer: PersistenceLayer @@ -400,7 +400,7 @@ class BolusWizard @Inject constructor( commandQueue.bolus(this, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } else carbTimer.scheduleAutomationEventEatReminder() } @@ -447,7 +447,7 @@ class BolusWizard @Inject constructor( commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) @@ -455,7 +455,7 @@ class BolusWizard @Inject constructor( commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) @@ -486,7 +486,7 @@ class BolusWizard @Inject constructor( commandQueue.bolus(this, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/core/core-main/src/main/res/values/strings.xml b/core/core-main/src/main/res/values/strings.xml index 309290b65d..3f43e281f5 100644 --- a/core/core-main/src/main/res/values/strings.xml +++ b/core/core-main/src/main/res/values/strings.xml @@ -29,7 +29,6 @@ Blood Glucose Target g % - Advanced Settings Bluetooth BT Watchdog Switches off the phone\'s bluetooth for one second if no connection to the pump is possible. This may help on some phones where the bluetooth stack freezes. diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt similarity index 99% rename from core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt rename to core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt index 8d1a743ee9..3638508369 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt @@ -11,7 +11,7 @@ import info.nightscout.interfaces.nsclient.NSAlarm * Interface to use activities located in different modules * usage: startActivity(Intent(context, activityNames.xxxx)) */ -interface ActivityNames { +interface UiInteraction { val mainActivity: Class<*> val tddStatsActivity: Class<*> diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index b1f9f648ad..b97e4be429 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -45,6 +45,7 @@ Mute for 5 minutes Mute Success + Advanced Settings Unlock settings diff --git a/implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt b/implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt index 1a8e4c7719..6ab5dcf4fb 100644 --- a/implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/HardLimitsImpl.kt @@ -5,7 +5,7 @@ import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.core.main.R import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper @@ -21,7 +21,7 @@ import kotlin.math.min @Singleton class HardLimitsImpl @Inject constructor( private val aapsLogger: AAPSLogger, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, private val sp: SP, private val rh: ResourceHelper, private val context: Context, @@ -100,7 +100,7 @@ class HardLimitsImpl @Inject constructor( msg += rh.gs(R.string.valuelimitedto, value, newValue) aapsLogger.error(msg) disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(msg)).subscribe() - activityNames.showToastAndNotification(context, msg, R.raw.error) + uiInteraction.showToastAndNotification(context, msg, R.raw.error) } return newValue } diff --git a/implementation/src/main/java/info/nightscout/implementation/androidNotification/NotificationHolderImpl.kt b/implementation/src/main/java/info/nightscout/implementation/androidNotification/NotificationHolderImpl.kt index 8bc83f63a8..57ecffa510 100644 --- a/implementation/src/main/java/info/nightscout/implementation/androidNotification/NotificationHolderImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/androidNotification/NotificationHolderImpl.kt @@ -10,7 +10,7 @@ import androidx.core.app.NotificationCompat import androidx.core.app.TaskStackBuilder import info.nightscout.core.main.R import info.nightscout.interfaces.NotificationHolder -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.ui.IconsProvider import info.nightscout.shared.interfaces.ResourceHelper import javax.inject.Inject @@ -21,7 +21,7 @@ class NotificationHolderImpl @Inject constructor( private val rh: ResourceHelper, private val context: Context, private val iconsProvider: IconsProvider, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : NotificationHolder { override val channelID = "AndroidAPS-Ongoing" @@ -34,8 +34,8 @@ class NotificationHolderImpl @Inject constructor( get() = _notification ?: placeholderNotification() override fun openAppIntent(context: Context): PendingIntent? = TaskStackBuilder.create(context).run { - addParentStack(activityNames.mainActivity) - addNextIntent(Intent(context, activityNames.mainActivity)) + addParentStack(uiInteraction.mainActivity) + addNextIntent(Intent(context, uiInteraction.mainActivity)) getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT) } diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt index 03c9d3c6cd..dfc7fee0c0 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt @@ -53,7 +53,7 @@ import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.queue.Command.CommandType import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.queue.CustomCommand -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus @@ -91,7 +91,7 @@ class CommandQueueImplementation @Inject constructor( private val repository: AppRepository, private val fabricPrivacy: FabricPrivacy, private val androidPermission: AndroidPermission, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, private val persistenceLayer: PersistenceLayer ) : CommandQueue { @@ -117,7 +117,7 @@ class CommandQueueImplementation @Inject constructor( setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.failed_update_basal_profile), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.failed_update_basal_profile), R.raw.boluserror) } else { val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil) EffectiveProfileSwitch( @@ -230,7 +230,7 @@ class CommandQueueImplementation @Inject constructor( val tempCommandQueue = CommandQueueImplementation( injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction, activePlugin, context, sp, - config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer + config, dateUtil, repository, fabricPrivacy, androidPermission, uiInteraction, persistenceLayer ) tempCommandQueue.readStatus(reason, callback) tempCommandQueue.disposable.clear() @@ -613,7 +613,7 @@ class CommandQueueImplementation @Inject constructor( private fun showBolusProgressDialog(detailedBolusInfo: DetailedBolusInfo) { if (detailedBolusInfo.context != null) { - activityNames.runBolusProgressDialog( + uiInteraction.runBolusProgressDialog( (detailedBolusInfo.context as AppCompatActivity).supportFragmentManager, detailedBolusInfo.insulin, detailedBolusInfo.id @@ -622,7 +622,7 @@ class CommandQueueImplementation @Inject constructor( val i = Intent() i.putExtra("insulin", detailedBolusInfo.insulin) i.putExtra("id", detailedBolusInfo.id) - i.setClass(context, activityNames.bolusProgressHelperActivity) + i.setClass(context, uiInteraction.bolusProgressHelperActivity) i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(i) } diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt index 6f4072efee..127ee5ca58 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt @@ -30,7 +30,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.queue.CustomCommand -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger @@ -55,7 +55,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var powerManager: PowerManager @Mock lateinit var repository: AppRepository - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var androidPermission: AndroidPermission @Mock lateinit var persistenceLayer: PersistenceLayer @@ -75,12 +75,12 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { repository: AppRepository, fabricPrivacy: FabricPrivacy, androidPermission: AndroidPermission, - activityNames: ActivityNames, + uiInteraction: UiInteraction, persistenceLayer: PersistenceLayer ) : CommandQueueImplementation( injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction, activePlugin, context, sp, config, dateUtil, repository, fabricPrivacy, - androidPermission, activityNames, persistenceLayer + androidPermission, uiInteraction, persistenceLayer ) { override fun notifyAboutNewCommand() : Boolean = true @@ -124,7 +124,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction, activePlugin, context, sp, config, dateUtil, repository, - fabricPrivacy, androidPermission, activityNames, persistenceLayer + fabricPrivacy, androidPermission, uiInteraction, persistenceLayer ) testPumpPlugin = TestPumpPlugin(injector) @@ -161,7 +161,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { val commandQueue = CommandQueueImplementation( injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction, activePlugin, context, sp, - config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer + config, dateUtil, repository, fabricPrivacy, androidPermission, uiInteraction, persistenceLayer ) val handler = mock(Handler::class.java) `when`(handler.post(anyObject())).thenAnswer { invocation: InvocationOnMock -> diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt index e4e2dac003..e393dfdfa1 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt @@ -17,7 +17,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Command -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -34,7 +34,7 @@ class QueueThreadTest : TestBaseWithProfile() { @Mock lateinit var powerManager: PowerManager @Mock lateinit var repository: AppRepository @Mock lateinit var androidPermission: AndroidPermission - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var persistenceLayer: PersistenceLayer val injector = HasAndroidInjector { @@ -60,7 +60,7 @@ class QueueThreadTest : TestBaseWithProfile() { commandQueue = CommandQueueImplementation( injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction, activePlugin, context, sp, - config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer + config, dateUtil, repository, fabricPrivacy, androidPermission, uiInteraction, persistenceLayer ) val pumpDescription = PumpDescription() diff --git a/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt b/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt index bc1e5d7fc8..adb851969a 100644 --- a/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt +++ b/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt @@ -32,7 +32,7 @@ import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileInstantiator import info.nightscout.interfaces.profile.ProfileStore -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.interfaces.utils.Round import info.nightscout.plugins.aps.R @@ -69,7 +69,7 @@ class AutotuneFragment : DaggerFragment() { @Inject lateinit var rxBus: RxBus @Inject lateinit var injector: HasAndroidInjector @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var profileInstantiator: ProfileInstantiator private var disposable: CompositeDisposable = CompositeDisposable() @@ -200,10 +200,10 @@ class AutotuneFragment : DaggerFragment() { } } pumpProfile?.let { - activityNames.runProfileViewerDialog( + uiInteraction.runProfileViewerDialog( fragmentManager = childFragmentManager, time = dateUtil.now(), - mode = ActivityNames.Mode.CUSTOM_PROFILE, + mode = UiInteraction.Mode.CUSTOM_PROFILE, customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(), customProfileName = pumpProfile.profilename ) @@ -214,10 +214,10 @@ class AutotuneFragment : DaggerFragment() { val pumpProfile = autotunePlugin.pumpProfile val circadian = sp.getBoolean(R.string.key_autotune_circadian_ic_isf, false) val tunedProfile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile - activityNames.runProfileViewerDialog( + uiInteraction.runProfileViewerDialog( fragmentManager = childFragmentManager, time = dateUtil.now(), - mode = ActivityNames.Mode.PROFILE_COMPARE, + mode = UiInteraction.Mode.PROFILE_COMPARE, customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(), customProfileName = pumpProfile.profilename + "\n" + rh.gs(R.string.autotune_tunedprofile_name), customProfile2 = tunedProfile?.toPureNsJson(dateUtil).toString() diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/activities/SingleFragmentActivity.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/activities/SingleFragmentActivity.kt index a565b6616a..b978b3e507 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/activities/SingleFragmentActivity.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/activities/SingleFragmentActivity.kt @@ -10,14 +10,14 @@ import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.protection.ProtectionCheck -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import javax.inject.Inject class SingleFragmentActivity : DaggerAppCompatActivityWithResult() { @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var plugin: PluginBase? = null @@ -45,7 +45,7 @@ class SingleFragmentActivity : DaggerAppCompatActivityWithResult() { R.id.nav_plugin_preferences -> { protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { - val i = Intent(this, activityNames.preferencesActivity) + val i = Intent(this, uiInteraction.preferencesActivity) i.putExtra("id", plugin?.preferencesId) startActivity(i) }, null) diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderFragment.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderFragment.kt index 738d37b389..bb16c0ca2f 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderFragment.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderFragment.kt @@ -25,7 +25,7 @@ import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.protection.ProtectionCheck.Protection.PREFERENCES -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventRebuildTabs @@ -46,7 +46,7 @@ class ConfigBuilderFragment : DaggerFragment() { @Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var config: Config @Inject lateinit var ctx: Context - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var disposable: CompositeDisposable = CompositeDisposable() private val pluginViewHolders = ArrayList() @@ -65,7 +65,7 @@ class ConfigBuilderFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val parentClass = this.activity?.let { it::class.java } - inMenu = parentClass == activityNames.singleFragmentActivity + inMenu = parentClass == uiInteraction.singleFragmentActivity updateProtectedUi() binding.unlock.setOnClickListener { queryProtection() } } @@ -166,7 +166,7 @@ class ConfigBuilderFragment : DaggerFragment() { pluginPreferences.setOnClickListener { fragment.activity?.let { activity -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.PREFERENCES, { - val i = Intent(ctx, activityNames.preferencesActivity) + val i = Intent(ctx, uiInteraction.preferencesActivity) i.putExtra("id", plugin.preferencesId) fragment.startActivity(i) }, null) diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/RunningConfigurationImpl.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/RunningConfigurationImpl.kt index e300a9b239..88e1d8fd23 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/RunningConfigurationImpl.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/RunningConfigurationImpl.kt @@ -11,7 +11,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventNSClientNewLog import info.nightscout.rx.logging.AAPSLogger @@ -34,7 +34,7 @@ class RunningConfigurationImpl @Inject constructor( private val rh: ResourceHelper, private val rxBus: RxBus, private val pumpSync: PumpSync, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : RunningConfiguration { private var counter = 0 @@ -74,7 +74,7 @@ class RunningConfigurationImpl @Inject constructor( configuration.version?.let { rxBus.send(EventNSClientNewLog("VERSION", "Received AndroidAPS version $it")) if (config.VERSION_NAME.startsWith(it).not()) - activityNames.addNotification(Notification.NSCLIENT_VERSION_DOES_NOT_MATCH, rh.gs(R.string.nsclient_version_does_not_match), Notification.NORMAL) + uiInteraction.addNotification(Notification.NSCLIENT_VERSION_DOES_NOT_MATCH, rh.gs(R.string.nsclient_version_does_not_match), Notification.NORMAL) } configuration.insulin?.let { val insulin = Insulin.InsulinType.fromInt(it) diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/ImportExportPrefsImpl.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/ImportExportPrefsImpl.kt index a04d661199..579461a11e 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/ImportExportPrefsImpl.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/ImportExportPrefsImpl.kt @@ -47,7 +47,7 @@ import info.nightscout.interfaces.maintenance.PrefsMetadataKey import info.nightscout.interfaces.maintenance.PrefsStatus import info.nightscout.interfaces.protection.PasswordCheck import info.nightscout.interfaces.storage.Storage -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.userEntry.UserEntryPresentationHelper import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.rx.bus.RxBus @@ -83,7 +83,7 @@ class ImportExportPrefsImpl @Inject constructor( private val prefFileList: PrefFileListProvider, private val uel: UserEntryLogger, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : ImportExportPrefs { override fun prefsFileExists(): Boolean { @@ -176,8 +176,8 @@ class ImportExportPrefsImpl @Inject constructor( rh.gs(wrongPwdTitle), rh.gs(R.string.master_password_missing, rh.gs(R.string.configbuilder_general), rh.gs(R.string.protection)), R.string.nav_preferences, { - val intent = Intent(activity, activityNames.preferencesActivity).apply { - putExtra("id", activityNames.prefGeneral) + val intent = Intent(activity, uiInteraction.preferencesActivity).apply { + putExtra("id", uiInteraction.prefGeneral) } activity.startActivity(intent) }) diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt index 17c7bda986..e6ad639c05 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt @@ -25,7 +25,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.protection.ProtectionCheck.Protection.PREFERENCES import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.sync.DataSyncSelector -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus @@ -56,7 +56,7 @@ class MaintenanceFragment : DaggerFragment() { @Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var overviewData: OverviewData @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var activePlugin: ActivePlugin private val disposable = CompositeDisposable() @@ -75,7 +75,7 @@ class MaintenanceFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val parentClass = this.activity?.let { it::class.java } - inMenu = parentClass == activityNames.singleFragmentActivity + inMenu = parentClass == uiInteraction.singleFragmentActivity updateProtectedUi() binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() } binding.logDelete.setOnClickListener { diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt index 4b25a58c9d..cd66df5e1c 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SWDefinition.kt @@ -38,7 +38,7 @@ import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.pump.OmnipodDash import info.nightscout.interfaces.pump.OmnipodEros import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventPumpStatusChanged @@ -67,7 +67,7 @@ class SWDefinition @Inject constructor( private val cryptoUtil: CryptoUtil, private val config: Config, private val hardLimits: HardLimits, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) { lateinit var activity: AppCompatActivity @@ -353,7 +353,7 @@ class SWDefinition @Inject constructor( ) .add(SWButton(injector) .text(R.string.doprofileswitch) - .action { activityNames.runProfileSwitchDialog(activity.supportFragmentManager) }) + .action { uiInteraction.runProfileSwitchDialog(activity.supportFragmentManager) }) .validator { profileFunction.getRequestedProfile() != null } .visibility { profileFunction.getRequestedProfile() == null } diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt index 9935cc5ce7..a3ae79c65a 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/SetupWizardActivity.kt @@ -12,7 +12,7 @@ import info.nightscout.configuration.setupwizard.elements.SWItem import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.locale.LocaleHelper.update import info.nightscout.core.utils.fabric.FabricPrivacy -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.events.EventProfileStoreChanged import info.nightscout.rx.events.EventProfileSwitchChanged @@ -34,7 +34,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() { @Inject lateinit var sp: SP @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private val disposable = CompositeDisposable() private lateinit var screens: List @@ -164,7 +164,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() { @Suppress("UNUSED_PARAMETER") fun finishSetupWizard(view: View?) { sp.putBoolean(R.string.key_setupwizard_processed, true) - val intent = Intent(this, activityNames.mainActivity) + val intent = Intent(this, uiInteraction.mainActivity) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) startActivity(intent) finish() diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPlugin.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPlugin.kt index 5eab2a5765..10f76a2223 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPlugin.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPlugin.kt @@ -14,7 +14,7 @@ import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.events.EventConfigBuilderChange import info.nightscout.rx.events.EventSWUpdate import javax.inject.Inject @@ -23,7 +23,7 @@ class SWPlugin(injector: HasAndroidInjector, private val definition: SWDefinitio @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var configBuilder: ConfigBuilder - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var pType: PluginType? = null private var radioGroup: RadioGroup? = null @@ -93,7 +93,7 @@ class SWPlugin(injector: HasAndroidInjector, private val definition: SWDefinitio private fun addConfiguration(layout: LinearLayout, plugin: PluginBase) { if (plugin.preferencesId != -1) { - fragment = Class.forName(activityNames.myPreferenceFragment.name).newInstance() as Fragment //MyPreferenceFragment() + fragment = Class.forName(uiInteraction.myPreferenceFragment.name).newInstance() as Fragment //MyPreferenceFragment() fragment?.let { it.arguments = Bundle().also { it.putInt("id", plugin.preferencesId) } definition.activity.supportFragmentManager.beginTransaction().run { diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPreference.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPreference.kt index 0c0bda1914..ba6fd41780 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPreference.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/setupwizard/elements/SWPreference.kt @@ -5,12 +5,12 @@ import android.widget.LinearLayout import androidx.fragment.app.Fragment import dagger.android.HasAndroidInjector import info.nightscout.configuration.setupwizard.SWDefinition -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import javax.inject.Inject class SWPreference(injector: HasAndroidInjector, private val definition: SWDefinition) : SWItem(injector, Type.PREFERENCE) { - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var xml: Int = -1 @@ -25,7 +25,7 @@ class SWPreference(injector: HasAndroidInjector, private val definition: SWDefin } private fun addConfiguration(layout: LinearLayout, xml: Int) { - (Class.forName(activityNames.myPreferenceFragment.name).newInstance() as Fragment).also { fragment -> + (Class.forName(uiInteraction.myPreferenceFragment.name).newInstance() as Fragment).also { fragment -> fragment.arguments = Bundle().also { it.putInt("id", xml) } definition.activity.supportFragmentManager.beginTransaction().run { replace(layout.id, fragment) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt index a08cb6485d..7365d6a89e 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt @@ -54,7 +54,7 @@ import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.receivers.ReceiverStatusStore -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui @@ -105,7 +105,7 @@ class LoopPlugin @Inject constructor( private val uel: UserEntryLogger, private val repository: AppRepository, private val runningConfiguration: RunningConfiguration, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : PluginBase( PluginDescription() .mainType(PluginType.LOOP) @@ -461,14 +461,14 @@ class LoopPlugin @Inject constructor( private fun presentSuggestion(builder: NotificationCompat.Builder) { // Creates an explicit intent for an Activity in your app - val resultIntent = Intent(context, activityNames.mainActivity) + val resultIntent = Intent(context, uiInteraction.mainActivity) // The stack builder object will contain an artificial back stack for the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. val stackBuilder = TaskStackBuilder.create(context) - stackBuilder.addParentStack(activityNames.mainActivity) + stackBuilder.addParentStack(uiInteraction.mainActivity) // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent) val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT) @@ -684,7 +684,7 @@ class LoopPlugin @Inject constructor( commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) @@ -692,7 +692,7 @@ class LoopPlugin @Inject constructor( commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) @@ -701,7 +701,7 @@ class LoopPlugin @Inject constructor( commandQueue.cancelExtended(object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) } } }) @@ -719,7 +719,7 @@ class LoopPlugin @Inject constructor( commandQueue.cancelTempBasal(true, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt index ed3bc0de79..c8b1171b40 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt @@ -30,7 +30,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.pump.actions.CustomAction import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.R import info.nightscout.plugins.databinding.ActionsFragmentBinding import info.nightscout.plugins.skins.SkinProvider @@ -72,7 +72,7 @@ class ActionsFragment : DaggerFragment() { @Inject lateinit var uel: UserEntryLogger @Inject lateinit var repository: AppRepository @Inject lateinit var loop: Loop - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var disposable: CompositeDisposable = CompositeDisposable() @@ -109,7 +109,7 @@ class ActionsFragment : DaggerFragment() { protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { activityNames.runProfileSwitchDialog(childFragmentManager) }) + UIRunnable { uiInteraction.runProfileSwitchDialog(childFragmentManager) }) } } binding.tempTarget.setOnClickListener { @@ -117,7 +117,7 @@ class ActionsFragment : DaggerFragment() { protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { activityNames.runTempTargetDialog(childFragmentManager) }) + UIRunnable { uiInteraction.runTempTargetDialog(childFragmentManager) }) } } binding.extendedBolus.setOnClickListener { @@ -126,7 +126,7 @@ class ActionsFragment : DaggerFragment() { OKDialog.showConfirmation( activity, rh.gs(R.string.extended_bolus), rh.gs(R.string.ebstopsloop), Runnable { - activityNames.runExtendedBolusDialog(childFragmentManager) + uiInteraction.runExtendedBolusDialog(childFragmentManager) }, null ) }) @@ -138,7 +138,7 @@ class ActionsFragment : DaggerFragment() { commandQueue.cancelExtended(object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) } } }) @@ -149,7 +149,7 @@ class ActionsFragment : DaggerFragment() { protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { activityNames.runTempBasalDialog(childFragmentManager) }) + UIRunnable { uiInteraction.runTempBasalDialog(childFragmentManager) }) } } binding.cancelTempBasal.setOnClickListener { @@ -158,7 +158,7 @@ class ActionsFragment : DaggerFragment() { commandQueue.cancelTempBasal(true, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) @@ -166,31 +166,31 @@ class ActionsFragment : DaggerFragment() { } binding.fill.setOnClickListener { activity?.let { activity -> - protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { activityNames.runFillDialog(childFragmentManager) }) + protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { uiInteraction.runFillDialog(childFragmentManager) }) } } - binding.historyBrowser.setOnClickListener { startActivity(Intent(context, activityNames.historyBrowseActivity)) } - binding.tddStats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) } + binding.historyBrowser.setOnClickListener { startActivity(Intent(context, uiInteraction.historyBrowseActivity)) } + binding.tddStats.setOnClickListener { startActivity(Intent(context, uiInteraction.tddStatsActivity)) } binding.bgCheck.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.BGCHECK, R.string.careportal_bgcheck) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.BGCHECK, R.string.careportal_bgcheck) } binding.cgmSensorInsert.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.SENSOR_INSERT, R.string.cgm_sensor_insert) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.SENSOR_INSERT, R.string.cgm_sensor_insert) } binding.pumpBatteryChange.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.BATTERY_CHANGE, R.string.pump_battery_change) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.BATTERY_CHANGE, R.string.pump_battery_change) } binding.note.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.NOTE, R.string.careportal_note) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.NOTE, R.string.careportal_note) } binding.exercise.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.EXERCISE, R.string.careportal_exercise) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.EXERCISE, R.string.careportal_exercise) } binding.question.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.QUESTION, R.string.careportal_question) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.QUESTION, R.string.careportal_question) } binding.announcement.setOnClickListener { - activityNames.runCareDialog(childFragmentManager, ActivityNames.EventType.ANNOUNCEMENT, R.string.careportal_announcement) + uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.ANNOUNCEMENT, R.string.careportal_announcement) } sp.putBoolean(R.string.key_objectiveuseactions, true) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt index bed124e9bd..4f231042f7 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt @@ -22,7 +22,7 @@ import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InvalidateFoodTransaction import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.protection.ProtectionCheck -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.R import info.nightscout.plugins.databinding.FoodFragmentBinding import info.nightscout.plugins.databinding.FoodItemBinding @@ -49,7 +49,7 @@ class FoodFragment : DaggerFragment() { @Inject lateinit var repository: AppRepository @Inject lateinit var uel: UserEntryLogger @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private val disposable = CompositeDisposable() private var unfiltered: List = arrayListOf() @@ -224,7 +224,7 @@ class FoodFragment : DaggerFragment() { val food = v.tag as Food activity?.let { activity -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { - if (isAdded) activityNames.runWizardDialog(childFragmentManager, food.carbs, food.name) + if (isAdded) uiInteraction.runWizardDialog(childFragmentManager, food.carbs, food.name) }) } } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt index d5991ae95c..04a99bde0e 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt @@ -63,7 +63,7 @@ import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.pump.defs.PumpType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.interfaces.utils.TrendCalculator import info.nightscout.plugins.R @@ -144,7 +144,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList @Inject lateinit var overviewData: OverviewData @Inject lateinit var automation: Automation @Inject lateinit var bgQualityCheck: BgQualityCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private val disposable = CompositeDisposable() @@ -367,34 +367,34 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList R.id.treatment_button -> protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { if (isAdded) activityNames.runTreatmentDialog(childFragmentManager) }) + UIRunnable { if (isAdded) uiInteraction.runTreatmentDialog(childFragmentManager) }) R.id.wizard_button -> protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { if (isAdded) activityNames.runWizardDialog(childFragmentManager) }) + UIRunnable { if (isAdded) uiInteraction.runWizardDialog(childFragmentManager) }) R.id.insulin_button -> protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { if (isAdded) activityNames.runInsulinDialog(childFragmentManager) }) + UIRunnable { if (isAdded) uiInteraction.runInsulinDialog(childFragmentManager) }) R.id.quick_wizard_button -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { if (isAdded) onClickQuickWizard() }) R.id.carbs_button -> protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { if (isAdded) activityNames.runCarbsDialog(childFragmentManager) }) + UIRunnable { if (isAdded) uiInteraction.runCarbsDialog(childFragmentManager) }) R.id.temp_target -> protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { if (isAdded) activityNames.runTempTargetDialog(childFragmentManager) }) + UIRunnable { if (isAdded) uiInteraction.runTempTargetDialog(childFragmentManager) }) R.id.active_profile -> { - activityNames.runProfileViewerDialog( + uiInteraction.runProfileViewerDialog( childFragmentManager, dateUtil.now(), - ActivityNames.Mode.RUNNING_PROFILE + UiInteraction.Mode.RUNNING_PROFILE ) } @@ -411,7 +411,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList R.id.calibration_button -> { if (xdripPlugin.isEnabled()) { - activityNames.runCalibrationDialog(childFragmentManager) + uiInteraction.runCalibrationDialog(childFragmentManager) } else if (dexcomPlugin.isEnabled()) { try { dexcomMediator.findDexcomPackageName()?.let { @@ -453,7 +453,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList R.id.aps_mode -> { protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { - if (isAdded) activityNames.runLoopDialog(childFragmentManager, 1) + if (isAdded) uiInteraction.runLoopDialog(childFragmentManager, 1) }) } } @@ -484,7 +484,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList R.id.aps_mode -> { activity?.let { activity -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { - activityNames.runLoopDialog(childFragmentManager, 0) + uiInteraction.runLoopDialog(childFragmentManager, 0) }) } } @@ -496,7 +496,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList protectionCheck.queryProtection( activity, ProtectionCheck.Protection.BOLUS, - UIRunnable { activityNames.runProfileSwitchDialog(childFragmentManager) }) + UIRunnable { uiInteraction.runProfileSwitchDialog(childFragmentManager) }) } } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/notifications/NotificationStore.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/notifications/NotificationStore.kt index 1528d877b2..73f9304159 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/notifications/NotificationStore.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/notifications/NotificationStore.kt @@ -15,7 +15,7 @@ import androidx.recyclerview.widget.RecyclerView import info.nightscout.interfaces.NotificationHolder import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.ActivePlugin -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.ui.IconsProvider import info.nightscout.plugins.R import info.nightscout.plugins.databinding.OverviewNotificationItemBinding @@ -36,7 +36,7 @@ class NotificationStore @Inject constructor( private val rh: ResourceHelper, private val context: Context, private val iconsProvider: IconsProvider, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, private val dateUtil: DateUtil, private val notificationHolder: NotificationHolder, private val activePlugin: ActivePlugin @@ -69,7 +69,7 @@ class NotificationStore @Inject constructor( store.add(n) if (sp.getBoolean(R.string.key_raise_notifications_as_android_notifications, true) && n !is NotificationWithAction) raiseSystemNotification(n) - if (n.soundId != null && n.soundId != 0) activityNames.startAlarm(n.soundId!!, n.text) + if (n.soundId != null && n.soundId != 0) uiInteraction.startAlarm(n.soundId!!, n.text) Collections.sort(store, NotificationComparator()) return true } @@ -78,7 +78,7 @@ class NotificationStore @Inject constructor( fun remove(id: Int): Boolean { for (i in store.indices) { if (store[i].id == id) { - if (store[i].soundId != null) activityNames.stopAlarm("Removed " + store[i].text) + if (store[i].soundId != null) uiInteraction.stopAlarm("Removed " + store[i].text) aapsLogger.debug(LTag.NOTIFICATION, "Notification removed: " + store[i].text) store.removeAt(i) return true @@ -93,7 +93,7 @@ class NotificationStore @Inject constructor( while (i < store.size) { val n = store[i] if (n.validTo != 0L && n.validTo < System.currentTimeMillis()) { - if (store[i].soundId != null) activityNames.stopAlarm("Expired " + store[i].text) + if (store[i].soundId != null) uiInteraction.stopAlarm("Expired " + store[i].text) aapsLogger.debug(LTag.NOTIFICATION, "Notification expired: " + store[i].text) store.removeAt(i) i-- diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt index ec65e6bd41..0471654de7 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt @@ -46,7 +46,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.receivers.ReceiverStatusStore -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.TrendCalculator @@ -101,7 +101,7 @@ class DataHandlerMobile @Inject constructor( private val activePlugin: ActivePlugin, private val commandQueue: CommandQueue, private val fabricPrivacy: FabricPrivacy, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) { private val disposable = CompositeDisposable() @@ -293,7 +293,7 @@ class DataHandlerMobile @Inject constructor( .observeOn(aapsSchedulers.io) .subscribe({ aapsLogger.debug(LTag.WEAR, "SnoozeAlert received $it from ${it.sourceNodeId}") - activityNames.stopAlarm("Muted from wear") + uiInteraction.stopAlarm("Muted from wear") }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventData.WearException::class.java) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt index 769c08a595..8084f00876 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt @@ -22,7 +22,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.protection.ProtectionCheck -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.R @@ -57,7 +57,7 @@ class ProfileFragment : DaggerFragment() { @Inject lateinit var dateUtil: DateUtil @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var uel: UserEntryLogger - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var disposable: CompositeDisposable = CompositeDisposable() private var inMenu = false @@ -105,7 +105,7 @@ class ProfileFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val parentClass = this.activity?.let { it::class.java } - inMenu = parentClass == activityNames.singleFragmentActivity + inMenu = parentClass == uiInteraction.singleFragmentActivity updateProtectedUi() processVisibility(0) binding.tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { @@ -298,7 +298,7 @@ class ProfileFragment : DaggerFragment() { binding.units.text = rh.gs(R.string.units_colon) + " " + (if (currentProfile.mgdl) rh.gs(R.string.mgdl) else rh.gs(R.string.mmol)) binding.profileswitch.setOnClickListener { - activityNames.runProfileSwitchDialog(childFragmentManager, profilePlugin.currentProfile()?.name) + uiInteraction.runProfileSwitchDialog(childFragmentManager, profilePlugin.currentProfile()?.name) } binding.reset.setOnClickListener { diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt b/plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt index 3e44058008..6283c3c6bb 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt +++ b/plugins/support/src/main/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPlugin.kt @@ -11,7 +11,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.support.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper @@ -45,7 +45,7 @@ class SignatureVerifierPlugin @Inject constructor( rh: ResourceHelper, private val sp: SP, private val context: Context, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : PluginBase( PluginDescription() .mainType(PluginType.CONSTRAINTS) @@ -103,7 +103,7 @@ class SignatureVerifierPlugin @Inject constructor( } private fun showNotification() { - activityNames.addNotification(Notification.INVALID_VERSION, rh.gs(R.string.running_invalid_version), Notification.URGENT) + uiInteraction.addNotification(Notification.INVALID_VERSION, rh.gs(R.string.running_invalid_version), Notification.URGENT) } private fun hasIllegalSignature(): Boolean { diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt b/plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt index 15cea33109..801b43c4c2 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt +++ b/plugins/support/src/main/java/info/nightscout/plugins/constraints/storage/StorageConstraintPlugin.kt @@ -11,7 +11,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.support.R import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag @@ -25,7 +25,7 @@ class StorageConstraintPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, rh: ResourceHelper, - private val activeNames: ActivityNames + private val activeNames: UiInteraction ) : PluginBase( PluginDescription() .mainType(PluginType.CONSTRAINTS) diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt b/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt index 6dc3d9e4ad..c3381477eb 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt +++ b/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerPlugin.kt @@ -8,7 +8,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.plugins.support.R import info.nightscout.rx.bus.RxBus @@ -31,7 +31,7 @@ class VersionCheckerPlugin @Inject constructor( aapsLogger: AAPSLogger, private val config: Config, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : PluginBase( PluginDescription() .mainType(PluginType.CONSTRAINTS) @@ -96,7 +96,7 @@ class VersionCheckerPlugin @Inject constructor( gracePeriod.old, gracePeriod.veryOld ) - activityNames.addNotification(Notification.OLD_VERSION, message, Notification.NORMAL) + uiInteraction.addNotification(Notification.OLD_VERSION, message, Notification.NORMAL) } val endDate = sp.getLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0) @@ -105,7 +105,7 @@ class VersionCheckerPlugin @Inject constructor( sp.putLong(R.string.key_last_versionchecker_plugin_warning, now) //notify - activityNames.addNotification(Notification.VERSION_EXPIRE, rh.gs(R.string.application_expired), Notification.URGENT) + uiInteraction.addNotification(Notification.VERSION_EXPIRE, rh.gs(R.string.application_expired), Notification.URGENT) } } diff --git a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt b/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt index d281eba607..cea8c2e591 100644 --- a/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt +++ b/plugins/support/src/main/java/info/nightscout/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt @@ -6,7 +6,7 @@ import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.Config import info.nightscout.interfaces.constraints.versionChecker.AllowedVersions import info.nightscout.interfaces.notifications.Notification -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.plugins.support.R import info.nightscout.rx.logging.AAPSLogger @@ -29,7 +29,7 @@ class VersionCheckerUtilsImpl @Inject constructor( private val config: Lazy, private val receiverStatusStore: ReceiverStatusStore, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : VersionCheckerUtils { private fun isConnected(): Boolean = receiverStatusStore.isConnected @@ -121,7 +121,7 @@ class VersionCheckerUtilsImpl @Inject constructor( val now = dateUtil.now() if (now > sp.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) { aapsLogger.debug(LTag.CORE, "Version $currentVersion outdated. Found $newVersion") - activityNames.addNotification(Notification.NEW_VERSION_DETECTED, rh.gs(R.string.versionavailable, newVersion.toString()), Notification.LOW) + uiInteraction.addNotification(Notification.NEW_VERSION_DETECTED, rh.gs(R.string.versionavailable, newVersion.toString()), Notification.LOW) sp.putLong(R.string.key_last_versionchecker_warning, now) } } @@ -130,7 +130,7 @@ class VersionCheckerUtilsImpl @Inject constructor( val now = dateUtil.now() if (now > sp.getLong(R.string.key_last_expired_versionchecker_warning, 0) + WARN_EVERY) { aapsLogger.debug(LTag.CORE, rh.gs(R.string.version_expire, currentVersion, endDate)) - activityNames.addNotification(Notification.VERSION_EXPIRE, rh.gs(R.string.version_expire, currentVersion, endDate), Notification.LOW) + uiInteraction.addNotification(Notification.VERSION_EXPIRE, rh.gs(R.string.version_expire, currentVersion, endDate), Notification.LOW) sp.putLong(R.string.key_last_expired_versionchecker_warning, now) } } diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt index 0e38de7e12..4ac0fdd3ec 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt @@ -4,7 +4,7 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert @@ -16,7 +16,7 @@ class SignatureVerifierPluginTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock lateinit var sp: SP @Mock lateinit var context: Context - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction val injector = HasAndroidInjector { AndroidInjector { } } diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt index b51d650d8d..9a352475ab 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt @@ -4,7 +4,7 @@ import dagger.Lazy import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.Config -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.plugins.constraints.versionChecker.VersionCheckerUtilsImpl import info.nightscout.plugins.constraints.versionChecker.numericVersionPart @@ -31,10 +31,10 @@ import org.mockito.Mockito.`when` @Mock lateinit var receiverStatusStore: ReceiverStatusStore @Mock lateinit var config: Lazy @Mock lateinit var dateUtil: DateUtil - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Before fun setup() { - versionCheckerUtils = VersionCheckerUtilsImpl(aapsLogger, sp, rh, config, receiverStatusStore, dateUtil, activityNames) + versionCheckerUtils = VersionCheckerUtilsImpl(aapsLogger, sp, rh, config, receiverStatusStore, dateUtil, uiInteraction) } @Test @@ -170,49 +170,49 @@ import org.mockito.Mockito.`when` @Test fun `should find update1`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should find update2`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1-dev") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should find update3`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.1") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should find update4`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2", currentVersion = "2.1.1") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should find update5`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2-dev") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should find update6`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2dev") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should not find update on fourth version digit`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0.1") - verify(activityNames, times(0)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(0)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `should not find update on personal version with same number`() { versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0-myversion") - verify(activityNames, times(0)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(0)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -226,7 +226,7 @@ import org.mockito.Mockito.`when` """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2.2") - verify(activityNames, times(0)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(0)).addNotification(anyInt(), anyString(), anyInt()) } @Test fun `find higher version`() { @@ -238,7 +238,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2.2") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -251,7 +251,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2.2") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -264,7 +264,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.0-RC04") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -277,7 +277,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.0RC04") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -290,7 +290,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.RC04") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -303,7 +303,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.0.RC04") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -316,7 +316,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.7.9") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -329,7 +329,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.3") - verify(activityNames, times(0)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(0)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -342,7 +342,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.3-RC") - verify(activityNames, times(0)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(0)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -355,7 +355,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2-beta1") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Test @@ -368,7 +368,7 @@ import org.mockito.Mockito.`when` | appName = "Aaoeu" """.trimMargin() versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2-rc1") - verify(activityNames, times(1)).addNotification(anyInt(), anyString(), anyInt()) + verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } @Before diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt index e06655f90a..0497255a0b 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.constraints.Constraint -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import org.junit.Assert @@ -18,12 +18,12 @@ import org.mockito.Mockito.`when` class StorageConstraintPluginTest : TestBase() { @Mock lateinit var rh: ResourceHelper - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction private lateinit var storageConstraintPlugin: StorageConstraintPlugin @Before fun prepareMock() { - storageConstraintPlugin = StorageConstraintPlugin({ AndroidInjector { } }, aapsLogger, rh, activityNames) + storageConstraintPlugin = StorageConstraintPlugin({ AndroidInjector { } }, aapsLogger, rh, uiInteraction) `when`(rh.gs(anyInt(), anyLong())).thenReturn("") } @@ -31,15 +31,15 @@ class StorageConstraintPluginTest : TestBase() { injector: HasAndroidInjector, aapsLogger: AAPSLogger, rh: ResourceHelper, - activityNames: ActivityNames - ) : StorageConstraintPlugin(injector, aapsLogger, rh, activityNames) { + uiInteraction: UiInteraction + ) : StorageConstraintPlugin(injector, aapsLogger, rh, uiInteraction) { var memSize = 150L override fun availableInternalMemorySize(): Long = memSize } @Test fun isLoopInvocationAllowedTest() { - val mocked = MockedStorageConstraintPlugin({ AndroidInjector { } }, aapsLogger, rh, activityNames) + val mocked = MockedStorageConstraintPlugin({ AndroidInjector { } }, aapsLogger, rh, uiInteraction) // Set free space under 200(Mb) to disable loop mocked.memSize = 150L Assert.assertEquals(false, mocked.isClosedLoopAllowed(Constraint(true)).value()) diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDbImpl.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDbImpl.kt index 03534dbd27..c60ee69a7e 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDbImpl.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDbImpl.kt @@ -39,7 +39,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.nsclient.StoreDataForDb import info.nightscout.interfaces.pump.VirtualPump import info.nightscout.interfaces.source.NSClientSource -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.sync.R import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventNSClientNewLog @@ -73,7 +73,7 @@ class StoreDataForDbImpl @Inject constructor( private val nsClientSource: NSClientSource, private val xDripBroadcast: XDripBroadcast, private val virtualPump: VirtualPump, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : StoreDataForDb { override val glucoseValues: MutableList = mutableListOf() @@ -529,7 +529,7 @@ class StoreDataForDbImpl @Inject constructor( it.enteredBy != sp.getString("careportal_enteredby", "AndroidAPS") ) { if (sp.getBoolean(R.string.key_ns_announcements, config.NSCLIENT)) - activityNames.addNotificationValidFor(Notification.NS_ANNOUNCEMENT, it.note ?: "", Notification.ANNOUNCEMENT, 60) + uiInteraction.addNotificationValidFor(Notification.NS_ANNOUNCEMENT, it.note ?: "", Notification.ANNOUNCEMENT, 60) } } if (therapyEvents.isNotEmpty()) diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt index ad6113b846..8d62ac4472 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt @@ -22,7 +22,7 @@ import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.sync.DataSyncSelector import info.nightscout.interfaces.sync.NsClient import info.nightscout.interfaces.sync.Sync -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper.fromHtml import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.nsShared.NSClientFragment @@ -61,7 +61,7 @@ class NSClientPlugin @Inject constructor( private val nsClientReceiverDelegate: NsClientReceiverDelegate, private val config: Config, private val dataSyncSelector: DataSyncSelector, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : NsClient, Sync, PluginBase( PluginDescription() .mainType(PluginType.SYNC) @@ -185,7 +185,7 @@ class NSClientPlugin @Inject constructor( } return fromHtml(newTextLog.toString()) } catch (e: OutOfMemoryError) { - activityNames.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error) + uiInteraction.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error) } return fromHtml("") } diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt index dcb1c5af51..adfb488772 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatusImpl.kt @@ -10,7 +10,7 @@ import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.interfaces.profile.DefaultValueHelper -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.plugins.sync.R import info.nightscout.rx.bus.RxBus @@ -124,7 +124,7 @@ class NSSettingsStatusImpl @Inject constructor( private val sp: SP, private val config: Config, private val uel: UserEntryLogger, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : NSSettingsStatus { // ***** PUMP STATUS ****** @@ -151,7 +151,7 @@ class NSSettingsStatusImpl @Inject constructor( data = status aapsLogger.debug(LTag.NSCLIENT, "Got versions: Nightscout: ${getVersion()}") if (getVersionNum() < config.SUPPORTEDNSVERSION) { - activityNames.addNotification(Notification.OLD_NS, rh.gs(R.string.unsupported_ns_version), Notification.NORMAL) + uiInteraction.addNotification(Notification.OLD_NS, rh.gs(R.string.unsupported_ns_version), Notification.NORMAL) } else { rxBus.send(EventDismissNotification(Notification.OLD_NS)) } diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt index aa2a2a4558..61db6c619e 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt @@ -26,12 +26,11 @@ import info.nightscout.interfaces.nsclient.NSAlarm import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.interfaces.sync.DataSyncSelector import info.nightscout.interfaces.sync.NsClient -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.JsonHelper.safeGetString import info.nightscout.interfaces.utils.JsonHelper.safeGetStringAllowNull import info.nightscout.interfaces.workflow.WorkerClasses import info.nightscout.plugins.sync.R -import info.nightscout.interfaces.nsclient.StoreDataForDb import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus import info.nightscout.plugins.sync.nsShared.events.EventNSClientUpdateGUI @@ -90,7 +89,7 @@ class NSClientService : DaggerService(), NsClient.NSClientService { @Inject lateinit var dataWorkerStorage: DataWorkerStorage @Inject lateinit var dataSyncSelector: DataSyncSelector @Inject lateinit var repository: AppRepository - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var workerClasses: WorkerClasses companion object { @@ -669,7 +668,7 @@ class NSClientService : DaggerService(), NsClient.NSClientService { val defaultVal = config.NSCLIENT if (sp.getBoolean(R.string.key_ns_announcements, defaultVal)) { val nsAlarm = NSAlarm(announcement) - activityNames.addNotificationWithAction(injector, nsAlarm) + uiInteraction.addNotificationWithAction(injector, nsAlarm) rxBus.send(EventNSClientNewLog("ANNOUNCEMENT", safeGetString(announcement, "message", "received"))) aapsLogger.debug(LTag.NSCLIENT, announcement.toString()) } @@ -681,7 +680,7 @@ class NSClientService : DaggerService(), NsClient.NSClientService { val snoozedTo = sp.getLong(R.string.key_snoozed_to, 0L) if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) { val nsAlarm = NSAlarm(alarm) - activityNames.addNotificationWithAction(injector, nsAlarm) + uiInteraction.addNotificationWithAction(injector, nsAlarm) } rxBus.send(EventNSClientNewLog("ALARM", safeGetString(alarm, "message", "received"))) aapsLogger.debug(LTag.NSCLIENT, alarm.toString()) @@ -694,7 +693,7 @@ class NSClientService : DaggerService(), NsClient.NSClientService { val snoozedTo = sp.getLong(R.string.key_snoozed_to, 0L) if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) { val nsAlarm = NSAlarm(alarm) - activityNames.addNotificationWithAction(injector, nsAlarm) + uiInteraction.addNotificationWithAction(injector, nsAlarm) } rxBus.send(EventNSClientNewLog("URGENTALARM", safeGetString(alarm, "message", "received"))) aapsLogger.debug(LTag.NSCLIENT, alarm.toString()) diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt index 5a9bfcb074..c53dc07ab3 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt @@ -21,7 +21,7 @@ import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.sync.NsClient import info.nightscout.interfaces.sync.Sync -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.nsShared.NSClientFragment @@ -71,7 +71,7 @@ class NSClientV3Plugin @Inject constructor( private val nsClientReceiverDelegate: NsClientReceiverDelegate, private val config: Config, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : NsClient, Sync, PluginBase( PluginDescription() .mainType(PluginType.SYNC) @@ -225,7 +225,7 @@ class NSClientV3Plugin @Inject constructor( } return HtmlHelper.fromHtml(newTextLog.toString()) } catch (e: OutOfMemoryError) { - activityNames.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error) + uiInteraction.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error) } return HtmlHelper.fromHtml("") } diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/tidepool/TidepoolPlugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/tidepool/TidepoolPlugin.kt index da382f6e50..03a4a94e8b 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/tidepool/TidepoolPlugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/tidepool/TidepoolPlugin.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.sync.Sync -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.tidepool.comm.TidepoolUploader @@ -51,7 +51,7 @@ class TidepoolPlugin @Inject constructor( private val sp: SP, private val rateLimit: RateLimit, private val receiverStatusStore: ReceiverStatusStore, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : Sync, PluginBase( PluginDescription() .mainType(PluginType.SYNC) @@ -172,7 +172,7 @@ class TidepoolPlugin @Inject constructor( } textLog = HtmlHelper.fromHtml(newTextLog.toString()) } catch (e: OutOfMemoryError) { - activityNames.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error) + uiInteraction.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error) } } diff --git a/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java index b946c8fff9..33a6dc18a2 100644 --- a/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java @@ -37,7 +37,7 @@ import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.CommandQueue; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.pump.combo.events.EventComboPumpUpdateGUI; import info.nightscout.pump.combo.ruffyscripter.BasalProfile; import info.nightscout.pump.combo.ruffyscripter.BolusProgressReporter; @@ -95,7 +95,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { private final PumpSync pumpSync; private final DateUtil dateUtil; private final RuffyCommands ruffyScripter; - private final ActivityNames activityNames; + private final UiInteraction uiInteraction; private final static PumpDescription pumpDescription = new PumpDescription(); @@ -151,7 +151,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { PumpSync pumpSync, DateUtil dateUtil, RuffyScripter ruffyScripter, - ActivityNames activitynames + UiInteraction activitynames ) { super(new PluginDescription() .mainType(PluginType.PUMP) @@ -170,7 +170,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { this.pumpSync = pumpSync; this.dateUtil = dateUtil; this.ruffyScripter = ruffyScripter; - this.activityNames = activitynames; + this.uiInteraction = activitynames; pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO); } @@ -262,7 +262,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // note that this should not happen anymore since the queue is present, which // issues a READSTATE when starting to issue commands which initializes the pump getAapsLogger().error("setNewBasalProfile not initialized"); - activityNames.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT); + uiInteraction.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT); return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(R.string.pump_not_initialized_profile_not_set); } @@ -282,7 +282,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { CommandResult setResult = runCommand(getRh().gs(R.string.combo_activity_setting_basal_profile), 2, () -> ruffyScripter.setBasalProfile(requestedBasalProfile)); if (!setResult.success) { - activityNames.addNotification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT); + uiInteraction.addNotification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT); return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(R.string.failed_update_basal_profile); } @@ -292,7 +292,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); rxBus.send(new EventDismissNotification(Notification.FAILED_UPDATE_PROFILE)); //issue success notification - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60); return new PumpEnactResult(getInjector()).success(true).enacted(true); } @@ -366,7 +366,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // trigger a connect, which will update state and check history CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState); if (stateResult.invalidSetup) { - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_invalid_setup), Notification.URGENT); return; @@ -383,7 +383,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } if (stateResult.state.unsafeUsageDetected == PumpState.UNSUPPORTED_BASAL_RATE_PROFILE) { - activityNames.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_force_disabled_notification), Notification.URGENT, R.raw.alarm); return; @@ -406,7 +406,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { long lastBolusTimestamp = recentBoluses.get(0).timestamp; long now = System.currentTimeMillis(); if (lastBolusTimestamp < now - 24 * 60 * 60 * 1000 || lastBolusTimestamp > now + 5 * 60 * 1000) { - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_check_date), Notification.URGENT); } @@ -606,7 +606,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // check pump bolus record has a sane timestamp long now = System.currentTimeMillis(); if (lastPumpBolus.timestamp < now - 10 * 60 * 1000 || lastPumpBolus.timestamp > now + 10 * 60 * 1000) { - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_suspious_bolus_time), Notification.URGENT); } @@ -675,7 +675,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } catch (Exception e) { getAapsLogger().error("Adding treatment record failed", e); if (detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB) { - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_error_updating_treatment_record), Notification.URGENT); } return false; @@ -898,7 +898,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { pump.lastSuccessfulCmdTime = System.currentTimeMillis(); if (validBasalRateProfileSelectedOnPump && commandResult.state.unsafeUsageDetected == PumpState.UNSUPPORTED_BASAL_RATE_PROFILE) { setValidBasalRateProfileSelectedOnPump(false); - activityNames.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_force_disabled_notification), Notification.URGENT, R.raw.alarm); commandQueue.cancelTempBasal(true, null); @@ -947,7 +947,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // so update the var with it, so the check routines below can work on it preCheckResult = alertConfirmationResult; } else if (activeAlert.errorCode != null) { - activityNames.addNotificationValidTo(Notification.COMBO_PUMP_ALARM, dateUtil.now(), + uiInteraction.addNotificationValidTo(Notification.COMBO_PUMP_ALARM, dateUtil.now(), getRh().gs(R.string.combo_is_in_error_state, activeAlert.errorCode, activeAlert.message), Notification.URGENT, 0); return preCheckResult.success(false); } @@ -1011,10 +1011,10 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { CommandResult readBasalResult = runCommand(getRh().gs(R.string.combo_actvity_reading_basal_profile), 2, ruffyScripter::readBasalProfile); if (readBasalResult.success) { pump.basalProfile = readBasalResult.basalProfile; - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_warning_pump_basal_rate_changed), Notification.NORMAL); } else { - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_error_failure_reading_changed_basal_rate), Notification.URGENT); } } @@ -1029,10 +1029,10 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // time couldn't be read (e.g. a warning is displayed on the menu , hiding the time field) } else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 10 * 60 * 1000) { getAapsLogger().debug(LTag.PUMP, "Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")"); - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.URGENT); + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.URGENT); } else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 3 * 60 * 1000) { getAapsLogger().debug(LTag.PUMP, "Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")"); - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.NORMAL); + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.NORMAL); } } @@ -1051,7 +1051,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } else if (activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED) { text = getRh().gs(R.string.combo_pump_tbr_cancelled_warrning); } - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, text, Notification.NORMAL); + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, text, Notification.NORMAL); } private void checkForUnsafeUsage(CommandResult commandResult) { @@ -1070,7 +1070,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { if (lastViolation > 0) { lowSuspendOnlyLoopEnforcedUntil = lastViolation + 6 * 60 * 60 * 1000; if (lowSuspendOnlyLoopEnforcedUntil > System.currentTimeMillis() && violationWarningRaisedForBolusAt != lowSuspendOnlyLoopEnforcedUntil) { - activityNames.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, + uiInteraction.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_low_suspend_forced_notification), Notification.URGENT, R.raw.alarm); violationWarningRaisedForBolusAt = lowSuspendOnlyLoopEnforcedUntil; @@ -1240,7 +1240,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { HashSet bolusSet = new HashSet<>(historyResult.history.bolusHistory); if (bolusSet.size() != historyResult.history.bolusHistory.size()) { getAapsLogger().debug(LTag.PUMP, "Bolus with same amount within the same minute imported. Only one will make it to the DB."); - activityNames.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string. + uiInteraction.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string. combo_error_multiple_boluses_with_identical_timestamp), Notification.URGENT); } diff --git a/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt index 8783621810..046d5452fd 100644 --- a/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt +++ b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt @@ -10,7 +10,7 @@ import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.pump.PumpEnactResult import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.combo.ruffyscripter.RuffyScripter import info.nightscout.pump.combo.ruffyscripter.history.Bolus import info.nightscout.rx.bus.RxBus @@ -33,7 +33,7 @@ class ComboPluginTest : TestBase() { @Mock lateinit var dateUtil: DateUtil @Mock lateinit var ruffyScripter: RuffyScripter @Mock lateinit var context: Context - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction private val injector = HasAndroidInjector { AndroidInjector { @@ -49,7 +49,7 @@ class ComboPluginTest : TestBase() { fun prepareMocks() { `when`(rh.gs(R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump") `when`(context.getString(R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump") - comboPlugin = ComboPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames) + comboPlugin = ComboPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, uiInteraction) } @Test diff --git a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt index 5c0326d00c..75fac0b0c2 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt @@ -41,7 +41,7 @@ import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.TimeChangeType import info.nightscout.rx.bus.RxBus @@ -108,7 +108,7 @@ class ComboV2Plugin @Inject constructor ( private val sp: SP, private val pumpSync: PumpSync, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : PumpPluginBase( PluginDescription() @@ -540,7 +540,7 @@ class ComboV2Plugin @Inject constructor ( val activeBasalProfileNumber = it.statusFlow.value?.activeBasalProfileNumber aapsLogger.debug(LTag.PUMP, "Active basal profile number: $activeBasalProfileNumber") if ((activeBasalProfileNumber != null) && (activeBasalProfileNumber != 1)) { - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_PUMP_ALARM, text = rh.gs(R.string.combov2_incorrect_active_basal_profile, activeBasalProfileNumber), level = Notification.URGENT @@ -574,7 +574,7 @@ class ComboV2Plugin @Inject constructor ( notifyAboutComboAlert(e.alertScreenContent) forciblyDisconnectDueToError = true } catch (e: Exception) { - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_PUMP_ALARM, text = rh.gs(R.string.combov2_connection_error, e.message), level = Notification.URGENT @@ -665,7 +665,7 @@ class ComboV2Plugin @Inject constructor ( if (!isInitialized()) { aapsLogger.error(LTag.PUMP, "Cannot set profile since driver is not initialized") - activityNames.addNotification( + uiInteraction.addNotification( Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT @@ -694,7 +694,7 @@ class ComboV2Plugin @Inject constructor ( activeBasalProfile = requestedBasalProfile updateBaseBasalRateUI() - activityNames.addNotificationValidFor( + uiInteraction.addNotificationValidFor( Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, @@ -724,7 +724,7 @@ class ComboV2Plugin @Inject constructor ( } catch (e: Exception) { aapsLogger.error("Exception thrown during basal profile update: $e") - activityNames.addNotification( + uiInteraction.addNotification( Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT @@ -1699,7 +1699,7 @@ class ComboV2Plugin @Inject constructor ( when (event) { is ComboCtlPump.Event.BatteryLow -> { - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_PUMP_ALARM, text = rh.gs(R.string.combov2_battery_low_warning), level = Notification.NORMAL @@ -1707,7 +1707,7 @@ class ComboV2Plugin @Inject constructor ( } is ComboCtlPump.Event.ReservoirLow -> { - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_PUMP_ALARM, text = rh.gs(R.string.combov2_reservoir_low_warning), level = Notification.NORMAL @@ -1802,7 +1802,7 @@ class ComboV2Plugin @Inject constructor ( event.remainingTbrDurationInMinutes / 60, event.remainingTbrDurationInMinutes % 60 ) - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_UNKNOWN_TBR, text = rh.gs( R.string.combov2_unknown_tbr_detected, @@ -1954,7 +1954,7 @@ class ComboV2Plugin @Inject constructor ( // that the Combo is currently suspended, otherwise this // only shows up in the Combo fragment. if (newState == DriverState.Suspended) { - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_PUMP_SUSPENDED, text = rh.gs(R.string.combov2_pump_is_suspended), level = Notification.NORMAL @@ -1995,7 +1995,7 @@ class ComboV2Plugin @Inject constructor ( private fun unpairDueToPumpDataError() { disconnectInternal(forceDisconnect = true) - activityNames.addNotificationValidTo( + uiInteraction.addNotificationValidTo( id = Notification.PUMP_ERROR, date = dateUtil.now(), text = rh.gs(R.string.combov2_cannot_access_pump_data), @@ -2081,7 +2081,7 @@ class ComboV2Plugin @Inject constructor ( } private fun notifyAboutComboAlert(alert: AlertScreenContent) { - activityNames.addNotification( + uiInteraction.addNotification( Notification.COMBO_PUMP_ALARM, text = "${rh.gs(R.string.combov2_combo_alert)}: ${getAlertDescription(alert)}", level = if (alert is AlertScreenContent.Warning) Notification.NORMAL else Notification.URGENT diff --git a/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt b/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt index 79513653ac..6dfc904c75 100644 --- a/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt +++ b/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt @@ -19,7 +19,7 @@ import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.WarnColors import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.userEntry.UserEntryMapper.Action import info.nightscout.interfaces.userEntry.UserEntryMapper.Sources import info.nightscout.pump.dana.activities.DanaHistoryActivity @@ -58,7 +58,7 @@ class DanaFragment : DaggerFragment() { @Inject lateinit var dateUtil: DateUtil @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var uel: UserEntryLogger - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var disposable: CompositeDisposable = CompositeDisposable() @@ -97,15 +97,15 @@ class DanaFragment : DaggerFragment() { ?: return@setOnClickListener val profileName = danaPump.createConvertedProfile()?.getDefaultProfileName() ?: return@setOnClickListener - activityNames.runProfileViewerDialog( + uiInteraction.runProfileViewerDialog( fragmentManager = childFragmentManager, time = dateUtil.now(), - mode = ActivityNames.Mode.CUSTOM_PROFILE, + mode = UiInteraction.Mode.CUSTOM_PROFILE, customProfile = profile.toString(), customProfileName = profileName ) } - binding.stats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) } + binding.stats.setOnClickListener { startActivity(Intent(context, uiInteraction.tddStatsActivity)) } binding.userOptions.setOnClickListener { startActivity(Intent(context, DanaUserOptionsActivity::class.java)) } binding.btConnectionLayout.setOnClickListener { aapsLogger.debug(LTag.PUMP, "Clicked connect to pump") diff --git a/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt b/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt index 81cd3292db..9f58b1c8c3 100644 --- a/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt +++ b/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt @@ -9,7 +9,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.R import info.nightscout.pump.dana.databinding.DanarUserOptionsActivityBinding @@ -37,7 +37,7 @@ class DanaUserOptionsActivity : DaggerAppCompatActivity() { @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private val disposable = CompositeDisposable() @@ -158,7 +158,7 @@ class DanaUserOptionsActivity : DaggerAppCompatActivity() { commandQueue.setUserOptions(object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.pumperror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.pumperror), R.raw.boluserror) } } }) 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 bb7215cbb8..f50c942a17 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 @@ -20,7 +20,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.PumpSync.TemporaryBasalType import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.Round import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase @@ -56,9 +56,9 @@ class DanaRKoreanPlugin @Inject constructor( dateUtil: DateUtil, private val fabricPrivacy: FabricPrivacy, pumpSync: PumpSync, - activityNames: ActivityNames, + uiInteraction: UiInteraction, danaHistoryDatabase: DanaHistoryDatabase -) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase) { +) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, uiInteraction, danaHistoryDatabase) { init { pluginDescription.description(R.string.description_pump_dana_r_korean) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt index 4ceca9911b..79de89f009 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt @@ -31,12 +31,12 @@ class MsgInitConnStatusBasic_k( aapsLogger.debug(LTag.PUMPCOMM, "easyUIMode: $easyUIMode") aapsLogger.debug(LTag.PUMPCOMM, "Pump password: " + danaPump.password) if (danaPump.isEasyModeEnabled) { - activityNames.addNotification(Notification.EASY_MODE_ENABLED, rh.gs(R.string.danar_disableeasymode), Notification.URGENT) + uiInteraction.addNotification(Notification.EASY_MODE_ENABLED, rh.gs(R.string.danar_disableeasymode), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.EASY_MODE_ENABLED)) } if (!danaPump.isPasswordOK) { - activityNames.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT) + uiInteraction.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.WRONG_PUMP_PASSWORD)) } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt index cb537b52eb..d17ab7ae7c 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt @@ -31,7 +31,7 @@ class MsgInitConnStatusBolus_k( aapsLogger.debug(LTag.PUMPCOMM, "Bolus max: " + danaPump.maxBolus) aapsLogger.debug(LTag.PUMPCOMM, "Delivery status: $deliveryStatus") if (!danaPump.isExtendedBolusEnabled) { - activityNames.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT) + uiInteraction.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED)) } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt index 0ca9f01d22..b0ce830045 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt @@ -19,7 +19,7 @@ class MsgInitConnStatusTime_k( override fun handleMessage(bytes: ByteArray) { if (bytes.size - 10 < 10) { - activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) + uiInteraction.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) danaRKoreanPlugin.disconnect("Wrong Model") aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to export DanaR") danaRKoreanPlugin.setPluginEnabled(PluginType.PUMP, false) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index 9860b593f5..04d2882a42 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -37,7 +37,6 @@ import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService; import info.nightscout.interfaces.Constants; import info.nightscout.interfaces.constraints.Constraints; import info.nightscout.interfaces.notifications.Notification; -import info.nightscout.interfaces.plugin.ActivePlugin; import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.profile.ProfileFunction; import info.nightscout.interfaces.pump.BolusProgressData; @@ -46,7 +45,7 @@ import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.Command; import info.nightscout.interfaces.queue.CommandQueue; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.pump.dana.DanaPump; import info.nightscout.pump.dana.events.EventDanaRNewStatus; import info.nightscout.rx.bus.RxBus; @@ -70,7 +69,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { @Inject DanaRKoreanPlugin danaRKoreanPlugin; @Inject CommandQueue commandQueue; @Inject MessageHashTableRKorean messageHashTableRKorean; - @Inject ActivityNames activityNames; + @Inject UiInteraction uiInteraction; @Inject ProfileFunction profileFunction; @Inject PumpSync pumpSync; @Inject DateUtil dateUtil; @@ -199,7 +198,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) { aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits()); if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) { - activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT); + uiInteraction.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT); pumpSync.insertAnnouncement(rh.gs(R.string.approachingdailylimit) + ": " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits() + "U", null, PumpType.DANA_R_KOREAN, danaRKoreanPlugin.serialNumber()); lastApproachingDailyLimit = System.currentTimeMillis(); } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index a764fac26a..b42900a855 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -27,7 +27,7 @@ import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.TemporaryBasalStorage; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.CommandQueue; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.interfaces.utils.Round; import info.nightscout.pump.dana.DanaPump; import info.nightscout.pump.dana.database.DanaHistoryDatabase; @@ -75,10 +75,10 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { DateUtil dateUtil, FabricPrivacy fabricPrivacy, PumpSync pumpSync, - ActivityNames activityNames, + UiInteraction uiInteraction, DanaHistoryDatabase danaHistoryDatabase ) { - super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase); + super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, uiInteraction, danaHistoryDatabase); this.aapsLogger = aapsLogger; this.context = context; this.rh = rh; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt index dbbf6ab6eb..84145843be 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt @@ -25,7 +25,7 @@ class MsgCheckValue_v2( danaPump.protocol = intFromBuff(bytes, 1, 1) danaPump.productCode = intFromBuff(bytes, 2, 1) if (danaPump.hwModel != DanaPump.EXPORT_MODEL) { - activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) + uiInteraction.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) danaRPlugin.disconnect("Wrong Model") aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to Korean DanaR") danaRKoreanPlugin.setPluginEnabled(PluginType.PUMP, true) @@ -41,7 +41,7 @@ class MsgCheckValue_v2( return } if (danaPump.protocol != 2) { - activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) + uiInteraction.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) danaRKoreanPlugin.disconnect("Wrong Model") aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to non APS DanaR") danaRv2Plugin.setPluginEnabled(PluginType.PUMP, false) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java index 190ec91b2e..5806cee870 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java @@ -59,7 +59,7 @@ import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.Callback; import info.nightscout.interfaces.queue.Command; import info.nightscout.interfaces.queue.CommandQueue; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.pump.dana.DanaPump; import info.nightscout.pump.dana.events.EventDanaRNewStatus; import info.nightscout.rx.bus.RxBus; @@ -90,7 +90,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { @Inject PumpSync pumpSync; @Inject SP sp; @Inject DateUtil dateUtil; - @Inject ActivityNames activityNames; + @Inject UiInteraction uiInteraction; public DanaRv2ExecutionService() { } @@ -194,7 +194,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { if (Math.abs(timeDiff) > 60 * 60 * 1.5) { aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds - large difference"); //If time-diff is very large, warn user until we can synchronize history readings properly - activityNames.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error); + uiInteraction.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error); //deinitialize pump danaPump.reset(); @@ -235,7 +235,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) { aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits()); if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) { - activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT); + uiInteraction.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT); pumpSync.insertAnnouncement(rh.gs(R.string.approachingdailylimit) + ": " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits() + "U", null, PumpType.DANA_R_KOREAN, danaRKoreanPlugin.serialNumber()); lastApproachingDailyLimit = System.currentTimeMillis(); } @@ -349,7 +349,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { mSerialIOThread.sendMessage(msgSetHistoryEntry_v2); danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs()); if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.getFailed()) - activityNames.runAlarm(rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror); + uiInteraction.runAlarm(rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror); } final long bolusStart = System.currentTimeMillis(); diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index 52cdcbf583..0334b7ac63 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -23,7 +23,7 @@ import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; import info.nightscout.interfaces.queue.CommandQueue; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.interfaces.utils.DecimalFormatter; import info.nightscout.interfaces.utils.Round; import info.nightscout.pump.dana.DanaFragment; @@ -62,7 +62,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump protected DateUtil dateUtil; protected AapsSchedulers aapsSchedulers; protected PumpSync pumpSync; - protected ActivityNames activityNames; + protected UiInteraction uiInteraction; protected DanaHistoryDatabase danaHistoryDatabase; protected AbstractDanaRPlugin( HasAndroidInjector injector, @@ -77,7 +77,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump SP sp, DateUtil dateUtil, PumpSync pumpSync, - ActivityNames activityNames, + UiInteraction uiInteraction, DanaHistoryDatabase danaHistoryDatabase ) { super(new PluginDescription() @@ -98,7 +98,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump this.dateUtil = dateUtil; this.aapsSchedulers = aapsSchedulers; this.pumpSync = pumpSync; - this.activityNames = activityNames; + this.uiInteraction = uiInteraction; this.danaHistoryDatabase = danaHistoryDatabase; } @@ -150,19 +150,19 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump } if (!isInitialized()) { getAapsLogger().error("setNewBasalProfile not initialized"); - activityNames.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT); + uiInteraction.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT); result.comment(R.string.pump_not_initialized_profile_not_set); return result; } else { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); } if (!sExecutionService.updateBasalsInPump(profile)) { - activityNames.addNotification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT); + uiInteraction.addNotification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT); result.comment(R.string.failed_update_basal_profile); } else { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); rxBus.send(new EventDismissNotification(Notification.FAILED_UPDATE_PROFILE)); - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60); + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60); result.success(true).enacted(true).comment("OK"); } return result; 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 d4158c0a73..6a79cf3393 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 @@ -23,7 +23,7 @@ import info.nightscout.interfaces.pump.PumpEnactResult; import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.CommandQueue; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.interfaces.utils.Round; import info.nightscout.pump.dana.DanaPump; import info.nightscout.pump.dana.database.DanaHistoryDatabase; @@ -65,10 +65,10 @@ public class DanaRPlugin extends AbstractDanaRPlugin { DateUtil dateUtil, FabricPrivacy fabricPrivacy, PumpSync pumpSync, - ActivityNames activityNames, + UiInteraction uiInteraction, DanaHistoryDatabase danaHistoryDatabase ) { - super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase); + super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, uiInteraction, danaHistoryDatabase); this.aapsLogger = aapsLogger; this.context = context; this.rh = rh; diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt index 6471975bd5..a4e81c0bbf 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt @@ -13,7 +13,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryRecordDao import info.nightscout.rx.bus.RxBus @@ -51,7 +51,7 @@ open class MessageBase(injector: HasAndroidInjector) { @Inject lateinit var constraintChecker: Constraints @Inject lateinit var pumpSync: PumpSync @Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction var injector: HasAndroidInjector var buffer = ByteArray(512) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt index c310c3dbc8..41d4b14eb9 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt @@ -30,7 +30,7 @@ class MsgInitConnStatusBolus( aapsLogger.debug(LTag.PUMPCOMM, "Bolus increment: " + danaPump.bolusStep) aapsLogger.debug(LTag.PUMPCOMM, "Bolus max: " + danaPump.maxBolus) if (!danaPump.isExtendedBolusEnabled) { - activityNames.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT) + uiInteraction.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED)) } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt index 685f6ef3e9..21a73fbee8 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt @@ -33,7 +33,7 @@ class MsgInitConnStatusOption( failed = true } if (!danaPump.isPasswordOK) { - activityNames.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT) + uiInteraction.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.WRONG_PUMP_PASSWORD)) } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt index 2473c11355..d6b91386b8 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt @@ -18,7 +18,7 @@ class MsgInitConnStatusTime( override fun handleMessage(bytes: ByteArray) { if (bytes.size - 10 > 7) { - activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) + uiInteraction.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL) danaRPlugin.disconnect("Wrong Model") aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to Korean DanaR") danaRKoreanPlugin.setPluginEnabled(PluginType.PUMP, true) diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt index d07a054c2f..568a2610b5 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt @@ -26,11 +26,11 @@ class MsgSetBasalProfile( if (result != 1) { failed = true aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result FAILED!!!") - activityNames.addNotification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT) + uiInteraction.addNotification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT) } else { failed = false aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result") - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) } } } \ No newline at end of file diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt index 6737ae9f2f..8897e5b094 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt @@ -24,11 +24,11 @@ class MsgSetSingleBasalProfile( if (result != 1) { failed = true aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result FAILED!!!") - activityNames.addNotification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT) + uiInteraction.addNotification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT) } else { failed = false aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result") - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) } } } \ No newline at end of file diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt index 9c6c2c20c8..b92d5195a6 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt @@ -33,12 +33,12 @@ class MsgSettingMeal( danaPump.basalStep = 0.01 } if (danaPump.basalStep != 0.01) { - activityNames.addNotification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT) + uiInteraction.addNotification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.WRONG_BASAL_STEP)) } if (danaPump.isConfigUD) { - activityNames.addNotification(Notification.UD_MODE_ENABLED, rh.gs(R.string.danar_switchtouhmode), Notification.URGENT) + uiInteraction.addNotification(Notification.UD_MODE_ENABLED, rh.gs(R.string.danar_switchtouhmode), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.UD_MODE_ENABLED)) } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java index 308e09e2c4..6001c7952d 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java @@ -44,7 +44,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin; import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.pump.PumpEnactResult; import info.nightscout.interfaces.pump.PumpSync; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.pump.dana.DanaPump; import info.nightscout.pump.dana.comm.RecordTypes; import info.nightscout.rx.AapsSchedulers; @@ -77,7 +77,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { @Inject AapsSchedulers aapsSchedulers; @Inject PumpSync pumpSync; @Inject ActivePlugin activePlugin; - @Inject ActivityNames activityNames; + @Inject UiInteraction uiInteraction; private final CompositeDisposable disposable = new CompositeDisposable(); @@ -307,7 +307,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { if (pumpState.getTemporaryBasal().getRate() != danaPump.getTempBasalPercent() || Math.abs(pumpState.getTemporaryBasal().getTimestamp() - danaPump.getTempBasalStart()) > 10000 ) { // Close current temp basal - activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); + uiInteraction.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); aapsLogger.error(LTag.PUMP, "Different temporary basal found running AAPS: " + (pumpState.getTemporaryBasal() + " DanaPump " + danaPump.temporaryBasalToString())); pumpSync.syncTemporaryBasalWithPumpId( danaPump.getTempBasalStart(), @@ -326,7 +326,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { activePlugin.getActivePump().model(), activePlugin.getActivePump().serialNumber() ); - activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); + uiInteraction.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); aapsLogger.error(LTag.PUMP, "Temporary basal should not be running. Sending stop to AAPS"); } } else { @@ -340,7 +340,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { activePlugin.getActivePump().model(), activePlugin.getActivePump().serialNumber() ); - activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); + uiInteraction.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); aapsLogger.error(LTag.PUMP, "Temporary basal should be running: DanaPump " + danaPump.temporaryBasalToString()); } } @@ -350,7 +350,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { if (pumpState.getExtendedBolus().getRate() != danaPump.getExtendedBolusAbsoluteRate() || Math.abs(pumpState.getExtendedBolus().getTimestamp() - danaPump.getExtendedBolusStart()) > 10000 ) { // Close current extended - activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); + uiInteraction.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); aapsLogger.error(LTag.PUMP, "Different extended bolus found running AAPS: " + (pumpState.getExtendedBolus() + " DanaPump " + danaPump.extendedBolusToString())); pumpSync.syncExtendedBolusWithPumpId( danaPump.getExtendedBolusStart(), @@ -369,12 +369,12 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { activePlugin.getActivePump().model(), activePlugin.getActivePump().serialNumber() ); - activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); + uiInteraction.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); aapsLogger.error(LTag.PUMP, "Extended bolus should not be running. Sending stop to AAPS"); } } else { if (danaPump.isExtendedInProgress()) { // Create new - activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); + uiInteraction.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT); aapsLogger.error(LTag.PUMP, "Extended bolus should not be running: DanaPump " + danaPump.extendedBolusToString()); pumpSync.syncExtendedBolusWithPumpId( danaPump.getExtendedBolusStart(), diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java index 76e8512a35..2525650af6 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java @@ -203,7 +203,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) { aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits()); if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) { - activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT); + uiInteraction.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT); pumpSync.insertAnnouncement(rh.gs(R.string.approachingdailylimit) + ": " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits() + "U", null, PumpType.DANA_R_KOREAN, danaRKoreanPlugin.serialNumber()); lastApproachingDailyLimit = System.currentTimeMillis(); } diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index 1ce4010a4b..a277b21e68 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileInstantiator import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP @@ -29,7 +29,7 @@ class DanaRPluginTest : TestBaseWithProfile() { @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var pumpSync: PumpSync @Mock lateinit var profileInstantiator: ProfileInstantiator - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase lateinit var danaPump: DanaPump @@ -49,7 +49,7 @@ class DanaRPluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, - activityNames, danaHistoryDatabase) + uiInteraction, danaHistoryDatabase) } @Test @Throws(Exception::class) diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index fce79c3b94..5b04925591 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -16,7 +16,7 @@ import info.nightscout.interfaces.profile.ProfileInstantiator import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryRecordDao import info.nightscout.rx.bus.RxBus @@ -47,7 +47,7 @@ open class DanaRTestBase : TestBase() { @Mock lateinit var pumpSync: PumpSync @Mock lateinit var danaHistoryRecordDao: DanaHistoryRecordDao @Mock lateinit var profileInstantiator: ProfileInstantiator - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction private lateinit var testPumpPlugin: TestPumpPlugin @@ -79,7 +79,7 @@ open class DanaRTestBase : TestBase() { it.commandQueue = commandQueue it.pumpSync = pumpSync it.danaHistoryRecordDao = danaHistoryRecordDao - it.activityNames = activityNames + it.uiInteraction = uiInteraction } } } diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index 0cdc52f9f3..fcd254b47d 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileInstantiator import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP @@ -29,7 +29,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var pumpSync: PumpSync @Mock lateinit var profileInstantiator: ProfileInstantiator - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase lateinit var danaPump: DanaPump @@ -49,7 +49,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, - pumpSync, activityNames, danaHistoryDatabase) + pumpSync, uiInteraction, danaHistoryDatabase) } @Test @Throws(Exception::class) diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index 704f0f0040..2355da4324 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -14,7 +14,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP @@ -32,7 +32,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() { @Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage @Mock lateinit var pumpSync: PumpSync @Mock lateinit var profileInstantiator: ProfileInstantiator - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase lateinit var danaPump: DanaPump @@ -51,8 +51,8 @@ class DanaRv2PluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) - danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump,detailedBolusInfoStorage, - temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames, danaHistoryDatabase) + danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, + temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, uiInteraction, danaHistoryDatabase) } @Test diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt index 3c68974e34..fe283ceaad 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/DanaRSPlugin.kt @@ -30,7 +30,7 @@ import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.Round import info.nightscout.pump.dana.DanaFragment @@ -78,7 +78,7 @@ class DanaRSPlugin @Inject constructor( private val temporaryBasalStorage: TemporaryBasalStorage, private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, private val danaHistoryDatabase: DanaHistoryDatabase ) : PumpPluginBase( PluginDescription() @@ -233,20 +233,20 @@ class DanaRSPlugin @Inject constructor( val result = PumpEnactResult(injector) if (!isInitialized()) { aapsLogger.error("setNewBasalProfile not initialized") - activityNames.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT) + uiInteraction.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT) result.comment = rh.gs(R.string.pump_not_initialized_profile_not_set) return result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) } return if (danaRSService?.updateBasalsInPump(profile) != true) { - activityNames.addNotification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT) + uiInteraction.addNotification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT) result.comment = rh.gs(R.string.failed_update_basal_profile) result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) rxBus.send(EventDismissNotification(Notification.FAILED_UPDATE_PROFILE)) - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) result.success = true result.enacted = true result.comment = "OK" diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacket.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacket.kt index 006963ef90..d16bae5546 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacket.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacket.kt @@ -2,7 +2,7 @@ package info.nightscout.pump.danars.comm import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.encryption.BleEncryption -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.utils.DateUtil import org.joda.time.DateTime @@ -14,7 +14,7 @@ open class DanaRSPacket(protected var injector: HasAndroidInjector) { @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var dateUtil: DateUtil - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction var isReceived = false private set diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalGetBasalRate.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalGetBasalRate.kt index 45e56e01c6..801bda229e 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalGetBasalRate.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalGetBasalRate.kt @@ -47,7 +47,7 @@ class DanaRSPacketBasalGetBasalRate( aapsLogger.debug(LTag.PUMPCOMM, "Basal " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + danaPump.pumpProfiles!![danaPump.activeProfile][index]) if (danaPump.basalStep != 0.01) { failed = true - activityNames.addNotification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT) + uiInteraction.addNotification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT) } else { rxBus.send(EventDismissNotification(Notification.WRONG_BASAL_STEP)) } diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBolusGetBolusOption.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBolusGetBolusOption.kt index 0235255375..0bca1ce163 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBolusGetBolusOption.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketBolusGetBolusOption.kt @@ -83,7 +83,7 @@ class DanaRSPacketBolusGetBolusOption( dataSize = 1 val missedBolus04EndMin = byteArrayToInt(getBytes(data, dataIndex, dataSize)) if (!danaPump.isExtendedBolusEnabled) { - activityNames.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT) + uiInteraction.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT) failed = true } else { rxBus.send(EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED)) diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketGeneralGetPumpCheck.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketGeneralGetPumpCheck.kt index 7ee97ad49d..5c2cca171c 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketGeneralGetPumpCheck.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketGeneralGetPumpCheck.kt @@ -42,7 +42,7 @@ class DanaRSPacketGeneralGetPumpCheck( aapsLogger.debug(LTag.PUMPCOMM, "Protocol: " + String.format("%02X ", danaPump.protocol)) aapsLogger.debug(LTag.PUMPCOMM, "Product Code: " + String.format("%02X ", danaPump.productCode)) if (danaPump.productCode < 2) { - activityNames.addNotification(Notification.UNSUPPORTED_FIRMWARE, rh.gs(R.string.unsupportedfirmware), Notification.URGENT) + uiInteraction.addNotification(Notification.UNSUPPORTED_FIRMWARE, rh.gs(R.string.unsupportedfirmware), Notification.URGENT) } } diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyAlarm.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyAlarm.kt index bbc9d99057..89e0f70de5 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyAlarm.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyAlarm.kt @@ -63,7 +63,7 @@ class DanaRSPacketNotifyAlarm( aapsLogger.debug(LTag.PUMPCOMM, "Error detected: $errorString") return } - activityNames.addNotification(Notification.USER_MESSAGE, errorString, Notification.URGENT) + uiInteraction.addNotification(Notification.USER_MESSAGE, errorString, Notification.URGENT) pumpSync.insertAnnouncement(errorString, null, danaPump.pumpType(), danaPump.serialNumber) } diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/services/BLEComm.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/services/BLEComm.kt index 75f2d85673..c99b5b4c9d 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/services/BLEComm.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/services/BLEComm.kt @@ -25,7 +25,7 @@ import info.nightscout.core.utils.notify import info.nightscout.core.utils.waitMillis import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.pump.PumpSync -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.danars.R import info.nightscout.pump.danars.activities.EnterPinActivity @@ -63,7 +63,7 @@ class BLEComm @Inject internal constructor( private val bleEncryption: BleEncryption, private val pumpSync: PumpSync, private val dateUtil: DateUtil, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) { companion object { @@ -514,7 +514,7 @@ class BLEComm @Inject internal constructor( private fun sendConnect() { val deviceName = connectDeviceName if (deviceName == null || deviceName == "") { - activityNames.addNotification(Notification.DEVICE_NOT_PAIRED, rh.gs(R.string.pairfirst), Notification.URGENT) + uiInteraction.addNotification(Notification.DEVICE_NOT_PAIRED, rh.gs(R.string.pairfirst), Notification.URGENT) return } val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK, null, deviceName) @@ -586,7 +586,7 @@ class BLEComm @Inject internal constructor( mSendQueue.clear() rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, rh.gs(R.string.pumperror))) pumpSync.insertAnnouncement(rh.gs(R.string.pumperror), null, danaPump.pumpType(), danaPump.serialNumber) - activityNames.addNotification(Notification.PUMP_ERROR, rh.gs(R.string.pumperror), Notification.URGENT) + uiInteraction.addNotification(Notification.PUMP_ERROR, rh.gs(R.string.pumperror), Notification.URGENT) // response BUSY: error status } else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'B'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'S'.code.toByte() && decryptedBuffer[5] == 'Y'.code.toByte()) { aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRSPacket.toHexString(decryptedBuffer)) @@ -598,7 +598,7 @@ class BLEComm @Inject internal constructor( mSendQueue.clear() rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, rh.gs(R.string.connection_error))) danaRSPlugin.clearPairing() - activityNames.addNotification(Notification.WRONG_SERIAL_NUMBER, rh.gs(R.string.password_cleared), Notification.URGENT) + uiInteraction.addNotification(Notification.WRONG_SERIAL_NUMBER, rh.gs(R.string.password_cleared), Notification.URGENT) } } @@ -688,7 +688,7 @@ class BLEComm @Inject internal constructor( aapsLogger.debug(LTag.PUMPBTCOMM, "Pump user password: " + danaPump.rsPassword) if (!danaPump.isRSPasswordOK) { aapsLogger.error(LTag.PUMPBTCOMM, "Wrong pump password") - activityNames.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT) + uiInteraction.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT) disconnect("WrongPassword") SystemClock.sleep(T.mins(1).msecs()) } else { diff --git a/pump/danars/src/main/java/info/nightscout/pump/danars/services/DanaRSService.kt b/pump/danars/src/main/java/info/nightscout/pump/danars/services/DanaRSService.kt index c2e672104c..03e921f8bf 100644 --- a/pump/danars/src/main/java/info/nightscout/pump/danars/services/DanaRSService.kt +++ b/pump/danars/src/main/java/info/nightscout/pump/danars/services/DanaRSService.kt @@ -21,7 +21,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.comm.RecordTypes import info.nightscout.pump.dana.events.EventDanaRNewStatus @@ -105,7 +105,7 @@ class DanaRSService : DaggerService() { @Inject lateinit var danaPump: DanaPump @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var constraintChecker: Constraints - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var bleComm: BLEComm @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var pumpSync: PumpSync @@ -199,7 +199,7 @@ class DanaRSService : DaggerService() { if (abs(timeDiff) > 60 * 60 * 1.5) { aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference") //If time-diff is very large, warn user until we can synchronize history readings properly - activityNames.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error) + uiInteraction.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error) //de-initialize pump danaPump.reset() @@ -240,7 +240,7 @@ class DanaRSService : DaggerService() { if (danaPump.dailyTotalUnits > danaPump.maxDailyTotalUnits * Constants.dailyLimitWarning) { aapsLogger.debug(LTag.PUMPCOMM, "Approaching daily limit: " + danaPump.dailyTotalUnits + "/" + danaPump.maxDailyTotalUnits) if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) { - activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT) + uiInteraction.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT) pumpSync.insertAnnouncement( rh.gs(R.string.approachingdailylimit) + ": " + danaPump.dailyTotalUnits + "/" + danaPump.maxDailyTotalUnits + "U", null, @@ -308,7 +308,7 @@ class DanaRSService : DaggerService() { sendMessage(msgSetHistoryEntryV2) danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs()) if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed) - activityNames.runAlarm(rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror) + uiInteraction.runAlarm(rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror) } val bolusStart = System.currentTimeMillis() if (insulin > 0) { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt index a9d9741088..7dd5899780 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt @@ -79,7 +79,7 @@ class DanaRSPluginTest : DanaRSTestBase() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames, + uiInteraction, danaHistoryDatabase ) } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt index 57a280d4b6..c2d7bba1fc 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.interfaces.profile.ProfileInstantiator -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.danars.comm.DanaRSPacket import info.nightscout.shared.sharedPreferences.SP @@ -17,7 +17,7 @@ open class DanaRSTestBase : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var profileInstantiator: ProfileInstantiator - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction val injector = HasAndroidInjector { AndroidInjector { } } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt index 52452fe72b..cc0b8e091d 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt @@ -15,7 +15,7 @@ class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() { it.rxBus = rxBus it.rh = rh it.danaPump = danaPump - it.activityNames = activityNames + it.uiInteraction = uiInteraction } } } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt index e85caa6880..fdf806d4e4 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt @@ -15,7 +15,7 @@ class DanaRsPacketBolusGetBolusOptionTest : DanaRSTestBase() { it.rxBus = rxBus it.rh = rh it.danaPump = danaPump - it.activityNames = activityNames + it.uiInteraction = uiInteraction } } } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index 6694eded09..b64134039e 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -73,7 +73,7 @@ class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames, + uiInteraction, danaHistoryDatabase ) Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt index fcec87cec9..7a2b853a59 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt @@ -15,7 +15,7 @@ class DanaRsPacketGeneralGetPumpCheckTest : DanaRSTestBase() { it.rxBus = rxBus it.rh = rh it.danaPump = danaPump - it.activityNames = activityNames + it.uiInteraction = uiInteraction } } } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt index 2a263d4d5c..115631bed5 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt @@ -20,7 +20,7 @@ class DanaRsPacketNotifyAlarmTest : DanaRSTestBase() { it.rh = rh it.pumpSync = pumpSync it.danaPump = danaPump - it.activityNames = activityNames + it.uiInteraction = uiInteraction } } } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index a3de175d13..c6a231682b 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -77,7 +77,7 @@ class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { temporaryBasalStorage, fabricPrivacy, dateUtil, - activityNames, + uiInteraction, danaHistoryDatabase ) danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt index 947038269f..0639dfed72 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt @@ -14,7 +14,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.Pump import info.nightscout.interfaces.pump.WarnColors import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.diaconn.activities.DiaconnG8HistoryActivity import info.nightscout.pump.diaconn.activities.DiaconnG8UserOptionsActivity import info.nightscout.pump.diaconn.databinding.DiaconnG8FragmentBinding @@ -49,7 +49,7 @@ class DiaconnG8Fragment : DaggerFragment() { @Inject lateinit var warnColors: WarnColors @Inject lateinit var dateUtil: DateUtil @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var disposable: CompositeDisposable = CompositeDisposable() @@ -78,7 +78,7 @@ class DiaconnG8Fragment : DaggerFragment() { super.onViewCreated(view, savedInstanceState) binding.history.setOnClickListener { startActivity(Intent(context, DiaconnG8HistoryActivity::class.java)) } - binding.stats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) } + binding.stats.setOnClickListener { startActivity(Intent(context, uiInteraction.tddStatsActivity)) } binding.userOptions.setOnClickListener { startActivity(Intent(context, DiaconnG8UserOptionsActivity::class.java)) } binding.btconnection.setOnClickListener { aapsLogger.debug(LTag.PUMP, "Clicked connect to pump") diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt index 7b55078a4f..4cfac2a873 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Plugin.kt @@ -33,7 +33,7 @@ import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.Round import info.nightscout.pump.diaconn.database.DiaconnHistoryDatabase @@ -77,7 +77,7 @@ class DiaconnG8Plugin @Inject constructor( private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil, private val aapsSchedulers: AapsSchedulers, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, private val diaconnHistoryDatabase: DiaconnHistoryDatabase ) : PumpPluginBase( PluginDescription() @@ -216,20 +216,20 @@ class DiaconnG8Plugin @Inject constructor( override fun setNewBasalProfile(profile: Profile): PumpEnactResult { val result = PumpEnactResult(injector) if (!isInitialized()) { - activityNames.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT) + uiInteraction.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT) result.comment = rh.gs(R.string.pump_not_initialized_profile_not_set) return result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) } return if (diaconnG8Service?.updateBasalsInPump(profile) != true) { - activityNames.addNotification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT) + uiInteraction.addNotification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT) result.comment = rh.gs(R.string.failed_update_basal_profile) result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) rxBus.send(EventDismissNotification(Notification.FAILED_UPDATE_PROFILE)) - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) result.success = true result.enacted = true result.comment = "OK" diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8UserOptionsActivity.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8UserOptionsActivity.kt index bccb6a4218..0cf4b1fb8b 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8UserOptionsActivity.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8UserOptionsActivity.kt @@ -11,7 +11,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.diaconn.DiaconnG8Pump import info.nightscout.pump.diaconn.R import info.nightscout.pump.diaconn.databinding.DiaconnG8UserOptionsActivityBinding @@ -31,7 +31,7 @@ class DiaconnG8UserOptionsActivity : DaggerAppCompatActivity() { @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var sp: SP - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var rh: ResourceHelper @@ -155,7 +155,7 @@ class DiaconnG8UserOptionsActivity : DaggerAppCompatActivity() { commandQueue.setUserOptions(object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.pumperror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.pumperror), R.raw.boluserror) } } }) diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/BLECommonService.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/BLECommonService.kt index 2ec428847d..8b9adf87ec 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/BLECommonService.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/BLECommonService.kt @@ -19,7 +19,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.utils.notify import info.nightscout.core.utils.waitMillis -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.diaconn.DiaconnG8Pump import info.nightscout.pump.diaconn.R import info.nightscout.pump.diaconn.packet.BatteryWarningReportPacket @@ -49,7 +49,7 @@ class BLECommonService @Inject internal constructor( private val diaconnG8ResponseMessageHashTable: DiaconnG8ResponseMessageHashTable, private val diaconnG8SettingResponseMessageHashTable: DiaconnG8SettingResponseMessageHashTable, private val diaconnG8Pump: DiaconnG8Pump, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) { companion object { @@ -338,20 +338,20 @@ class BLECommonService @Inject internal constructor( if (message is InjectionBlockReportPacket) { message.handleMessage(data) diaconnG8Pump.bolusBlocked = true - activityNames.runAlarm(rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror) + uiInteraction.runAlarm(rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror) return } // battery warning report if (message is BatteryWarningReportPacket) { message.handleMessage(data) - activityNames.runAlarm(rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror) + uiInteraction.runAlarm(rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror) return } // insulin lack warning report if (message is InsulinLackReportPacket) { message.handleMessage(data) - activityNames.runAlarm(rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror) + uiInteraction.runAlarm(rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror) return } diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/DiaconnG8Service.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/DiaconnG8Service.kt index c5a02c366a..3e27035ff7 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/DiaconnG8Service.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/service/DiaconnG8Service.kt @@ -21,7 +21,7 @@ import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.diaconn.DiaconnG8Plugin import info.nightscout.pump.diaconn.DiaconnG8Pump import info.nightscout.pump.diaconn.R @@ -100,7 +100,7 @@ class DiaconnG8Service : DaggerService() { @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var diaconnLogUploader: DiaconnLogUploader @Inject lateinit var diaconnHistoryRecordDao: DiaconnHistoryRecordDao - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private val disposable = CompositeDisposable() private val mBinder: IBinder = LocalBinder() @@ -212,7 +212,7 @@ class DiaconnG8Service : DaggerService() { if (abs(timeDiff) > 60 * 60 * 1.5) { aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference") //If time-diff is very large, warn user until we can synchronize history readings properly - activityNames.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error) + uiInteraction.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error) //de-initialize pump diaconnG8Pump.reset() @@ -244,7 +244,7 @@ class DiaconnG8Service : DaggerService() { if (diaconnG8Pump.dailyTotalUnits > diaconnG8Pump.maxDailyTotalUnits * Constants.dailyLimitWarning) { aapsLogger.debug(LTag.PUMPCOMM, "Approaching daily limit: " + diaconnG8Pump.dailyTotalUnits + "/" + diaconnG8Pump.maxDailyTotalUnits) if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) { - activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT) + uiInteraction.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT) pumpSync.insertAnnouncement( rh.gs(R.string.approachingdailylimit) + ": " + diaconnG8Pump.dailyTotalUnits + "/" + diaconnG8Pump.maxDailyTotalUnits + "U", null, diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt index 6ddb22808f..f331803b2a 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt @@ -26,7 +26,7 @@ import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.queue.CustomCommand -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.TimeChangeType import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus @@ -61,7 +61,7 @@ class EopatchPumpPlugin @Inject constructor( private val patchManager: IPatchManager, private val alarmManager: IAlarmManager, private val preferenceManager: IPreferenceManager, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) : PumpPluginBase( PluginDescription() .mainType(PluginType.PUMP) @@ -204,7 +204,7 @@ class EopatchPumpPlugin @Inject constructor( disposable.dispose() aapsLogger.info(LTag.PUMP, "Basal Profile was set: ${isSuccess ?: false}") if (isSuccess == true) { - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) return PumpEnactResult(injector).success(true).enacted(true) } else { return PumpEnactResult(injector) @@ -213,7 +213,7 @@ class EopatchPumpPlugin @Inject constructor( } else { preferenceManager.getNormalBasalManager().setNormalBasal(profile) preferenceManager.flushNormalBasalManager() - activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60) return PumpEnactResult(injector).success(true).enacted(true) } } diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt index 26306ebc54..14da626cbd 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/alarm/AlarmManager.kt @@ -22,7 +22,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger @@ -58,7 +58,7 @@ class AlarmManager @Inject constructor() : IAlarmManager { @Inject lateinit var sp: SP @Inject lateinit var context: Context @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var pm: IPreferenceManager @Inject lateinit var mAlarmRegistry: IAlarmRegistry @@ -156,7 +156,7 @@ class AlarmManager @Inject constructor() : IAlarmManager { val expireTimeString = SimpleDateFormat(resourceHelper.gs(R.string.date_format_yyyy_m_d_e_a_hh_mm_comma), Locale.US).format(expireTimeValue) alarmMsg = resourceHelper.gs(alarmCode.resId, expireTimeString) } - activityNames.addNotificationWithAction( + uiInteraction.addNotificationWithAction( id = Notification.EOELOW_PATCH_ALERTS + (alarmCode.aeCode + 10000), text = alarmMsg, level = Notification.URGENT, @@ -180,7 +180,7 @@ class AlarmManager @Inject constructor() : IAlarmManager { } updateState(alarmCode, AlarmState.HANDLE) } else { - activityNames.addNotification( + uiInteraction.addNotification( id = Notification.EOELOW_PATCH_ALERTS + (alarmCode.aeCode + 10000), text = alarmMsg, level = Notification.URGENT diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt index 229f1bfcf5..478101d5e0 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt @@ -17,7 +17,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager import info.nightscout.androidaps.plugins.pump.eopatch.databinding.DialogAlarmBinding import info.nightscout.androidaps.plugins.pump.eopatch.ui.AlarmHelperActivity import info.nightscout.core.ui.R -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger @@ -27,7 +27,7 @@ import javax.inject.Inject class AlarmDialog : DaggerDialogFragment() { - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var patchManager: IPatchManager @Inject lateinit var rxBus: RxBus @@ -158,10 +158,10 @@ class AlarmDialog : DaggerDialogFragment() { } private fun startAlarm(reason: String) { - if (sound != 0) activityNames.startAlarm(sound, reason) + if (sound != 0) uiInteraction.startAlarm(sound, reason) } private fun stopAlarm(reason: String) { - activityNames.stopAlarm(reason) + uiInteraction.stopAlarm(reason) } } diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt index 21cd8b87a1..16220039f3 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt @@ -54,7 +54,7 @@ import info.nightscout.interfaces.pump.actions.CustomActionType import info.nightscout.interfaces.pump.defs.ManufacturerType import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.TimeChangeType import info.nightscout.pump.common.data.PumpStatus import info.nightscout.pump.common.defs.PumpDriverState @@ -101,7 +101,7 @@ class MedtronicPumpPlugin @Inject constructor( private val medtronicHistoryData: MedtronicHistoryData, private val rileyLinkServiceData: RileyLinkServiceData, private val serviceTaskExecutor: ServiceTaskExecutor, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, dateUtil: DateUtil, aapsSchedulers: AapsSchedulers, pumpSync: PumpSync, @@ -577,7 +577,7 @@ class MedtronicPumpPlugin @Inject constructor( aapsLogger.info(LTag.PUMP, String.format(Locale.ENGLISH, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is %d s. Set time on pump.", timeDiff)) rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetRealTimeClock) if (clock.timeDifference == 0) { - activityNames.addNotificationValidFor(Notification.INSIGHT_DATE_TIME_UPDATED, rh.gs(R.string.pump_time_updated), Notification.INFO, 60) + uiInteraction.addNotificationValidFor(Notification.INSIGHT_DATE_TIME_UPDATED, rh.gs(R.string.pump_time_updated), Notification.INFO, 60) } } else { if (clock.localDeviceTime.year > 2015) { @@ -646,7 +646,7 @@ class MedtronicPumpPlugin @Inject constructor( // LOG.debug("MedtronicPumpPlugin::deliverBolus - Delivery Canceled after Bolus started."); Thread { SystemClock.sleep(2000) - activityNames.runAlarm(rh.gs(R.string.medtronic_cmd_cancel_bolus_not_supported), rh.gs(R.string.medtronic_warning), R.raw.boluserror) + uiInteraction.runAlarm(rh.gs(R.string.medtronic_cmd_cancel_bolus_not_supported), rh.gs(R.string.medtronic_warning), R.raw.boluserror) }.start() } val now = System.currentTimeMillis() @@ -1202,7 +1202,7 @@ class MedtronicPumpPlugin @Inject constructor( if (rileyLinkMedtronicService?.verifyConfiguration() == true) { serviceTaskExecutor.startTask(WakeAndTuneTask(injector)) } else { - activityNames.runAlarm(rh.gs(R.string.medtronic_error_operation_not_possible_no_configuration), rh.gs(R.string.medtronic_warning), R.raw.boluserror) + uiInteraction.runAlarm(rh.gs(R.string.medtronic_error_operation_not_possible_no_configuration), rh.gs(R.string.medtronic_warning), R.raw.boluserror) } } diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt index 4a693dfdad..8fdea9f65e 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt @@ -26,7 +26,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.common.sync.PumpDbEntry import info.nightscout.pump.common.sync.PumpDbEntryBolus import info.nightscout.pump.common.sync.PumpDbEntryCarbs @@ -67,7 +67,7 @@ class MedtronicHistoryData @Inject constructor( val medtronicPumpStatus: MedtronicPumpStatus, private val pumpSync: PumpSync, private val pumpSyncStorage: PumpSyncStorage, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) { val allHistory: MutableList = mutableListOf() @@ -654,7 +654,7 @@ class MedtronicHistoryData @Inject constructor( "pumpSerial=${medtronicPumpStatus.serialNumber}]") if (tempBasalProcessDTO.durationAsSeconds <= 0) { - activityNames.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT) + uiInteraction.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT) aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped") } else { val result = pumpSync.syncTemporaryBasalWithTempId( @@ -695,7 +695,7 @@ class MedtronicHistoryData @Inject constructor( "duration=${tempBasalProcessDTO.durationAsSeconds} s, pumpSerial=${medtronicPumpStatus.serialNumber}]") if (tempBasalProcessDTO.durationAsSeconds <= 0) { - activityNames.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT) + uiInteraction.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT) aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped") } else { val result = pumpSync.syncTemporaryBasalWithPumpId( @@ -963,7 +963,7 @@ class MedtronicHistoryData @Inject constructor( "pumpSerial=${medtronicPumpStatus.serialNumber}]") if (tempBasalProcess.durationAsSeconds <= 0) { - activityNames.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT) + uiInteraction.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT) aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped") } else { val result = pumpSync.syncTemporaryBasalWithPumpId( diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.kt index 5d410c40b1..34fe0eafa5 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandTy import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificationType import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventDismissNotification @@ -35,7 +35,7 @@ class MedtronicUtil @Inject constructor( private val rxBus: RxBus, private val rileyLinkUtil: RileyLinkUtil, private val medtronicPumpStatus: MedtronicPumpStatus, - private val activityNames: ActivityNames + private val uiInteraction: UiInteraction ) { private val ENVELOPE_SIZE = 4 // 0xA7 S1 S2 S3 CMD PARAM_COUNT [PARAMS] @@ -94,7 +94,7 @@ class MedtronicUtil @Inject constructor( } fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper) { - activityNames.addNotification( + uiInteraction.addNotification( notificationType.notificationType, rh.gs(notificationType.resourceId), notificationType.notificationUrgency @@ -102,7 +102,7 @@ class MedtronicUtil @Inject constructor( } fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, vararg parameters: Any?) { - activityNames.addNotification( + uiInteraction.addNotification( notificationType.notificationType, rh.gs(notificationType.resourceId, *parameters), notificationType.notificationUrgency diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt index 78d89e738f..c18ffd9de4 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt @@ -12,7 +12,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceTyp import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.database.impl.serialisation.SealedClassHelper -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.bus.RxBus @@ -27,7 +27,7 @@ import org.mockito.Mock */ class MedtronicHistoryDataUTest : TestBase() { - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction //TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class); // var historyPageData = ByteUtil // .createByteArrayFromString( @@ -43,11 +43,11 @@ class MedtronicHistoryDataUTest : TestBase() { rxBus = RxBus(TestAapsSchedulers(), aapsLogger) medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) - medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames) + medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) medtronicHistoryData = MedtronicHistoryData( packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, - medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, activityNames + medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, uiInteraction ) diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt index 3b504fd31a..2d169e2c0d 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistory import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.core.utils.ByteUtil import org.junit.Assert import org.junit.Before @@ -19,7 +19,7 @@ import org.mockito.Mock @Suppress("SpellCheckingInspection") class MedtronicPumpHistoryDecoderUTest : TestBase() { - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction //@Mock lateinit var injector: HasAndroidInjector //@Mock lateinit var rh: ResourceHelper // @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin @@ -35,7 +35,7 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() { medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) medtronicUtil = - MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames) + MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, ByteUtil()) } diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt index 002b9b8747..0cc748c7cd 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt @@ -9,7 +9,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpH import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import org.junit.Before import org.junit.Test import org.mockito.Mock @@ -19,11 +19,11 @@ import java.lang.reflect.Type class MedtronicHistoryDataUTest : TestBase() { @Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Before fun setUp() { - medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames) + medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) } @@ -32,7 +32,7 @@ class MedtronicHistoryDataUTest : TestBase() { val unitToTest = MedtronicHistoryData( packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, - medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, activityNames + medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, uiInteraction ) val gson = Gson() @@ -75,7 +75,7 @@ class MedtronicHistoryDataUTest : TestBase() { medtronicUtil, decoder, medtronicPumpStatus, pumpSync, - pumpSyncStorage, activityNames + pumpSyncStorage, uiInteraction ) val gson = Gson() diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index 1f7e60b253..ba6f4ad223 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -56,7 +56,7 @@ import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.queue.CustomCommand -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter.to0Decimal import info.nightscout.interfaces.utils.DecimalFormatter.to2Decimal import info.nightscout.interfaces.utils.Round @@ -102,7 +102,7 @@ class OmnipodDashPumpPlugin @Inject constructor( private val aapsSchedulers: AapsSchedulers, private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil, - private val activityNames: ActivityNames, + private val uiInteraction: UiInteraction, injector: HasAndroidInjector, aapsLogger: AAPSLogger, rh: ResourceHelper, @@ -181,7 +181,7 @@ class OmnipodDashPumpPlugin @Inject constructor( private fun updatePodWarnings() { if (System.currentTimeMillis() > nextPodWarningCheck) { if (!podStateManager.isPodRunning) { - activityNames.addNotification( + uiInteraction.addNotification( Notification.OMNIPOD_POD_NOT_ATTACHED, "Pod not activated", Notification.NORMAL @@ -198,7 +198,7 @@ class OmnipodDashPumpPlugin @Inject constructor( } else { rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED)) if (!podStateManager.sameTimeZone) { - activityNames.addNotification( + uiInteraction.addNotification( Notification.OMNIPOD_TIME_OUT_OF_SYNC, "Timezone on pod is different from the timezone on phone. " + "Basal rate is incorrect" + @@ -1496,11 +1496,11 @@ class OmnipodDashPumpPlugin @Inject constructor( } private fun showErrorDialog(message: String, sound: Int) { - activityNames.runAlarm(message, rh.gs(R.string.error), sound) + uiInteraction.runAlarm(message, rh.gs(R.string.error), sound) } private fun showNotification(id: Int, message: String, urgency: Int, sound: Int?) { - activityNames.addNotificationWithSound( + uiInteraction.addNotificationWithSound( id, message, urgency, diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt index 633192de04..99bf878614 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt @@ -17,7 +17,7 @@ import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventQueueChanged @@ -35,7 +35,7 @@ class DashPodManagementActivity : DaggerAppCompatActivity() { @Inject lateinit var context: Context @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var podStateManager: OmnipodDashPodStateManager - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var rh: ResourceHelper @Inject lateinit var rxBus: RxBus @@ -151,6 +151,6 @@ class DashPodManagementActivity : DaggerAppCompatActivity() { } private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) { - activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) + uiInteraction.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) } } 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 5c995a4a6f..1efbda4252 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 @@ -33,7 +33,7 @@ import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventDismissNotification @@ -66,7 +66,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { @Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var dateUtil: DateUtil @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var config: Config companion object { @@ -676,7 +676,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } private fun displayErrorDialog(title: String, message: String, withSound: Boolean) { - activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) + uiInteraction.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) } private fun displayOkDialog(title: String, message: String) { diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index cdc71dfc12..63430ad16b 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -92,7 +92,7 @@ import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.Callback; import info.nightscout.interfaces.queue.CommandQueue; import info.nightscout.interfaces.queue.CustomCommand; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.interfaces.utils.DecimalFormatter; import info.nightscout.interfaces.utils.Round; import info.nightscout.interfaces.utils.TimeChangeType; @@ -144,7 +144,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley private final ServiceConnection serviceConnection; private final PumpType pumpType = PumpType.OMNIPOD_EROS; private final PumpSync pumpSync; - private final ActivityNames activityNames; + private final UiInteraction uiInteraction; private final ErosHistoryDatabase erosHistoryDatabase; private final CompositeDisposable disposable = new CompositeDisposable(); @@ -184,7 +184,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley OmnipodAlertUtil omnipodAlertUtil, ProfileFunction profileFunction, PumpSync pumpSync, - ActivityNames activityNames, + UiInteraction uiInteraction, ErosHistoryDatabase erosHistoryDatabase ) { super(new PluginDescription() // @@ -212,7 +212,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley this.omnipodAlertUtil = omnipodAlertUtil; this.profileFunction = profileFunction; this.pumpSync = pumpSync; - this.activityNames = activityNames; + this.uiInteraction = uiInteraction; this.erosHistoryDatabase = erosHistoryDatabase; pumpDescription = new PumpDescription(pumpType); @@ -414,7 +414,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley } else { // Not sure what's going on. Notify the user aapsLogger.error(LTag.PUMP, "Unknown TBR in both Pod state and AAPS"); - activityNames.addNotificationWithSound(Notification.OMNIPOD_UNKNOWN_TBR, rh.gs(R.string.omnipod_eros_error_tbr_running_but_aaps_not_aware), Notification.NORMAL, R.raw.boluserror); + uiInteraction.addNotificationWithSound(Notification.OMNIPOD_UNKNOWN_TBR, rh.gs(R.string.omnipod_eros_error_tbr_running_but_aaps_not_aware), Notification.NORMAL, R.raw.boluserror); } } else if (!podStateManager.isTempBasalRunning() && tempBasal != null) { aapsLogger.warn(LTag.PUMP, "Removing AAPS TBR that actually hadn't succeeded"); @@ -430,7 +430,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley if (activeAlerts.size() > 0) { String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager)); String notificationText = rh.gq(R.plurals.omnipod_common_pod_alerts, activeAlerts.size(), alerts); - activityNames.addNotification(Notification.OMNIPOD_POD_ALERTS, notificationText, Notification.URGENT); + uiInteraction.addNotification(Notification.OMNIPOD_POD_ALERTS, notificationText, Notification.URGENT); pumpSync.insertAnnouncement(notificationText, null, PumpType.OMNIPOD_EROS, serialNumber()); if (aapsOmnipodErosManager.isAutomaticallyAcknowledgeAlertsEnabled() && !getCommandQueue().isCustomCommandInQueue(CommandSilenceAlerts.class)) { @@ -472,17 +472,17 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley private void updatePodWarningNotifications() { if (System.currentTimeMillis() > this.nextPodWarningCheck) { if (!podStateManager.isPodRunning()) { - activityNames.addNotification(Notification.OMNIPOD_POD_NOT_ATTACHED, rh.gs(R.string.omnipod_common_error_pod_not_attached), Notification.NORMAL); + uiInteraction.addNotification(Notification.OMNIPOD_POD_NOT_ATTACHED, rh.gs(R.string.omnipod_common_error_pod_not_attached), Notification.NORMAL); } else { rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED)); if (podStateManager.isSuspended()) { - activityNames.addNotification(Notification.OMNIPOD_POD_SUSPENDED, rh.gs(R.string.omnipod_common_error_pod_suspended), Notification.NORMAL); + uiInteraction.addNotification(Notification.OMNIPOD_POD_SUSPENDED, rh.gs(R.string.omnipod_common_error_pod_suspended), Notification.NORMAL); } else { rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED)); if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) { - activityNames.addNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC, rh.gs(R.string.omnipod_common_error_time_out_of_sync), Notification.NORMAL); + uiInteraction.addNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC, rh.gs(R.string.omnipod_common_error_time_out_of_sync), Notification.NORMAL); } else { rxBus.send(new EventDismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC)); } @@ -898,7 +898,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex)); } - activityNames.runAlarm(rh.gs(R.string.omnipod_eros_pod_management_pulse_log_value) + ":\n" + result.toString(), rh.gs(R.string.omnipod_eros_pod_management_pulse_log), 0); + uiInteraction.runAlarm(rh.gs(R.string.omnipod_eros_pod_management_pulse_log_value) + ":\n" + result.toString(), rh.gs(R.string.omnipod_eros_pod_management_pulse_log), 0); return new PumpEnactResult(getInjector()).success(true).enacted(false); } @@ -920,7 +920,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley podStateManager.setExpirationAlertTimeBeforeShutdown(expirationReminderTimeBeforeShutdown); podStateManager.setLowReservoirAlertUnits(lowReservoirAlertUnits); - activityNames.addNotificationValidFor( + uiInteraction.addNotificationValidFor( Notification.OMNIPOD_POD_ALERTS_UPDATED, rh.gs(R.string.omnipod_common_confirmation_expiration_alerts_updated), Notification.INFO, 60); @@ -948,7 +948,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley timeChangeRetries = 0; if (!requestedByUser && aapsOmnipodErosManager.isTimeChangeEventEnabled()) { - activityNames.addNotificationValidFor( + uiInteraction.addNotificationValidFor( Notification.TIME_OR_TIMEZONE_CHANGE, rh.gs(R.string.omnipod_common_confirmation_time_on_pod_updated), Notification.INFO, 60); @@ -960,7 +960,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley if (timeChangeRetries > 3) { if (aapsOmnipodErosManager.isTimeChangeEventEnabled()) { - activityNames.addNotificationValidFor( + uiInteraction.addNotificationValidFor( Notification.TIME_OR_TIMEZONE_CHANGE, rh.gs(R.string.omnipod_eros_error_automatic_time_or_timezone_change_failed), Notification.INFO, 60); @@ -1100,7 +1100,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley } if (!success) { aapsLogger.warn(LTag.PUMP, "Failed to retrieve Pod status on startup"); - activityNames.addNotification(Notification.OMNIPOD_STARTUP_STATUS_REFRESH_FAILED, rh.gs(R.string.omnipod_common_error_failed_to_refresh_status_on_startup), Notification.NORMAL); + uiInteraction.addNotification(Notification.OMNIPOD_STARTUP_STATUS_REFRESH_FAILED, rh.gs(R.string.omnipod_common_error_failed_to_refresh_status_on_startup), Notification.NORMAL); } } else { aapsLogger.debug(LTag.PUMP, "Not retrieving Pod status on startup: no Pod running"); diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java index acf5f6cb08..074cf66e61 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java @@ -68,7 +68,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfo; import info.nightscout.interfaces.pump.PumpEnactResult; import info.nightscout.interfaces.pump.PumpSync; import info.nightscout.interfaces.pump.defs.PumpType; -import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.interfaces.ui.UiInteraction; import info.nightscout.pump.common.defs.TempBasalPair; import info.nightscout.pump.core.utils.ByteUtil; import info.nightscout.rx.AapsSchedulers; @@ -99,7 +99,7 @@ public class AapsOmnipodErosManager { private final OmnipodAlertUtil omnipodAlertUtil; private final Context context; private final PumpSync pumpSync; - private final ActivityNames activityNames; + private final UiInteraction uiInteraction; private boolean basalBeepsEnabled; private boolean bolusBeepsEnabled; @@ -130,7 +130,7 @@ public class AapsOmnipodErosManager { OmnipodAlertUtil omnipodAlertUtil, Context context, PumpSync pumpSync, - ActivityNames activityNames) { + UiInteraction uiInteraction) { this.podStateManager = podStateManager; this.erosHistory = erosHistory; @@ -143,7 +143,7 @@ public class AapsOmnipodErosManager { this.omnipodAlertUtil = omnipodAlertUtil; this.context = context; this.pumpSync = pumpSync; - this.activityNames = activityNames; + this.uiInteraction = uiInteraction; delegate = new OmnipodManager(aapsLogger, aapsSchedulers, communicationService, podStateManager); @@ -968,7 +968,7 @@ public class AapsOmnipodErosManager { } private void showErrorDialog(String message, Integer sound) { - activityNames.runAlarm(message, rh.gs(R.string.error), sound); + uiInteraction.runAlarm(message, rh.gs(R.string.error), sound); } private void showPodFaultNotification(FaultEventCode faultEventCode) { @@ -980,7 +980,7 @@ public class AapsOmnipodErosManager { } private void showNotification(int id, String message, int urgency, Integer sound) { - activityNames.addNotificationWithSound(id, message, urgency, sound); + uiInteraction.addNotificationWithSound(id, message, urgency, sound); } private void dismissNotification(int id) { diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt index 84a6b27ae0..ee70e9595c 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt @@ -29,7 +29,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.Config import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventQueueChanged @@ -55,7 +55,7 @@ class ErosPodManagementActivity : DaggerAppCompatActivity() { @Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var config: Config - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var rh: ResourceHelper @Inject lateinit var rxBus: RxBus @@ -235,7 +235,7 @@ class ErosPodManagementActivity : DaggerAppCompatActivity() { } private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) { - activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) + uiInteraction.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) } private fun displayNotConfiguredDialog() { 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 95aadf90c5..aa2dad2803 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 @@ -41,7 +41,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventDismissNotification @@ -80,7 +80,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() { @Inject lateinit var omnipodManager: AapsOmnipodErosManager @Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var disposables: CompositeDisposable = CompositeDisposable() @@ -590,7 +590,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() { } private fun displayErrorDialog(title: String, message: String, withSound: Boolean) { - activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) + uiInteraction.runAlarm(message, title, if (withSound) R.raw.boluserror else 0) } private fun displayOkDialog(title: String, message: String) { diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt index 484c68165d..65f8113c2e 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt @@ -12,7 +12,7 @@ import info.nightscout.interfaces.pump.PumpEnactResult import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.common.defs.TempBasalPair import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.bus.RxBus @@ -35,7 +35,7 @@ class OmnipodErosPumpPluginTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin @Mock lateinit var aapsOmnipodErosManager: AapsOmnipodErosManager - @Mock lateinit var activityNames: ActivityNames + @Mock lateinit var uiInteraction: UiInteraction @Mock lateinit var commandQueue: CommandQueue @Mock lateinit var rileyLinkUtil: RileyLinkUtil @Mock lateinit var pumpSync: PumpSync @@ -56,7 +56,7 @@ class OmnipodErosPumpPluginTest : TestBase() { injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null, rh, null, null, aapsOmnipodErosManager, commandQueue, null, null, null, null, - rileyLinkUtil, null, null, pumpSync, activityNames, erosHistoryDatabase + rileyLinkUtil, null, null, pumpSync, uiInteraction, erosHistoryDatabase ) val pumpState = PumpSync.PumpState(null, null, null, null, "") `when`(pumpSync.expectedPumpState()).thenReturn(pumpState) diff --git a/ui/src/main/java/info/nightscout/ui/activities/ProfileHelperActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/ProfileHelperActivity.kt index edbd20f4e8..8bdec9ef83 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/ProfileHelperActivity.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/ProfileHelperActivity.kt @@ -19,7 +19,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.PureProfile import info.nightscout.interfaces.stats.TddCalculator -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventLocalProfileChanged @@ -220,7 +220,7 @@ class ProfileHelperActivity : DaggerAppCompatActivity() { ProfileViewerDialog().also { pvd -> pvd.arguments = Bundle().also { it.putLong("time", dateUtil.now()) - it.putInt("mode", ActivityNames.Mode.PROFILE_COMPARE.ordinal) + it.putInt("mode", UiInteraction.Mode.PROFILE_COMPARE.ordinal) it.putString("customProfile", profile0.jsonObject.toString()) it.putString("customProfile2", profile1.jsonObject.toString()) it.putString( diff --git a/ui/src/main/java/info/nightscout/ui/activities/SurveyActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/SurveyActivity.kt index 8df3c89d8a..2edc637135 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/SurveyActivity.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/SurveyActivity.kt @@ -7,7 +7,7 @@ import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.utils.fabric.InstanceId import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.ProfileFunction -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.shared.SafeParse import info.nightscout.shared.utils.DateUtil import info.nightscout.ui.R @@ -21,7 +21,7 @@ class SurveyActivity : DaggerAppCompatActivity() { @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var defaultProfile: DefaultProfile @Inject lateinit var dateUtil: DateUtil - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private lateinit var binding: ActivitySurveyBinding @@ -54,10 +54,10 @@ class SurveyActivity : DaggerAppCompatActivity() { } profileFunction.getProfile()?.let { runningProfile -> defaultProfile.profile(age, tdd, weight, profileFunction.getUnits())?.let { profile -> - activityNames.runProfileViewerDialog( + uiInteraction.runProfileViewerDialog( fragmentManager = supportFragmentManager, time = dateUtil.now(), - mode = ActivityNames.Mode.PROFILE_COMPARE, + mode = UiInteraction.Mode.PROFILE_COMPARE, customProfile = runningProfile.toPureNsJson(dateUtil).toString(), customProfileName = "Age: $age TDD: $tdd Weight: $weight", customProfile2 = profile.jsonObject.toString() diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt index 4b614cd8a2..1eb9ebb422 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt @@ -30,7 +30,7 @@ import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.ActivePlugin -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged @@ -262,7 +262,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider { ProfileViewerDialog().also { pvd -> pvd.arguments = Bundle().also { args -> args.putLong("time", (it.tag as ProfileSealed).timestamp) - args.putInt("mode", ActivityNames.Mode.RUNNING_PROFILE.ordinal) + args.putInt("mode", UiInteraction.Mode.RUNNING_PROFILE.ordinal) } pvd.show(childFragmentManager, "ProfileViewDialog") } @@ -271,7 +271,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider { ProfileViewerDialog().also { pvd -> pvd.arguments = Bundle().also { args -> args.putLong("time", (it.tag as ProfileSealed).timestamp) - args.putInt("mode", ActivityNames.Mode.RUNNING_PROFILE.ordinal) + args.putInt("mode", UiInteraction.Mode.RUNNING_PROFILE.ordinal) } pvd.show(childFragmentManager, "ProfileViewDialog") } diff --git a/ui/src/main/java/info/nightscout/ui/alertDialogs/ErrorDialog.kt b/ui/src/main/java/info/nightscout/ui/alertDialogs/ErrorDialog.kt index 6852cdcf01..40f7266130 100644 --- a/ui/src/main/java/info/nightscout/ui/alertDialogs/ErrorDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/alertDialogs/ErrorDialog.kt @@ -15,7 +15,7 @@ import info.nightscout.core.ui.activities.DialogAppCompatActivity import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.interfaces.logging.UserEntryLogger -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.utils.T import info.nightscout.ui.databinding.DialogErrorBinding @@ -23,7 +23,7 @@ import javax.inject.Inject class ErrorDialog : DaggerDialogFragment() { - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var uel: UserEntryLogger @@ -113,9 +113,9 @@ class ErrorDialog : DaggerDialogFragment() { private fun startAlarm() { if (sound != 0) - activityNames.startAlarm(sound, "$title:$status") + uiInteraction.startAlarm(sound, "$title:$status") } private fun stopAlarm(reason: String) = - activityNames.stopAlarm(reason) + uiInteraction.stopAlarm(reason) } diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt index 9f92c368cf..5e55d36038 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt @@ -36,7 +36,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck.Protection.BOLUS import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag @@ -67,7 +67,7 @@ class CarbsDialog : DialogFragmentWithDate() { @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var repository: AppRepository @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var queryingProtection = false private val disposable = CompositeDisposable() @@ -374,7 +374,7 @@ class CarbsDialog : DialogFragmentWithDate() { override fun run() { carbTimer.removeAutomationEventEatReminder() if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } else if (sp.getBoolean(R.string.key_usebolusreminder, false) && remindBolus) bolusTimer.scheduleAutomationEventBolusReminder() } diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt index d6763c5db8..bb6a74fd41 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt @@ -24,7 +24,7 @@ import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.Translator import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag import info.nightscout.shared.interfaces.ResourceHelper @@ -50,7 +50,7 @@ class CareDialog : DialogFragmentWithDate() { private val disposable = CompositeDisposable() - private var options: ActivityNames.EventType = ActivityNames.EventType.BGCHECK + private var options: UiInteraction.EventType = UiInteraction.EventType.BGCHECK //private var valuesWithUnit = mutableListOf() private var valuesWithUnit = mutableListOf() @@ -84,48 +84,48 @@ class CareDialog : DialogFragmentWithDate() { (savedInstanceState ?: arguments)?.let { event = it.getInt("event", R.string.error) - options = ActivityNames.EventType.values()[it.getInt("options", 0)] + options = UiInteraction.EventType.values()[it.getInt("options", 0)] } binding.icon.setImageResource( when (options) { - ActivityNames.EventType.BGCHECK -> R.drawable.ic_cp_bgcheck - ActivityNames.EventType.SENSOR_INSERT -> R.drawable.ic_cp_cgm_insert - ActivityNames.EventType.BATTERY_CHANGE -> R.drawable.ic_cp_pump_battery - ActivityNames.EventType.NOTE -> R.drawable.ic_cp_note - ActivityNames.EventType.EXERCISE -> R.drawable.ic_cp_exercise - ActivityNames.EventType.QUESTION -> R.drawable.ic_cp_question - ActivityNames.EventType.ANNOUNCEMENT -> R.drawable.ic_cp_announcement + UiInteraction.EventType.BGCHECK -> R.drawable.ic_cp_bgcheck + UiInteraction.EventType.SENSOR_INSERT -> R.drawable.ic_cp_cgm_insert + UiInteraction.EventType.BATTERY_CHANGE -> R.drawable.ic_cp_pump_battery + UiInteraction.EventType.NOTE -> R.drawable.ic_cp_note + UiInteraction.EventType.EXERCISE -> R.drawable.ic_cp_exercise + UiInteraction.EventType.QUESTION -> R.drawable.ic_cp_question + UiInteraction.EventType.ANNOUNCEMENT -> R.drawable.ic_cp_announcement } ) binding.title.text = rh.gs( when (options) { - ActivityNames.EventType.BGCHECK -> R.string.careportal_bgcheck - ActivityNames.EventType.SENSOR_INSERT -> R.string.cgm_sensor_insert - ActivityNames.EventType.BATTERY_CHANGE -> R.string.pump_battery_change - ActivityNames.EventType.NOTE -> R.string.careportal_note - ActivityNames.EventType.EXERCISE -> R.string.careportal_exercise - ActivityNames.EventType.QUESTION -> R.string.careportal_question - ActivityNames.EventType.ANNOUNCEMENT -> R.string.careportal_announcement + UiInteraction.EventType.BGCHECK -> R.string.careportal_bgcheck + UiInteraction.EventType.SENSOR_INSERT -> R.string.cgm_sensor_insert + UiInteraction.EventType.BATTERY_CHANGE -> R.string.pump_battery_change + UiInteraction.EventType.NOTE -> R.string.careportal_note + UiInteraction.EventType.EXERCISE -> R.string.careportal_exercise + UiInteraction.EventType.QUESTION -> R.string.careportal_question + UiInteraction.EventType.ANNOUNCEMENT -> R.string.careportal_announcement } ) when (options) { - ActivityNames.EventType.QUESTION, - ActivityNames.EventType.ANNOUNCEMENT, - ActivityNames.EventType.BGCHECK -> { + UiInteraction.EventType.QUESTION, + UiInteraction.EventType.ANNOUNCEMENT, + UiInteraction.EventType.BGCHECK -> { binding.durationLayout.visibility = View.GONE } - ActivityNames.EventType.SENSOR_INSERT, - ActivityNames.EventType.BATTERY_CHANGE -> { + UiInteraction.EventType.SENSOR_INSERT, + UiInteraction.EventType.BATTERY_CHANGE -> { binding.bgLayout.visibility = View.GONE binding.bgsource.visibility = View.GONE binding.durationLayout.visibility = View.GONE } - ActivityNames.EventType.NOTE, - ActivityNames.EventType.EXERCISE -> { + UiInteraction.EventType.NOTE, + UiInteraction.EventType.EXERCISE -> { binding.bgLayout.visibility = View.GONE binding.bgsource.visibility = View.GONE } @@ -160,7 +160,7 @@ class CareDialog : DialogFragmentWithDate() { savedInstanceState?.getDouble("duration") ?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, binding.okcancel.ok ) - if (options == ActivityNames.EventType.NOTE || options == ActivityNames.EventType.QUESTION || options == ActivityNames.EventType.ANNOUNCEMENT || options == ActivityNames.EventType.EXERCISE) + if (options == UiInteraction.EventType.NOTE || options == UiInteraction.EventType.QUESTION || options == UiInteraction.EventType.ANNOUNCEMENT || options == UiInteraction.EventType.EXERCISE) binding.notesLayout.root.visibility = View.VISIBLE // independent to preferences binding.bgLabel.labelFor = binding.bg.editTextId binding.durationLabel.labelFor = binding.duration.editTextId @@ -180,19 +180,19 @@ class CareDialog : DialogFragmentWithDate() { val therapyEvent = TherapyEvent( timestamp = eventTime, type = when (options) { - ActivityNames.EventType.BGCHECK -> TherapyEvent.Type.FINGER_STICK_BG_VALUE - ActivityNames.EventType.SENSOR_INSERT -> TherapyEvent.Type.SENSOR_CHANGE - ActivityNames.EventType.BATTERY_CHANGE -> TherapyEvent.Type.PUMP_BATTERY_CHANGE - ActivityNames.EventType.NOTE -> TherapyEvent.Type.NOTE - ActivityNames.EventType.EXERCISE -> TherapyEvent.Type.EXERCISE - ActivityNames.EventType.QUESTION -> TherapyEvent.Type.QUESTION - ActivityNames.EventType.ANNOUNCEMENT -> TherapyEvent.Type.ANNOUNCEMENT + UiInteraction.EventType.BGCHECK -> TherapyEvent.Type.FINGER_STICK_BG_VALUE + UiInteraction.EventType.SENSOR_INSERT -> TherapyEvent.Type.SENSOR_CHANGE + UiInteraction.EventType.BATTERY_CHANGE -> TherapyEvent.Type.PUMP_BATTERY_CHANGE + UiInteraction.EventType.NOTE -> TherapyEvent.Type.NOTE + UiInteraction.EventType.EXERCISE -> TherapyEvent.Type.EXERCISE + UiInteraction.EventType.QUESTION -> TherapyEvent.Type.QUESTION + UiInteraction.EventType.ANNOUNCEMENT -> TherapyEvent.Type.ANNOUNCEMENT }, glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(profileFunction.getUnits()) ) val actions: LinkedList = LinkedList() - if (options == ActivityNames.EventType.BGCHECK || options == ActivityNames.EventType.QUESTION || options == ActivityNames.EventType.ANNOUNCEMENT) { + if (options == UiInteraction.EventType.BGCHECK || options == UiInteraction.EventType.QUESTION || options == UiInteraction.EventType.ANNOUNCEMENT) { val meterType = when { binding.meter.isChecked -> TherapyEvent.MeterType.FINGER @@ -206,7 +206,7 @@ class CareDialog : DialogFragmentWithDate() { valuesWithUnit.add(ValueWithUnit.fromGlucoseUnit(binding.bg.value, profileFunction.getUnits().asText)) valuesWithUnit.add(ValueWithUnit.TherapyEventMeterType(meterType)) } - if (options == ActivityNames.EventType.NOTE || options == ActivityNames.EventType.EXERCISE) { + if (options == UiInteraction.EventType.NOTE || options == UiInteraction.EventType.EXERCISE) { actions.add(rh.gs(R.string.duration_label) + ": " + rh.gs(R.string.format_mins, binding.duration.value.toInt())) therapyEvent.duration = T.mins(binding.duration.value.toLong()).msecs() valuesWithUnit.add(ValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) }) @@ -222,13 +222,13 @@ class CareDialog : DialogFragmentWithDate() { therapyEvent.enteredBy = enteredBy val source = when (options) { - ActivityNames.EventType.BGCHECK -> UserEntry.Sources.BgCheck - ActivityNames.EventType.SENSOR_INSERT -> UserEntry.Sources.SensorInsert - ActivityNames.EventType.BATTERY_CHANGE -> UserEntry.Sources.BatteryChange - ActivityNames.EventType.NOTE -> UserEntry.Sources.Note - ActivityNames.EventType.EXERCISE -> UserEntry.Sources.Exercise - ActivityNames.EventType.QUESTION -> UserEntry.Sources.Question - ActivityNames.EventType.ANNOUNCEMENT -> UserEntry.Sources.Announcement + UiInteraction.EventType.BGCHECK -> UserEntry.Sources.BgCheck + UiInteraction.EventType.SENSOR_INSERT -> UserEntry.Sources.SensorInsert + UiInteraction.EventType.BATTERY_CHANGE -> UserEntry.Sources.BatteryChange + UiInteraction.EventType.NOTE -> UserEntry.Sources.Note + UiInteraction.EventType.EXERCISE -> UserEntry.Sources.Exercise + UiInteraction.EventType.QUESTION -> UserEntry.Sources.Question + UiInteraction.EventType.ANNOUNCEMENT -> UserEntry.Sources.Announcement } activity?.let { activity -> diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt index 1ee8facdd7..903dcc946d 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt @@ -18,7 +18,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag import info.nightscout.shared.SafeParse @@ -39,7 +39,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var uel: UserEntryLogger @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var queryingProtection = false private var _binding: DialogExtendedbolusBinding? = null @@ -110,7 +110,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/FillDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/FillDialog.kt index 1acce48084..b10d274c54 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/FillDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/FillDialog.kt @@ -22,7 +22,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag @@ -46,7 +46,7 @@ class FillDialog : DialogFragmentWithDate() { @Inject lateinit var uel: UserEntryLogger @Inject lateinit var repository: AppRepository @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var queryingProtection = false private val disposable = CompositeDisposable() @@ -207,7 +207,7 @@ class FillDialog : DialogFragmentWithDate() { commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/InsulinDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/InsulinDialog.kt index baaec164bd..be836d09fb 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/InsulinDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/InsulinDialog.kt @@ -34,7 +34,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag @@ -68,7 +68,7 @@ class InsulinDialog : DialogFragmentWithDate() { @Inject lateinit var bolusTimer: BolusTimer @Inject lateinit var uel: UserEntryLogger @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var persistenceLayer: PersistenceLayer private var queryingProtection = false @@ -266,7 +266,7 @@ class InsulinDialog : DialogFragmentWithDate() { commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } else { bolusTimer.removeAutomationEventBolusReminder() } diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/LoopDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/LoopDialog.kt index 7282fb763e..44b579c2ce 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/LoopDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/LoopDialog.kt @@ -34,7 +34,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventPreferenceChange import info.nightscout.rx.events.EventRefreshOverview @@ -70,7 +70,7 @@ class LoopDialog : DaggerDialogFragment() { @Inject lateinit var dateUtil: DateUtil @Inject lateinit var repository: AppRepository @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var queryingProtection = false private var showOkCancel: Boolean = true @@ -351,7 +351,7 @@ class LoopDialog : DaggerDialogFragment() { commandQueue.cancelTempBasal(true, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } }) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt index 67a01df0de..93718d6a7d 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt @@ -20,7 +20,7 @@ import info.nightscout.interfaces.Constants import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.bus.RxBus @@ -46,7 +46,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { private var time: Long = 0 - private var mode: ActivityNames.Mode = ActivityNames.Mode.RUNNING_PROFILE + private var mode: UiInteraction.Mode = UiInteraction.Mode.RUNNING_PROFILE private var customProfileJson: String = "" private var customProfileJson2: String = "" private var customProfileName: String = "" @@ -64,10 +64,10 @@ class ProfileViewerDialog : DaggerDialogFragment() { // load data from bundle (savedInstanceState ?: arguments)?.let { bundle -> time = bundle.getLong("time", 0) - mode = ActivityNames.Mode.values()[bundle.getInt("mode", ActivityNames.Mode.RUNNING_PROFILE.ordinal)] + mode = UiInteraction.Mode.values()[bundle.getInt("mode", UiInteraction.Mode.RUNNING_PROFILE.ordinal)] customProfileJson = bundle.getString("customProfile", "") customProfileName = bundle.getString("customProfileName", "") - if (mode == ActivityNames.Mode.PROFILE_COMPARE) + if (mode == UiInteraction.Mode.PROFILE_COMPARE) customProfileJson2 = bundle.getString("customProfile2", "") } @@ -90,7 +90,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { val profileName: String? val date: String? when (mode) { - ActivityNames.Mode.RUNNING_PROFILE -> { + UiInteraction.Mode.RUNNING_PROFILE -> { val eps = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet() if (eps !is ValueWrapper.Existing) { dismiss() @@ -103,7 +103,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { binding.dateLayout.visibility = View.VISIBLE } - ActivityNames.Mode.CUSTOM_PROFILE -> { + UiInteraction.Mode.CUSTOM_PROFILE -> { profile = pureProfileFromJson(JSONObject(customProfileJson), dateUtil)?.let { ProfileSealed.Pure(it) } profile2 = null profileName = customProfileName @@ -111,7 +111,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { binding.dateLayout.visibility = View.GONE } - ActivityNames.Mode.PROFILE_COMPARE -> { + UiInteraction.Mode.PROFILE_COMPARE -> { profile = pureProfileFromJson(JSONObject(customProfileJson), dateUtil)?.let { ProfileSealed.Pure(it) } profile2 = pureProfileFromJson(JSONObject(customProfileJson2), dateUtil)?.let { ProfileSealed.Pure(it) } profileName = customProfileName @@ -120,7 +120,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { binding.dateLayout.visibility = View.GONE } - ActivityNames.Mode.DB_PROFILE -> { + UiInteraction.Mode.DB_PROFILE -> { //val profileList = databaseHelper.getProfileSwitchData(time, true) val profileList = repository.getAllProfileSwitches().blockingGet() profile = if (profileList.isNotEmpty()) ProfileSealed.PS(profileList[0]) else null @@ -132,7 +132,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { } binding.noProfile.visibility = View.VISIBLE - if (mode == ActivityNames.Mode.PROFILE_COMPARE) + if (mode == UiInteraction.Mode.PROFILE_COMPARE) profile?.let { profile1 -> profile2?.let { profile2 -> binding.units.text = profileFunction.getUnits().asText @@ -188,7 +188,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { bundle.putInt("mode", mode.ordinal) bundle.putString("customProfile", customProfileJson) bundle.putString("customProfileName", customProfileName) - if (mode == ActivityNames.Mode.PROFILE_COMPARE) + if (mode == UiInteraction.Mode.PROFILE_COMPARE) bundle.putString("customProfile2", customProfileJson2) } diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt index dc68a56dba..8421656064 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt @@ -21,7 +21,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag import info.nightscout.shared.SafeParse @@ -43,7 +43,7 @@ class TempBasalDialog : DialogFragmentWithDate() { @Inject lateinit var ctx: Context @Inject lateinit var uel: UserEntryLogger @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction private var queryingProtection = false private var isPercentPump = true @@ -135,7 +135,7 @@ class TempBasalDialog : DialogFragmentWithDate() { val callback: Callback = object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) } } } diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/TreatmentDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/TreatmentDialog.kt index 4a54b7faae..8bd63a4099 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/TreatmentDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/TreatmentDialog.kt @@ -24,7 +24,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.rx.logging.LTag @@ -49,7 +49,7 @@ class TreatmentDialog : DialogFragmentWithDate() { @Inject lateinit var uel: UserEntryLogger @Inject lateinit var repository: AppRepository @Inject lateinit var protectionCheck: ProtectionCheck - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var persistenceLayer: PersistenceLayer private var queryingProtection = false @@ -177,7 +177,7 @@ class TreatmentDialog : DialogFragmentWithDate() { commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) + uiInteraction.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt index c47d98d393..001666a314 100644 --- a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt +++ b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt @@ -30,7 +30,7 @@ import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction -import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.TrendCalculator import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag @@ -51,7 +51,7 @@ class Widget : AppWidgetProvider() { @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var overviewData: OverviewData @Inject lateinit var trendCalculator: TrendCalculator - @Inject lateinit var activityNames: ActivityNames + @Inject lateinit var uiInteraction: UiInteraction @Inject lateinit var rh: ResourceHelper @Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider @Inject lateinit var dateUtil: DateUtil @@ -104,7 +104,7 @@ class Widget : AppWidgetProvider() { val alpha = sp.getInt(WidgetConfigureActivity.PREF_PREFIX_KEY + appWidgetId, WidgetConfigureActivity.DEFAULT_OPACITY) // Create an Intent to launch MainActivity when clicked - val intent = Intent(context, activityNames.mainActivity).also { it.action = intentAction } + val intent = Intent(context, uiInteraction.mainActivity).also { it.action = intentAction } val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT) // Widgets allow click handlers to only launch pending intents views.setOnClickPendingIntent(R.id.widget_layout, pendingIntent)