remove :core:main dependency

This commit is contained in:
Milos Kozak 2022-11-28 20:29:04 +01:00
parent 6f37d6a47c
commit c4b535b65c
36 changed files with 92 additions and 130 deletions

View file

@ -42,6 +42,7 @@ import info.nightscout.ui.dialogs.WizardDialog
import javax.inject.Inject import javax.inject.Inject
class ActivityNamesImpl @Inject constructor( class ActivityNamesImpl @Inject constructor(
private val context: Context,
private val rxBus: RxBus, private val rxBus: RxBus,
private val injector: HasAndroidInjector, private val injector: HasAndroidInjector,
private val alarmSoundServiceHelper: AlarmSoundServiceHelper private val alarmSoundServiceHelper: AlarmSoundServiceHelper
@ -57,13 +58,13 @@ class ActivityNamesImpl @Inject constructor(
override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java
override val prefGeneral: Int = R.xml.pref_general override val prefGeneral: Int = R.xml.pref_general
override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) { override fun runAlarm(status: String, title: String, @RawRes soundId: Int) {
val i = Intent(ctx, errorHelperActivity) val i = Intent(context, errorHelperActivity)
i.putExtra(AlarmSoundService.SOUND_ID, soundId) i.putExtra(AlarmSoundService.SOUND_ID, soundId)
i.putExtra(AlarmSoundService.STATUS, status) i.putExtra(AlarmSoundService.STATUS, status)
i.putExtra(AlarmSoundService.TITLE, title) i.putExtra(AlarmSoundService.TITLE, title)
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
ctx.startActivity(i) context.startActivity(i)
} }
override fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int?, name: String?) { override fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int?, name: String?) {
@ -168,7 +169,7 @@ class ActivityNamesImpl @Inject constructor(
rxBus.send(EventNewNotification(Notification(id, text, level, validMinutes))) rxBus.send(EventNewNotification(Notification(id, text, level, validMinutes)))
} }
override fun addNotificationWithSound(id: Int, text: String, level: Int, soundId: Int) { override fun addNotificationWithSound(id: Int, text: String, level: Int, soundId: Int?) {
rxBus.send(EventNewNotification(Notification(id, text, level).also { it.soundId = soundId })) rxBus.send(EventNewNotification(Notification(id, text, level).also { it.soundId = soundId }))
} }

View file

@ -400,7 +400,7 @@ class BolusWizard @Inject constructor(
commandQueue.bolus(this, object : Callback() { commandQueue.bolus(this, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} else } else
carbTimer.scheduleAutomationEventEatReminder() carbTimer.scheduleAutomationEventEatReminder()
} }
@ -447,7 +447,7 @@ class BolusWizard @Inject constructor(
commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() { commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.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() { commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.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() { commandQueue.bolus(this, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} }
} }
}) })

View file

@ -356,8 +356,6 @@
<string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string> <string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string>
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string> <string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string>
<string name="sms" comment="26 characters max for translation">SMS</string> <string name="sms" comment="26 characters max for translation">SMS</string>
<string name="unconfirmed_command" comment="26 characters max for translation">Unconfirmed command</string>
<string name="requested_by_user" comment="26 characters max for translation">Requested by user</string>
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string> <string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>
<string name="formatPercent">%1$.0f%%</string> <string name="formatPercent">%1$.0f%%</string>
<string name="basal">Basal</string> <string name="basal">Basal</string>

View file

@ -1,9 +1,8 @@
package info.nightscout.androidaps.data package info.nightscout.androidaps.data
import android.content.Context import android.content.Context
import com.google.gson.Gson
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import info.nightscout.core.pump.fromJsonString
import info.nightscout.core.pump.toJsonString
import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.Bolus
import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.TherapyEvent
@ -29,6 +28,11 @@ class DetailedBolusInfoTest : TestBase() {
Assert.assertEquals(true, EqualsBuilder.reflectionEquals(d2, d1)) Assert.assertEquals(true, EqualsBuilder.reflectionEquals(d2, d1))
} }
private fun fromJsonString(json: String): DetailedBolusInfo =
Gson().fromJson(json, DetailedBolusInfo::class.java)
private fun DetailedBolusInfo.toJsonString(): String = Gson().toJson(this)
@Test @Test
fun shouldAllowSerialization() { fun shouldAllowSerialization() {
val detailedBolusInfo = DetailedBolusInfo() val detailedBolusInfo = DetailedBolusInfo()
@ -36,7 +40,7 @@ class DetailedBolusInfoTest : TestBase() {
detailedBolusInfo.context = context detailedBolusInfo.context = context
detailedBolusInfo.eventType = DetailedBolusInfo.EventType.BOLUS_WIZARD detailedBolusInfo.eventType = DetailedBolusInfo.EventType.BOLUS_WIZARD
val serialized = detailedBolusInfo.toJsonString() val serialized = detailedBolusInfo.toJsonString()
val deserialized = DetailedBolusInfo().fromJsonString(serialized) val deserialized = fromJsonString(serialized)
Assert.assertEquals(1L, deserialized.bolusCalculatorResult?.timestamp) Assert.assertEquals(1L, deserialized.bolusCalculatorResult?.timestamp)
Assert.assertEquals(DetailedBolusInfo.EventType.BOLUS_WIZARD, deserialized.eventType) Assert.assertEquals(DetailedBolusInfo.EventType.BOLUS_WIZARD, deserialized.eventType)
// Context should be excluded // Context should be excluded

View file

@ -30,7 +30,7 @@ interface ActivityNames {
* @param title title of dialog * @param title title of dialog
* @param soundId sound resource. if == 0 alarm is not started * @param soundId sound resource. if == 0 alarm is not started
*/ */
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0) fun runAlarm(status: String, title: String, @RawRes soundId: Int = 0)
fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int? = null, name: String? = null) fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int? = null, name: String? = null)
fun runLoopDialog(fragmentManager: FragmentManager, showOkCancel: Int) fun runLoopDialog(fragmentManager: FragmentManager, showOkCancel: Int)
fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String? = null) fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String? = null)
@ -64,7 +64,7 @@ interface ActivityNames {
fun addNotification(id: Int, text: String, level: Int) fun addNotification(id: Int, text: String, level: Int)
fun addNotificationValidFor(id: Int, text: String, level: Int, validMinutes: Int) fun addNotificationValidFor(id: Int, text: String, level: Int, validMinutes: Int)
fun addNotificationWithSound(id: Int, text: String, level: Int, @RawRes soundId: Int) fun addNotificationWithSound(id: Int, text: String, level: Int, @RawRes soundId: Int?)
fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long) fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long)
fun addNotificationWithAction(injector: HasAndroidInjector, nsAlarm: NSAlarm) fun addNotificationWithAction(injector: HasAndroidInjector, nsAlarm: NSAlarm)
fun addNotificationWithAction(id: Int, text: String, level: Int, buttonText: Int, action: Runnable, @RawRes soundId: Int? = null, date: Long = System.currentTimeMillis()) fun addNotificationWithAction(id: Int, text: String, level: Int, buttonText: Int, action: Runnable, @RawRes soundId: Int? = null, date: Long = System.currentTimeMillis())

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.pump package info.nightscout.implementation.pump
import com.google.gson.Gson
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.core.pump.toJsonString
import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.DetailedBolusInfoStorage import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
@ -19,6 +19,8 @@ class DetailedBolusInfoStorageImpl @Inject constructor(
val store = ArrayList<DetailedBolusInfo>() val store = ArrayList<DetailedBolusInfo>()
fun DetailedBolusInfo.toJsonString(): String = Gson().toJson(this)
@Synchronized @Synchronized
override fun add(detailedBolusInfo: DetailedBolusInfo) { override fun add(detailedBolusInfo: DetailedBolusInfo) {
aapsLogger.debug("Stored bolus info: ${detailedBolusInfo.toJsonString()}") aapsLogger.debug("Stored bolus info: ${detailedBolusInfo.toJsonString()}")

View file

@ -9,8 +9,8 @@ import android.text.Spanned
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.core.extensions.getCustomizedName
import info.nightscout.core.events.EventNewNotification import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.extensions.getCustomizedName
import info.nightscout.core.profile.ProfileSealed import info.nightscout.core.profile.ProfileSealed
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.database.ValueWrapper import info.nightscout.database.ValueWrapper
@ -117,7 +117,7 @@ class CommandQueueImplementation @Inject constructor(
setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() { setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.failed_update_basal_profile), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.failed_update_basal_profile), R.raw.boluserror)
} else { } else {
val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil) val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil)
EffectiveProfileSwitch( EffectiveProfileSwitch(

View file

@ -14,10 +14,10 @@ import android.os.SystemClock
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.extensions.convertedToAbsolute import info.nightscout.core.extensions.convertedToAbsolute
import info.nightscout.core.extensions.convertedToPercent import info.nightscout.core.extensions.convertedToPercent
import info.nightscout.core.extensions.plannedRemainingMinutes import info.nightscout.core.extensions.plannedRemainingMinutes
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.iob.json import info.nightscout.core.iob.json
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.database.ValueWrapper import info.nightscout.database.ValueWrapper
@ -684,7 +684,7 @@ class LoopPlugin @Inject constructor(
commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() { commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.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() { commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.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() { commandQueue.cancelExtended(object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
} }
} }
}) })
@ -719,7 +719,7 @@ class LoopPlugin @Inject constructor(
commandQueue.cancelTempBasal(true, object : Callback() { commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
} }
} }
}) })

