diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index f9209c97b3..bf41126f8b 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -11,6 +11,7 @@
+
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 015a2b65a7..ae9e8290ac 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
@@ -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(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(ctx, 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(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), 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 87652abd9c..f88ca2ca89 100644
--- a/core/core-main/src/main/res/values/strings.xml
+++ b/core/core-main/src/main/res/values/strings.xml
@@ -3,7 +3,6 @@
Save
Not set
- Tempbasal delivery error
Going to deliver %1$.2f U
Waiting for pump
AAPS started
@@ -128,13 +127,6 @@
IC
ISF
-
- Limiting max basal rate to %1$.2f U/h because of %2$s
- pump limit
- Limiting max percent rate to %1$d%% because of %2$s
- it must be positive value
- Limiting bolus to %1$.1f U because of %2$s
-
Bluetooth Low Energy not supported.
Bluetooth Low Energy not supported or device not paired.
@@ -426,13 +418,10 @@
KeepAlive. Status outdated.
KeepAlive. Basal outdated.
SMS
- Pump driver change.
- Device changed
Clicked refresh
Scheduled Status Refresh
Unconfirmed command
Requested by user
- Bolus OK
Insight Refresh Button
%1$.0f%%
Basal
diff --git a/core/core-main/src/main/res/values/fet_attrs.xml b/core/ui/src/main/res/values/fet_attrs.xml
similarity index 100%
rename from core/core-main/src/main/res/values/fet_attrs.xml
rename to core/ui/src/main/res/values/fet_attrs.xml
diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml
index 1c6cc3c3ed..dfe5fe668b 100644
--- a/core/ui/src/main/res/values/strings.xml
+++ b/core/ui/src/main/res/values/strings.xml
@@ -23,7 +23,7 @@
mg/dl
mmol/l
-
+
Battery
Reservoir
Last connection
@@ -41,6 +41,17 @@
View profile
Pump history
Stats
+ Pump driver change.
+ Device changed
+ Bolus OK
+ Tempbasal delivery error
+
+
+ Limiting max basal rate to %1$.2f U/h because of %2$s
+ pump limit
+ Limiting max percent rate to %1$d%% because of %2$s
+ it must be positive value
+ Limiting bolus to %1$.1f U because of %2$s
language
diff --git a/core/core-main/src/main/res/values/validator.xml b/core/ui/src/main/res/values/validator.xml
similarity index 100%
rename from core/core-main/src/main/res/values/validator.xml
rename to core/ui/src/main/res/values/validator.xml
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 dfbb894744..970dfb5a29 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
@@ -679,7 +679,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(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
}
}
})
@@ -687,7 +687,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(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
}
}
})
@@ -714,7 +714,7 @@ class LoopPlugin @Inject constructor(
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
- activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(context, 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 a0c1c074e0..b721aa24d7 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
@@ -158,7 +158,7 @@ class ActionsFragment : DaggerFragment() {
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
- activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
}
}
})
diff --git a/pump/danar/build.gradle b/pump/danar/build.gradle
index 9d5d36753b..33cf509c1a 100644
--- a/pump/danar/build.gradle
+++ b/pump/danar/build.gradle
@@ -17,9 +17,11 @@ android {
dependencies {
implementation project(':app-wear-shared:shared')
- implementation project(':core:core-main')
+ //implementation project(':core:core-main')
implementation project(':core:interfaces')
implementation project(':core:utils')
implementation project(':core:ui')
implementation project(':pump:dana')
+
+ testImplementation project(':core:core-main')
}
\ No newline at end of file
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 849d45fe89..a43b613a71 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,6 +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.utils.Round
import info.nightscout.pump.dana.DanaPump
import info.nightscout.rx.AapsSchedulers
@@ -53,8 +54,9 @@ class DanaRKoreanPlugin @Inject constructor(
danaPump: DanaPump,
dateUtil: DateUtil,
private val fabricPrivacy: FabricPrivacy,
- pumpSync: PumpSync
-) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync) {
+ pumpSync: PumpSync,
+ activityNames: ActivityNames
+) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames) {
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 763d92b428..4ceca9911b 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
@@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRKorean.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.events.EventDismissNotification
import info.nightscout.rx.logging.LTag
@@ -32,14 +31,12 @@ class MsgInitConnStatusBasic_k(
aapsLogger.debug(LTag.PUMPCOMM, "easyUIMode: $easyUIMode")
aapsLogger.debug(LTag.PUMPCOMM, "Pump password: " + danaPump.password)
if (danaPump.isEasyModeEnabled) {
- val notification = Notification(Notification.EASY_MODE_ENABLED, rh.gs(R.string.danar_disableeasymode), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.addNotification(Notification.EASY_MODE_ENABLED, rh.gs(R.string.danar_disableeasymode), Notification.URGENT)
} else {
rxBus.send(EventDismissNotification(Notification.EASY_MODE_ENABLED))
}
if (!danaPump.isPasswordOK) {
- val notification = Notification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 1326396b73..cb537b52eb 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
@@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRKorean.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.events.EventDismissNotification
import info.nightscout.rx.logging.LTag
@@ -32,8 +31,7 @@ class MsgInitConnStatusBolus_k(
aapsLogger.debug(LTag.PUMPCOMM, "Bolus max: " + danaPump.maxBolus)
aapsLogger.debug(LTag.PUMPCOMM, "Delivery status: $deliveryStatus")
if (!danaPump.isExtendedBolusEnabled) {
- val notification = Notification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 645ec41e64..0ca9f01d22 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
@@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRKorean.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.rx.events.EventRebuildTabs
@@ -20,8 +19,7 @@ class MsgInitConnStatusTime_k(
override fun handleMessage(bytes: ByteArray) {
if (bytes.size - 10 < 10) {
- val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 1b6e76c0e4..9860b593f5 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
@@ -34,7 +34,6 @@ import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
-import info.nightscout.core.events.EventNewNotification;
import info.nightscout.interfaces.Constants;
import info.nightscout.interfaces.constraints.Constraints;
import info.nightscout.interfaces.notifications.Notification;
@@ -47,6 +46,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.pump.dana.DanaPump;
import info.nightscout.pump.dana.events.EventDanaRNewStatus;
import info.nightscout.rx.bus.RxBus;
@@ -70,11 +70,12 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
@Inject DanaRKoreanPlugin danaRKoreanPlugin;
@Inject CommandQueue commandQueue;
@Inject MessageHashTableRKorean messageHashTableRKorean;
- @Inject ActivePlugin activePlugin;
+ @Inject ActivityNames activityNames;
@Inject ProfileFunction profileFunction;
@Inject PumpSync pumpSync;
@Inject DateUtil dateUtil;
+
public DanaRKoreanExecutionService() {
}
@@ -198,8 +199,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) {
- Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
- rxBus.send(new EventNewNotification(reportFail));
+ activityNames.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 1d46aedf8b..dbdabca63a 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,6 +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.utils.Round;
import info.nightscout.pump.dana.DanaPump;
import info.nightscout.rx.AapsSchedulers;
@@ -72,9 +73,10 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
TemporaryBasalStorage temporaryBasalStorage,
DateUtil dateUtil,
FabricPrivacy fabricPrivacy,
- PumpSync pumpSync
+ PumpSync pumpSync,
+ ActivityNames activityNames
) {
- super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync);
+ super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames);
this.aapsLogger = aapsLogger;
this.context = context;
this.rh = rh;
@@ -316,7 +318,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
aapsLogger.debug(LTag.PUMP, "setTempBasalPercent: OK");
return result;
}
- result.enacted(false).success(false).comment(R.string.tempbasaldeliveryerror);
+ result.enacted(false).success(false).comment(R.string.temp_basal_delivery_error);
aapsLogger.error("setTempBasalPercent: Failed to set temp basal");
return result;
}
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 3bfd971e97..dbbf6ab6eb 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
@@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRv2.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.pump.dana.DanaPump
@@ -26,8 +25,7 @@ class MsgCheckValue_v2(
danaPump.protocol = intFromBuff(bytes, 1, 1)
danaPump.productCode = intFromBuff(bytes, 2, 1)
if (danaPump.hwModel != DanaPump.EXPORT_MODEL) {
- val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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)
@@ -43,8 +41,7 @@ class MsgCheckValue_v2(
return
}
if (danaPump.protocol != 2) {
- val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 cbe0c81303..73d6d66197 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
@@ -46,7 +46,6 @@ import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
-import info.nightscout.core.events.EventNewNotification;
import info.nightscout.interfaces.Constants;
import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.plugin.ActivePlugin;
@@ -237,8 +236,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) {
- Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
- rxBus.send(new EventNewNotification(reportFail));
+ activityNames.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/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java
index 6d2b191203..cbfcbfbdf8 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
@@ -7,7 +7,6 @@ import org.json.JSONObject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
-import info.nightscout.core.events.EventNewNotification;
import info.nightscout.interfaces.constraints.Constraint;
import info.nightscout.interfaces.constraints.Constraints;
import info.nightscout.interfaces.notifications.Notification;
@@ -23,6 +22,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.utils.DecimalFormatter;
import info.nightscout.interfaces.utils.Round;
import info.nightscout.pump.dana.DanaFragment;
@@ -60,6 +60,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
protected DateUtil dateUtil;
protected AapsSchedulers aapsSchedulers;
protected PumpSync pumpSync;
+ protected ActivityNames activityNames;
protected AbstractDanaRPlugin(
HasAndroidInjector injector,
@@ -73,7 +74,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
ActivePlugin activePlugin,
SP sp,
DateUtil dateUtil,
- PumpSync pumpSync
+ PumpSync pumpSync,
+ ActivityNames activityNames
) {
super(new PluginDescription()
.mainType(PluginType.PUMP)
@@ -93,6 +95,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
this.dateUtil = dateUtil;
this.aapsSchedulers = aapsSchedulers;
this.pumpSync = pumpSync;
+ this.activityNames = activityNames;
}
@Override protected void onStart() {
@@ -143,22 +146,19 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
}
if (!isInitialized()) {
getAapsLogger().error("setNewBasalProfile not initialized");
- Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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)) {
- Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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));
- Notification notification = new Notification(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60);
result.success(true).enacted(true).comment("OK");
}
return result;
@@ -255,7 +255,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
);
return result;
}
- result.enacted(false).success(false).comment(R.string.tempbasaldeliveryerror);
+ result.enacted(false).success(false).comment(R.string.temp_basal_delivery_error);
getAapsLogger().error("setTempBasalPercent: Failed to set temp basal");
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 fe700c9555..7b0bd7a89d 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,6 +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.utils.Round;
import info.nightscout.pump.dana.DanaPump;
import info.nightscout.rx.AapsSchedulers;
@@ -62,9 +63,10 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
DanaPump danaPump,
DateUtil dateUtil,
FabricPrivacy fabricPrivacy,
- PumpSync pumpSync
+ PumpSync pumpSync,
+ ActivityNames activityNames
) {
- super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync);
+ super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames);
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 f8c60e9035..6471975bd5 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,6 +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.pump.dana.DanaPump
import info.nightscout.pump.dana.database.DanaHistoryRecordDao
import info.nightscout.rx.bus.RxBus
@@ -50,6 +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
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 406c3a6123..c310c3dbc8 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
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.events.EventDismissNotification
import info.nightscout.rx.logging.LTag
@@ -31,8 +30,7 @@ class MsgInitConnStatusBolus(
aapsLogger.debug(LTag.PUMPCOMM, "Bolus increment: " + danaPump.bolusStep)
aapsLogger.debug(LTag.PUMPCOMM, "Bolus max: " + danaPump.maxBolus)
if (!danaPump.isExtendedBolusEnabled) {
- val notification = Notification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 a645b74a02..685f6ef3e9 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
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.events.EventDismissNotification
import info.nightscout.rx.logging.LTag
@@ -34,8 +33,7 @@ class MsgInitConnStatusOption(
failed = true
}
if (!danaPump.isPasswordOK) {
- val notification = Notification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 baaa44214a..2473c11355 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
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.rx.events.EventRebuildTabs
@@ -19,8 +18,7 @@ class MsgInitConnStatusTime(
override fun handleMessage(bytes: ByteArray) {
if (bytes.size - 10 > 7) {
- val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 f284179755..d07a054c2f 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
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.logging.LTag
@@ -27,13 +26,11 @@ class MsgSetBasalProfile(
if (result != 1) {
failed = true
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result FAILED!!!")
- val reportFail = Notification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT)
- rxBus.send(EventNewNotification(reportFail))
+ activityNames.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")
- val reportOK = Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)
- rxBus.send(EventNewNotification(reportOK))
+ activityNames.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 3369fb0dd5..6737ae9f2f 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
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.logging.LTag
@@ -25,13 +24,11 @@ class MsgSetSingleBasalProfile(
if (result != 1) {
failed = true
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result FAILED!!!")
- val reportFail = Notification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT)
- rxBus.send(EventNewNotification(reportFail))
+ activityNames.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")
- val reportOK = Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)
- rxBus.send(EventNewNotification(reportOK))
+ activityNames.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 375b615759..9c6c2c20c8 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
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danar.R
-import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.events.EventDismissNotification
import info.nightscout.rx.logging.LTag
@@ -34,14 +33,12 @@ class MsgSettingMeal(
danaPump.basalStep = 0.01
}
if (danaPump.basalStep != 0.01) {
- val notification = Notification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.addNotification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT)
} else {
rxBus.send(EventDismissNotification(Notification.WRONG_BASAL_STEP))
}
if (danaPump.isConfigUD) {
- val notification = Notification(Notification.UD_MODE_ENABLED, rh.gs(R.string.danar_switchtouhmode), Notification.URGENT)
- rxBus.send(EventNewNotification(notification))
+ activityNames.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 a35e4af4d1..308e09e2c4 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
@@ -37,7 +37,6 @@ import info.nightscout.androidaps.danar.comm.MsgHistoryRefill;
import info.nightscout.androidaps.danar.comm.MsgHistorySuspend;
import info.nightscout.androidaps.danar.comm.MsgPCCommStart;
import info.nightscout.androidaps.danar.comm.MsgPCCommStop;
-import info.nightscout.core.events.EventNewNotification;
import info.nightscout.core.ui.toast.ToastUtils;
import info.nightscout.core.utils.fabric.FabricPrivacy;
import info.nightscout.interfaces.notifications.Notification;
@@ -45,6 +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.pump.dana.DanaPump;
import info.nightscout.pump.dana.comm.RecordTypes;
import info.nightscout.rx.AapsSchedulers;
@@ -77,6 +77,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
@Inject AapsSchedulers aapsSchedulers;
@Inject PumpSync pumpSync;
@Inject ActivePlugin activePlugin;
+ @Inject ActivityNames activityNames;
private final CompositeDisposable disposable = new CompositeDisposable();
@@ -306,8 +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
- Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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,8 +326,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
activePlugin.getActivePump().model(),
activePlugin.getActivePump().serialNumber()
);
- Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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 {
@@ -341,8 +340,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
activePlugin.getActivePump().model(),
activePlugin.getActivePump().serialNumber()
);
- Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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());
}
}
@@ -352,8 +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
- Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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(),
@@ -372,14 +369,12 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
activePlugin.getActivePump().model(),
activePlugin.getActivePump().serialNumber()
);
- Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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
- Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
+ activityNames.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 ac17b6270b..76e8512a35 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
@@ -41,7 +41,6 @@ import info.nightscout.androidaps.danar.comm.MsgStatus;
import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
-import info.nightscout.core.events.EventNewNotification;
import info.nightscout.interfaces.Constants;
import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.profile.Profile;
@@ -204,8 +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) {
- Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
- rxBus.send(new EventNewNotification(reportFail));
+ activityNames.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 28151aa228..dbade82c4e 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,6 +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.pump.dana.DanaPump
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert
@@ -27,6 +28,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
@Mock lateinit var commandQueue: CommandQueue
@Mock lateinit var pumpSync: PumpSync
@Mock lateinit var profileInstantiator: ProfileInstantiator
+ @Mock lateinit var activityNames: ActivityNames
lateinit var danaPump: DanaPump
@@ -44,7 +46,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
- danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync)
+ danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames)
}
@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 7122911f46..fce79c3b94 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,6 +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.pump.dana.DanaPump
import info.nightscout.pump.dana.database.DanaHistoryRecordDao
import info.nightscout.rx.bus.RxBus
@@ -46,6 +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
private lateinit var testPumpPlugin: TestPumpPlugin
@@ -77,6 +79,7 @@ open class DanaRTestBase : TestBase() {
it.commandQueue = commandQueue
it.pumpSync = pumpSync
it.danaHistoryRecordDao = danaHistoryRecordDao
+ it.activityNames = activityNames
}
}
}
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 8101c0a70e..bbf5d12b7e 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,6 +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.pump.dana.DanaPump
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert
@@ -27,6 +28,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
@Mock lateinit var commandQueue: CommandQueue
@Mock lateinit var pumpSync: PumpSync
@Mock lateinit var profileInstantiator: ProfileInstantiator
+ @Mock lateinit var activityNames: ActivityNames
lateinit var danaPump: DanaPump
@@ -44,7 +46,8 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
- danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync)
+ danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy,
+ pumpSync, activityNames)
}
@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 45314c7174..0d24bdf37f 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,6 +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.pump.dana.DanaPump
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Before
@@ -30,6 +31,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
@Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage
@Mock lateinit var pumpSync: PumpSync
@Mock lateinit var profileInstantiator: ProfileInstantiator
+ @Mock lateinit var activityNames: ActivityNames
lateinit var danaPump: DanaPump
@@ -47,7 +49,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)
+ danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump,detailedBolusInfoStorage,
+ temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames)
}
@Test
diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
index 4e6fa7b312..9d1a663034 100644
--- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
+++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
@@ -454,7 +454,7 @@ class DanaRSPlugin @Inject constructor(
}
result.enacted = false
result.success = false
- result.comment = rh.gs(R.string.tempbasaldeliveryerror)
+ result.comment = rh.gs(R.string.temp_basal_delivery_error)
aapsLogger.error("setTempBasalPercent: Failed to set temp basal. connectionOK: $connectionOK isTempBasalInProgress: ${danaPump.isTempBasalInProgress} tempBasalPercent: ${danaPump.tempBasalPercent}")
return result
}
diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
index 73ed27c75c..eed0ed9746 100644
--- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
+++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
@@ -368,7 +368,7 @@ class DiaconnG8Plugin @Inject constructor(
result.enacted = false
result.success = false
- result.comment = rh.gs(R.string.tempbasaldeliveryerror)
+ result.comment = rh.gs(R.string.temp_basal_delivery_error)
aapsLogger.error("setTempBasalAbsolute: Failed to set temp basal")
return result
}
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 6ae4a63306..6e94f4d9ad 100644
--- a/ui/src/main/java/info/nightscout/ui/dialogs/LoopDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/LoopDialog.kt
@@ -310,7 +310,7 @@ class LoopDialog : DaggerDialogFragment() {
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
- ToastUtils.errorToast(ctx, rh.gs(R.string.tempbasaldeliveryerror))
+ ToastUtils.errorToast(ctx, rh.gs(R.string.temp_basal_delivery_error))
}
}
})
@@ -351,7 +351,7 @@ class LoopDialog : DaggerDialogFragment() {
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
- activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
}
}
})
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 ae443cdbd1..a969a87fca 100644
--- a/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt
@@ -135,7 +135,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
val callback: Callback = object : Callback() {
override fun run() {
if (!result.success) {
- activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
+ activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
}
}
}