From acd6863461679d982363200e306eb8a563ab8311 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 11 Dec 2021 22:38:00 +0100 Subject: [PATCH] new Dexcom package name --- .../androidaps/plugins/source/DexcomPlugin.kt | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt index ad20c34f50..1c766f66a1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt @@ -19,14 +19,14 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.transactions.CgmSourceTransaction import info.nightscout.androidaps.extensions.fromConstant import info.nightscout.androidaps.interfaces.* -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.receivers.DataWorker import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.XDripBroadcast import info.nightscout.androidaps.utils.resources.ResourceHelper +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag import info.nightscout.shared.sharedPreferences.SP import javax.inject.Inject import javax.inject.Singleton @@ -39,14 +39,15 @@ class DexcomPlugin @Inject constructor( private val sp: SP, private val dexcomMediator: DexcomMediator, config: Config -) : PluginBase(PluginDescription() - .mainType(PluginType.BGSOURCE) - .fragmentClass(BGSourceFragment::class.java.name) - .pluginIcon(R.drawable.ic_dexcom_g6) - .pluginName(R.string.dexcom_app_patched) - .shortName(R.string.dexcom_short) - .preferencesId(R.xml.pref_bgsourcedexcom) - .description(R.string.description_source_dexcom), +) : PluginBase( + PluginDescription() + .mainType(PluginType.BGSOURCE) + .fragmentClass(BGSourceFragment::class.java.name) + .pluginIcon(R.drawable.ic_dexcom_g6) + .pluginName(R.string.dexcom_app_patched) + .shortName(R.string.dexcom_short) + .preferencesId(R.xml.pref_bgsourcedexcom) + .description(R.string.description_source_dexcom), aapsLogger, rh, injector ), BgSource { @@ -125,11 +126,13 @@ class DexcomPlugin @Inject constructor( val now = dateUtil.now() val value = it.getInt("meterValue").toDouble() if (timestamp > now - T.months(1).msecs() && timestamp < now) { - calibrations.add(CgmSourceTransaction.Calibration( - timestamp = it.getLong("timestamp") * 1000, - value = value, - glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(Profile.unit(value)) - )) + calibrations.add( + CgmSourceTransaction.Calibration( + timestamp = it.getLong("timestamp") * 1000, + value = value, + glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(Profile.unit(value)) + ) + ) } } } @@ -155,20 +158,22 @@ class DexcomPlugin @Inject constructor( aapsLogger.debug(LTag.DATABASE, "Updated bg $it") } result.sensorInsertionsInserted.forEach { - uel.log(Action.CAREPORTAL, + uel.log( + Action.CAREPORTAL, Sources.Dexcom, ValueWithUnit.Timestamp(it.timestamp), - ValueWithUnit.TherapyEventType(it.type)) + ValueWithUnit.TherapyEventType(it.type) + ) aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it") } - result.calibrationsInserted.forEach { calibration -> - calibration.glucose?.let { glucosevalue -> + result.calibrationsInserted.forEach { calibration -> + calibration.glucose?.let { glucoseValue -> uel.log( Action.CALIBRATION, Sources.Dexcom, ValueWithUnit.Timestamp(calibration.timestamp), ValueWithUnit.TherapyEventType(calibration.type), - ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString) + ValueWithUnit.fromGlucoseUnit(glucoseValue, calibration.glucoseUnit.toString) ) } aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration") @@ -184,10 +189,12 @@ class DexcomPlugin @Inject constructor( companion object { - private val PACKAGE_NAMES = arrayOf("com.dexcom.cgm.region1.mgdl", "com.dexcom.cgm.region1.mmol", + private val PACKAGE_NAMES = arrayOf( + "com.dexcom.cgm.region1.mgdl", "com.dexcom.cgm.region1.mmol", "com.dexcom.cgm.region2.mgdl", "com.dexcom.cgm.region2.mmol", "com.dexcom.g6.region1.mmol", "com.dexcom.g6.region2.mgdl", - "com.dexcom.g6.region3.mgdl", "com.dexcom.g6.region3.mmol") + "com.dexcom.g6.region3.mgdl", "com.dexcom.g6.region3.mmol", "com.dexcom.g6" + ) const val PERMISSION = "com.dexcom.cgm.EXTERNAL_PERMISSION" }