View file

@ -138,7 +138,7 @@ class ActionsFragment : DaggerFragment() {
commandQueue.cancelExtended(object : Callback() { commandQueue.cancelExtended(object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
} }
} }
}) })
@ -158,7 +158,7 @@ class ActionsFragment : DaggerFragment() {
commandQueue.cancelTempBasal(true, object : Callback() { commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
} }
} }
}) })

View file

@ -158,7 +158,7 @@ class DanaUserOptionsActivity : DaggerAppCompatActivity() {
commandQueue.setUserOptions(object : Callback() { commandQueue.setUserOptions(object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
} }
} }
}) })

View file

@ -194,8 +194,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
if (Math.abs(timeDiff) > 60 * 60 * 1.5) { if (Math.abs(timeDiff) > 60 * 60 * 1.5) {
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds - large difference"); 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 //If time-diff is very large, warn user until we can synchronize history readings properly
activityNames.runAlarm(context, rh.gs(R.string.largetimediff), activityNames.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error);
rh.gs(R.string.largetimedifftitle), R.raw.error);
//deinitialize pump //deinitialize pump
danaPump.reset(); danaPump.reset();
@ -350,8 +349,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2); mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs()); danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.getFailed()) if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.getFailed())
activityNames.runAlarm(context, rh.gs(R.string.carbs_store_error) activityNames.runAlarm(rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror);
, rh.gs(R.string.error), R.raw.boluserror);
} }
final long bolusStart = System.currentTimeMillis(); final long bolusStart = System.currentTimeMillis();

View file

@ -199,7 +199,7 @@ class DanaRSService : DaggerService() {
if (abs(timeDiff) > 60 * 60 * 1.5) { if (abs(timeDiff) > 60 * 60 * 1.5) {
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference") 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 //If time-diff is very large, warn user until we can synchronize history readings properly
activityNames.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error) activityNames.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error)
//de-initialize pump //de-initialize pump
danaPump.reset() danaPump.reset()
@ -308,7 +308,7 @@ class DanaRSService : DaggerService() {
sendMessage(msgSetHistoryEntryV2) sendMessage(msgSetHistoryEntryV2)
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs()) danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed) if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed)
activityNames.runAlarm(context, rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror) activityNames.runAlarm(rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror)
} }
val bolusStart = System.currentTimeMillis() val bolusStart = System.currentTimeMillis()
if (insulin > 0) { if (insulin > 0) {

View file

@ -155,7 +155,7 @@ class DiaconnG8UserOptionsActivity : DaggerAppCompatActivity() {
commandQueue.setUserOptions(object : Callback() { commandQueue.setUserOptions(object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
} }
} }
}) })

View file

@ -338,20 +338,20 @@ class BLECommonService @Inject internal constructor(
if (message is InjectionBlockReportPacket) { if (message is InjectionBlockReportPacket) {
message.handleMessage(data) message.handleMessage(data)
diaconnG8Pump.bolusBlocked = true diaconnG8Pump.bolusBlocked = true
activityNames.runAlarm(context, rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror) activityNames.runAlarm(rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror)
return return
} }
// battery warning report // battery warning report
if (message is BatteryWarningReportPacket) { if (message is BatteryWarningReportPacket) {
message.handleMessage(data) message.handleMessage(data)
activityNames.runAlarm(context, rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror) activityNames.runAlarm(rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror)
return return
} }
// insulin lack warning report // insulin lack warning report
if (message is InsulinLackReportPacket) { if (message is InsulinLackReportPacket) {
message.handleMessage(data) message.handleMessage(data)
activityNames.runAlarm(context, rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror) activityNames.runAlarm(rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror)
return return
} }

View file

@ -212,7 +212,7 @@ class DiaconnG8Service : DaggerService() {
if (abs(timeDiff) > 60 * 60 * 1.5) { if (abs(timeDiff) > 60 * 60 * 1.5) {
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference") 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 //If time-diff is very large, warn user until we can synchronize history readings properly
activityNames.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error) activityNames.runAlarm(rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error)
//de-initialize pump //de-initialize pump
diaconnG8Pump.reset() diaconnG8Pump.reset()

View file

@ -646,7 +646,7 @@ class MedtronicPumpPlugin @Inject constructor(
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Delivery Canceled after Bolus started."); // LOG.debug("MedtronicPumpPlugin::deliverBolus - Delivery Canceled after Bolus started.");
Thread { Thread {
SystemClock.sleep(2000) SystemClock.sleep(2000)
activityNames.runAlarm(context, rh.gs(R.string.medtronic_cmd_cancel_bolus_not_supported), rh.gs(R.string.medtronic_warning), R.raw.boluserror) activityNames.runAlarm(rh.gs(R.string.medtronic_cmd_cancel_bolus_not_supported), rh.gs(R.string.medtronic_warning), R.raw.boluserror)
}.start() }.start()
} }
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
@ -1202,7 +1202,7 @@ class MedtronicPumpPlugin @Inject constructor(
if (rileyLinkMedtronicService?.verifyConfiguration() == true) { if (rileyLinkMedtronicService?.verifyConfiguration() == true) {
serviceTaskExecutor.startTask(WakeAndTuneTask(injector)) serviceTaskExecutor.startTask(WakeAndTuneTask(injector))
} else { } else {
activityNames.runAlarm(context, rh.gs(R.string.medtronic_error_operation_not_possible_no_configuration), rh.gs(R.string.medtronic_warning), R.raw.boluserror) activityNames.runAlarm(rh.gs(R.string.medtronic_error_operation_not_possible_no_configuration), rh.gs(R.string.medtronic_warning), R.raw.boluserror)
} }
} }

View file

@ -30,7 +30,6 @@ dependencies {
implementation project(':database:impl') implementation project(':database:impl')
implementation project(':app-wear-shared:shared') implementation project(':app-wear-shared:shared')
implementation project(':core:libraries') implementation project(':core:libraries')
implementation project(':core:core-main')
implementation project(':core:interfaces') implementation project(':core:interfaces')
implementation project(':core:utils') implementation project(':core:utils')
implementation project(':core:ui') implementation project(':core:ui')

View file

@ -34,7 +34,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.Das
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOverviewFragment import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOverviewFragment
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.Constants import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.Constants
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.mapProfileToBasalProgram import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.mapProfileToBasalProgram
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.utils.DateTimeUtil import info.nightscout.core.utils.DateTimeUtil
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.notifications.Notification
@ -182,13 +181,11 @@ class OmnipodDashPumpPlugin @Inject constructor(
private fun updatePodWarnings() { private fun updatePodWarnings() {
if (System.currentTimeMillis() > nextPodWarningCheck) { if (System.currentTimeMillis() > nextPodWarningCheck) {
if (!podStateManager.isPodRunning) { if (!podStateManager.isPodRunning) {
val notification = activityNames.addNotification(
Notification(
Notification.OMNIPOD_POD_NOT_ATTACHED, Notification.OMNIPOD_POD_NOT_ATTACHED,
"Pod not activated", "Pod not activated",
Notification.NORMAL Notification.NORMAL
) )
rxBus.send(EventNewNotification(notification))
} else { } else {
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED)) rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED))
if (podStateManager.isSuspended) { if (podStateManager.isSuspended) {
@ -201,15 +198,13 @@ class OmnipodDashPumpPlugin @Inject constructor(
} else { } else {
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED)) rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED))
if (!podStateManager.sameTimeZone) { if (!podStateManager.sameTimeZone) {
val notification = activityNames.addNotification(
Notification(
Notification.OMNIPOD_TIME_OUT_OF_SYNC, Notification.OMNIPOD_TIME_OUT_OF_SYNC,
"Timezone on pod is different from the timezone on phone. " + "Timezone on pod is different from the timezone on phone. " +
"Basal rate is incorrect" + "Basal rate is incorrect" +
"Switch profile to fix", "Switch profile to fix",
Notification.NORMAL Notification.NORMAL
) )
rxBus.send(EventNewNotification(notification))
} }
} }
} }
@ -1501,19 +1496,16 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
private fun showErrorDialog(message: String, sound: Int) { private fun showErrorDialog(message: String, sound: Int) {
activityNames.runAlarm(context, message, rh.gs(R.string.error), sound) activityNames.runAlarm(message, rh.gs(R.string.error), sound)
} }
private fun showNotification(id: Int, message: String, urgency: Int, sound: Int?) { private fun showNotification(id: Int, message: String, urgency: Int, sound: Int?) {
val notification = Notification( activityNames.addNotificationWithSound(
id, id,
message, message,
urgency urgency,
if (sound != null && soundEnabledForNotificationType(id)) sound else null
) )
if (sound != null && soundEnabledForNotificationType(id)) {
notification.soundId = sound
}
rxBus.send(EventNewNotification(notification))
} }
private fun soundEnabledForNotificationType(notificationType: Int): Boolean { private fun soundEnabledForNotificationType(notificationType: Int): Boolean {

View file

@ -151,8 +151,6 @@ class DashPodManagementActivity : DaggerAppCompatActivity() {
} }
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) { private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
context.let { activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0)
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
}
} }
} }

View file

@ -676,9 +676,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
} }
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) { private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
context?.let { activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0)
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
}
} }
private fun displayOkDialog(title: String, message: String) { private fun displayOkDialog(title: String, message: String) {

View file

@ -50,4 +50,8 @@
<string name="omnipod_dash_connection_lost">Lost connection to pod</string> <string name="omnipod_dash_connection_lost">Lost connection to pod</string>
<string name="omnipod_dash_bolus_already_in_progress">Another bolus is being delivered</string> <string name="omnipod_dash_bolus_already_in_progress">Another bolus is being delivered</string>
<string name="omnipod_dash_not_enough_insulin">Not enough insulin left in the reservoir</string> <string name="omnipod_dash_not_enough_insulin">Not enough insulin left in the reservoir</string>
<string name="unconfirmed_command" comment="26 characters max for translation">Unconfirmed command</string>
<string name="requested_by_user" comment="26 characters max for translation">Requested by user</string>
</resources> </resources>

View file

@ -30,7 +30,6 @@ dependencies {
implementation project(':database:impl') implementation project(':database:impl')
implementation project(':app-wear-shared:shared') implementation project(':app-wear-shared:shared')
implementation project(':core:libraries') implementation project(':core:libraries')
implementation project(':core:core-main')
implementation project(':core:interfaces') implementation project(':core:interfaces')
implementation project(':core:utils') implementation project(':core:utils')
implementation project(':core:ui') implementation project(':core:ui')

View file

@ -62,6 +62,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodEr
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosTbrChanged; import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosTbrChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosUncertainTbrRecovered; import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosUncertainTbrRecovered;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions.DetailedBolusInfoExtensionKt;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase; import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager; import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandGetPodStatus; import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandGetPodStatus;
@ -70,13 +71,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.service.Ri
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.OmnipodErosOverviewFragment; import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.OmnipodErosOverviewFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
import info.nightscout.core.services.AlarmSoundService;
import info.nightscout.core.events.EventNewNotification;
import info.nightscout.core.pump.DetailedBolusInfoExtensionKt;
import info.nightscout.core.utils.DateTimeUtil; import info.nightscout.core.utils.DateTimeUtil;
import info.nightscout.core.utils.fabric.FabricPrivacy; import info.nightscout.core.utils.fabric.FabricPrivacy;
import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.plugin.ActivePlugin;
import info.nightscout.interfaces.plugin.OwnDatabasePlugin; import info.nightscout.interfaces.plugin.OwnDatabasePlugin;
import info.nightscout.interfaces.plugin.PluginDescription; import info.nightscout.interfaces.plugin.PluginDescription;
import info.nightscout.interfaces.plugin.PluginType; import info.nightscout.interfaces.plugin.PluginType;
@ -138,7 +135,6 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
private final AAPSLogger aapsLogger; private final AAPSLogger aapsLogger;
private final AapsSchedulers aapsSchedulers; private final AapsSchedulers aapsSchedulers;
private final RxBus rxBus; private final RxBus rxBus;
private final ActivePlugin activePlugin;
private final Context context; private final Context context;
private final FabricPrivacy fabricPrivacy; private final FabricPrivacy fabricPrivacy;
private final ResourceHelper rh; private final ResourceHelper rh;
@ -176,7 +172,6 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
RxBus rxBus, RxBus rxBus,
Context context, Context context,
ResourceHelper rh, ResourceHelper rh,
ActivePlugin activePlugin,
SP sp, SP sp,
ErosPodStateManager podStateManager, ErosPodStateManager podStateManager,
AapsOmnipodErosManager aapsOmnipodErosManager, AapsOmnipodErosManager aapsOmnipodErosManager,
@ -204,7 +199,6 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
this.aapsLogger = aapsLogger; this.aapsLogger = aapsLogger;
this.aapsSchedulers = aapsSchedulers; this.aapsSchedulers = aapsSchedulers;
this.rxBus = rxBus; this.rxBus = rxBus;
this.activePlugin = activePlugin;
this.context = context; this.context = context;
this.fabricPrivacy = fabricPrivacy; this.fabricPrivacy = fabricPrivacy;
this.rh = rh; this.rh = rh;
@ -420,7 +414,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
} else { } else {
// Not sure what's going on. Notify the user // Not sure what's going on. Notify the user
aapsLogger.error(LTag.PUMP, "Unknown TBR in both Pod state and AAPS"); aapsLogger.error(LTag.PUMP, "Unknown TBR in both Pod state and AAPS");
rxBus.send(new EventNewNotification(new Notification(Notification.OMNIPOD_UNKNOWN_TBR, rh.gs(R.string.omnipod_eros_error_tbr_running_but_aaps_not_aware), Notification.NORMAL).sound(R.raw.boluserror))); activityNames.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) { } else if (!podStateManager.isTempBasalRunning() && tempBasal != null) {
aapsLogger.warn(LTag.PUMP, "Removing AAPS TBR that actually hadn't succeeded"); aapsLogger.warn(LTag.PUMP, "Removing AAPS TBR that actually hadn't succeeded");
@ -436,8 +430,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (activeAlerts.size() > 0) { if (activeAlerts.size() > 0) {
String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager)); String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager));
String notificationText = rh.gq(R.plurals.omnipod_common_pod_alerts, activeAlerts.size(), alerts); String notificationText = rh.gq(R.plurals.omnipod_common_pod_alerts, activeAlerts.size(), alerts);
Notification notification = new Notification(Notification.OMNIPOD_POD_ALERTS, notificationText, Notification.URGENT); activityNames.addNotification(Notification.OMNIPOD_POD_ALERTS, notificationText, Notification.URGENT);
rxBus.send(new EventNewNotification(notification));
pumpSync.insertAnnouncement(notificationText, null, PumpType.OMNIPOD_EROS, serialNumber()); pumpSync.insertAnnouncement(notificationText, null, PumpType.OMNIPOD_EROS, serialNumber());
if (aapsOmnipodErosManager.isAutomaticallyAcknowledgeAlertsEnabled() && !getCommandQueue().isCustomCommandInQueue(CommandSilenceAlerts.class)) { if (aapsOmnipodErosManager.isAutomaticallyAcknowledgeAlertsEnabled() && !getCommandQueue().isCustomCommandInQueue(CommandSilenceAlerts.class)) {
@ -479,20 +472,17 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
private void updatePodWarningNotifications() { private void updatePodWarningNotifications() {
if (System.currentTimeMillis() > this.nextPodWarningCheck) { if (System.currentTimeMillis() > this.nextPodWarningCheck) {
if (!podStateManager.isPodRunning()) { if (!podStateManager.isPodRunning()) {
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, rh.gs(R.string.omnipod_common_error_pod_not_attached), Notification.NORMAL); activityNames.addNotification(Notification.OMNIPOD_POD_NOT_ATTACHED, rh.gs(R.string.omnipod_common_error_pod_not_attached), Notification.NORMAL);
rxBus.send(new EventNewNotification(notification));
} else { } else {
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED)); rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED));
if (podStateManager.isSuspended()) { if (podStateManager.isSuspended()) {
Notification notification = new Notification(Notification.OMNIPOD_POD_SUSPENDED, rh.gs(R.string.omnipod_common_error_pod_suspended), Notification.NORMAL); activityNames.addNotification(Notification.OMNIPOD_POD_SUSPENDED, rh.gs(R.string.omnipod_common_error_pod_suspended), Notification.NORMAL);
rxBus.send(new EventNewNotification(notification));
} else { } else {
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED)); rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED));
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) { if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
Notification notification = new Notification(Notification.OMNIPOD_TIME_OUT_OF_SYNC, rh.gs(R.string.omnipod_common_error_time_out_of_sync), Notification.NORMAL); activityNames.addNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC, rh.gs(R.string.omnipod_common_error_time_out_of_sync), Notification.NORMAL);
rxBus.send(new EventNewNotification(notification));
} else { } else {
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC)); rxBus.send(new EventDismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC));
} }
@ -908,13 +898,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex)); return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex));
} }
Intent i = new Intent(context, activityNames.getErrorHelperActivity()); 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);
i.putExtra(AlarmSoundService.SOUND_ID, 0);
i.putExtra(AlarmSoundService.STATUS, rh.gs(R.string.omnipod_eros_pod_management_pulse_log_value) + ":\n" + result.toString());
i.putExtra(AlarmSoundService.TITLE, rh.gs(R.string.omnipod_eros_pod_management_pulse_log));
i.putExtra("clipboardContent", result.toString());
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
return new PumpEnactResult(getInjector()).success(true).enacted(false); return new PumpEnactResult(getInjector()).success(true).enacted(false);
} }
@ -936,11 +920,10 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
podStateManager.setExpirationAlertTimeBeforeShutdown(expirationReminderTimeBeforeShutdown); podStateManager.setExpirationAlertTimeBeforeShutdown(expirationReminderTimeBeforeShutdown);
podStateManager.setLowReservoirAlertUnits(lowReservoirAlertUnits); podStateManager.setLowReservoirAlertUnits(lowReservoirAlertUnits);
Notification notification = new Notification( activityNames.addNotificationValidFor(
Notification.OMNIPOD_POD_ALERTS_UPDATED, Notification.OMNIPOD_POD_ALERTS_UPDATED,
rh.gs(R.string.omnipod_common_confirmation_expiration_alerts_updated), rh.gs(R.string.omnipod_common_confirmation_expiration_alerts_updated),
Notification.INFO, 60); Notification.INFO, 60);
rxBus.send(new EventNewNotification(notification));
} else { } else {
aapsLogger.warn(LTag.PUMP, "Failed to configure alerts in Pod"); aapsLogger.warn(LTag.PUMP, "Failed to configure alerts in Pod");
} }
@ -965,11 +948,10 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
timeChangeRetries = 0; timeChangeRetries = 0;
if (!requestedByUser && aapsOmnipodErosManager.isTimeChangeEventEnabled()) { if (!requestedByUser && aapsOmnipodErosManager.isTimeChangeEventEnabled()) {
Notification notification = new Notification( activityNames.addNotificationValidFor(
Notification.TIME_OR_TIMEZONE_CHANGE, Notification.TIME_OR_TIMEZONE_CHANGE,
rh.gs(R.string.omnipod_common_confirmation_time_on_pod_updated), rh.gs(R.string.omnipod_common_confirmation_time_on_pod_updated),
Notification.INFO, 60); Notification.INFO, 60);
rxBus.send(new EventNewNotification(notification));
} }
} else { } else {
@ -978,11 +960,10 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (timeChangeRetries > 3) { if (timeChangeRetries > 3) {
if (aapsOmnipodErosManager.isTimeChangeEventEnabled()) { if (aapsOmnipodErosManager.isTimeChangeEventEnabled()) {
Notification notification = new Notification( activityNames.addNotificationValidFor(
Notification.TIME_OR_TIMEZONE_CHANGE, Notification.TIME_OR_TIMEZONE_CHANGE,
rh.gs(R.string.omnipod_eros_error_automatic_time_or_timezone_change_failed), rh.gs(R.string.omnipod_eros_error_automatic_time_or_timezone_change_failed),
Notification.INFO, 60); Notification.INFO, 60);
rxBus.send(new EventNewNotification(notification));
} }
this.hasTimeDateOrTimeZoneChanged = false; this.hasTimeDateOrTimeZoneChanged = false;
timeChangeRetries = 0; timeChangeRetries = 0;
@ -1119,7 +1100,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
} }
if (!success) { if (!success) {
aapsLogger.warn(LTag.PUMP, "Failed to retrieve Pod status on startup"); aapsLogger.warn(LTag.PUMP, "Failed to retrieve Pod status on startup");
rxBus.send(new EventNewNotification(new Notification(Notification.OMNIPOD_STARTUP_STATUS_REFRESH_FAILED, rh.gs(R.string.omnipod_common_error_failed_to_refresh_status_on_startup), Notification.NORMAL))); activityNames.addNotification(Notification.OMNIPOD_STARTUP_STATUS_REFRESH_FAILED, rh.gs(R.string.omnipod_common_error_failed_to_refresh_status_on_startup), Notification.NORMAL);
} }
} else { } else {
aapsLogger.debug(LTag.PUMP, "Not retrieving Pod status on startup: no Pod running"); aapsLogger.debug(LTag.PUMP, "Not retrieving Pod status on startup: no Pod running");

View file

@ -1,4 +1,4 @@
package info.nightscout.core.pump package info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions
import com.google.gson.Gson import com.google.gson.Gson
import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.DetailedBolusInfo

View file

@ -55,13 +55,12 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.Ril
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.OmnipodManager; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.OmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions.DetailedBolusInfoExtensionKt;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory; import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordEntity; import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordEntity;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager; import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
import info.nightscout.core.events.EventNewNotification;
import info.nightscout.core.pump.DetailedBolusInfoExtensionKt;
import info.nightscout.core.pump.PumpStateExtensionKt; import info.nightscout.core.pump.PumpStateExtensionKt;
import info.nightscout.interfaces.notifications.Notification; import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.profile.Profile; import info.nightscout.interfaces.profile.Profile;
@ -969,7 +968,7 @@ public class AapsOmnipodErosManager {
} }
private void showErrorDialog(String message, Integer sound) { private void showErrorDialog(String message, Integer sound) {
activityNames.runAlarm(context, message, rh.gs(R.string.error), sound); activityNames.runAlarm(message, rh.gs(R.string.error), sound);
} }
private void showPodFaultNotification(FaultEventCode faultEventCode) { private void showPodFaultNotification(FaultEventCode faultEventCode) {
@ -981,14 +980,7 @@ public class AapsOmnipodErosManager {
} }
private void showNotification(int id, String message, int urgency, Integer sound) { private void showNotification(int id, String message, int urgency, Integer sound) {
Notification notification = new Notification( // activityNames.addNotificationWithSound(id, message, urgency, sound);
id, //
message, //
urgency);
if (sound != null) {
notification.setSoundId(sound);
}
sendEvent(new EventNewNotification(notification));
} }
private void dismissNotification(int id) { private void dismissNotification(int id) {

View file

@ -235,9 +235,7 @@ class ErosPodManagementActivity : DaggerAppCompatActivity() {
} }
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) { private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
context.let { activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0)
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
}
} }
private fun displayNotConfiguredDialog() { private fun displayNotConfiguredDialog() {

View file

@ -590,9 +590,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
} }
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) { private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
context?.let { activityNames.runAlarm(message, title, if (withSound) R.raw.boluserror else 0)
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
}
} }
private fun displayOkDialog(title: String, message: String) { private fun displayOkDialog(title: String, message: String) {

View file

@ -54,7 +54,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
// mock all the things // mock all the things
val plugin = OmnipodErosPumpPlugin( val plugin = OmnipodErosPumpPlugin(
injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null, injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null,
rh, activePlugin, null, null, aapsOmnipodErosManager, commandQueue, rh, null, null, aapsOmnipodErosManager, commandQueue,
null, null, null, null, null, null, null, null,
rileyLinkUtil, null, null, pumpSync, activityNames, erosHistoryDatabase rileyLinkUtil, null, null, pumpSync, activityNames, erosHistoryDatabase
) )

View file

@ -374,7 +374,7 @@ class CarbsDialog : DialogFragmentWithDate() {
override fun run() { override fun run() {
carbTimer.removeAutomationEventEatReminder() carbTimer.removeAutomationEventEatReminder()
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} else if (sp.getBoolean(R.string.key_usebolusreminder, false) && remindBolus) } else if (sp.getBoolean(R.string.key_usebolusreminder, false) && remindBolus)
bolusTimer.scheduleAutomationEventBolusReminder() bolusTimer.scheduleAutomationEventBolusReminder()
} }

View file

@ -6,7 +6,6 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import com.google.common.base.Joiner import com.google.common.base.Joiner
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.extensions.formatColor import info.nightscout.core.utils.extensions.formatColor
@ -14,6 +13,7 @@ import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.protection.ProtectionCheck
import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.Callback
@ -110,7 +110,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() { commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} }
} }
}) })

View file

@ -6,7 +6,6 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import com.google.common.base.Joiner import com.google.common.base.Joiner
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.extensions.formatColor import info.nightscout.core.utils.extensions.formatColor
@ -17,6 +16,7 @@ import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.protection.ProtectionCheck
import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.DetailedBolusInfo
@ -207,7 +207,7 @@ class FillDialog : DialogFragmentWithDate() {
commandQueue.bolus(detailedBolusInfo, object : Callback() { commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} }
} }
}) })

View file

@ -266,7 +266,7 @@ class InsulinDialog : DialogFragmentWithDate() {
commandQueue.bolus(detailedBolusInfo, object : Callback() { commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} else { } else {
bolusTimer.removeAutomationEventBolusReminder() bolusTimer.removeAutomationEventBolusReminder()
} }

View file

@ -11,7 +11,6 @@ import android.view.Window
import android.view.WindowManager import android.view.WindowManager
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import dagger.android.support.DaggerDialogFragment import dagger.android.support.DaggerDialogFragment
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
@ -26,6 +25,7 @@ import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.constraints.Objectives import info.nightscout.interfaces.constraints.Objectives
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
@ -351,7 +351,7 @@ class LoopDialog : DaggerDialogFragment() {
commandQueue.cancelTempBasal(true, object : Callback() { commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
} }
} }
}) })

View file

@ -135,7 +135,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
val callback: Callback = object : Callback() { val callback: Callback = object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
} }
} }
} }

View file

@ -177,7 +177,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
commandQueue.bolus(detailedBolusInfo, object : Callback() { commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) activityNames.runAlarm(result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} }
} }
}) })