Use error dialog instead of notification for user-enacted boluses
This commit is contained in:
parent
f0765a6704
commit
1eedf86fa1
|
@ -1,5 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
import org.json.JSONException;
|
||||
|
@ -14,6 +17,7 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
|
@ -102,6 +106,7 @@ public class AapsOmnipodManager {
|
|||
private final OmnipodAlertUtil omnipodAlertUtil;
|
||||
private final NSUpload nsUpload;
|
||||
private final ProfileFunction profileFunction;
|
||||
private final Context context;
|
||||
|
||||
private boolean basalBeepsEnabled;
|
||||
private boolean bolusBeepsEnabled;
|
||||
|
@ -128,8 +133,9 @@ public class AapsOmnipodManager {
|
|||
DatabaseHelperInterface databaseHelper,
|
||||
OmnipodAlertUtil omnipodAlertUtil,
|
||||
NSUpload nsUpload,
|
||||
ProfileFunction profileFunction
|
||||
) {
|
||||
ProfileFunction profileFunction,
|
||||
Context context) {
|
||||
|
||||
this.podStateManager = podStateManager;
|
||||
this.aapsOmnipodUtil = aapsOmnipodUtil;
|
||||
this.aapsLogger = aapsLogger;
|
||||
|
@ -142,6 +148,7 @@ public class AapsOmnipodManager {
|
|||
this.omnipodAlertUtil = omnipodAlertUtil;
|
||||
this.nsUpload = nsUpload;
|
||||
this.profileFunction = profileFunction;
|
||||
this.context = context;
|
||||
|
||||
delegate = new OmnipodManager(aapsLogger, communicationService, podStateManager);
|
||||
|
||||
|
@ -357,7 +364,7 @@ public class AapsOmnipodManager {
|
|||
if (detailedBolusInfo.isSMB) {
|
||||
showNotification(getStringResource(R.string.omnipod_error_bolus_failed_uncertain_smb, detailedBolusInfo.insulin), Notification.URGENT, isNotificationUncertainSmbSoundEnabled() ? R.raw.boluserror : null);
|
||||
} else {
|
||||
showNotification(getStringResource(R.string.omnipod_error_bolus_failed_uncertain), Notification.URGENT, isNotificationUncertainBolusSoundEnabled() ? R.raw.boluserror : null);
|
||||
showErrorDialog(getStringResource(R.string.omnipod_error_bolus_failed_uncertain), isNotificationUncertainBolusSoundEnabled() ? R.raw.boluserror : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,6 +861,15 @@ public class AapsOmnipodManager {
|
|||
rxBus.send(event);
|
||||
}
|
||||
|
||||
private void showErrorDialog(String message, Integer sound) {
|
||||
Intent intent = new Intent(context, ErrorHelperActivity.class);
|
||||
intent.putExtra("soundid", sound);
|
||||
intent.putExtra("status", message);
|
||||
intent.putExtra("title", resourceHelper.gs(R.string.error));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private void showPodFaultNotification(FaultEventCode faultEventCode) {
|
||||
showPodFaultNotification(faultEventCode, R.raw.boluserror);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue