Receive profile updates on uploadOnly when NS-Profiles are used

This commit is contained in:
AdrianLxM 2016-11-09 21:01:21 +01:00
parent c900d6611c
commit a6ae92bb2f
2 changed files with 7 additions and 1 deletions

View file

@ -39,6 +39,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaR.History.DanaRNSHistorySync; import info.nightscout.androidaps.plugins.DanaR.History.DanaRNSHistorySync;
import info.nightscout.androidaps.plugins.NSProfileViewer.NSProfileViewerPlugin;
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin; import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin; import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
@ -75,6 +76,8 @@ public class DataService extends IntentService {
nsClientEnabled = true; nsClientEnabled = true;
} }
boolean isNSProfile = ConfigBuilderPlugin.getActiveProfile().getClass().equals(NSProfileViewerPlugin.class);
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean nsUploadOnly = SP.getBoolean("ns_upload_only", false); boolean nsUploadOnly = SP.getBoolean("ns_upload_only", false);
@ -92,6 +95,9 @@ public class DataService extends IntentService {
// Objectives 0 // Objectives 0
ObjectivesPlugin.bgIsAvailableInNS = true; ObjectivesPlugin.bgIsAvailableInNS = true;
ObjectivesPlugin.saveProgress(); ObjectivesPlugin.saveProgress();
} else if (isNSProfile && Intents.ACTION_NEW_PROFILE.equals(action)){
// always handle Profili if NSProfile is enabled without looking at nsUploadOnly
handleNewDataFromNSClient(intent);
} else if (!nsUploadOnly && } else if (!nsUploadOnly &&
(Intents.ACTION_NEW_PROFILE.equals(action) || (Intents.ACTION_NEW_PROFILE.equals(action) ||
Intents.ACTION_NEW_TREATMENT.equals(action) || Intents.ACTION_NEW_TREATMENT.equals(action) ||

View file

@ -337,6 +337,6 @@
<string name="actions">Actions</string> <string name="actions">Actions</string>
<string name="androidaps_start">AndroidAPS started</string> <string name="androidaps_start">AndroidAPS started</string>
<string name="ns_upload_only">NS upload only (disabled sync)</string> <string name="ns_upload_only">NS upload only (disabled sync)</string>
<string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected.</string> <string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used.</string>
<string name="ns_upload_only_enabled">Please deactivate "NS upload only" to use this feature.</string> <string name="ns_upload_only_enabled">Please deactivate "NS upload only" to use this feature.</string>
</resources> </resources>