From 1d37a8bd5973a9a3afe1be7b3ef938a8cb0dd256 Mon Sep 17 00:00:00 2001 From: Waseef Akhtar Date: Sun, 12 Nov 2023 00:36:32 +0100 Subject: [PATCH] Improve adding/removing medication time tracking --- .../feature/addmedication/AddMedicationRoute.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/waseefakhtar/doseapp/feature/addmedication/AddMedicationRoute.kt b/app/src/main/java/com/waseefakhtar/doseapp/feature/addmedication/AddMedicationRoute.kt index 9daf534..201a7dc 100644 --- a/app/src/main/java/com/waseefakhtar/doseapp/feature/addmedication/AddMedicationRoute.kt +++ b/app/src/main/java/com/waseefakhtar/doseapp/feature/addmedication/AddMedicationRoute.kt @@ -101,10 +101,12 @@ fun AddMedicationScreen( fun addTime(time: CalendarInformation) { selectedTimes.add(time) + analyticsHelper.logEvent(AnalyticsEvents.ADD_MEDICATION_ADD_TIME_CLICKED) } fun removeTime(time: CalendarInformation) { selectedTimes.remove(time) + analyticsHelper.logEvent(AnalyticsEvents.ADD_MEDICATION_DELETE_TIME_CLICKED) } Scaffold( @@ -274,20 +276,14 @@ fun AddMedicationScreen( time = { selectedTimes[index] = it }, - onDeleteClick = { - analyticsHelper.logEvent(AnalyticsEvents.ADD_MEDICATION_DELETE_TIME_CLICKED) - removeTime(selectedTimes[index]) - }, + onDeleteClick = { removeTime(selectedTimes[index]) }, analyticsHelper = analyticsHelper ) } Button( - onClick = { - addTime(CalendarInformation(Calendar.getInstance())) - } + onClick = { addTime(CalendarInformation(Calendar.getInstance())) } ) { - analyticsHelper.logEvent(AnalyticsEvents.ADD_MEDICATION_ADD_TIME_CLICKED) Icon(imageVector = Icons.Default.Add, contentDescription = "Add") Text("Add Time") }