Skip to content

Show pod expiration minutes during final day - #218

Open
htenlik wants to merge 3 commits into
loopandlearn:next-devfrom
htenlik:fix/pod-expiration-minutes
Open

htenlik wants to merge 3 commits into
loopandlearn:next-devfrom
htenlik:fix/pod-expiration-minutes

Conversation

@htenlik

@htenlik htenlik commented Nov 10, 2026 •

Copy link
Copy Markdown

Show pod expiration minutes during final day

Summary

Addresses LoopKit/LoopKit#583.

The Omnipod settings screen previously displayed minutes only when less than two hours remained before pod expiration. As a result, a pod with 11 hours and 58 minutes remaining appeared to have only 11 hours left.

This change displays hours and minutes throughout the final 24 hours, matching the behavior described in LoopDocs.

Changes

  • Move the remaining-time component calculations from OmniSettingsView into PodLifeState for unit testing.
  • Display minutes throughout the final 24 hours, independently of expiration reminder settings.
  • Correct boundary cases at exactly 24 hours and exactly 1 hour remaining.
  • Add nine regression tests covering expiration boundaries and reminder configurations.

Testing

  • Full OmniTests suite on an iPhone 18 Pro simulator: 241 tests, 238 passed, 3 skipped, 0 failures.
  • Updated the branch against the latest next-dev and adapted the activation-state regression test following PR Update/next dev from dev #232. The original production changes remain unchanged.

Notes

At narrow content widths, the longer countdown can cause the "Pod expires in" label to wrap onto two lines. No layout changes are included in this PR.

The original issue suggests showing minutes after the scheduled expiration reminder. This implementation instead shows minutes throughout the final day, consistently with LoopDocs and independently of reminder configuration. Happy to adjust if a narrower behavior is preferred.

@marionbarker

Copy link
Copy Markdown
Contributor

Comment

I'm looking at my next-dev build and my Pod UI shows:

"Change Pod now. Insulin delivery will stop in 6 hours, 44 minutes or when no more insulin remains."

But looking more closely - I see that the Issue is posted before Pod expires not during the 8 hour grace period.

As currently configured, pod must exceed 70 hours of pod life before minutes are shown.

Test

Configure a test phone with latest next-dev:
Examine the Pod UI at a series of pod active life values (hrs).

  • The minutes are shown only when pod life is 70 hours or greater.

Rebuild after applying a patch created from this PR:
Examine the Pod UI at a series of pod active values (hrs)

  • The minutes are shown when pod life is 48 hours or greater.

Pod Life of 12 hr, 24 hr and 48 hours without the PR

omni-time-without-pr218

Pod Life of 12 hr, 24 hr and 48 hours with the PR

omni-time-with-pr218

@marionbarker marionbarker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve by test.

I also requested Claude to review the code and confirm the new test runs correctly.

  • No issues were found and logic was reported to be correct.

@htenlik

htenlik commented Nov 21, 2026

Copy link
Copy Markdown
Author

Thank you for taking the time to test the change and review the code! I really appreciate the detailed verification and approval.

This is actually my first approved open-source PR, so it's especially exciting and motivating for me. It definitely encourages me to keep contributing to the project!

@marionbarker

Copy link
Copy Markdown
Contributor

Thanks again for this PR! A heads-up about a change that just landed in next-dev, so you can update this PR.

This information was created by Claude.

Details:

#232 was merged into next-dev today. It brings in a change from dev (#231) that gives the PodLifeState.podActivating case an associated value:

// before
case podActivating
// after
case podActivating(screen: OmniUIScreen)

Your app code in this PR isn't affected, and GitHub will still show the PR as mergeable. But once next-dev is merged into your branch, your new test file won't compile, because it uses .podActivating without a value.

If you update your branch by merging next-dev into it, please also make this one-line change:

File: OmniTests/PodLifeStateTests.swift, line 62, in testOtherStatesShowNoTime()

// change this:
let states: [PodLifeState] = [.podActivating, .expired, .podDeactivating, .noPod]
// to this:
let states: [PodLifeState] = [.podActivating(screen: .pairAndPrime), .expired, .podDeactivating, .noPod]

The test only checks that no time is shown while a pod is activating, so the screen value doesn't matter; .pairAndPrime is fine.

After the change, OmniTests should build.

@htenlik

htenlik commented Dec 4, 2026

Copy link
Copy Markdown
Author

Thanks for the heads-up! I've merged the latest next-dev and updated the test as suggested.

The full OmniTests suite completed successfully: 238 passed, 0 failed, and 3 existing upstream skips.

The original production changes remain unchanged. Thanks again for your help!

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