commit
2527bf1be6
85 changed files with 3362 additions and 180 deletions
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.activities
|
|||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.ActivityStatsBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.utils.ActivityMonitor
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.stats.TddCalculator
|
||||
|
@ -14,6 +15,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var tddCalculator: TddCalculator
|
||||
@Inject lateinit var tirCalculator: TirCalculator
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private lateinit var binding: ActivityStatsBinding
|
||||
|
||||
|
@ -29,6 +31,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
binding.ok.setOnClickListener { finish() }
|
||||
binding.reset.setOnClickListener {
|
||||
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
|
||||
uel.log("STATS RESET")
|
||||
activityMonitor.reset()
|
||||
recreate()
|
||||
}
|
||||
|
|
|
@ -77,18 +77,13 @@ abstract class FragmentsModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun contributesTidepoolFragment(): TidepoolFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsFragment(): TreatmentsFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesTreatmentsBolusFragment(): TreatmentsBolusFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesTreatmentsTemporaryBasalsFragment(): TreatmentsTemporaryBasalsFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesTreatmentsTempTargetFragment(): TreatmentsTempTargetFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesTreatmentsExtendedBolusesFragment(): TreatmentsExtendedBolusesFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesTreatmentsCareportalFragment(): TreatmentsCareportalFragment
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesTreatmentsProfileSwitchFragment(): TreatmentsProfileSwitchFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsBolusFragment(): TreatmentsBolusFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsTemporaryBasalsFragment(): TreatmentsTemporaryBasalsFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsTempTargetFragment(): TreatmentsTempTargetFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsExtendedBolusesFragment(): TreatmentsExtendedBolusesFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsCareportalFragment(): TreatmentsCareportalFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsProfileSwitchFragment(): TreatmentsProfileSwitchFragment
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentsUserEntryFragment(): TreatmentsUserEntryFragment
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.databinding.DialogCalibrationBinding
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.XdripCalibrations
|
||||
|
@ -26,6 +27,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var xdripCalibrations: XdripCalibrations
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: DialogCalibrationBinding? = null
|
||||
|
||||
|
@ -75,7 +77,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
|||
if (bg > 0) {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
aapsLogger.debug("USER ENTRY: CALIBRATION $bg")
|
||||
uel.log("CALIBRATION", d1 = bg)
|
||||
xdripCalibrations.sendIntent(bg)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.db.Source
|
|||
import info.nightscout.androidaps.db.TempTarget
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||
|
@ -46,6 +47,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var iobCobCalculatorPlugin: IobCobCalculatorPlugin
|
||||
@Inject lateinit var nsUpload: NSUpload
|
||||
@Inject lateinit var carbsGenerator: CarbsGenerator
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -210,7 +212,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.carbs), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
when {
|
||||
activitySelected -> {
|
||||
aapsLogger.debug("USER ENTRY: TEMPTARGET ACTIVITY $activityTT duration: $activityTTDuration")
|
||||
uel.log("TT ACTIVITY", d1 = activityTT, i1 = activityTTDuration)
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(activityTTDuration)
|
||||
|
@ -222,7 +224,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
|
||||
eatingSoonSelected -> {
|
||||
aapsLogger.debug("USER ENTRY: TEMPTARGET EATING SOON $eatingSoonTT duration: $eatingSoonTTDuration")
|
||||
uel.log("TT EATING SOON", d1 = eatingSoonTT, i1 = eatingSoonTTDuration)
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(eatingSoonTTDuration)
|
||||
|
@ -234,7 +236,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
|
||||
hypoSelected -> {
|
||||
aapsLogger.debug("USER ENTRY: TEMPTARGET HYPO $hypoTT duration: $hypoTTDuration")
|
||||
uel.log("TT HYPO", d1 = hypoTT, i1 = hypoTTDuration)
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(hypoTTDuration)
|
||||
|
@ -247,10 +249,10 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
if (carbsAfterConstraints > 0) {
|
||||
if (duration == 0) {
|
||||
aapsLogger.debug("USER ENTRY: CARBS $carbsAfterConstraints time: $time")
|
||||
uel.log("CARBS", d1 = carbsAfterConstraints.toDouble(), i1 = timeOffset)
|
||||
carbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes)
|
||||
} else {
|
||||
aapsLogger.debug("USER ENTRY: CARBS $carbsAfterConstraints time: $time duration: $duration")
|
||||
uel.log("CARBS", d1 = carbsAfterConstraints.toDouble(), i1 = timeOffset, i2 = duration)
|
||||
carbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes)
|
||||
nsUpload.uploadEvent(CareportalEvent.NOTE, DateUtil.now() - 2000, resourceHelper.gs(R.string.generated_ecarbs_note, carbsAfterConstraints, duration, timeOffset))
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.databinding.DialogCareBinding
|
|||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
@ -37,6 +38,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var nsUpload: NSUpload
|
||||
@Inject lateinit var translator: Translator
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
enum class EventType {
|
||||
BGCHECK,
|
||||
|
@ -220,7 +222,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
EventType.ANNOUNCEMENT -> CareportalEvent.ANNOUNCEMENT
|
||||
}
|
||||
careportalEvent.json = json.toString()
|
||||
aapsLogger.debug("USER ENTRY: CAREPORTAL ${careportalEvent.eventType} json: ${careportalEvent.json}")
|
||||
uel.log("CAREPORTAL", careportalEvent.eventType)
|
||||
MainApp.getDbHelper().createOrUpdate(careportalEvent)
|
||||
nsUpload.uploadCareportalEntryToNS(json)
|
||||
}, null)
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
|
|||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
|
@ -32,6 +33,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: DialogExtendedbolusBinding? = null
|
||||
|
||||
|
@ -86,7 +88,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
|||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
aapsLogger.debug("USER ENTRY: EXTENDED BOLUS $insulinAfterConstraint duration: $durationInMinutes")
|
||||
uel.log("EXTENDED BOLUS", d1 = insulinAfterConstraint, i1 = durationInMinutes)
|
||||
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.db.Source
|
|||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
|
@ -37,6 +38,7 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var nsUpload: NSUpload
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: DialogFillBinding? = null
|
||||
|
||||
|
@ -126,16 +128,16 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
if (insulinAfterConstraints > 0) {
|
||||
aapsLogger.debug("USER ENTRY: PRIME BOLUS $insulinAfterConstraints")
|
||||
uel.log("PRIME BOLUS", d1 = insulinAfterConstraints)
|
||||
requestPrimeBolus(insulinAfterConstraints, notes)
|
||||
}
|
||||
if (siteChange) {
|
||||
aapsLogger.debug("USER ENTRY: SITE CHANGE")
|
||||
uel.log("SITE CHANGE")
|
||||
nsUpload.generateCareportalEvent(CareportalEvent.SITECHANGE, eventTime, notes)
|
||||
}
|
||||
if (insulinChange) {
|
||||
// add a second for case of both checked
|
||||
aapsLogger.debug("USER ENTRY: INSULIN CHANGE")
|
||||
uel.log("INSULIN CHANGE")
|
||||
nsUpload.generateCareportalEvent(CareportalEvent.INSULINCHANGE, eventTime + 1000, notes)
|
||||
}
|
||||
}, null)
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -23,6 +24,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
|||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.*
|
||||
|
@ -46,7 +48,9 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var ctx: Context
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -175,7 +179,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
if (eatingSoonChecked) {
|
||||
aapsLogger.debug("USER ENTRY: TEMPTARGET EATING SOON $eatingSoonTT duration: $eatingSoonTTDuration")
|
||||
uel.log("TT EATING SOON", d1 = eatingSoonTT, i1 = eatingSoonTTDuration)
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(eatingSoonTTDuration)
|
||||
|
@ -193,11 +197,11 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
detailedBolusInfo.source = Source.USER
|
||||
detailedBolusInfo.notes = notes
|
||||
if (recordOnlyChecked) {
|
||||
aapsLogger.debug("USER ENTRY: BOLUS RECORD ONLY $insulinAfterConstraints")
|
||||
uel.log("BOLUS RECORD", d1 = insulinAfterConstraints, i1 = timeOffset)
|
||||
detailedBolusInfo.date = time
|
||||
activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false)
|
||||
} else {
|
||||
aapsLogger.debug("USER ENTRY: BOLUS $insulinAfterConstraints")
|
||||
uel.log("BOLUS", d1 = insulinAfterConstraints)
|
||||
detailedBolusInfo.date = DateUtil.now()
|
||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.databinding.DialogLoopBinding
|
|||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
|
@ -46,6 +47,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var showOkCancel: Boolean = true
|
||||
private var _binding: DialogLoopBinding? = null
|
||||
|
@ -237,28 +239,28 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
val profile = profileFunction.getProfile() ?: return true
|
||||
when (v.id) {
|
||||
R.id.overview_closeloop -> {
|
||||
aapsLogger.debug("USER ENTRY: CLOSED LOOP MODE")
|
||||
uel.log("CLOSED LOOP MODE")
|
||||
sp.putString(R.string.key_aps_mode, "closed")
|
||||
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.closedloop)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_lgsloop -> {
|
||||
aapsLogger.debug("USER ENTRY: LGS LOOP MODE")
|
||||
uel.log("LGS LOOP MODE")
|
||||
sp.putString(R.string.key_aps_mode, "lgs")
|
||||
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_openloop -> {
|
||||
aapsLogger.debug("USER ENTRY: OPEN LOOP MODE")
|
||||
uel.log("OPEN LOOP MODE")
|
||||
sp.putString(R.string.key_aps_mode, "open")
|
||||
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disable -> {
|
||||
aapsLogger.debug("USER ENTRY: LOOP DISABLED")
|
||||
uel.log("LOOP DISABLED")
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
|
||||
configBuilderPlugin.storeSettings("DisablingLoop")
|
||||
|
@ -275,7 +277,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_enable -> {
|
||||
aapsLogger.debug("USER ENTRY: LOOP ENABLED")
|
||||
uel.log("LOOP ENABLED")
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
|
||||
configBuilderPlugin.storeSettings("EnablingLoop")
|
||||
|
@ -285,7 +287,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_resume, R.id.overview_reconnect -> {
|
||||
aapsLogger.debug("USER ENTRY: RESUME")
|
||||
uel.log("RESUME")
|
||||
loopPlugin.suspendTo(0L)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -306,49 +308,49 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_suspend_1h -> {
|
||||
aapsLogger.debug("USER ENTRY: SUSPEND 1h")
|
||||
uel.log("SUSPEND 1h")
|
||||
loopPlugin.suspendLoop(60)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_2h -> {
|
||||
aapsLogger.debug("USER ENTRY: SUSPEND 2h")
|
||||
uel.log("SUSPEND 2h")
|
||||
loopPlugin.suspendLoop(120)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_3h -> {
|
||||
aapsLogger.debug("USER ENTRY: SUSPEND 3h")
|
||||
uel.log("SUSPEND 3h")
|
||||
loopPlugin.suspendLoop(180)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_10h -> {
|
||||
aapsLogger.debug("USER ENTRY: SUSPEND 10h")
|
||||
uel.log("SUSPEND 10h")
|
||||
loopPlugin.suspendLoop(600)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_15m -> {
|
||||
aapsLogger.debug("USER ENTRY: DISCONNECT 15m")
|
||||
uel.log("DISCONNECT 15m")
|
||||
loopPlugin.disconnectPump(15, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_30m -> {
|
||||
aapsLogger.debug("USER ENTRY: DISCONNECT 30m")
|
||||
uel.log("DISCONNECT 30m")
|
||||
loopPlugin.disconnectPump(30, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_1h -> {
|
||||
aapsLogger.debug("USER ENTRY: DISCONNECT 1h")
|
||||
uel.log("DISCONNECT 1h")
|
||||
loopPlugin.disconnectPump(60, profile)
|
||||
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
|
@ -356,14 +358,14 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_disconnect_2h -> {
|
||||
aapsLogger.debug("USER ENTRY: DISCONNECT 2h")
|
||||
uel.log("DISCONNECT 2h")
|
||||
loopPlugin.disconnectPump(120, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_3h -> {
|
||||
aapsLogger.debug("USER ENTRY: DISCONNECT 3h")
|
||||
uel.log("DISCONNECT 3h")
|
||||
loopPlugin.disconnectPump(180, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
|
@ -26,6 +27,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var profileIndex: Int? = null
|
||||
|
||||
|
@ -122,7 +124,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
aapsLogger.debug("USER ENTRY: PROFILE SWITCH $profile percent: $percent timeshift: $timeShift duration: $duration")
|
||||
uel.log("PROFILE SWITCH", d1 = percent.toDouble(), i1 = timeShift, i2 = duration)
|
||||
treatmentsPlugin.doProfileSwitch(profileStore, profile, duration, percent, timeShift, eventTime)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
|||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
|
@ -35,6 +36,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var ctx: Context
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var isPercentPump = true
|
||||
|
||||
|
@ -129,10 +131,10 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
}
|
||||
if (isPercentPump) {
|
||||
aapsLogger.debug("USER ENTRY: TEMP BASAL $percent% duration: $durationInMinutes")
|
||||
uel.log("TEMP BASAL", d1 = percent.toDouble(), i1 = durationInMinutes)
|
||||
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
|
||||
} else {
|
||||
aapsLogger.debug("USER ENTRY: TEMP BASAL $absolute duration: $durationInMinutes")
|
||||
uel.log("TEMP BASAL", d1 = absolute, i1 = durationInMinutes)
|
||||
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.db.Source
|
|||
import info.nightscout.androidaps.db.TempTarget
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||
|
@ -33,8 +34,9 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
||||
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
lateinit var reasonList: List<String>
|
||||
private lateinit var reasonList: List<String>
|
||||
|
||||
private var _binding: DialogTemptargetBinding? = null
|
||||
|
||||
|
@ -162,7 +164,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
aapsLogger.debug("USER ENTRY: TEMP TARGET $target duration: $duration")
|
||||
uel.log("TT", d1 = target, i1 = duration)
|
||||
if (target == 0.0 || duration == 0) {
|
||||
val tempTarget = TempTarget()
|
||||
.date(eventTime)
|
||||
|
|
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.db.Source
|
|||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
|
@ -41,6 +42,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var ctx: Context
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val textWatcher: TextWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {}
|
||||
|
@ -128,7 +130,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
aapsLogger.debug("USER ENTRY: BOLUS insulin $insulin carbs: $carbs")
|
||||
uel.log("TREATMENT", d1 = insulin, i1 = carbs)
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION
|
||||
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS
|
||||
|
|
|
@ -15,11 +15,11 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class LoopFragment : DaggerFragment() {
|
||||
|
|
|
@ -16,10 +16,10 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.JSONFormatter
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -17,10 +17,10 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.JSONFormatter
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -18,7 +18,7 @@ import info.nightscout.androidaps.interfaces.*
|
|||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
|
|
@ -9,9 +9,10 @@ import info.nightscout.androidaps.events.EventRebuildTabs
|
|||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import java.util.*
|
||||
|
@ -25,7 +26,8 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
resourceHelper: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val activePlugin: ActivePluginProvider
|
||||
private val activePlugin: ActivePluginProvider,
|
||||
private val uel: UserEntryLogger
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
.fragmentClass(ConfigBuilderFragment::class.java.name)
|
||||
|
@ -137,9 +139,10 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
if (allowHardwarePump || activity == null) {
|
||||
performPluginSwitch(changedPlugin, newState, type)
|
||||
} else {
|
||||
showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
|
||||
performPluginSwitch(changedPlugin, newState, type)
|
||||
sp.putBoolean("allow_hardware_pump", true)
|
||||
uel.log("HW PUMP ALLOWED")
|
||||
aapsLogger.debug(LTag.PUMP, "First time HW pump allowed!")
|
||||
}, Runnable {
|
||||
rxBus.send(EventConfigBuilderUpdateGui())
|
||||
|
|
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.databinding.ObjectivesItemBinding
|
|||
import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
||||
import info.nightscout.androidaps.events.EventNtpStatus
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesUpdateGui
|
||||
|
@ -33,7 +34,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.SntpClient
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -52,6 +53,7 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
@Inject lateinit var receiverStatusStore: ReceiverStatusStore
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var sntpClient: SntpClient
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val objectivesAdapter = ObjectivesAdapter()
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
@ -305,6 +307,7 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.binding.unstart.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.doyouwantresetstart), Runnable {
|
||||
uel.log("OBJECTVE UNSTARTED", i1 = position + 1)
|
||||
objective.startedOn = 0
|
||||
scrollToCurrentObjective()
|
||||
rxBus.send(EventObjectivesUpdateGui())
|
||||
|
|
|
@ -9,6 +9,7 @@ import info.nightscout.androidaps.Config
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.*
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
|
@ -25,8 +26,8 @@ class ObjectivesPlugin @Inject constructor(
|
|||
resourceHelper: ResourceHelper,
|
||||
private val activePlugin: ActivePluginProvider,
|
||||
private val sp: SP,
|
||||
private val config: Config
|
||||
|
||||
config: Config,
|
||||
private val uel: UserEntryLogger
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.CONSTRAINTS)
|
||||
.fragmentClass(ObjectivesFragment::class.qualifiedName)
|
||||
|
@ -141,6 +142,7 @@ class ObjectivesPlugin @Inject constructor(
|
|||
sp.putLong("Objectives_" + "auto" + "_accomplished", DateUtil.now())
|
||||
setupObjectives()
|
||||
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeaccepted))
|
||||
uel.log("OBJECTIVES SKIPPED")
|
||||
} else {
|
||||
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeinvalid))
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
|||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
|
||||
|
@ -32,7 +33,7 @@ import info.nightscout.androidaps.skins.SkinProvider
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -61,6 +62,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var skinProvider: SkinProvider
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -152,7 +154,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
extendedBolusCancel?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isInHistoryExtendedBoluslInProgress) {
|
||||
aapsLogger.debug("USER ENTRY: CANCEL EXTENDED BOLUS")
|
||||
uel.log("CANCEL EXTENDED BOLUS")
|
||||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -172,7 +174,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
cancelTempBasal?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isTempBasalInProgress) {
|
||||
aapsLogger.debug("USER ENTRY: CANCEL TEMP BASAL")
|
||||
uel.log("CANCEL TEMP BASAL")
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
|
|
@ -18,7 +18,7 @@ class AutomationEvent(private val injector: HasAndroidInjector) {
|
|||
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
|
||||
var title: String? = null
|
||||
var title: String = ""
|
||||
var isEnabled = true
|
||||
var systemAction: Boolean = false // true = generated by AAPS, false = entered by user
|
||||
var readOnly: Boolean = false // removing, editing disabled
|
||||
|
|
|
@ -20,6 +20,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.AutomationEventItemBinding
|
||||
import info.nightscout.androidaps.databinding.AutomationFragmentBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog
|
||||
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.ItemTouchHelperAdapter
|
||||
|
@ -31,8 +32,8 @@ import info.nightscout.androidaps.plugins.general.automation.events.EventAutomat
|
|||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
|
@ -48,6 +49,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var automationPlugin: AutomationPlugin
|
||||
@Inject lateinit var injector: HasAndroidInjector
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
private lateinit var eventListAdapter: EventListAdapter
|
||||
|
@ -212,11 +214,12 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
}
|
||||
// remove event
|
||||
holder.binding.iconTrash.setOnClickListener {
|
||||
showConfirmation(requireContext(), resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
Runnable {
|
||||
OKDialog.showConfirmation(requireContext(), resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
{
|
||||
uel.log("AUTOM REMOVED", automationPlugin.at(position).title)
|
||||
automationPlugin.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
}, Runnable {
|
||||
}, {
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
})
|
||||
}
|
||||
|
@ -234,8 +237,9 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
|
||||
override fun onItemDismiss(position: Int) {
|
||||
activity?.let { activity ->
|
||||
showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
Runnable {
|
||||
uel.log("AUTOM REMOVED", automationPlugin.at(position).title)
|
||||
automationPlugin.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
rxBus.send(EventAutomationDataChanged())
|
||||
|
|
|
@ -30,7 +30,7 @@ import info.nightscout.androidaps.services.LocationServiceHelper
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
|
|
@ -25,7 +25,7 @@ import info.nightscout.androidaps.plugins.general.automation.events.EventAutomat
|
|||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
|
|
@ -16,7 +16,7 @@ import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
|||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import org.json.JSONObject
|
||||
|
|
|
@ -18,11 +18,12 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.databinding.FoodFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.FoodItemBinding
|
||||
import info.nightscout.androidaps.events.EventFoodDatabaseChanged
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.food.FoodFragment.RecyclerViewAdapter.FoodsViewHolder
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -38,6 +39,7 @@ class FoodFragment : DaggerFragment() {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var foodPlugin: FoodPlugin
|
||||
@Inject lateinit var nsUpload: NSUpload
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private lateinit var unfiltered: List<Food>
|
||||
|
@ -213,7 +215,8 @@ class FoodFragment : DaggerFragment() {
|
|||
binding.remove.setOnClickListener { v: View ->
|
||||
val food = v.tag as Food
|
||||
activity?.let { activity ->
|
||||
showConfirmation(activity, resourceHelper.gs(R.string.confirmation), resourceHelper.gs(R.string.removerecord) + "\n" + food.name, DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.confirmation), resourceHelper.gs(R.string.removerecord) + "\n" + food.name, DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
|
||||
uel.log("FOOD REMOVED", food.name)
|
||||
if (food._id != null && food._id != "") {
|
||||
nsUpload.removeFoodFromNS(food._id)
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@ import info.nightscout.androidaps.interfaces.ConfigInterface
|
|||
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.*
|
||||
import info.nightscout.androidaps.utils.AndroidPermission
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
|
||||
import info.nightscout.androidaps.utils.alertDialogs.PrefImportSummaryDialog
|
||||
import info.nightscout.androidaps.utils.alertDialogs.TwoMessagesAlertDialog
|
||||
import info.nightscout.androidaps.utils.alertDialogs.WarningDialog
|
||||
|
@ -58,7 +58,8 @@ class ImportExportPrefs @Inject constructor(
|
|||
private val androidPermission: AndroidPermission,
|
||||
private val classicPrefsFormat: ClassicPrefsFormat,
|
||||
private val encryptedPrefsFormat: EncryptedPrefsFormat,
|
||||
private val prefFileList: PrefFileListProvider
|
||||
private val prefFileList: PrefFileListProvider,
|
||||
private val uel: UserEntryLogger
|
||||
) : ImportExportPrefsInterface {
|
||||
|
||||
override fun prefsFileExists(): Boolean {
|
||||
|
@ -342,7 +343,8 @@ class ImportExportPrefs @Inject constructor(
|
|||
|
||||
private fun restartAppAfterImport(context: Context) {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp), Runnable {
|
||||
OKDialog.show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp), Runnable {
|
||||
uel.log("IMPORT")
|
||||
log.debug(LTag.CORE, "Exiting")
|
||||
rxBus.send(EventAppExit())
|
||||
if (context is AppCompatActivity) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
|
|||
import info.nightscout.androidaps.events.EventNewBG
|
||||
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.food.FoodPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
|
||||
|
@ -36,6 +37,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
@Inject lateinit var importExportPrefs: ImportExportPrefsInterface
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -54,13 +56,13 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() }
|
||||
binding.logDelete.setOnClickListener {
|
||||
aapsLogger.debug("USER ENTRY: DELETE LOGS")
|
||||
uel.log("DELETE LOGS")
|
||||
maintenancePlugin.deleteLogs()
|
||||
}
|
||||
binding.navResetdb.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.maintenance), resourceHelper.gs(R.string.reset_db_confirm), Runnable {
|
||||
aapsLogger.debug("USER ENTRY: RESET DATABASES")
|
||||
uel.log("RESET DATABASES")
|
||||
compositeDisposable.add(
|
||||
fromAction {
|
||||
MainApp.getDbHelper().resetDatabases()
|
||||
|
@ -81,14 +83,14 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
binding.navExport.setOnClickListener {
|
||||
aapsLogger.debug("USER ENTRY: EXPORT SETTINGS")
|
||||
uel.log("EXPORT SETTINGS")
|
||||
// start activity for checking permissions...
|
||||
importExportPrefs.verifyStoragePermissions(this) {
|
||||
importExportPrefs.exportSharedPreferences(this)
|
||||
}
|
||||
}
|
||||
binding.navImport.setOnClickListener {
|
||||
aapsLogger.debug("USER ENTRY: IMPORT SETTINGS")
|
||||
uel.log("IMPORT SETTINGS")
|
||||
// start activity for checking permissions...
|
||||
importExportPrefs.verifyStoragePermissions(this) {
|
||||
importExportPrefs.importSharedPreferences(this)
|
||||
|
|
|
@ -16,6 +16,7 @@ import javax.inject.Inject;
|
|||
|
||||
import dagger.android.support.DaggerFragment;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientNewLog;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;
|
||||
|
@ -36,6 +37,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
|
|||
@Inject UploadQueue uploadQueue;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
@Inject AapsSchedulers aapsSchedulers;
|
||||
@Inject UserEntryLogger uel;
|
||||
|
||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
@ -121,6 +123,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
|
|||
break;
|
||||
case R.id.nsclientinternal_clearqueue:
|
||||
OKDialog.showConfirmation(getContext(), resourceHelper.gs(R.string.nsclientinternal), resourceHelper.gs(R.string.clearqueueconfirm), () -> {
|
||||
uel.log("NS QUEUE CLEARED", "", 0.0, 0.0, 0, 0);
|
||||
uploadQueue.clearQueue();
|
||||
updateGui();
|
||||
fabricPrivacy.logCustom("NSClientClearQueue");
|
||||
|
@ -136,6 +139,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
|
|||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
switch (buttonView.getId()) {
|
||||
case R.id.nsclientinternal_paused:
|
||||
uel.log("NS PAUSED", "", 0.0, 0.0, isChecked ? 1 : 0, 0);
|
||||
nsClientPlugin.pause(isChecked);
|
||||
updateGui();
|
||||
fabricPrivacy.logCustom("NSClientPause");
|
||||
|
|
|
@ -5,6 +5,7 @@ import info.nightscout.androidaps.Config
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
|
@ -116,7 +117,8 @@ class NSSettingsStatus @Inject constructor(
|
|||
private val rxBus: RxBusWrapper,
|
||||
private val defaultValueHelper: DefaultValueHelper,
|
||||
private val sp: SP,
|
||||
private val config: Config
|
||||
private val config: Config,
|
||||
private val uel: UserEntryLogger
|
||||
) {
|
||||
|
||||
var nightscoutVersionName = ""
|
||||
|
@ -233,6 +235,7 @@ class NSSettingsStatus @Inject constructor(
|
|||
getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_sage_critical, it) }
|
||||
getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(R.string.key_statuslights_bage_warning, it) }
|
||||
getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_bage_critical, it) }
|
||||
uel.log("NS SETTINGS COPIED")
|
||||
}
|
||||
|
||||
if (context != null) OKDialog.showConfirmation(context, resourceHelper.gs(R.string.statuslights), resourceHelper.gs(R.string.copyexistingvalues), action)
|
||||
|
|
|
@ -16,7 +16,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.events.Event
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.BackpressureStrategy
|
||||
|
|
|
@ -27,7 +27,7 @@ import info.nightscout.androidaps.logging.AAPSLogger
|
|||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
|
|
@ -33,6 +33,7 @@ import info.nightscout.androidaps.dialogs.*
|
|||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
@ -109,6 +110,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var databaseHelper: DatabaseHelperInterface
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
||||
|
@ -341,7 +343,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
|
||||
?: "".toSpanned(), {
|
||||
aapsLogger.debug("USER ENTRY: ACCEPT TEMP BASAL")
|
||||
uel.log("ACCEPT TEMP BASAL")
|
||||
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
|
||||
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Constants.notificationID)
|
||||
actionStringHandler.handleInitiate("cancelChangeRequest")
|
||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
|
|||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import org.json.JSONObject
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
|
|
@ -17,7 +17,7 @@ import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWiza
|
|||
import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.wizard.QuickWizard
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
|
|
@ -207,7 +207,7 @@ class PersistentNotificationPlugin @Inject constructor(
|
|||
builder.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
builder.setSmallIcon(iconsProvider.getNotificationIcon())
|
||||
builder.setLargeIcon(resourceHelper.decodeResource(iconsProvider.getIcon()))
|
||||
if (line1 != null) builder.setContentTitle(line1)
|
||||
builder.setContentTitle(line1)
|
||||
if (line2 != null) builder.setContentText(line2)
|
||||
if (line3 != null) builder.setSubText(line3)
|
||||
/// Android Auto
|
||||
|
|
|
@ -11,7 +11,7 @@ import info.nightscout.androidaps.plugins.general.smsCommunicator.events.EventSm
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import java.util.*
|
||||
|
|
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview
|
|||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
|
@ -37,7 +38,7 @@ import info.nightscout.androidaps.queue.Callback
|
|||
import info.nightscout.androidaps.receivers.BundleStore
|
||||
import info.nightscout.androidaps.receivers.DataReceiver
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -69,7 +70,8 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
private val xdripCalibrations: XdripCalibrations,
|
||||
private var otp: OneTimePassword,
|
||||
private val config: Config,
|
||||
private val dateUtil: DateUtil
|
||||
private val dateUtil: DateUtil,
|
||||
private val uel: UserEntryLogger
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
.fragmentClass(SmsCommunicatorFragment::class.java.name)
|
||||
|
@ -336,7 +338,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS LOOP DISABLE")
|
||||
uel.log("SMS LOOP DISABLE")
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -360,7 +362,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS LOOP ENABLE")
|
||||
uel.log("SMS LOOP ENABLE")
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_loophasbeenenabled)))
|
||||
rxBus.send(EventRefreshOverview("SMS_LOOP_START"))
|
||||
|
@ -387,7 +389,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS LOOP RESUME")
|
||||
uel.log("SMS LOOP RESUME")
|
||||
loopPlugin.suspendTo(0L)
|
||||
rxBus.send(EventRefreshOverview("SMS_LOOP_RESUME"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -420,7 +422,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(duration) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS LOOP SUSPEND")
|
||||
uel.log("SMS LOOP SUSPEND")
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -504,7 +506,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS PUMP CONNECT")
|
||||
uel.log("SMS PUMP CONNECT")
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -533,7 +535,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS PUMP DISCONNECT")
|
||||
uel.log("SMS PUMP DISCONNECT")
|
||||
val profile = profileFunction.getProfile()
|
||||
loopPlugin.disconnectPump(duration, profile)
|
||||
rxBus.send(EventRefreshOverview("SMS_PUMP_DISCONNECT"))
|
||||
|
@ -587,7 +589,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val finalPercentage = percentage
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(list[pindex - 1] as String, finalPercentage) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS PROFILE $reply")
|
||||
uel.log("SMS PROFILE", reply)
|
||||
activePlugin.activeTreatments.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
|
||||
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.profileswitchcreated)))
|
||||
}
|
||||
|
@ -605,7 +607,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS BASAL $reply")
|
||||
uel.log("SMS BASAL", reply)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -637,7 +639,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(tempBasalPct, duration) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS BASAL $reply")
|
||||
uel.log("SMS BASAL", reply)
|
||||
commandQueue.tempBasalPercent(anInteger(), secondInteger(), true, profile, object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -670,7 +672,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(tempBasal, duration) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS BASAL $reply")
|
||||
uel.log("SMS BASAL", reply)
|
||||
commandQueue.tempBasalAbsolute(aDouble(), secondInteger(), true, profile, object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -698,7 +700,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS EXTENDED $reply")
|
||||
uel.log("SMS EXTENDED", reply)
|
||||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -727,7 +729,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(extended, duration) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS EXTENDED $reply")
|
||||
uel.log("SMS EXTENDED", reply)
|
||||
commandQueue.extendedBolus(aDouble(), secondInteger(), object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -763,7 +765,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(bolus) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS BOLUS $reply")
|
||||
uel.log("SMS BOLUS", reply)
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
detailedBolusInfo.insulin = aDouble()
|
||||
detailedBolusInfo.source = Source.USER
|
||||
|
@ -840,7 +842,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(grams, time) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS CARBS $reply")
|
||||
uel.log("SMS CARBS", reply)
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
detailedBolusInfo.carbs = anInteger().toDouble()
|
||||
detailedBolusInfo.source = Source.USER
|
||||
|
@ -881,7 +883,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS TARGET $reply")
|
||||
uel.log("SMS TARGET", reply)
|
||||
val units = profileFunction.getUnits()
|
||||
var keyDuration = 0
|
||||
var defaultTargetDuration = 0
|
||||
|
@ -937,7 +939,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS TARGET $reply")
|
||||
uel.log("SMS TARGET", reply)
|
||||
val tempTarget = TempTarget()
|
||||
.source(Source.USER)
|
||||
.date(DateUtil.now())
|
||||
|
@ -962,7 +964,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS SMS $reply")
|
||||
uel.log("SMS SMS", reply)
|
||||
sp.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
|
@ -979,7 +981,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(cal) {
|
||||
override fun run() {
|
||||
aapsLogger.debug("USER ENTRY: SMS CAL $reply")
|
||||
uel.log("SMS CAL", reply)
|
||||
val result = xdripCalibrations.sendIntent(aDouble!!)
|
||||
if (result) sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_calibrationsent))) else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_calibrationfailed)))
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.androidaps.databinding.ActivitySmscommunicatorOtpBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePassword
|
||||
|
@ -31,6 +32,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
|
||||
@Inject lateinit var otp: OneTimePassword
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private lateinit var binding: ActivitySmscommunicatorOtpBinding
|
||||
|
||||
|
@ -70,6 +72,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
|||
resourceHelper.gs(R.string.smscommunicator_otp_reset_title),
|
||||
resourceHelper.gs(R.string.smscommunicator_otp_reset_prompt),
|
||||
Runnable {
|
||||
uel.log("OTP RESET")
|
||||
otp.ensureKey(true)
|
||||
updateGui()
|
||||
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_reset_successful))
|
||||
|
@ -85,6 +88,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
|||
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
|
||||
clipboard.primaryClip = clip
|
||||
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_export_successful))
|
||||
uel.log("OTP EXPORT")
|
||||
})
|
||||
|
||||
true
|
||||
|
|
|
@ -14,7 +14,7 @@ import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolD
|
|||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolResetData
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolUpdateGUI
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
|
|
@ -30,7 +30,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
|
|
@ -19,7 +19,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorP
|
|||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
|
|
@ -16,11 +16,12 @@ import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
|
|||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -38,6 +39,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
@Inject lateinit var hardLimits: HardLimits
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -159,6 +161,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log("NEW PROFILE")
|
||||
localProfilePlugin.addNewProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -168,6 +171,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log("CLONE PROFILE", localProfilePlugin.currentProfile()?.name ?: "")
|
||||
localProfilePlugin.cloneProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -176,6 +180,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
binding.profileRemove.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
|
||||
uel.log("REMOVE PROFILE", localProfilePlugin.currentProfile()?.name ?: "")
|
||||
localProfilePlugin.removeCurrentProfile()
|
||||
build()
|
||||
}, null)
|
||||
|
|
|
@ -9,6 +9,7 @@ import info.nightscout.androidaps.events.EventProfileStoreChanged
|
|||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
@ -32,7 +33,8 @@ class LocalProfilePlugin @Inject constructor(
|
|||
resourceHelper: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val profileFunction: ProfileFunction,
|
||||
private val nsUpload: NSUpload
|
||||
private val nsUpload: NSUpload,
|
||||
private val uel: UserEntryLogger
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.PROFILE)
|
||||
.fragmentClass(LocalProfileFragment::class.java.name)
|
||||
|
@ -113,6 +115,7 @@ class LocalProfilePlugin @Inject constructor(
|
|||
createAndStoreConvertedProfile()
|
||||
isEdited = false
|
||||
aapsLogger.debug(LTag.PROFILE, "Storing settings: " + rawProfile?.data.toString())
|
||||
uel.log("STORE PROFILE")
|
||||
rxBus.send(EventProfileStoreChanged())
|
||||
var namesOK = true
|
||||
profiles.forEach {
|
||||
|
|
|
@ -10,6 +10,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.NsprofileFragmentBinding
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.profile.ns.events.EventNSProfileUpdateGUI
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
|
@ -17,7 +18,7 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -32,6 +33,7 @@ class NSProfileFragment : DaggerFragment() {
|
|||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var nsProfilePlugin: NSProfilePlugin
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -59,6 +61,7 @@ class NSProfileFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.nsprofile),
|
||||
resourceHelper.gs(R.string.activate_profile) + ": " + name + " ?", Runnable {
|
||||
uel.log("PROFILE SWITCH", name, i1 = 100)
|
||||
treatmentsPlugin.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import info.nightscout.androidaps.plugins.pump.virtual.events.EventVirtualPumpUp
|
|||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
|
|
@ -31,7 +31,7 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.InstanceId.instanceId
|
||||
import info.nightscout.androidaps.utils.TimeChangeType
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.databinding.BgsourceItemBinding
|
|||
import info.nightscout.androidaps.events.EventNewBG
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
@ -42,6 +43,7 @@ class BGSourceFragment : DaggerFragment() {
|
|||
@Inject lateinit var databaseHelper: DatabaseHelperInterface
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private val millsToThePast = T.hours(12).msecs()
|
||||
|
@ -126,6 +128,7 @@ class BGSourceFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
val text = dateUtil.dateAndTimeString(glucoseValue.timestamp) + "\n" + glucoseValue.valueToUnitsString(profileFunction.getUnits())
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log("BG REMOVED", dateUtil.dateAndTimeString(glucoseValue.timestamp))
|
||||
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
|||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.treatments.fragments.*
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
|
@ -68,6 +68,10 @@ class TreatmentsFragment : DaggerFragment() {
|
|||
setFragment(TreatmentsCareportalFragment())
|
||||
setBackgroundColorOnSelected(it)
|
||||
}
|
||||
binding.userentry.setOnClickListener {
|
||||
setFragment(TreatmentsUserEntryFragment())
|
||||
setBackgroundColorOnSelected(it)
|
||||
}
|
||||
setFragment(TreatmentsBolusFragment())
|
||||
setBackgroundColorOnSelected(binding.treatments)
|
||||
}
|
||||
|
@ -109,6 +113,7 @@ class TreatmentsFragment : DaggerFragment() {
|
|||
binding.tempTargets.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
||||
binding.profileSwitches.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
||||
binding.careportal.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
||||
binding.userentry.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
||||
selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected))
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.db.Treatment
|
|||
import info.nightscout.androidaps.dialogs.WizardInfoDialog
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
||||
|
@ -48,6 +49,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: TreatmentsBolusFragmentBinding? = null
|
||||
|
||||
|
@ -66,6 +68,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||
uel.log("TREAT NS REFRESH")
|
||||
treatmentsPlugin.service.resetTreatments()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
}
|
||||
|
@ -74,6 +77,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
binding.deleteFutureTreatments.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), resourceHelper.gs(R.string.deletefuturetreatments) + "?", Runnable {
|
||||
uel.log("DELETE FUTURE TREATMENTS")
|
||||
val futureTreatments = treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true)
|
||||
for (treatment in futureTreatments) {
|
||||
if (NSUpload.isIdValid(treatment._id))
|
||||
|
@ -170,6 +174,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.carbs) + ": " + resourceHelper.gs(R.string.format_carbs, treatment.carbs.toInt()) + "\n" +
|
||||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(treatment.date)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log("REMOVED TREATMENT", text)
|
||||
if (treatment.source == Source.PUMP) {
|
||||
treatment.isValid = false
|
||||
treatmentsPlugin.service.update(treatment)
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBindin
|
|||
import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.events.EventCareportalEventChange
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
||||
|
@ -44,6 +45,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: TreatmentsCareportalFragmentBinding? = null
|
||||
|
||||
|
@ -62,6 +64,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal), resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", Runnable {
|
||||
uel.log("CAREPORTAL NS REFRESH")
|
||||
MainApp.getDbHelper().resetCareportalEvents()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
})
|
||||
|
@ -70,6 +73,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
binding.removeAndroidapsStartedEvents.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal), resourceHelper.gs(R.string.careportal_removestartedevents), Runnable {
|
||||
uel.log("REMOVED RESTART EVENTS")
|
||||
val events = MainApp.getDbHelper().getCareportalEvents(false)
|
||||
for (i in events.indices) {
|
||||
val careportalEvent = events[i]
|
||||
|
@ -150,6 +154,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" +
|
||||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log("REMOVED CAREP", text)
|
||||
if (NSUpload.isIdValid(careportalEvent._id))
|
||||
nsUpload.removeCareportalEntryFromNS(careportalEvent._id)
|
||||
else
|
||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.db.Source
|
|||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
||||
|
@ -27,7 +28,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutos
|
|||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsExtendedBolusesFragment.RecyclerViewAdapter.ExtendedBolusesViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -46,6 +47,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: TreatmentsExtendedbolusFragmentBinding? = null
|
||||
|
||||
|
@ -114,16 +116,17 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
binding.remove.setOnClickListener { v: View ->
|
||||
val extendedBolus = v.tag as ExtendedBolus
|
||||
context?.let {
|
||||
showConfirmation(it, resourceHelper.gs(R.string.removerecord),
|
||||
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.removerecord),
|
||||
"""
|
||||
${resourceHelper.gs(R.string.extended_bolus)}
|
||||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(extendedBolus.date)}
|
||||
""".trimIndent(), DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
|
||||
""".trimIndent(), { _: DialogInterface, _: Int ->
|
||||
uel.log("REMOVED EB")
|
||||
val id = extendedBolus._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
MainApp.getDbHelper().delete(extendedBolus)
|
||||
}, null)
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
MainApp.getDbHelper().delete(extendedBolus)
|
||||
}, null)
|
||||
}
|
||||
}
|
||||
binding.remove.paintFlags = binding.remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.db.ProfileSwitch
|
|||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
||||
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
||||
|
@ -49,6 +50,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: TreatmentsProfileswitchFragmentBinding? = null
|
||||
|
||||
|
@ -67,6 +69,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
|
||||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
uel.log("PROFILE SWITCH NS REFRESH")
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||
MainApp.getDbHelper().resetProfileSwitch()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
|
@ -143,6 +146,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord),
|
||||
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
|
||||
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
uel.log("REMOVED PROFILE SWITCH", profileSwitch.profileName + " " + dateUtil.dateAndTimeString(profileSwitch.date))
|
||||
val id = profileSwitch._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
|
@ -155,6 +159,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
val profileSwitch = it.tag as ProfileSwitch
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
profileSwitch.profileObject?.let {
|
||||
uel.log("PROFILE SWITCH CLONE", profileSwitch.profileName + " " + dateUtil.dateAndTimeString(profileSwitch.date))
|
||||
val nonCustomized = it.convertToNonCustomizedProfile()
|
||||
if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) {
|
||||
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
|
||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.db.TempTarget
|
|||
import info.nightscout.androidaps.events.EventTempTargetChange
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
||||
|
@ -27,7 +28,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR
|
|||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
|
@ -48,6 +49,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
||||
|
@ -66,7 +68,8 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
binding.recyclerview.adapter = RecyclerViewAdapter(activePlugin.activeTreatments.tempTargetsFromHistory)
|
||||
binding.refreshFromNightscout.setOnClickListener {
|
||||
context?.let { context ->
|
||||
showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
|
||||
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
|
||||
uel.log("TT NS REFRESH")
|
||||
MainApp.getDbHelper().resetTempTargets()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
})
|
||||
|
@ -152,12 +155,13 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
binding.remove.setOnClickListener { v: View ->
|
||||
val tempTarget = v.tag as TempTarget
|
||||
context?.let { context ->
|
||||
showConfirmation(context, resourceHelper.gs(R.string.removerecord),
|
||||
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.removerecord),
|
||||
"""
|
||||
${resourceHelper.gs(R.string.careportal_temporarytarget)}: ${tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper)}
|
||||
${dateUtil.dateAndTimeString(tempTarget.date)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log("TT REMOVE", tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper))
|
||||
val id = tempTarget._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
|
|
|
@ -19,13 +19,14 @@ import info.nightscout.androidaps.db.TemporaryBasal
|
|||
import info.nightscout.androidaps.events.EventTempBasalChange
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTemporaryBasalsFragment.RecyclerViewAdapter.TempBasalsViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -42,6 +43,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
|
|||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var _binding: TreatmentsTempbasalsFragmentBinding? = null
|
||||
|
||||
|
@ -155,12 +157,13 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
|
|||
binding.remove.setOnClickListener { v: View ->
|
||||
val tempBasal = v.tag as TemporaryBasal
|
||||
context?.let {
|
||||
showConfirmation(it, resourceHelper.gs(R.string.removerecord),
|
||||
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.removerecord),
|
||||
"""
|
||||
${resourceHelper.gs(R.string.tempbasal_label)}: ${tempBasal.toStringFull()}
|
||||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)}
|
||||
""".trimIndent(),
|
||||
DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log("REMOVED TT", dateUtil.dateAndTimeString(tempBasal.date))
|
||||
activePlugin.activeTreatments.removeTempBasal(tempBasal)
|
||||
}, null)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package info.nightscout.androidaps.plugins.treatments.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.databinding.TreatmentsUserEntryFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsUserEntryItemBinding
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class TreatmentsUserEntryFragment : DaggerFragment() {
|
||||
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
||||
private var _binding: TreatmentsUserEntryFragmentBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||
TreatmentsUserEntryFragmentBinding.inflate(inflater, container, false).also { _binding = it }.root
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.recyclerview.setHasFixedSize(true)
|
||||
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
|
||||
|
||||
disposable += repository
|
||||
.getAllUserEntries()
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe { list -> binding.recyclerview.swapAdapter(UserEntryAdapter(list), true) }
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
disposable.clear()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
inner class UserEntryAdapter internal constructor(var entries: List<UserEntry>) : RecyclerView.Adapter<UserEntryAdapter.UserEntryViewHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UserEntryViewHolder {
|
||||
val view: View = LayoutInflater.from(parent.context).inflate(R.layout.treatments_user_entry_item, parent, false)
|
||||
return UserEntryViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: UserEntryViewHolder, position: Int) {
|
||||
val current = entries[position]
|
||||
holder.binding.date.text = dateUtil.dateAndTimeAndSecondsString(current.timestamp)
|
||||
holder.binding.action.text = current.action
|
||||
holder.binding.s.text = current.s
|
||||
holder.binding.d1.text = if (current.d1 != 0.0) current.d1.toString() else ""
|
||||
holder.binding.d2.text = if (current.d2 != 0.0) current.d2.toString() else ""
|
||||
holder.binding.i1.text = if (current.i1 != 0) current.i1.toString() else ""
|
||||
holder.binding.i1.text = if (current.i2 != 0) current.i2.toString() else ""
|
||||
}
|
||||
|
||||
inner class UserEntryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
||||
val binding = TreatmentsUserEntryItemBinding.bind(itemView)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = entries.size
|
||||
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.databinding.ActivitySetupwizardBinding
|
|||
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||
|
@ -19,7 +20,7 @@ import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDevic
|
|||
import info.nightscout.androidaps.setupwizard.elements.SWItem
|
||||
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.locale.LocaleHelper.update
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -37,6 +38,7 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private lateinit var screens: List<SWScreen>
|
||||
|
@ -143,13 +145,13 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
|
|||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (currentWizardPage == 0) showConfirmation(this, resourceHelper.gs(R.string.exitwizard), Runnable { finish() }) else showPreviousPage(null)
|
||||
if (currentWizardPage == 0) OKDialog.showConfirmation(this, resourceHelper.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun exitPressed(view: View?) {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
showConfirmation(this, resourceHelper.gs(R.string.exitwizard), Runnable { finish() })
|
||||
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.exitwizard)) { finish() }
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
|
|
|
@ -22,7 +22,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
|
|||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
@ -58,7 +58,7 @@ class AndroidPermission @Inject constructor(
|
|||
activity.callForBatteryOptimization.launch(null)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
permissionBatteryOptimizationFailed = true
|
||||
show(activity, resourceHelper.gs(R.string.permission), resourceHelper.gs(R.string.alert_dialog_permission_battery_optimization_failed), Runnable { activity.recreate() })
|
||||
OKDialog.show(activity, resourceHelper.gs(R.string.permission), resourceHelper.gs(R.string.alert_dialog_permission_battery_optimization_failed), Runnable { activity.recreate() })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview
|
|||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
|
@ -65,6 +66,7 @@ class BolusWizard @Inject constructor(
|
|||
@Inject lateinit var automationPlugin: AutomationPlugin
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
init {
|
||||
injector.androidInjector().inject(this)
|
||||
|
@ -354,7 +356,7 @@ class BolusWizard @Inject constructor(
|
|||
boluscalc = nsJSON()
|
||||
source = Source.USER
|
||||
notes = this@BolusWizard.notes
|
||||
aapsLogger.debug("USER ENTRY: BOLUS ADVISOR insulin $insulinAfterConstraints")
|
||||
uel.log("BOLUS ADVISOR", d1 = insulinAfterConstraints)
|
||||
if (insulin > 0) {
|
||||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -382,7 +384,7 @@ class BolusWizard @Inject constructor(
|
|||
OKDialog.showConfirmation(ctx, resourceHelper.gs(R.string.boluswizard), confirmMessage, {
|
||||
if (insulinAfterConstraints > 0 || carbs > 0) {
|
||||
if (useSuperBolus) {
|
||||
aapsLogger.debug("USER ENTRY: SUPERBOLUS TBR")
|
||||
uel.log("SUPERBOLUS TBR")
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000)
|
||||
rxBus.send(EventRefreshOverview("WizardDialog"))
|
||||
|
@ -428,7 +430,7 @@ class BolusWizard @Inject constructor(
|
|||
boluscalc = nsJSON()
|
||||
source = Source.USER
|
||||
notes = this@BolusWizard.notes
|
||||
aapsLogger.debug("USER ENTRY: BOLUS WIZARD insulin $insulinAfterConstraints carbs: $carbs")
|
||||
uel.log("BOLUS WIZARD", "", insulinAfterConstraints, carbs)
|
||||
if (insulin > 0 || pump.pumpDescription.storesCarbInfo) {
|
||||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
android:id="@+id/treatments"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/bolus"
|
||||
android:scaleX="0.8"
|
||||
|
@ -35,8 +35,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/extended_bolus"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.7"
|
||||
app:srcCompat="@drawable/ic_actions_startextbolus" />
|
||||
|
@ -45,8 +45,8 @@
|
|||
android:id="@+id/temp_basals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/tempbasal_label"
|
||||
android:scaleX="0.7"
|
||||
|
@ -57,8 +57,8 @@
|
|||
android:id="@+id/temp_targets"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/careportal_temporarytarget"
|
||||
android:scaleX="0.7"
|
||||
|
@ -69,8 +69,8 @@
|
|||
android:id="@+id/profile_switches"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/careportal_profileswitch"
|
||||
android:scaleX="0.7"
|
||||
|
@ -81,14 +81,26 @@
|
|||
android:id="@+id/careportal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/careportal"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.7"
|
||||
app:srcCompat="@drawable/ic_cp_note" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userentry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/userentry"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="1dp"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.7"
|
||||
app:srcCompat="@drawable/ic_danar_useropt" />
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
|
13
app/src/main/res/layout/treatments_user_entry_fragment.xml
Normal file
13
app/src/main/res/layout/treatments_user_entry_fragment.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".plugins.treatments.fragments.TreatmentsUserEntryFragment">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
70
app/src/main/res/layout/treatments_user_entry_item.xml
Normal file
70
app/src/main/res/layout/treatments_user_entry_item.xml
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:text="1.1.2021 09:00"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/action"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="USER ENTRY"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/s"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/d1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="0.0"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/d2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="0.0"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/i1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="0.0"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/i2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="0.0"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1380,5 +1380,6 @@
|
|||
<string name="clear_filter">Clear filter</string>
|
||||
<string name="trend_arrow">Trend arrow</string>
|
||||
<string name="cannula">Cannula</string>
|
||||
<string name="userentry">User entry</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -10,7 +10,7 @@ buildscript {
|
|||
room_version = '2.2.6'
|
||||
lifecycle_version = '2.3.0'
|
||||
dagger_version = '2.31.2'
|
||||
coroutinesVersion = '1.3.7'
|
||||
coroutinesVersion = '1.4.1'
|
||||
activityVersion = '1.2.0'
|
||||
fragmentktx_version = '1.3.0-rc01'
|
||||
ormLiteVersion = '4.46'
|
||||
|
|
|
@ -12,8 +12,8 @@ dependencies {
|
|||
api "androidx.preference:preference-ktx:$preferencektx_version"
|
||||
api 'androidx.biometric:biometric:1.1.0'
|
||||
api "androidx.browser:browser:1.3.0"
|
||||
api "androidx.activity:activity-ktx:$activityVersion"
|
||||
api "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
|
||||
api "androidx.activity:activity-ktx:${activityVersion}"
|
||||
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
|
||||
api 'androidx.cardview:cardview:1.0.0'
|
||||
api 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
api 'androidx.gridlayout:gridlayout:1.0.0'
|
||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.core.databinding.DialogErrorBinding
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import javax.inject.Inject
|
||||
|
@ -20,6 +21,7 @@ class ErrorDialog : DaggerDialogFragment() {
|
|||
|
||||
@Inject lateinit var alarmSoundServiceHelper: AlarmSoundServiceHelper
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
var helperActivity: ErrorHelperActivity? = null
|
||||
var status: String = ""
|
||||
|
@ -56,15 +58,15 @@ class ErrorDialog : DaggerDialogFragment() {
|
|||
|
||||
binding.title.text = title
|
||||
binding.ok.setOnClickListener {
|
||||
aapsLogger.debug("USER ENTRY: Error dialog ok button pressed")
|
||||
uel.log("Error dialog ok button pressed")
|
||||
dismiss()
|
||||
}
|
||||
binding.mute.setOnClickListener {
|
||||
aapsLogger.debug("USER ENTRY: Error dialog mute button pressed")
|
||||
uel.log("Error dialog mute button pressed")
|
||||
stopAlarm()
|
||||
}
|
||||
binding.mute5min.setOnClickListener {
|
||||
aapsLogger.debug("USER ENTRY: Error dialog mute 5 min button pressed")
|
||||
uel.log("Error dialog mute 5 min button pressed")
|
||||
stopAlarm()
|
||||
loopHandler.postDelayed(this::startAlarm, T.mins(5).msecs())
|
||||
}
|
||||
|
|
|
@ -13,11 +13,10 @@ import info.nightscout.androidaps.logging.AAPSLogger
|
|||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class NtpProgressDialog : DaggerDialogFragment() {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package info.nightscout.androidaps.logging
|
||||
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.transactions.UserEntryTransaction
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.subscribeBy
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class UserEntryLogger @Inject constructor(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val repository: AppRepository,
|
||||
private val aapsSchedulers: AapsSchedulers
|
||||
) {
|
||||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
fun log(action: String, s: String = "", d1: Double = 0.0, d2: Double = 0.0, i1: Int = 0, i2: Int = 0) {
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
s = s,
|
||||
d1 = d1,
|
||||
d2 = d2,
|
||||
i1 = i1,
|
||||
i2 = i2
|
||||
))
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribeBy(
|
||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s ${if (d1 == 0.0) d1 else ""} ${if (d2 == 0.0) d2 else ""} ${if (i1 == 0) i1 else ""} ${if (i2 == 0) i2 else ""}") },
|
||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $s ${if (d1 == 0.0) d1 else ""} ${if (d2 == 0.0) d2 else ""} ${if (i1 == 0) i1 else ""} ${if (i2 == 0) i2 else ""}") }
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package info.nightscout.androidaps.utils.extensions
|
||||
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
|||
import info.nightscout.androidaps.interfaces.PumpInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||
|
@ -28,12 +29,12 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.WarnColors
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaFragment : DaggerFragment() {
|
||||
|
@ -49,6 +50,7 @@ class DanaFragment : DaggerFragment() {
|
|||
@Inject lateinit var warnColors: WarnColors
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -106,7 +108,7 @@ class DanaFragment : DaggerFragment() {
|
|||
binding.btconnection.setOnLongClickListener {
|
||||
activity?.let {
|
||||
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) {
|
||||
aapsLogger.error("USER ENTRY: Clearing pairing keys !!!")
|
||||
uel.log("CLEAR PAIRING KEYS")
|
||||
(activePlugin.activePump as DanaPumpInterface).clearPairing()
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +154,9 @@ class DanaFragment : DaggerFragment() {
|
|||
EventPumpStatusChanged.Status.DISCONNECTED ->
|
||||
@Suppress("SetTextI18n")
|
||||
binding.btconnection.text = "{fa-bluetooth-b}"
|
||||
else -> {}
|
||||
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
if (it.getStatus(resourceHelper) != "") {
|
||||
binding.danaPumpstatus.text = it.getStatus(resourceHelper)
|
||||
|
|
|
@ -30,9 +30,9 @@ import info.nightscout.androidaps.queue.Callback
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,16 +5,16 @@ import androidx.room.RoomDatabase
|
|||
import androidx.room.TypeConverters
|
||||
import info.nightscout.androidaps.database.daos.*
|
||||
import info.nightscout.androidaps.database.entities.*
|
||||
import info.nightscout.androidaps.database.entities.APSResultLink
|
||||
import info.nightscout.androidaps.database.entities.MealLink
|
||||
import info.nightscout.androidaps.database.entities.MultiwaveBolusLink
|
||||
|
||||
const val DATABASE_VERSION = 1
|
||||
const val DATABASE_VERSION = 2
|
||||
|
||||
@Database(version = DATABASE_VERSION, entities = arrayOf(APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
||||
@Database(version = DATABASE_VERSION,
|
||||
entities = arrayOf(APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
||||
EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
|
||||
TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class,
|
||||
APSResultLink::class, MealLink::class, MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class), exportSchema = true)
|
||||
APSResultLink::class, MealLink::class, MultiwaveBolusLink::class, PreferenceChange::class,
|
||||
VersionChange::class, UserEntry::class),
|
||||
exportSchema = true)
|
||||
@TypeConverters(Converters::class)
|
||||
internal abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
|
@ -50,6 +50,8 @@ internal abstract class AppDatabase : RoomDatabase() {
|
|||
|
||||
abstract val versionChangeDao: VersionChangeDao
|
||||
|
||||
abstract val userEntryDao: UserEntryDao
|
||||
|
||||
abstract val preferenceChangeDao: PreferenceChangeDao
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.database
|
|||
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.interfaces.DBEntry
|
||||
import info.nightscout.androidaps.database.transactions.Transaction
|
||||
import io.reactivex.Completable
|
||||
|
@ -105,7 +106,17 @@ class AppRepository @Inject internal constructor(
|
|||
fun getTemporaryTargetsCorrespondingLastHistoryRecord(lastId: Long): TemporaryTarget? =
|
||||
database.temporaryTargetDao.getLastHistoryRecord(lastId)
|
||||
|
||||
// USER ENTRY
|
||||
fun getAllUserEntries(): Single<List<UserEntry>> =
|
||||
database.userEntryDao.getAll()
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
fun insert(word: UserEntry) {
|
||||
database.userEntryDao.insert(word)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Suppress("USELESS_CAST")
|
||||
inline fun <reified T : Any> Maybe<T>.toWrappedSingle(): Single<ValueWrapper<T>> =
|
||||
this.map { ValueWrapper.Existing(it) as ValueWrapper<T> }
|
||||
|
|
|
@ -2,6 +2,8 @@ package info.nightscout.androidaps.database
|
|||
|
||||
import android.content.Context
|
||||
import androidx.room.Room
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Qualifier
|
||||
|
@ -17,8 +19,17 @@ open class DatabaseModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
internal fun provideAppDatabase(context: Context, @DbFileName fileName: String) =
|
||||
Room.databaseBuilder(context, AppDatabase::class.java, fileName).build()
|
||||
Room
|
||||
.databaseBuilder(context, AppDatabase::class.java, fileName)
|
||||
.addMigrations(migration1to2)
|
||||
.build()
|
||||
|
||||
@Qualifier
|
||||
annotation class DbFileName
|
||||
|
||||
private val migration1to2 = object : Migration(1, 2) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS userEntry (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `s` TEXT NOT NULL, `d1` REAL NOT NULL, `d2` REAL NOT NULL, `i1` INTEGER NOT NULL, `i2` INTEGER NOT NULL)")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ internal class DelegatedAppDatabase(val changes: MutableList<DBEntry>, val datab
|
|||
val profileSwitchDao: ProfileSwitchDao = DelegatedProfileSwitchDao(changes, database.profileSwitchDao)
|
||||
val apsResultDao: APSResultDao = DelegatedAPSResultDao(changes, database.apsResultDao)
|
||||
val versionChangeDao: VersionChangeDao = DelegatedVersionChangeDao(changes, database.versionChangeDao)
|
||||
val userEntryDao: UserEntryDao = DelegatedUserEntryDao(changes, database.userEntryDao)
|
||||
val preferenceChangeDao: PreferenceChangeDao = DelegatedPreferenceChangeDao(changes, database.preferenceChangeDao)
|
||||
fun clearAllTables() = database.clearAllTables()
|
||||
}
|
|
@ -16,4 +16,5 @@ const val TABLE_TEMPORARY_TARGETS = "temporaryTargets"
|
|||
const val TABLE_TOTAL_DAILY_DOSES = "totalDailyDoses"
|
||||
const val TABLE_THERAPY_EVENTS = "therapyEvents"
|
||||
const val TABLE_PREFERENCE_CHANGES = "preferenceChanges"
|
||||
const val TABLE_VERSION_CHANGES = "versionChanges"
|
||||
const val TABLE_VERSION_CHANGES = "versionChanges"
|
||||
const val TABLE_USER_ENTRY = "userEntry"
|
|
@ -0,0 +1,19 @@
|
|||
package info.nightscout.androidaps.database.daos
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import info.nightscout.androidaps.database.TABLE_USER_ENTRY
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import io.reactivex.Single
|
||||
|
||||
@Dao
|
||||
interface UserEntryDao {
|
||||
|
||||
@Insert
|
||||
fun insert(userEntry: UserEntry)
|
||||
|
||||
@Query("SELECT * FROM $TABLE_USER_ENTRY ORDER BY id DESC")
|
||||
fun getAll(): Single<List<UserEntry>>
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package info.nightscout.androidaps.database.daos.delegated
|
||||
|
||||
import info.nightscout.androidaps.database.daos.UserEntryDao
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.interfaces.DBEntry
|
||||
|
||||
internal class DelegatedUserEntryDao(changes: MutableList<DBEntry>, private val dao: UserEntryDao) : DelegatedDao(changes), UserEntryDao by dao {
|
||||
|
||||
override fun insert(userEntry: UserEntry) {
|
||||
changes.add(userEntry)
|
||||
return dao.insert(userEntry)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package info.nightscout.androidaps.database.entities
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import info.nightscout.androidaps.database.TABLE_USER_ENTRY
|
||||
import info.nightscout.androidaps.database.interfaces.DBEntry
|
||||
import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
|
||||
import java.util.*
|
||||
|
||||
@Entity(tableName = TABLE_USER_ENTRY)
|
||||
data class UserEntry(
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
override var id: Long = 0L,
|
||||
override var timestamp: Long,
|
||||
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
||||
var action: String,
|
||||
var s: String,
|
||||
var d1: Double,
|
||||
var d2: Double,
|
||||
var i1: Int,
|
||||
var i2: Int
|
||||
) : DBEntry, DBEntryWithTime
|
|
@ -0,0 +1,26 @@
|
|||
package info.nightscout.androidaps.database.transactions
|
||||
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
|
||||
class UserEntryTransaction(
|
||||
val action: String,
|
||||
val s: String = "",
|
||||
val d1: Double = 0.0,
|
||||
val d2: Double = 0.0,
|
||||
val i1: Int = 0,
|
||||
val i2: Int = 0,
|
||||
) : Transaction<Unit>() {
|
||||
|
||||
override fun run() {
|
||||
|
||||
database.userEntryDao.insert(UserEntry(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
action = action,
|
||||
s = s,
|
||||
d1 = d1,
|
||||
d2 = d2,
|
||||
i1 = i1,
|
||||
i2 = i2
|
||||
))
|
||||
}
|
||||
}
|
|
@ -40,10 +40,10 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.WarnColors
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class MedtronicFragment : DaggerFragment() {
|
||||
|
|
|
@ -44,13 +44,13 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.Duration
|
||||
|
|
|
@ -29,11 +29,11 @@ import info.nightscout.androidaps.queue.Callback
|
|||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue