Skip to content

Watch bolus: open on the amount, start at the recommendation; fit the meal and bolus buttons - #792

Open
MtlPhil wants to merge 10 commits into
loopandlearn:devfrom
achkars-org:feature/watch-bolus-amount
Open

MtlPhil wants to merge 10 commits into
loopandlearn:devfrom
achkars-org:feature/watch-bolus-amount

Conversation

@MtlPhil

@MtlPhil MtlPhil commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Suggested changes to the watch treatment screens after testing on Apple Watch. This includes Jonas's review fixes from achkars-org#6.

Bolus

  • Opens on the amount. The first screen used to be a list. Without Quick-Pick boluses or a recent recommendation, that list held only "Other Amount", so it was an extra tap to reach the crown. Now the bolus screen opens straight on the amount.

  • Starts at the recommendation. When Loop / Trio's recommendation is under 5 minutes old, the amount starts there, rounded down to the step. A line under the amount shows where it came from: a wand.and.stars icon, then "1.25 U, 2 min ago". The age keeps counting while the screen is open and turns red at 5 minutes. VoiceOver reads "Recommended…". Going back from the confirmation keeps whatever amount was set.

  • Follows newer loop cycles. When the bolus screen opens, the watch asks the phone for its latest state, on top of the updates the phone already sends. While the amount is still the recommendation and the amount screen is on top:

    • a newer cycle that lowers it replaces the amount, with a haptic;
    • a newer cycle with the same amount just restarts the age;
    • a newer cycle that raises it is never applied on its own. The line becomes "New 1.6 U, tap to use", with a haptic, so more insulin always has to be chosen.

    If the screen opened with nothing filled in, a fresh recommendation that comes in later is offered the same way, with a tap. A loop cycle without a recommendation counts as having none, not as 0 U. Going back from the confirmation catches up on any cycle that came in meanwhile.

    Once the amount is changed by hand, it's no longer treated as the recommendation. It stays where the user put it, with no recommendation line and no check at send, the same as typing an amount on the phone.

  • Age checked at Continue. If the amount is still the starting recommendation and it's 5 minutes or older, Continue shows the same Old Calculation Warning as Presets. From 12 minutes, Continue shows "Recommendation Expired" and clears the amount, matching the cut-off on the phone.

  • Checked again before sending. The confirmation shows "Recommended, N min ago" under an amount that came from the recommendation, red from 5 minutes. When the crown confirms, the watch compares the amount with the latest recommendation it has. If a newer cycle lowered it, nothing is sent and a "Recommendation Lowered" alert offers Change to the new amount (which needs another turn of the crown), Send Anyway, or Cancel.

  • Not offered again after a bolus. After a bolus, the recommendation stays the same until Loop or Trio runs a new cycle and LoopFollow fetches it, which can take a few minutes. Until then, a recommendation from before the last bolus counts as none, so the watch doesn't fill in the same amount again. The watch ignores one from before insulin it sent itself, through the phone or directly. The phone leaves out one from before any manual bolus: in Nightscout, or sent from LoopFollow or the watch, alone or with a meal. Automatic boluses and SMBs don't count, since the cycle that recommends a bolus can also give one.

  • Presets behind a button. The Quick-Pick boluses and the recommendation moved to a Presets button under Continue. Under 5 minutes the recommendation is already the starting amount, so Presets lists it only from 5 to 12 minutes, with the Old Calculation Warning. The button only appears when there's something to show, and it appears by itself once the recommendation passes 5 minutes.

  • Max line removed. The "Max 2 U" line is gone. The crown and + already stop at the maximum.

  • Click on − and +. Pressing − or + plays a click, like a crown detent.

Meal

  • Time and Log buttons line up. Time was centered by an outer frame while Log hugged the left of the leading-aligned stack, so they were offset. Both are now centered, and the Time label is centered like Log's.
  • Quick-Pick rows centered. The meal Quick-Pick rows are centered like Time and Log, and longer titles wrap onto a second line.

Phone

  • Bolus screens. The Loop and Trio remote bolus screens use the same check, so they no longer offer a recommendation from before the last bolus.
  • Loop's recommendation time. For Loop, the recommendation's time is now the loop cycle's own timestamp instead of the pump clock. The pump clock also moves on failed cycles, which keep the previous recommendation, so an old amount showed as just calculated, and after a bolus it looked newer than the bolus.

Both watch screens

  • Buttons fit the screen. The system button height pushed Log off the bottom of the meal screen. The meal and bolus buttons now use a compact capsule whose height scales with the watch, about 34 pt on a 40 mm watch up to about 43 pt on the largest, so the amount and two buttons fit without scrolling.

…fit the meal and bolus buttons

The bolus screen opens on the amount instead of a list that, without
Quick-Pick boluses or a recent recommendation, held only Other Amount.
Loop / Trio's recommendation and the Quick-Pick boluses move behind a
Presets button under Continue, shown only when there are any, with the
Old Calculation Warning as before.

While the recommendation is under 5 minutes old the amount starts there,
with an icon line showing the amount and its age. It is filled in once,
so coming back from the confirmation keeps what was set. The Max line is
gone, since the crown and + stop at the maximum, and − and + click like
a crown detent.

The meal and bolus buttons use a compact capsule whose height scales
with the watch, so the amount and two buttons fit without scrolling;
the system buttons pushed Log off the bottom of the meal screen. On the
meal screen, Time and Log are both centered, so they line up.

@bjorkert bjorkert left a comment

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.

Thanks, opening straight on the amount is a nice improvement, and the meal buttons fitting on screen fixes a real problem. A few things before merging:

  1. Pre-filling the recommendation is a change from the phone. On both phone bolus screens the recommendation is only applied when tapped, and a warning that new treatments may have occurred is always shown next to it. Here the amount is pre-filled automatically, so a recommendation can be sent with Continue and the crown without ever being chosen, and the confirmation only shows the amount. With the 5 minute limit and the crown confirmation I think this can be acceptable, but it's a deliberate difference from the phone and I'd like us to agree on it.

  2. The age is captured once in onAppear and never re-evaluated. If the screen stays open, or you go to the confirmation and back, the line still says "2 min ago" and the pre-filled amount stays, even after the recommendation is past 5 or 12 minutes. That skips the Old Calculation Warning the Presets path gives. Could the age be checked again on Continue, and if the amount still equals the seeded recommendation and it's now 5 minutes or older, show the same warning (or clear the amount)?

  3. When the recommendation is under 5 minutes old it shows both as the pre-filled amount and as a row under Presets. Maybe leave it out of Presets in that case.

  4. The watch page in the docs (docs/setup/apple-watch.md, currently in loopandlearn/loopfollowdocs#73) describes the old flow with Recommended, Quick-Pick and Other Amount in a list, along with the watch-bolus.png screenshot. That needs updating to match if this goes in.

@MtlPhil

MtlPhil commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. I've pushed commits that address 1–3.

1. Pre-filling the recommendation

Fair point, and I may have overthought the answer. I've gone back and forth a few times tonight.

I'd like to keep the pre-fill, since it's what makes the watch bolus quick. But the watch now treats a pre-filled amount as "the recommendation" rather than just a number, and keeps it in line with the latest loop cycle:

  • When the bolus screen opens, the watch asks the phone for its latest state, on top of the updates the phone already sends.
  • While the amount is still the recommendation, a newer cycle that lowers it replaces the amount, with a haptic. A newer cycle with the same value just restarts the age. A newer cycle that raises it is never applied on its own: the line under the amount becomes "New 1.6 U, tap to use", with a haptic, so more insulin always has to be chosen.
  • The confirmation shows "Recommended, N min ago" under the amount (red from 5 minutes), so it's clear where the amount came from.
  • When the crown confirms, the watch checks the amount against the latest recommendation it has. If a last-minute cycle that arrived while the confirmation was showing lowered it, nothing is sent and a "Recommendation Lowered" alert offers Change to the new amount (which needs another crown turn), Send Anyway, or Cancel. Going back from the confirmation also brings the amount screen up to date.

Once the amount is changed by hand, it's no longer treated as the recommendation: it stays where the user put it, with no "Recommended" line and no check at send, the same as typing an amount on the phone.

If you'd still rather match the phone exactly, the alternative is to start at 0 and show the recommendation as a one-tap button on the amount screen. Happy to go that way if you prefer.

2. Age only checked once

The age on the amount screen now keeps counting and turns red at 5 minutes. If the amount is still the starting recommendation and it's now 5 minutes or older, Continue shows the same Old Calculation Warning as the Presets path. That also covers going to the confirmation and back.

3. Duplicate in Presets

Presets no longer lists the recommendation while it's under 5 minutes old. From 5 to 12 minutes it's listed there with the warning. When there are no Quick-Picks, the Presets button only appears when there's something in it.

4. Docs

I'll update the watch page and watch-bolus.png in loopandlearn/loopfollowdocs#73 once we've settled on the flow.

…low only untouched amounts while on top, clear an expired starting recommendation, and let compact buttons wrap

A loop cycle without a recommendation no longer counts as 0 U. The Presets button appears once the recommendation is old enough to be listed there, and meal Quick-Picks are centered like the other buttons.
Watch bolus: review fixes for the recommendation handling and compact buttons
bjorkert
bjorkert previously approved these changes Oct 29, 2026

@bjorkert bjorkert left a comment

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.

Thanks, looks good now. Please update the PR description to match the current flow before merging, and the docs in loopandlearn/loopfollowdocs#73.

@marionbarker

marionbarker commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Test

❓ The issues I found are probably also in the dev branch.
✅ This does have the new features mentioned and those seem to work well.
Things to fix:

  • ❌ Sending a bolus from watch then tapping on bolus again - give the same recommendation (it does not update right away)
  • ❓ If the LoopFollow app is open on the phone, then the notification of success/failure goes to the phone not the watch

Configuration

Use my personal Loop phone and build this branch onto my personal LoopFollow.

Had to eat some apple salad to test this - I hope you appreciate the sacrifice.

First test was with feature/lfhub branch

This showed the following issue that needs to be fixed. (Not caused by this PR.)

Entered carbs on phone, got rec bolus on watch, tweaked amount of carbs on phone and got update on watch.
I bolused from watch and it went through onto Loop phone.
It says wait for notification confirming the result - but the notification goes to the phone (not the watch).

❌ But then I tapped on watch, bolus icon again and it gave me the same bolus recommendation even though the first one went through - if I had accepted it, it would have been a double bolus.

A few minutes later it updated to zero recommended. Or maybe it updated when I tapped on the home screen on the phone. This is effectively what is currently in LoopFollow dev

Second test was with achkars-org:feature/watch-bolus-amount

Background refresh was set to Silent Tunes.
I'm pretty sure I got the same thing by going back to the watch bolus button too soon.
Also, the notification goes to the phone if LoopFollow is open on the phone, it does not show up on the watch.

After a bolus, the recommendation stays the same until Loop or Trio runs a
new cycle and LoopFollow fetches it, which can take a few minutes. During
that time the watch filled the old amount in again, so Continue and the
crown would have given the bolus twice. The phone's bolus screens offered
it too, with a tap.

The phone now leaves out a recommendation when a manual bolus came after
its loop cycle: from Nightscout, or sent from LoopFollow or the watch,
alone or with a meal. The watch also ignores one from before insulin it
sent itself, including when it sent directly.

For Loop, the recommendation's time is now the cycle's own timestamp. The
pump clock it used before also moves on failed cycles, which keep the old
recommendation, so after a bolus that recommendation looked newer than the
bolus.
@MtlPhil

MtlPhil commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks Marion, for the testing and for the apple salad.

Same recommendation after a bolus

Good catch, and this PR made it worse. On dev the old recommendation needs a tap, but here it's the starting amount, so Continue and the crown would have sent it again.

After a bolus, the recommendation stays the same until Loop runs a new cycle and LoopFollow fetches it, which can take a few minutes. Nothing told the watch that the recommendation was from before the bolus.

Fixed in 7750548:

  • The watch remembers when it sent insulin and ignores any recommendation from before then. That covers your test without waiting for the phone.
  • The phone leaves out a recommendation from before any manual bolus: in Nightscout, or sent from LoopFollow or the watch. The phone's Loop and Trio bolus screens use the same check, so this also fixes what you saw with feature/lfhub.
  • For Loop, the recommendation's time is now Loop's cycle timestamp instead of the pump clock. The pump clock also moves on failed cycles, which keep the old recommendation, so a failed cycle right after the bolus would have made the old recommendation look newer than the bolus.

So right after a bolus, the bolus screen opens with nothing filled in, and the recommendation comes back after Loop's next cycle. Automatic boluses don't count, since the cycle that recommends a bolus can also give one.

Notification goes to the phone

That's how iOS handles notifications: they only show on the watch while the iPhone is locked. When the phone is unlocked or LoopFollow is open, Loop's confirmation shows on the phone. It isn't caused by this PR.

Since the confirmation comes back to LoopFollow, the phone could pass the result on to the watch, so the Sent screen shows whether Loop delivered it. I'd do that in a separate PR, if that sounds useful.

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.

3 participants