check if plugin is enabled before accepting message

This commit is contained in:
Milos Kozak 2016-12-09 11:31:45 +01:00
parent 064de0f64e
commit f75c2f8f91
2 changed files with 14 additions and 10 deletions

View file

@ -102,11 +102,13 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
@Subscribe
public void onStatusEvent(final EventPreferenceChange s) {
boolean previousValue = useExtendedBoluses;
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop();
if (isEnabled(PUMP)) {
boolean previousValue = useExtendedBoluses;
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop();
}
}
}

View file

@ -101,11 +101,13 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
@Subscribe
public void onStatusEvent(final EventPreferenceChange s) {
boolean previousValue = useExtendedBoluses;
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop();
if (isEnabled(PUMP)) {
boolean previousValue = useExtendedBoluses;
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop();
}
}
}