- fix for dagger injection of RileyLinkMedtronicService (removed duplicate variables), and moved code to different location, because we can use injected variables before onCreate is called

This commit is contained in:
Andy Rozman 2020-04-24 15:06:17 +01:00
parent 55ecac882d
commit fae7e947a5
2 changed files with 11 additions and 9 deletions

View file

@ -33,9 +33,9 @@ import static info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyL
*/ */
public abstract class RileyLinkService extends DaggerService { public abstract class RileyLinkService extends DaggerService {
@Inject AAPSLogger aapsLogger; @Inject protected AAPSLogger aapsLogger;
@Inject SP sp; @Inject protected SP sp;
@Inject Context context; @Inject protected Context context;
public RileyLinkBLE rileyLinkBLE; // android-bluetooth management public RileyLinkBLE rileyLinkBLE; // android-bluetooth management

View file

@ -36,10 +36,10 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
*/ */
public class RileyLinkMedtronicService extends RileyLinkService { public class RileyLinkMedtronicService extends RileyLinkService {
@Inject AAPSLogger aapsLogger; //@Inject AAPSLogger aapsLogger;
@Inject Context context; //@Inject Context context;
@Inject MedtronicPumpPlugin medtronicPumpPlugin; @Inject MedtronicPumpPlugin medtronicPumpPlugin;
@Inject SP sp; //@Inject SP sp;
private static RileyLinkMedtronicService instance; private static RileyLinkMedtronicService instance;
private static ServiceTask currentTask = null; private static ServiceTask currentTask = null;
@ -53,9 +53,6 @@ public class RileyLinkMedtronicService extends RileyLinkService {
public RileyLinkMedtronicService() { public RileyLinkMedtronicService() {
super(); super();
instance = this; instance = this;
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");
MedtronicUtil.setMedtronicService(this);
pumpStatus = (MedtronicPumpStatus) medtronicPumpPlugin.getPumpStatusData();
} }
@ -106,6 +103,11 @@ public class RileyLinkMedtronicService extends RileyLinkService {
// init rileyLinkCommunicationManager // init rileyLinkCommunicationManager
medtronicCommunicationManager = new MedtronicCommunicationManager(context, rfspy); medtronicCommunicationManager = new MedtronicCommunicationManager(context, rfspy);
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");
MedtronicUtil.setMedtronicService(this);
pumpStatus = (MedtronicPumpStatus) medtronicPumpPlugin.getPumpStatusData();
} }