FabricPrivacy & GraphData dagger

This commit is contained in:
Milos Kozak 2020-03-21 15:09:14 +01:00
parent 69b177ed06
commit 1a485f9e11
19 changed files with 135 additions and 123 deletions

View file

@ -86,6 +86,7 @@ public class MainActivity extends NoSplashAppCompatActivity {
@Inject NSSettingsStatus nsSettingsStatus;
@Inject BuildHelper buildHelper;
@Inject ActivePluginProvider activePlugin;
@Inject FabricPrivacy fabricPrivacy;
@Override
@ -130,7 +131,7 @@ public class MainActivity extends NoSplashAppCompatActivity {
if (!loopPlugin.isEnabled(PluginType.LOOP))
versionCheckerUtils.triggerCheckVersion();
FabricPrivacy.getInstance().setUserStats();
fabricPrivacy.setUserStats();
setupTabs();
setupViews();
@ -147,12 +148,12 @@ public class MainActivity extends NoSplashAppCompatActivity {
setupViews();
}
setWakeLock();
}, exception -> FabricPrivacy.getInstance().logException(exception))
}, exception -> fabricPrivacy.logException(exception))
);
disposable.add(rxBus
.toObservable(EventPreferenceChange.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::processPreferenceChange, exception -> FabricPrivacy.getInstance().logException(exception))
.subscribe(this::processPreferenceChange, exception -> fabricPrivacy.logException(exception))
);
if (!sp.getBoolean(R.string.key_setupwizard_processed, false) && !isRunningRealPumpTest()) {

View file

@ -17,9 +17,6 @@ import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
@ -39,7 +36,7 @@ import info.nightscout.androidaps.db.TDD;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction;
@ -58,6 +55,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class TDDStatsActivity extends NoSplashAppCompatActivity {
@Inject AAPSLogger aapsLogger;
@Inject ResourceHelper resourceHelper;
@Inject RxBusWrapper rxBus;
@Inject SP sp;
@ -70,8 +68,8 @@ public class TDDStatsActivity extends NoSplashAppCompatActivity {
@Inject LocalInsightPlugin localInsightPlugin;
@Inject ConfigBuilderPlugin configBuilderPlugin;
@Inject CommandQueueProvider commandQueue;
@Inject FabricPrivacy fabricPrivacy;
private static Logger log = StacktraceLoggerWrapper.getLogger(TDDStatsActivity.class);
private CompositeDisposable disposable = new CompositeDisposable();
TextView statusView, statsMessage, totalBaseBasal2;
@ -96,15 +94,15 @@ public class TDDStatsActivity extends NoSplashAppCompatActivity {
disposable.add(rxBus
.toObservable(EventPumpStatusChanged.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(event -> statusView.setText(event.getStatus(resourceHelper)), exception -> FabricPrivacy.getInstance().logException(exception))
.subscribe(event -> statusView.setText(event.getStatus(resourceHelper)), exception -> fabricPrivacy.logException(exception))
);
disposable.add(rxBus
.toObservable(EventDanaRSyncStatus.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(event -> {
log.debug("EventDanaRSyncStatus: " + event.getMessage());
aapsLogger.debug("EventDanaRSyncStatus: " + event.getMessage());
statusView.setText(event.getMessage());
}, exception -> FabricPrivacy.getInstance().logException(exception))
}, exception -> fabricPrivacy.logException(exception))
);
}

View file

@ -21,6 +21,7 @@ import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
import info.nightscout.androidaps.plugins.general.automation.actions.*
import info.nightscout.androidaps.plugins.general.automation.elements.*
import info.nightscout.androidaps.plugins.general.automation.triggers.*
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
import info.nightscout.androidaps.plugins.general.smsCommunicator.AuthRequest
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData
@ -175,6 +176,8 @@ interface AppComponent : AndroidInjector<MainApp> {
fun injectProfile(profile: Profile)
fun injectGlucoseStatus(glucoseStatus: GlucoseStatus)
fun injectGraphData(graphData: GraphData)
@Component.Builder
interface Builder {

View file

@ -32,6 +32,7 @@ import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
import info.nightscout.androidaps.plugins.general.automation.actions.*
import info.nightscout.androidaps.plugins.general.automation.elements.*
import info.nightscout.androidaps.plugins.general.automation.triggers.*
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
import info.nightscout.androidaps.plugins.general.smsCommunicator.AuthRequest
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData
@ -45,6 +46,7 @@ import info.nightscout.androidaps.setupwizard.SWDefinition
import info.nightscout.androidaps.setupwizard.SWEventListener
import info.nightscout.androidaps.setupwizard.SWScreen
import info.nightscout.androidaps.setupwizard.elements.*
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.resources.ResourceHelperImplementation
import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -64,8 +66,8 @@ open class AppModule {
@Provides
@Singleton
fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePluginProvider): ProfileFunction {
return ProfileFunctionImplementation(injector, aapsLogger, sp, resourceHelper, activePlugin)
fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePluginProvider, fabricPrivacy: FabricPrivacy): ProfileFunction {
return ProfileFunctionImplementation(injector, aapsLogger, sp, resourceHelper, activePlugin, fabricPrivacy)
}
@Provides
@ -230,6 +232,8 @@ open class AppModule {
@ContributesAndroidInjector fun profileInjector(): Profile
@ContributesAndroidInjector fun glucoseStatusInjector(): GlucoseStatus
@ContributesAndroidInjector fun graphDataInjector(): GraphData
@Binds fun bindContext(mainApp: MainApp): Context
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector

View file

@ -23,6 +23,7 @@ import java.util.Date;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.data.Profile;
@ -48,6 +49,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
@Inject HasAndroidInjector injector;
@Inject AAPSLogger aapsLogger;
@Inject RxBusWrapper rxBus;
@Inject SP sp;
@ -57,6 +59,7 @@ public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
@Inject IobCobStaticCalculatorPlugin iobCobStaticCalculatorPlugin;
@Inject ActivePluginProvider activePlugin;
@Inject BuildHelper buildHelper;
@Inject FabricPrivacy fabricPrivacy;
private CompositeDisposable disposable = new CompositeDisposable();
@ -191,7 +194,7 @@ public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
updateGUI("EventAutosensCalculationFinished");
}
}
}, exception -> FabricPrivacy.getInstance().logException(exception))
}, exception -> fabricPrivacy.logException(exception))
);
disposable.add(rxBus
.toObservable(EventIobCalculationProgress.class)
@ -199,7 +202,7 @@ public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
.subscribe(event -> {
if (iobCalculationProgressView != null)
iobCalculationProgressView.setText(event.getProgress());
}, exception -> FabricPrivacy.getInstance().logException(exception))
}, exception -> fabricPrivacy.logException(exception))
);
// set start of current day
Calendar calendar = Calendar.getInstance();
@ -276,7 +279,7 @@ public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
// ------------------ 1st graph
final GraphData graphData = new GraphData(bgGraph, iobCobStaticCalculatorPlugin);
final GraphData graphData = new GraphData(injector, bgGraph, iobCobStaticCalculatorPlugin);
// **** In range Area ****
graphData.addInRangeArea(fromTime, toTime, lowLine, highLine);
@ -309,7 +312,7 @@ public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
// ------------------ 2nd graph
new Thread(() -> {
final GraphData secondGraphData = new GraphData(iobGraph, iobCobStaticCalculatorPlugin);
final GraphData secondGraphData = new GraphData(injector, iobGraph, iobCobStaticCalculatorPlugin);
boolean useIobForScale = false;
boolean useCobForScale = false;

View file

@ -26,7 +26,8 @@ class ProfileFunctionImplementation @Inject constructor(
private val aapsLogger: AAPSLogger,
private val sp: SP,
private val resourceHelper: ResourceHelper,
private val activePlugin: ActivePluginProvider
private val activePlugin: ActivePluginProvider,
private val fabricPrivacy: FabricPrivacy
) : ProfileFunction {
override fun getProfileName(): String =
@ -54,10 +55,10 @@ class ProfileFunctionImplementation @Inject constructor(
}
if (showRemainingTime && profileSwitch.durationInMinutes != 0) {
profileName += DateUtil.untilString(profileSwitch.originalEnd(), resourceHelper);
profileName += DateUtil.untilString(profileSwitch.originalEnd(), resourceHelper)
}
}
return profileName;
return profileName
}
override fun getProfileNameWithDuration(): String =
@ -89,7 +90,7 @@ class ProfileFunctionImplementation @Inject constructor(
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, BuildConfig.BUILDVERSION)
bundle.putString(FirebaseAnalytics.Param.START_DATE, time.toString())
bundle.putString(FirebaseAnalytics.Param.VALUE, activeTreatments.profileSwitchesFromHistory.toString())
FabricPrivacy.getInstance().logCustom(bundle)
fabricPrivacy.logCustom(bundle)
}
aapsLogger.error("getProfile at the end: returning null")
return null

View file

@ -242,7 +242,7 @@ public class NSClientPlugin extends PluginBase {
}
textLog = Html.fromHtml(newTextLog.toString());
} catch (OutOfMemoryError e) {
ToastUtils.showToastInUiThread(context, "Out of memory!\nStop using this phone !!!", R.raw.error);
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error);
}
}

View file

@ -1428,7 +1428,7 @@ public class OverviewFragment extends DaggerFragment implements View.OnClickList
// ------------------ 1st graph
Profiler.log(aapsLogger, LTag.OVERVIEW, from + " - 1st graph - START", updateGUIStart);
final GraphData graphData = new GraphData(bgGraph, iobCobCalculatorPlugin);
final GraphData graphData = new GraphData(injector, bgGraph, iobCobCalculatorPlugin);
// **** In range Area ****
graphData.addInRangeArea(fromTime, endTime, lowLine, highLine);
@ -1464,7 +1464,7 @@ public class OverviewFragment extends DaggerFragment implements View.OnClickList
// ------------------ 2nd graph
Profiler.log(aapsLogger, LTag.OVERVIEW, from + " - 2nd graph - START", updateGUIStart);
final GraphData secondGraphData = new GraphData(iobGraph, iobCobCalculatorPlugin);
final GraphData secondGraphData = new GraphData(injector, iobGraph, iobCobCalculatorPlugin);
boolean useIobForScale = false;
boolean useCobForScale = false;

View file

@ -5,18 +5,18 @@ import android.graphics.DashPathEffect;
import android.graphics.Paint;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.ValueDependentColor;
import com.jjoe64.graphview.series.BarGraphSeries;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import com.jjoe64.graphview.series.Series;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
@ -27,13 +27,14 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.PluginStore;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction;
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.AreaGraphSeries;
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DoubleDataPoint;
@ -47,30 +48,38 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.BasalData;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.treatments.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.Round;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
/**
* Created by mike on 18.10.2017.
*/
public class GraphData {
private static Logger log = StacktraceLoggerWrapper.getLogger(L.OVERVIEW);
@Inject AAPSLogger aapsLogger;
@Inject ProfileFunction profileFunction;
@Inject ResourceHelper resourceHelper;
@Inject ActivePluginProvider activePlugin;
private GraphView graph;
public double maxY = Double.MIN_VALUE;
public double minY = Double.MAX_VALUE;
private double minY = Double.MAX_VALUE;
private List<BgReading> bgReadingsArray;
private String units;
private List<Series> series = new ArrayList<>();
private TreatmentsInterface treatmentsPlugin;
private IobCobCalculatorPlugin iobCobCalculatorPlugin;
public GraphData(GraphView graph, IobCobCalculatorPlugin iobCobCalculatorPlugin) {
units = ConfigBuilderPlugin.getPlugin().getProfileFunction().getUnits();
private IobCobCalculatorPlugin iobCobCalculatorPlugin; // Cannot be injected: HistoryBrowser
public GraphData(HasAndroidInjector injector, GraphView graph, IobCobCalculatorPlugin iobCobCalculatorPlugin) {
injector.androidInjector().inject(this);
units = profileFunction.getUnits();
this.graph = graph;
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
treatmentsPlugin = activePlugin.getActiveTreatments();
}
public void addBgReadings(long fromTime, long toTime, double lowLine, double highLine, List<BgReading> predictions) {
@ -80,8 +89,7 @@ public class GraphData {
List<DataPointWithLabelInterface> bgListArray = new ArrayList<>();
if (bgReadingsArray == null || bgReadingsArray.size() == 0) {
if (L.isEnabled(L.OVERVIEW))
log.debug("No BG data.");
aapsLogger.debug(LTag.OVERVIEW, "No BG data.");
maxY = 10;
minY = 0;
return;
@ -127,7 +135,7 @@ public class GraphData {
inRangeAreaSeries = new AreaGraphSeries<>(inRangeAreaDataPoints);
inRangeAreaSeries.setColor(0);
inRangeAreaSeries.setDrawBackground(true);
inRangeAreaSeries.setBackgroundColor(MainApp.gc(R.color.inrangebackground));
inRangeAreaSeries.setBackgroundColor(resourceHelper.gc(R.color.inrangebackground));
addSeries(inRangeAreaSeries);
}
@ -151,7 +159,7 @@ public class GraphData {
double lastBaseBasal = 0;
double lastTempBasal = 0;
for (long time = fromTime; time < toTime; time += 60 * 1000L) {
Profile profile = ConfigBuilderPlugin.getPlugin().getProfileFunction().getProfile(time);
Profile profile = profileFunction.getProfile(time);
if (profile == null) continue;
BasalData basalData = iobCobCalculatorPlugin.getBasalData(profile, time);
double baseBasalValue = basalData.basal;
@ -205,14 +213,14 @@ public class GraphData {
baseBasal = baseBasalArray.toArray(baseBasal);
baseBasalsSeries = new LineGraphSeries<>(baseBasal);
baseBasalsSeries.setDrawBackground(true);
baseBasalsSeries.setBackgroundColor(MainApp.gc(R.color.basebasal));
baseBasalsSeries.setBackgroundColor(resourceHelper.gc(R.color.basebasal));
baseBasalsSeries.setThickness(0);
ScaledDataPoint[] tempBasal = new ScaledDataPoint[tempBasalArray.size()];
tempBasal = tempBasalArray.toArray(tempBasal);
tempBasalsSeries = new LineGraphSeries<>(tempBasal);
tempBasalsSeries.setDrawBackground(true);
tempBasalsSeries.setBackgroundColor(MainApp.gc(R.color.tempbasal));
tempBasalsSeries.setBackgroundColor(resourceHelper.gc(R.color.tempbasal));
tempBasalsSeries.setThickness(0);
ScaledDataPoint[] basalLine = new ScaledDataPoint[basalLineArray.size()];
@ -220,9 +228,9 @@ public class GraphData {
basalsLineSeries = new LineGraphSeries<>(basalLine);
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2);
paint.setStrokeWidth(resourceHelper.getDisplayMetrics().scaledDensity * 2);
paint.setPathEffect(new DashPathEffect(new float[]{2, 4}, 0));
paint.setColor(MainApp.gc(R.color.basal));
paint.setColor(resourceHelper.gc(R.color.basal));
basalsLineSeries.setCustomPaint(paint);
ScaledDataPoint[] absoluteBasalLine = new ScaledDataPoint[absoluteBasalLineArray.size()];
@ -230,8 +238,8 @@ public class GraphData {
absoluteBasalsLineSeries = new LineGraphSeries<>(absoluteBasalLine);
Paint absolutePaint = new Paint();
absolutePaint.setStyle(Paint.Style.STROKE);
absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2);
absolutePaint.setColor(MainApp.gc(R.color.basal));
absolutePaint.setStrokeWidth(resourceHelper.getDisplayMetrics().scaledDensity * 2);
absolutePaint.setColor(resourceHelper.gc(R.color.basal));
absoluteBasalsLineSeries.setCustomPaint(absolutePaint);
basalScale.setMultiplier(maxY * scale / maxBasalValueFound);
@ -260,12 +268,12 @@ public class GraphData {
}
for (long time = fromTime; time < toTime; time += 5 * 60 * 1000L) {
TempTarget tt = TreatmentsPlugin.getPlugin().getTempTargetFromHistory(time);
TempTarget tt = treatmentsPlugin.getTempTargetFromHistory(time);
double value;
if (tt == null) {
value = Profile.fromMgdlToUnits((profile.getTargetLowMgdl(time) + profile.getTargetHighMgdl(time)) / 2, ConfigBuilderPlugin.getPlugin().getProfileFunction().getUnits());
value = Profile.fromMgdlToUnits((profile.getTargetLowMgdl(time) + profile.getTargetHighMgdl(time)) / 2, profileFunction.getUnits());
} else {
value = Profile.fromMgdlToUnits(tt.target(), ConfigBuilderPlugin.getPlugin().getProfileFunction().getUnits());
value = Profile.fromMgdlToUnits(tt.target(), profileFunction.getUnits());
}
if (lastTarget != value) {
if (lastTarget != -1)
@ -280,7 +288,7 @@ public class GraphData {
targets = targetsSeriesArray.toArray(targets);
targetsSeries = new LineGraphSeries<>(targets);
targetsSeries.setDrawBackground(false);
targetsSeries.setColor(MainApp.gc(R.color.tempTargetBackground));
targetsSeries.setColor(resourceHelper.gc(R.color.tempTargetBackground));
targetsSeries.setThickness(2);
addSeries(targetsSeries);
@ -289,7 +297,7 @@ public class GraphData {
public void addTreatments(long fromTime, long endTime) {
List<DataPointWithLabelInterface> filteredTreatments = new ArrayList<>();
List<Treatment> treatments = TreatmentsPlugin.getPlugin().getTreatmentsFromHistory();
List<Treatment> treatments = treatmentsPlugin.getTreatmentsFromHistory();
for (int tx = 0; tx < treatments.size(); tx++) {
Treatment t = treatments.get(tx);
@ -300,7 +308,7 @@ public class GraphData {
}
// ProfileSwitch
List<ProfileSwitch> profileSwitches = TreatmentsPlugin.getPlugin().getProfileSwitchesFromHistory().getList();
List<ProfileSwitch> profileSwitches = treatmentsPlugin.getProfileSwitchesFromHistory().getList();
for (int tx = 0; tx < profileSwitches.size(); tx++) {
DataPointWithLabelInterface t = profileSwitches.get(tx);
@ -309,8 +317,8 @@ public class GraphData {
}
// Extended bolus
if (!PluginStore.Companion.getInstance().getActivePump().isFakingTempsByExtendedBoluses()) {
List<ExtendedBolus> extendedBoluses = TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory().getList();
if (!activePlugin.getActivePump().isFakingTempsByExtendedBoluses()) {
List<ExtendedBolus> extendedBoluses = treatmentsPlugin.getExtendedBolusesFromHistory().getList();
for (int tx = 0; tx < extendedBoluses.size(); tx++) {
DataPointWithLabelInterface t = extendedBoluses.get(tx);
@ -360,8 +368,8 @@ public class GraphData {
double maxIAValue = 0;
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
Profile profile = ConfigBuilderPlugin.getPlugin().getProfileFunction().getProfile(time);
double act = 0d;
Profile profile = profileFunction.getProfile(time);
double act;
if (profile == null) continue;
total = iobCobCalculatorPlugin.calculateFromTreatmentsAndTempsSynchronized(time, profile);
act = total.activity;
@ -378,7 +386,7 @@ public class GraphData {
actData = actArrayHist.toArray(actData);
actSeriesHist = new FixedLineGraphSeries<>(actData);
actSeriesHist.setDrawBackground(false);
actSeriesHist.setColor(MainApp.gc(R.color.activity));
actSeriesHist.setColor(resourceHelper.gc(R.color.activity));
actSeriesHist.setThickness(3);
addSeries(actSeriesHist);
@ -391,7 +399,7 @@ public class GraphData {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(3);
paint.setPathEffect(new DashPathEffect(new float[]{4, 4}, 0));
paint.setColor(MainApp.gc(R.color.activity));
paint.setColor(resourceHelper.gc(R.color.activity));
actSeriesPred.setCustomPaint(paint);
if (useForScale) {
@ -412,7 +420,7 @@ public class GraphData {
Scale iobScale = new Scale();
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
Profile profile = ConfigBuilderPlugin.getPlugin().getProfileFunction().getProfile(time);
Profile profile = profileFunction.getProfile(time);
double iob = 0d;
if (profile != null)
iob = iobCobCalculatorPlugin.calculateFromTreatmentsAndTempsSynchronized(time, profile).iob;
@ -429,23 +437,23 @@ public class GraphData {
iobData = iobArray.toArray(iobData);
iobSeries = new FixedLineGraphSeries<>(iobData);
iobSeries.setDrawBackground(true);
iobSeries.setBackgroundColor(0x80FFFFFF & MainApp.gc(R.color.iob)); //50%
iobSeries.setColor(MainApp.gc(R.color.iob));
iobSeries.setBackgroundColor(0x80FFFFFF & resourceHelper.gc(R.color.iob)); //50%
iobSeries.setColor(resourceHelper.gc(R.color.iob));
iobSeries.setThickness(3);
if (showPrediction) {
AutosensResult lastAutosensResult;
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("GraphData");
AutosensData autosensData = iobCobCalculatorPlugin.getLastAutosensDataSynchronized("GraphData");
if (autosensData == null)
lastAutosensResult = new AutosensResult();
else
lastAutosensResult = autosensData.autosensResult;
boolean isTempTarget = TreatmentsPlugin.getPlugin().getTempTargetFromHistory(System.currentTimeMillis()) != null;
boolean isTempTarget = treatmentsPlugin.getTempTargetFromHistory(System.currentTimeMillis()) != null;
List<DataPointWithLabelInterface> iobPred = new ArrayList<>();
IobTotal[] iobPredArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayForSMB(lastAutosensResult, SMBDefaults.exercise_mode, SMBDefaults.half_basal_exercise_target, isTempTarget);
IobTotal[] iobPredArray = iobCobCalculatorPlugin.calculateIobArrayForSMB(lastAutosensResult, SMBDefaults.exercise_mode, SMBDefaults.half_basal_exercise_target, isTempTarget);
for (IobTotal i : iobPredArray) {
iobPred.add(i.setColor(MainApp.gc(R.color.iobPredAS)));
iobPred.add(i.setColor(resourceHelper.gc(R.color.iobPredAS)));
maxIobValueFound = Math.max(maxIobValueFound, Math.abs(i.iob));
}
DataPointWithLabelInterface[] iobp = new DataPointWithLabelInterface[iobPred.size()];
@ -454,19 +462,17 @@ public class GraphData {
List<DataPointWithLabelInterface> iobPred2 = new ArrayList<>();
IobTotal[] iobPredArray2 = IobCobCalculatorPlugin.getPlugin().calculateIobArrayForSMB(new AutosensResult(), SMBDefaults.exercise_mode, SMBDefaults.half_basal_exercise_target, isTempTarget);
IobTotal[] iobPredArray2 = iobCobCalculatorPlugin.calculateIobArrayForSMB(new AutosensResult(), SMBDefaults.exercise_mode, SMBDefaults.half_basal_exercise_target, isTempTarget);
for (IobTotal i : iobPredArray2) {
iobPred2.add(i.setColor(MainApp.gc(R.color.iobPred)));
iobPred2.add(i.setColor(resourceHelper.gc(R.color.iobPred)));
maxIobValueFound = Math.max(maxIobValueFound, Math.abs(i.iob));
}
DataPointWithLabelInterface[] iobp2 = new DataPointWithLabelInterface[iobPred2.size()];
iobp2 = iobPred2.toArray(iobp2);
addSeries(new PointsWithLabelGraphSeries<>(iobp2));
if (L.isEnabled(L.AUTOSENS)) {
log.debug("IOB pred for AS=" + DecimalFormatter.to2Decimal(lastAutosensResult.ratio) + ": " + IobCobCalculatorPlugin.getPlugin().iobArrayToString(iobPredArray));
log.debug("IOB pred for AS=" + DecimalFormatter.to2Decimal(1) + ": " + IobCobCalculatorPlugin.getPlugin().iobArrayToString(iobPredArray2));
}
aapsLogger.debug(LTag.AUTOSENS, "IOB pred for AS=" + DecimalFormatter.to2Decimal(lastAutosensResult.ratio) + ": " + iobCobCalculatorPlugin.iobArrayToString(iobPredArray));
aapsLogger.debug(LTag.AUTOSENS, "IOB pred for AS=" + DecimalFormatter.to2Decimal(1) + ": " + iobCobCalculatorPlugin.iobArrayToString(iobPredArray2));
}
if (useForScale) {
@ -512,8 +518,8 @@ public class GraphData {
cobData = cobArray.toArray(cobData);
cobSeries = new FixedLineGraphSeries<>(cobData);
cobSeries.setDrawBackground(true);
cobSeries.setBackgroundColor(0x80FFFFFF & MainApp.gc(R.color.cob)); //50%
cobSeries.setColor(MainApp.gc(R.color.cob));
cobSeries.setBackgroundColor(0x80FFFFFF & resourceHelper.gc(R.color.cob)); //50%
cobSeries.setColor(resourceHelper.gc(R.color.cob));
cobSeries.setThickness(3);
if (useForScale) {
@ -535,7 +541,7 @@ public class GraphData {
class DeviationDataPoint extends ScaledDataPoint {
public int color;
public DeviationDataPoint(double x, double y, int color, Scale scale) {
private DeviationDataPoint(double x, double y, int color, Scale scale) {
super(x, y, scale);
this.color = color;
}
@ -549,18 +555,18 @@ public class GraphData {
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
AutosensData autosensData = iobCobCalculatorPlugin.getAutosensData(time);
if (autosensData != null) {
int color = MainApp.gc(R.color.deviationblack); // "="
int color = resourceHelper.gc(R.color.deviationblack); // "="
if (autosensData.type.equals("") || autosensData.type.equals("non-meal")) {
if (autosensData.pastSensitivity.equals("C"))
color = MainApp.gc(R.color.deviationgrey);
color = resourceHelper.gc(R.color.deviationgrey);
if (autosensData.pastSensitivity.equals("+"))
color = MainApp.gc(R.color.deviationgreen);
color = resourceHelper.gc(R.color.deviationgreen);
if (autosensData.pastSensitivity.equals("-"))
color = MainApp.gc(R.color.deviationred);
color = resourceHelper.gc(R.color.deviationred);
} else if (autosensData.type.equals("uam")) {
color = MainApp.gc(R.color.uam);
color = resourceHelper.gc(R.color.uam);
} else if (autosensData.type.equals("csf")) {
color = MainApp.gc(R.color.deviationgrey);
color = resourceHelper.gc(R.color.deviationgrey);
}
devArray.add(new DeviationDataPoint(time, autosensData.deviation, color, devScale));
maxDevValueFound = Math.max(maxDevValueFound, Math.abs(autosensData.deviation));
@ -571,12 +577,7 @@ public class GraphData {
DeviationDataPoint[] devData = new DeviationDataPoint[devArray.size()];
devData = devArray.toArray(devData);
devSeries = new BarGraphSeries<>(devData);
devSeries.setValueDependentColor(new ValueDependentColor<DeviationDataPoint>() {
@Override
public int get(DeviationDataPoint data) {
return data.color;
}
});
devSeries.setValueDependentColor(data -> data.color);
if (useForScale) {
maxY = maxDevValueFound;
@ -592,8 +593,8 @@ public class GraphData {
public void addRatio(long fromTime, long toTime, boolean useForScale, double scale) {
LineGraphSeries<ScaledDataPoint> ratioSeries;
List<ScaledDataPoint> ratioArray = new ArrayList<>();
Double maxRatioValueFound = Double.MIN_VALUE;
Double minRatioValueFound = Double.MAX_VALUE;
double maxRatioValueFound = Double.MIN_VALUE;
double minRatioValueFound = Double.MAX_VALUE;
Scale ratioScale = new Scale();
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
@ -609,7 +610,7 @@ public class GraphData {
ScaledDataPoint[] ratioData = new ScaledDataPoint[ratioArray.size()];
ratioData = ratioArray.toArray(ratioData);
ratioSeries = new LineGraphSeries<>(ratioData);
ratioSeries.setColor(MainApp.gc(R.color.ratio));
ratioSeries.setColor(resourceHelper.gc(R.color.ratio));
ratioSeries.setThickness(3);
if (useForScale) {
@ -628,8 +629,8 @@ public class GraphData {
LineGraphSeries<ScaledDataPoint> dsMinSeries;
List<ScaledDataPoint> dsMaxArray = new ArrayList<>();
List<ScaledDataPoint> dsMinArray = new ArrayList<>();
Double maxFromMaxValueFound = 0d;
Double maxFromMinValueFound = 0d;
double maxFromMaxValueFound = 0d;
double maxFromMinValueFound = 0d;
Scale dsMaxScale = new Scale();
Scale dsMinScale = new Scale();
@ -647,13 +648,13 @@ public class GraphData {
ScaledDataPoint[] ratioMaxData = new ScaledDataPoint[dsMaxArray.size()];
ratioMaxData = dsMaxArray.toArray(ratioMaxData);
dsMaxSeries = new LineGraphSeries<>(ratioMaxData);
dsMaxSeries.setColor(MainApp.gc(R.color.devslopepos));
dsMaxSeries.setColor(resourceHelper.gc(R.color.devslopepos));
dsMaxSeries.setThickness(3);
ScaledDataPoint[] ratioMinData = new ScaledDataPoint[dsMinArray.size()];
ratioMinData = dsMinArray.toArray(ratioMinData);
dsMinSeries = new LineGraphSeries<>(ratioMinData);
dsMinSeries.setColor(MainApp.gc(R.color.devslopeneg));
dsMinSeries.setColor(resourceHelper.gc(R.color.devslopeneg));
dsMinSeries.setThickness(3);
if (useForScale) {

View file

@ -178,7 +178,7 @@ class TidepoolPlugin @Inject constructor(
}
textLog = HtmlHelper.fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) {
ToastUtils.showToastInUiThread(context, "Out of memory!\nStop using this phone !!!", R.raw.error)
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
}
}

View file

@ -1,26 +1,24 @@
package info.nightscout.androidaps.plugins.general.tidepool.comm
import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus
import org.slf4j.LoggerFactory
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
internal class TidepoolCallback<T>(private val rxBus: RxBusWrapper, private val session: Session, val name: String, val onSuccess: () -> Unit, val onFail: () -> Unit) : Callback<T> {
private val log = StacktraceLoggerWrapper.getLogger(L.TIDEPOOL)
internal class TidepoolCallback<T>(private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val session: Session, val name: String, val onSuccess: () -> Unit, val onFail: () -> Unit) : Callback<T> {
override fun onResponse(call: Call<T>, response: Response<T>) {
if (response.isSuccessful && response.body() != null) {
if (L.isEnabled(L.TIDEPOOL)) log.debug("$name success")
aapsLogger.debug(LTag.TIDEPOOL, "$name success")
session.populateBody(response.body())
session.populateHeaders(response.headers())
onSuccess()
} else {
val msg = name + " was not successful: " + response.code() + " " + response.message()
if (L.isEnabled(L.TIDEPOOL)) log.debug(msg)
aapsLogger.debug(LTag.TIDEPOOL, msg)
rxBus.send(EventTidepoolStatus(msg))
onFail()
}
@ -28,7 +26,7 @@ internal class TidepoolCallback<T>(private val rxBus: RxBusWrapper, private val
override fun onFailure(call: Call<T>, t: Throwable) {
val msg = "$name Failed: $t"
if (L.isEnabled(L.TIDEPOOL)) log.debug(msg)
aapsLogger.debug(LTag.TIDEPOOL, msg)
rxBus.send(EventTidepoolStatus(msg))
onFail()
}

View file

@ -107,7 +107,7 @@ class TidepoolUploader @Inject constructor(
rxBus.send(EventTidepoolStatus(("Connecting")))
val call = session?.service?.getLogin(authHeader)
call?.enqueue(TidepoolCallback<AuthReplyMessage>(rxBus, session!!, "Login", {
call?.enqueue(TidepoolCallback<AuthReplyMessage>(aapsLogger, rxBus, session!!, "Login", {
startSession(session!!, doUpload)
}, {
connectionStatus = ConnectionStatus.FAILED
@ -128,7 +128,7 @@ class TidepoolUploader @Inject constructor(
session.authHeader?.let {
val call = session.service?.getLogin(it)
call?.enqueue(TidepoolCallback<AuthReplyMessage>(rxBus, session, "Login", {
call?.enqueue(TidepoolCallback<AuthReplyMessage>(aapsLogger, rxBus, session, "Login", {
OKDialog.show(rootContext, resourceHelper.gs(R.string.tidepool), "Successfully logged into Tidepool.")
}, {
OKDialog.show(rootContext, resourceHelper.gs(R.string.tidepool), "Failed to log into Tidepool.\nCheck that your user name and password are correct.")
@ -146,12 +146,12 @@ class TidepoolUploader @Inject constructor(
val datasetCall = session.service!!.getOpenDataSets(session.token!!,
session.authReply!!.userid!!, BuildConfig.APPLICATION_ID, 1)
datasetCall.enqueue(TidepoolCallback<List<DatasetReplyMessage>>(rxBus, session, "Get Open Datasets", {
datasetCall.enqueue(TidepoolCallback<List<DatasetReplyMessage>>(aapsLogger, rxBus, session, "Get Open Datasets", {
if (session.datasetReply == null) {
rxBus.send(EventTidepoolStatus(("Creating new dataset")))
val call = session.service.openDataSet(session.token!!, session.authReply!!.userid!!,
OpenDatasetRequestMessage(activePlugin.activePump.serialNumber()).getBody())
call.enqueue(TidepoolCallback<DatasetReplyMessage>(rxBus, session, "Open New Dataset", {
call.enqueue(TidepoolCallback<DatasetReplyMessage>(aapsLogger, rxBus, session, "Open New Dataset", {
connectionStatus = ConnectionStatus.CONNECTED
rxBus.send(EventTidepoolStatus(("New dataset OK")))
if (doUpload) doUpload()
@ -215,7 +215,7 @@ class TidepoolUploader @Inject constructor(
rxBus.send(EventTidepoolStatus(("Uploading")))
if (session.service != null && session.token != null && session.datasetReply != null) {
val call = session.service.doUpload(session.token!!, session.datasetReply!!.getUploadId()!!, body)
call.enqueue(TidepoolCallback<UploadReplyMessage>(rxBus, session, "Data Upload", {
call.enqueue(TidepoolCallback<UploadReplyMessage>(aapsLogger, rxBus, session, "Data Upload", {
uploadChunk.setLastEnd(session.end)
rxBus.send(EventTidepoolStatus(("Upload completed OK")))
releaseWakeLock()
@ -242,7 +242,7 @@ class TidepoolUploader @Inject constructor(
if (session?.datasetReply?.id != null) {
extendWakeLock(60000)
val call = session!!.service?.deleteDataSet(session!!.token!!, session!!.datasetReply!!.id!!)
call?.enqueue(TidepoolCallback(rxBus, session!!, "Delete Dataset", {
call?.enqueue(TidepoolCallback(aapsLogger, rxBus, session!!, "Delete Dataset", {
connectionStatus = ConnectionStatus.DISCONNECTED
rxBus.send(EventTidepoolStatus(("Dataset removed OK")))
releaseWakeLock()
@ -267,7 +267,7 @@ class TidepoolUploader @Inject constructor(
requireNotNull(userId)
extendWakeLock(60000)
val call = session.service?.deleteAllData(token, userId)
call?.enqueue(TidepoolCallback(rxBus, session, "Delete all data", {
call?.enqueue(TidepoolCallback(aapsLogger, rxBus, session, "Delete all data", {
connectionStatus = ConnectionStatus.DISCONNECTED
rxBus.send(EventTidepoolStatus(("All data removed OK")))
releaseWakeLock()

View file

@ -36,6 +36,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
@Inject lateinit var loopPlugin: LoopPlugin
@Inject lateinit var iobCobCalculatorPlugin: IobCobCalculatorPlugin
@Inject lateinit var localAlertUtils: LocalAlertUtils
@Inject lateinit var fabricPrivacy: FabricPrivacy
companion object {
@ -133,7 +134,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
}
if (lastRun != 0L && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
aapsLogger.error(LTag.CORE, "KeepAlive fail")
FabricPrivacy.getInstance().logCustom("KeepAliveFail")
fabricPrivacy.logCustom("KeepAliveFail")
}
lastRun = System.currentTimeMillis()
}

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.utils
import android.content.Context
import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -12,6 +13,7 @@ import javax.inject.Singleton
@Singleton
class HardLimits @Inject constructor(
val aapsLogger: AAPSLogger,
val rxBus: RxBusWrapper,
val sp: SP,
val resourceHelper: ResourceHelper,
val context: Context
@ -85,7 +87,7 @@ class HardLimits @Inject constructor(
msg += String.format(resourceHelper.gs(R.string.valuelimitedto), value, newvalue)
aapsLogger.error(msg)
NSUpload.uploadError(msg)
ToastUtils.showToastInUiThread(context, msg, R.raw.error)
ToastUtils.showToastInUiThread(context, rxBus, msg, R.raw.error)
}
return newvalue
}

View file

@ -8,6 +8,7 @@ import android.widget.Toast;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@ -22,13 +23,13 @@ public class ToastUtils {
mainThread.post(() -> Toast.makeText(ctx, string, Toast.LENGTH_SHORT).show());
}
public static void showToastInUiThread(final Context ctx,
public static void showToastInUiThread(final Context ctx, final RxBusWrapper rxBus,
final String string, int soundID) {
showToastInUiThread(ctx, string);
playSound(ctx, soundID);
Notification notification = new Notification(Notification.TOAST_ALARM, string, Notification.URGENT);
RxBus.Companion.getINSTANCE().send(new EventNewNotification(notification));
rxBus.send(new EventNewNotification(notification));
}
private static void playSound(final Context ctx, final int soundID) {

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.utils.resources
import android.content.res.AssetFileDescriptor
import android.graphics.Bitmap
import android.util.DisplayMetrics
import androidx.annotation.*
interface ResourceHelper {
@ -17,5 +18,6 @@ interface ResourceHelper {
fun getIcon() : Int
fun getNotificationIcon() : Int
fun decodeResource(id : Int) : Bitmap
fun getDisplayMetrics(): DisplayMetrics
fun dpToPx(dp: Int): Int
}

View file

@ -5,6 +5,7 @@ import android.content.Context
import android.content.res.AssetFileDescriptor
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.util.DisplayMetrics
import androidx.annotation.ArrayRes
import androidx.annotation.BoolRes
import androidx.annotation.ColorRes
@ -60,6 +61,9 @@ class ResourceHelperImplementation @Inject constructor(private val context: Cont
override fun decodeResource(id: Int): Bitmap =
BitmapFactory.decodeResource(context.resources, id)
override fun getDisplayMetrics():DisplayMetrics =
context.resources.getDisplayMetrics()
override fun dpToPx(dp: Int): Int {
val scale = context.resources.displayMetrics.density
return (dp * scale + 0.5f).toInt()

View file

@ -6,11 +6,9 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
@ -31,7 +29,6 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentService
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert
import org.junit.Before
@ -106,10 +103,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
`when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
// PowerMockito.mockStatic(FabricPrivacy::class.java)
// val mainApp = AAPSMocker.mockMainApp()
// `when`(mainApp.packageName).thenReturn("info.nightscout.androidaps")
// RS constructor
`when`(sp.getString(R.string.key_danars_address, "")).thenReturn("")
@ -118,7 +111,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
constraintChecker = ConstraintChecker(activePlugin)
danaRPump = DanaRPump(aapsLogger, sp, injector)
hardLimits = HardLimits(aapsLogger, sp, resourceHelper, context)
hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context)
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp)
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context)
danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump)

View file

@ -74,7 +74,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
hardLimits = HardLimits(aapsLogger, sp, resourceHelper, context)
hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context)
safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, buildHelper, treatmentsPlugin)
}