Skip to content

alarms: add a new kind of alarm clock mode: Just once then delete to auto-delete one-time alarms - #1810

Open
caco3 wants to merge 1 commit into
coredevices:mainfrom
caco3:add-alarm-kind_once-then-delete
Open

alarms: add a new kind of alarm clock mode: Just once then delete to auto-delete one-time alarms#1810
caco3 wants to merge 1 commit into
coredevices:mainfrom
caco3:add-alarm-kind_once-then-delete

Conversation

@caco3

@caco3 caco3 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new kind of alarm clock: Just once then delete:

grafik grafik grafik

This implements #1537

I often use my watch to set an alarm when cooking or when to leave to catch the train. Those alarms are often onte time shots and must be deleted again manually afterwards.
With this PR, the alarms will get deleted automatically after they got dismissed.

Implementation concept

  • First commit adds the deletion functionality
  • 2nd commit updates the alarm list after the alarm got deleted. This is needed since the user could have the alarm list open when the alarm gets dismissed + deleted. The alarm still would be shown in the list and only get updated when the list gets reloaded.
    However the dismiss action happens in one process (the popup), and the alarm list lives in another (the alarms app). They're separate. The popup can delete the alarm from storage, but it has no way to reach into the alarms app's UI state. So it sends the newly created system event; the alarms app listens for that event and refreshes its list when it arrives.

@caco3
caco3 force-pushed the add-alarm-kind_once-then-delete branch 2 times, most recently from 463f40a to f8c493f Compare July 28, 2026 21:40
@caco3
caco3 marked this pull request as ready for review July 28, 2026 22:09
@caco3
caco3 requested review from gmarull and jplexer as code owners July 28, 2026 22:09
@caco3
caco3 force-pushed the add-alarm-kind_once-then-delete branch 6 times, most recently from 7bb23b7 to cc3f6ef Compare July 29, 2026 07:28
@caco3 caco3 changed the title alarms: add ALARM_KIND_JUST_ONCE_DELETE for auto-deleting one-time alarms alarms: add a new kind of alarm clock: Just once then delete to auto-deleting one-time alarms Jul 29, 2026
@caco3 caco3 changed the title alarms: add a new kind of alarm clock: Just once then delete to auto-deleting one-time alarms alarms: add a new kind of alarm clock mode: Just once then delete to auto-deleting one-time alarms Jul 29, 2026
@caco3 caco3 changed the title alarms: add a new kind of alarm clock mode: Just once then delete to auto-deleting one-time alarms alarms: add a new kind of alarm clock mode: Just once then delete to auto-delete one-time alarms Jul 29, 2026
@caco3
caco3 force-pushed the add-alarm-kind_once-then-delete branch 15 times, most recently from 10154c9 to e8f5f3f Compare July 30, 2026 07:38
@caco3
caco3 force-pushed the add-alarm-kind_once-then-delete branch from e8f5f3f to 96a90c9 Compare July 30, 2026 07:40
@caco3

caco3 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

The MR is ready now. I had to shorten the strings so they do not get truncated.

//! Dismisses the most recently triggered alarm.
void alarm_dismiss_alarm(void);
//! @return True if the alarm was auto-deleted (ALARM_KIND_JUST_ONCE_DELETE), False otherwise.
bool alarm_dismiss_alarm(void);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that definition doesnt really make sense, why is auto-deleted "true"? I'd consider true/false to be equal to succeeded/failed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true means the alarm was deleted. Based on this, the dialog message will be different ("alarm deleted" instead of "alarm dismissed".

The alternative would be to provide a new public API function which tells us the kind of the alarm or its ID. I think the approach with the boolean value is less intrusive.

N.B. I originally wanted to show "alarm dismissed and deleted", but that is too long and gets truncated on the 2-line dialog text field.

@caco3

caco3 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb11172b31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/fw/services/alarms/alarm.c Outdated
…re deleting

Add ALARM_KIND_JUST_ONCE_DELETE for one-time alarms that delete themselves
when dismissed. Before deleting, re-read the current alarm kind from storage
so that an alarm edited while a snooze is pending is not deleted with a stale
cached kind.

Signed-off-by: George Ruinelli <george@ruinelli.ch>
Co-Authored-By: Cascade AI
@caco3
caco3 force-pushed the add-alarm-kind_once-then-delete branch from eb11172 to 13c94ac Compare August 1, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants