Merge remote-tracking branch 'Nightscout/dev' into UE_VWU_Dev

# Conflicts:
#	app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
#	core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
This commit is contained in:
Philoul 2021-03-17 08:55:26 +01:00
commit 919a718a81
8 changed files with 28 additions and 15 deletions

View file

@ -199,10 +199,10 @@ class TempTargetDialog : DialogFragmentWithDate() {
timestamp = eventTime, timestamp = eventTime,
duration = TimeUnit.MINUTES.toMillis(duration.toLong()), duration = TimeUnit.MINUTES.toMillis(duration.toLong()),
reason = when (reason) { reason = when (reason) {
"Eating Soon" -> TemporaryTarget.Reason.EATING_SOON resourceHelper.gs(R.string.eatingsoon) -> TemporaryTarget.Reason.EATING_SOON
"Activity" -> TemporaryTarget.Reason.ACTIVITY resourceHelper.gs(R.string.activity) -> TemporaryTarget.Reason.ACTIVITY
"Hypo" -> TemporaryTarget.Reason.HYPOGLYCEMIA resourceHelper.gs(R.string.hypo) -> TemporaryTarget.Reason.HYPOGLYCEMIA
else -> TemporaryTarget.Reason.CUSTOM else -> TemporaryTarget.Reason.CUSTOM
}, },
lowTarget = Profile.toMgdl(target, profileFunction.getUnits()), lowTarget = Profile.toMgdl(target, profileFunction.getUnits()),
highTarget = Profile.toMgdl(target, profileFunction.getUnits()) highTarget = Profile.toMgdl(target, profileFunction.getUnits())

View file

@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTar
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.extensions.friendlyDescription import info.nightscout.androidaps.utils.extensions.friendlyDescription
@ -59,6 +60,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
@Inject lateinit var nsUpload: NSUpload @Inject lateinit var nsUpload: NSUpload
@Inject lateinit var uploadQueue: UploadQueue @Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var translator: Translator
@Inject lateinit var dateUtil: DateUtil @Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper @Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var aapsSchedulers: AapsSchedulers
@ -168,7 +170,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
holder.binding.duration.text = resourceHelper.gs(R.string.format_mins, T.msecs(tempTarget.duration).mins()) holder.binding.duration.text = resourceHelper.gs(R.string.format_mins, T.msecs(tempTarget.duration).mins())
holder.binding.low.text = tempTarget.lowValueToUnitsToString(units) holder.binding.low.text = tempTarget.lowValueToUnitsToString(units)
holder.binding.high.text = tempTarget.highValueToUnitsToString(units) holder.binding.high.text = tempTarget.highValueToUnitsToString(units)
holder.binding.reason.text = tempTarget.reason.text holder.binding.reason.text = translator.translate(tempTarget.reason.text)
holder.binding.date.setTextColor( holder.binding.date.setTextColor(
when { when {
tempTarget.id == currentlyActiveTarget?.id -> resourceHelper.gc(R.color.colorActive) tempTarget.id == currentlyActiveTarget?.id -> resourceHelper.gc(R.color.colorActive)

View file

@ -66,7 +66,7 @@ class ActivityMonitor @Inject constructor(
val duration = DateUtil.niceTimeScalar(v as Long, resourceHelper) val duration = DateUtil.niceTimeScalar(v as Long, resourceHelper)
val start = sp.getLong(key.replace("total", "start"), 0) val start = sp.getLong(key.replace("total", "start"), 0)
val days = T.msecs(DateUtil.now() - start).days() val days = T.msecs(DateUtil.now() - start).days()
result += "<b><span style=\"color:yellow\">$activity:</span></b> <b>$duration</b> in <b>$days</b> days<br>" result += resourceHelper.gs(R.string.activitymonitorformat, activity, duration, days)
} }
return result return result
} }

View file

@ -319,9 +319,6 @@
<string name="openapsama_useautosens">Use Autosens feature</string> <string name="openapsama_useautosens">Use Autosens feature</string>
<string name="refresheventsfromnightscout">Refresh events from NS</string> <string name="refresheventsfromnightscout">Refresh events from NS</string>
<string name="deletefuturetreatments">Delete treatments in the future</string> <string name="deletefuturetreatments">Delete treatments in the future</string>
<string name="eatingsoon">Eating Soon</string>
<string name="hypo">Hypo</string>
<string name="activity">Activity</string>
<string name="actions_shortname">ACT</string> <string name="actions_shortname">ACT</string>
<string name="configbuilder_shortname">CONF</string> <string name="configbuilder_shortname">CONF</string>
<string name="loop_shortname">LOOP</string> <string name="loop_shortname">LOOP</string>

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.utils package info.nightscout.androidaps.utils
import info.nightscout.androidaps.core.R import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.TherapyEvent import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.* import info.nightscout.androidaps.database.entities.UserEntry.*
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -42,6 +43,13 @@ class Translator @Inject internal constructor(
TherapyEvent.MeterType.SENSOR.text -> resourceHelper.gs(R.string.glucosetype_sensor) TherapyEvent.MeterType.SENSOR.text -> resourceHelper.gs(R.string.glucosetype_sensor)
TherapyEvent.MeterType.MANUAL.text -> resourceHelper.gs(R.string.manual) TherapyEvent.MeterType.MANUAL.text -> resourceHelper.gs(R.string.manual)
TemporaryTarget.Reason.CUSTOM.text -> resourceHelper.gs(R.string.custom)
TemporaryTarget.Reason.HYPOGLYCEMIA.text -> resourceHelper.gs(R.string.hypo)
TemporaryTarget.Reason.EATING_SOON.text -> resourceHelper.gs(R.string.eatingsoon)
TemporaryTarget.Reason.ACTIVITY.text -> resourceHelper.gs(R.string.activity)
TemporaryTarget.Reason.AUTOMATION.text -> resourceHelper.gs(R.string.automation)
TemporaryTarget.Reason.WEAR.text -> resourceHelper.gs(R.string.wear)
Action.BOLUS.name -> resourceHelper.gs(R.string.uel_bolus) Action.BOLUS.name -> resourceHelper.gs(R.string.uel_bolus)
Action.BOLUS_WIZARD.name -> resourceHelper.gs(R.string.uel_bolus_wizard) Action.BOLUS_WIZARD.name -> resourceHelper.gs(R.string.uel_bolus_wizard)
Action.BOLUS_ADVISOR.name -> resourceHelper.gs(R.string.uel_bolus_advisor) Action.BOLUS_ADVISOR.name -> resourceHelper.gs(R.string.uel_bolus_advisor)
@ -154,6 +162,5 @@ class Translator @Inject internal constructor(
Units.None.name -> "" Units.None.name -> ""
else -> resourceHelper.gs(R.string.unknown) else -> resourceHelper.gs(R.string.unknown)
} }
} }

View file

@ -238,6 +238,7 @@
<!-- TDD--> <!-- TDD-->
<string name="tddformat"><![CDATA[<b>%1$s:</b> ∑: <b>%2$.2f U</b> Bol: <b>%3$.2f U</b> Bas: <b>%4$.2f U(%5$.0f%%)</b>]]></string> <string name="tddformat"><![CDATA[<b>%1$s:</b> ∑: <b>%2$.2f U</b> Bol: <b>%3$.2f U</b> Bas: <b>%4$.2f U(%5$.0f%%)</b>]]></string>
<string name="tddwithcarbsformat"><![CDATA[<b>%1$s:</b> ∑: <b>%2$.2f U</b> Bol: <b>%3$.2f U</b> Bas: <b>%4$.2f U(%5$.0f%%)</b> Carbs: <b>%6$.0f g</b>]]></string> <string name="tddwithcarbsformat"><![CDATA[<b>%1$s:</b> ∑: <b>%2$.2f U</b> Bol: <b>%3$.2f U</b> Bas: <b>%4$.2f U(%5$.0f%%)</b> Carbs: <b>%6$.0f g</b>]]></string>
<string name="activitymonitorformat"><![CDATA[<b><span style=\"color:yellow\">%1$s:</span></b> <b>%2$s</b> in <b>%3$d</b> days<br>]]></string>
<!-- Translator--> <!-- Translator-->
<string name="careportal_bgcheck">BG Check</string> <string name="careportal_bgcheck">BG Check</string>
@ -268,6 +269,12 @@
<string name="glucosetype_sensor">Sensor</string> <string name="glucosetype_sensor">Sensor</string>
<string name="manual">Manual</string> <string name="manual">Manual</string>
<string name="unknown">unknown</string> <string name="unknown">unknown</string>
<string name="eatingsoon">Eating Soon</string>
<string name="hypo">Hypo</string>
<string name="activity">Activity</string>
<string name="wear">Wear</string>
<string name="automation">Automation</string>
<string name="custom">Custom</string>
<!-- Command--> <!-- Command-->
<string name="connectiontimedout">Connection timed out</string> <string name="connectiontimedout">Connection timed out</string>

View file

@ -124,6 +124,7 @@ public class AapsOmnipodErosManager {
private boolean batteryChangeLoggingEnabled; private boolean batteryChangeLoggingEnabled;
private final CompositeDisposable disposable = new CompositeDisposable(); private final CompositeDisposable disposable = new CompositeDisposable();
private boolean aBoolean;
@Inject @Inject
public AapsOmnipodErosManager(OmnipodRileyLinkCommunicationManager communicationService, public AapsOmnipodErosManager(OmnipodRileyLinkCommunicationManager communicationService,
@ -463,7 +464,7 @@ public class AapsOmnipodErosManager {
} }
} }
String comment = null; String comment = "Unknown";
for (int i = 1; delegate.hasActiveBolus(); i++) { for (int i = 1; delegate.hasActiveBolus(); i++) {
aapsLogger.debug(LTag.PUMP, "Attempting to cancel bolus (#{})", i); aapsLogger.debug(LTag.PUMP, "Attempting to cancel bolus (#{})", i);
@ -704,8 +705,7 @@ public class AapsOmnipodErosManager {
public void addBolusToHistory(DetailedBolusInfo originalDetailedBolusInfo) { public void addBolusToHistory(DetailedBolusInfo originalDetailedBolusInfo) {
DetailedBolusInfo detailedBolusInfo = originalDetailedBolusInfo.copy(); DetailedBolusInfo detailedBolusInfo = originalDetailedBolusInfo.copy();
long pumpId = addSuccessToHistory(detailedBolusInfo.date, PodHistoryEntryType.SET_BOLUS, detailedBolusInfo.insulin + ";" + detailedBolusInfo.carbs); detailedBolusInfo.pumpId = addSuccessToHistory(detailedBolusInfo.date, PodHistoryEntryType.SET_BOLUS, detailedBolusInfo.insulin + ";" + detailedBolusInfo.carbs);
detailedBolusInfo.pumpId = pumpId;
if (detailedBolusInfo.carbs > 0 && detailedBolusInfo.carbTime > 0) { if (detailedBolusInfo.carbs > 0 && detailedBolusInfo.carbTime > 0) {
// split out a separate carbs record without a pumpId // split out a separate carbs record without a pumpId
@ -1004,7 +1004,7 @@ public class AapsOmnipodErosManager {
private void uploadCareportalEvent(long date, TherapyEvent.Type event) { private void uploadCareportalEvent(long date, TherapyEvent.Type event) {
if (repository.getTherapyEventByTimestamp(event, date) != null) return; if (repository.getTherapyEventByTimestamp(event, date) != null) return;
disposable.add(repository.runTransactionForResult(new InsertTherapyEventIfNewTransaction(date, event, 0, null, sp.getString("careportal_enteredby", "AndroidAPS"), null, null, null)) disposable.add(repository.runTransactionForResult(new InsertTherapyEventIfNewTransaction(date, event, 0, null, sp.getString("careportal_enteredby", "AndroidAPS"), null, null, TherapyEvent.GlucoseUnit.MGDL))
.subscribe( .subscribe(
result -> result.getInserted().forEach(nsUpload::uploadEvent), result -> result.getInserted().forEach(nsUpload::uploadEvent),
error -> aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", error) error -> aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", error)

View file

@ -127,7 +127,7 @@ dependencies {
implementation('com.github.lecho:hellocharts-library:1.5.8@aar') implementation('com.github.lecho:hellocharts-library:1.5.8@aar')
testImplementation "junit:junit:$junit_version" testImplementation "junit:junit:$junit_version"
testImplementation 'org.json:json:20201115' testImplementation 'org.json:json:20210307'
testImplementation("org.mockito:mockito-core:${mockitoVersion}") { testImplementation("org.mockito:mockito-core:${mockitoVersion}") {
exclude group: 'net.bytebuddy', module: 'byte-buddy' exclude group: 'net.bytebuddy', module: 'byte-buddy'
exclude group: 'net.bytebuddy', module: 'byte-buddy-android' exclude group: 'net.bytebuddy', module: 'byte-buddy-android'