Make duration optional for ongoing medications
Users taking medication indefinitely had no way to skip adding an end date. The date picker would crash when trying to set far-future dates like 2100.
Changes
Data Layer
- Made
endDatenullable inMedicationdomain model andMedicationEntity - Added Room auto-migration v4âv5 for schema change
UI
- Added "Ongoing (no end date)" checkbox with proper accessibility (
toggleable+Role.Checkbox) - Shows single date picker for start date when ongoing is selected, date range picker otherwise
- New
StartDatePickerDialogcomponent
ViewModel
- For ongoing medications, creates 1 year of reminders initially (extendable in future)
-
endDatestored asnullin database for ongoing medications
Confirmation Screen
- Displays "ongoing" instead of end date for ongoing medications
- Added
all_set_ongoingplural string resource
// Medication model now supports nullable endDate
data class Medication(
...
val endDate: Date?, // null = ongoing medication
...
)
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com
- Triggering command:
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.7-bin/bhs2wmbdwecv87pi65oeuq5iu/gradle-8.7/lib/gradle-launcher-8.7.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.7-bin/bhs2wmbdwecv87pi65oeuq5iu/gradle-8.7/lib/agents/gradle-instrumentation-agent-8.7.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.7(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>Make duration optional</issue_title> <issue_description>For medicine I need to take for life, there's no easy solution to skip adding a duration. If I try to enter a future date, it states the latest year I can set is 2100 but then the app crashes and won't let me click "confirm" to add it
</issue_description>
Comments on the Issue (you are @copilot in this section)
- Fixes waseefakhtar/dose-android#174
ð¡ You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.