Skip to content

Commit

Permalink
Improve adding/removing medication time tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
waseefakhtar committed Nov 11, 2023
1 parent 7e89b91 commit 1d37a8b
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 1d37a8b

Please sign in to comment.