diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 61021d55bc..311b1999fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -966,6 +966,7 @@ class SmsCommunicatorPlugin @Inject constructor( var keyTarget = 0 var defaultTargetMMOL = 0.0 var defaultTargetMGDL = 0.0 + var reason = TemporaryTarget.Reason.EATING_SOON when { isMeal -> { keyDuration = R.string.key_eatingsoon_duration @@ -973,6 +974,7 @@ class SmsCommunicatorPlugin @Inject constructor( keyTarget = R.string.key_eatingsoon_target defaultTargetMMOL = Constants.defaultEatingSoonTTmmol defaultTargetMGDL = Constants.defaultEatingSoonTTmgdl + reason = TemporaryTarget.Reason.EATING_SOON } isActivity -> { @@ -981,6 +983,7 @@ class SmsCommunicatorPlugin @Inject constructor( keyTarget = R.string.key_activity_target defaultTargetMMOL = Constants.defaultActivityTTmmol defaultTargetMGDL = Constants.defaultActivityTTmgdl + reason = TemporaryTarget.Reason.ACTIVITY } isHypo -> { @@ -989,6 +992,7 @@ class SmsCommunicatorPlugin @Inject constructor( keyTarget = R.string.key_hypo_target defaultTargetMMOL = Constants.defaultHypoTTmmol defaultTargetMGDL = Constants.defaultHypoTTmgdl + reason = TemporaryTarget.Reason.HYPOGLYCEMIA } } var ttDuration = sp.getInt(keyDuration, defaultTargetDuration) @@ -999,7 +1003,7 @@ class SmsCommunicatorPlugin @Inject constructor( disposable += repository.runTransactionForResult(InsertAndCancelCurrentTemporaryTargetTransaction( timestamp = dateUtil.now(), duration = TimeUnit.MINUTES.toMillis(ttDuration.toLong()), - reason = TemporaryTarget.Reason.EATING_SOON, + reason = reason, lowTarget = Profile.toMgdl(tt, profileFunction.getUnits()), highTarget = Profile.toMgdl(tt, profileFunction.getUnits()) )).subscribe({ result ->