handle switching profiles in correct order
This commit is contained in:
parent
463a913cd1
commit
a109bb9853
|
@ -245,10 +245,8 @@ public class DataService extends IntentService {
|
|||
String activeProfile = bundles.getString("activeprofile");
|
||||
String profile = bundles.getString("profile");
|
||||
NSProfile nsProfile = new NSProfile(new JSONObject(profile), activeProfile);
|
||||
if (MainApp.getConfigBuilder() == null) {
|
||||
log.error("Config builder not ready on receive profile");
|
||||
return;
|
||||
}
|
||||
MainApp.bus().post(new EventNewBasalProfile(nsProfile));
|
||||
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
if (pump != null) {
|
||||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
@ -260,13 +258,11 @@ public class DataService extends IntentService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
log.error("No active pump selected");
|
||||
}
|
||||
if (Config.logIncommingData)
|
||||
log.debug("Received profile: " + activeProfile + " " + profile);
|
||||
MainApp.bus().post(new EventNewBasalProfile(nsProfile));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -541,7 +541,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
builder.setMessage(confirmText);
|
||||
builder.setPositiveButton(getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
|
||||
if (options.executeProfileSwitch) {
|
||||
if (data.has("profile")) {
|
||||
sHandler.post(new Runnable() {
|
||||
|
@ -559,12 +558,15 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
} else {
|
||||
log.error("No active pump selected");
|
||||
}
|
||||
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue