diff --git a/core/utils/src/main/res/values/keys.xml b/core/utils/src/main/res/values/keys.xml index 8493fae85b..1dc4a7f260 100644 --- a/core/utils/src/main/res/values/keys.xml +++ b/core/utils/src/main/res/values/keys.xml @@ -50,6 +50,7 @@ insight_local_settings data_choices_settings dexcom_settings + xdrip_settings active_pump_change_timestamp active_pump_type active_pump_serial_number diff --git a/plugins/source/src/main/kotlin/app/aaps/plugins/source/XdripSourcePlugin.kt b/plugins/source/src/main/kotlin/app/aaps/plugins/source/XdripSourcePlugin.kt index 1942e424be..fee5212076 100644 --- a/plugins/source/src/main/kotlin/app/aaps/plugins/source/XdripSourcePlugin.kt +++ b/plugins/source/src/main/kotlin/app/aaps/plugins/source/XdripSourcePlugin.kt @@ -11,6 +11,7 @@ import app.aaps.core.interfaces.plugin.PluginDescription import app.aaps.core.interfaces.plugin.PluginType import app.aaps.core.interfaces.receivers.Intents import app.aaps.core.interfaces.resources.ResourceHelper +import app.aaps.core.interfaces.sharedPreferences.SP import app.aaps.core.interfaces.source.BgSource import app.aaps.core.interfaces.source.XDripSource import app.aaps.core.interfaces.utils.DateUtil @@ -41,7 +42,7 @@ class XdripSourcePlugin @Inject constructor( .mainType(PluginType.BGSOURCE) .fragmentClass(BGSourceFragment::class.java.name) .pluginIcon((app.aaps.core.main.R.drawable.ic_blooddrop_48)) - .preferencesId(R.xml.pref_bgsource) + .preferencesId(R.xml.pref_xdrip) .pluginName(R.string.source_xdrip) .description(R.string.description_source_xdrip), aapsLogger, rh, injector @@ -70,6 +71,7 @@ class XdripSourcePlugin @Inject constructor( ) : LoggingWorker(context, params, Dispatchers.IO) { @Inject lateinit var xdripSourcePlugin: XdripSourcePlugin + @Inject lateinit var sp: SP @Inject lateinit var dateUtil: DateUtil @Inject lateinit var repository: AppRepository @Inject lateinit var dataWorkerStorage: DataWorkerStorage @@ -96,7 +98,11 @@ class XdripSourcePlugin @Inject constructor( ) ) val now = dateUtil.now() - var sensorStartTime: Long? = bundle.getLong(Intents.EXTRA_SENSOR_STARTED_AT, 0) + var sensorStartTime: Long? = if (sp.getBoolean(R.string.key_xdrip_log_ns_sensor_change, false)) { + bundle.getLong(Intents.EXTRA_SENSOR_STARTED_AT, 0) + } else { + null + } // check start time validity sensorStartTime?.let { if (abs(it - now) > T.months(1).msecs() || it > now) sensorStartTime = null diff --git a/plugins/source/src/main/res/values/strings.xml b/plugins/source/src/main/res/values/strings.xml index 9c2db02d03..d2a3aa7d08 100644 --- a/plugins/source/src/main/res/values/strings.xml +++ b/plugins/source/src/main/res/values/strings.xml @@ -2,6 +2,7 @@ dexcom_lognssensorchange + xdrip_lognssensorchange last_processed_glunovo_timestamp last_processed_intelligo_timestamp @@ -39,8 +40,8 @@ Send BG data to xDrip+ In xDrip+ select 640g/Eversense data source BG upload settings - Log sensor change to NS - Create event \"Sensor Change\" in NS automatically on sensor start + Log sensor change to NS + Create event \"Sensor Change\" in NS automatically on sensor start direction diff --git a/plugins/source/src/main/res/xml/pref_dexcom.xml b/plugins/source/src/main/res/xml/pref_dexcom.xml index f9891d0049..2479f27cd6 100644 --- a/plugins/source/src/main/res/xml/pref_dexcom.xml +++ b/plugins/source/src/main/res/xml/pref_dexcom.xml @@ -15,8 +15,8 @@ + android:summary="@string/log_ns_sensor_change_summary" + android:title="@string/log_ns_sensor_change_title" /> diff --git a/plugins/source/src/main/res/xml/pref_xdrip.xml b/plugins/source/src/main/res/xml/pref_xdrip.xml new file mode 100644 index 0000000000..1eb5069016 --- /dev/null +++ b/plugins/source/src/main/res/xml/pref_xdrip.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + \ No newline at end of file