DataService inject SP
This commit is contained in:
parent
8b88e2d270
commit
5335b075b9
|
@ -40,7 +40,7 @@ import info.nightscout.androidaps.plugins.source.SourceTomatoPlugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
|
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
|
||||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||||
import info.nightscout.androidaps.utils.JsonHelper;
|
import info.nightscout.androidaps.utils.JsonHelper;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
|
|
||||||
public class DataService extends DaggerIntentService {
|
public class DataService extends DaggerIntentService {
|
||||||
|
@ -53,6 +53,9 @@ public class DataService extends DaggerIntentService {
|
||||||
@Inject
|
@Inject
|
||||||
SmsCommunicatorPlugin smsCommunicatorPlugin;
|
SmsCommunicatorPlugin smsCommunicatorPlugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SP sp;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHandleIntent(final Intent intent) {
|
protected void onHandleIntent(final Intent intent) {
|
||||||
if (L.isEnabled(L.DATASERVICE)) {
|
if (L.isEnabled(L.DATASERVICE)) {
|
||||||
|
@ -60,7 +63,7 @@ public class DataService extends DaggerIntentService {
|
||||||
log.debug("onHandleIntent " + BundleLogger.log(intent.getExtras()));
|
log.debug("onHandleIntent " + BundleLogger.log(intent.getExtras()));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean acceptNSData = !SP.getBoolean(R.string.key_ns_upload_only, false);
|
boolean acceptNSData = !sp.getBoolean(R.string.key_ns_upload_only, false);
|
||||||
Bundle bundles = intent.getExtras();
|
Bundle bundles = intent.getExtras();
|
||||||
|
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
|
@ -244,7 +247,7 @@ public class DataService extends DaggerIntentService {
|
||||||
String enteredBy = JsonHelper.safeGetString(json, "enteredBy", "");
|
String enteredBy = JsonHelper.safeGetString(json, "enteredBy", "");
|
||||||
String notes = JsonHelper.safeGetString(json, "notes", "");
|
String notes = JsonHelper.safeGetString(json, "notes", "");
|
||||||
if (date > now - 15 * 60 * 1000L && !notes.isEmpty()
|
if (date > now - 15 * 60 * 1000L && !notes.isEmpty()
|
||||||
&& !enteredBy.equals(SP.getString("careportal_enteredby", "AndroidAPS"))) {
|
&& !enteredBy.equals(sp.getString("careportal_enteredby", "AndroidAPS"))) {
|
||||||
Notification announcement = new Notification(Notification.NSANNOUNCEMENT, notes, Notification.ANNOUNCEMENT, 60);
|
Notification announcement = new Notification(Notification.NSANNOUNCEMENT, notes, Notification.ANNOUNCEMENT, 60);
|
||||||
RxBus.INSTANCE.send(new EventNewNotification(announcement));
|
RxBus.INSTANCE.send(new EventNewNotification(announcement));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue