Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enable Setting and Canceling Loop Overrides #362

Merged
merged 8 commits into from
Jan 30, 2025
Merged

Conversation

bjorkert
Copy link
Contributor

This pull request introduces support for setting and canceling Loop overrides.

Requirements:
• Use Remote Type Nightscout
• The token must have admin authorization (caregiver access is not sufficient).
• APNS must be properly configured in Nightscout.
• Setting overrides from Nightscout must function as expected.

image
image

@bjorkert bjorkert requested a review from marionbarker January 27, 2025 13:15
@marionbarker
Copy link
Collaborator

marionbarker commented Jan 27, 2025

Preliminary test. Requested a few feature updates - Jonas responded with a list:

TODO:
[ y ] If TRC and not detecting Trio, set remote type to None.
[ y ] More user friendly error message for unauthorized, might also detect that the user does not have Admin to start with.
[ y ] More user friendly error message for badDeviceToken, hint about production vs sandbox depending on build method.

@marionbarker
Copy link
Collaborator

Status

Things that need to be fixed:

  • The mini hint should have words "and Loop" added to read: "Nightscout is the only option for the released version of Trio and Loop".
  • When URL is fed from Loop (and if possible Trio 0.2.x), the Remote Type option for TRC should be disabled
  • When URL is fed from Trio-private-beta, changing the Remote Type option from Trio Remote Control to None, the TRC 4-grid of choices was still offered when tapping remote on the tool bar

Optional Things:

  • When URL is fed from Loop:
    • might want to include LOOP_PUSH_SERVER_ENVIRONMENT in the error message when NS was not configured properly (I'll put something in the code review with a specific suggestion)
    • perhaps a note could be added between the Active Override and Available Override sections that says - "Setting a new override while one is active will cancel the active override and set the new one." Otherwise, we'll be answering a lot of questions on FB
    • Perhaps add word Trio or Loop into token insufficient error messages

Test

Build branch loop-override-pr, commit a9757f3 on several test phones.

Test Loop Remote

Use test phone that is viewing a Loop URL, set token to admin
Modify choice for remote type

  • Select None
    • Tap on Remote and get "Please select a Remote Type in Settings"
  • Select Trio Remote Control - I don't think that option should be allowed
    • User is shown screen with places to fill out all the items needed for TRC
    • Tap on Remote and get "Trio Remote Control is only supported for Trio"
  • Select Nightscout
    • Attempt to set an override (can see the overrides, but not set one)
    • Better error message than before but maybe it should include LOOP_PUSH_SERVER_ENVIRONMENT
    • Replace the Browser Build Loop with Xcode Loop on the Loop phone
    • Attempt to set an override - got a success message and it shows up on Loop phone
    • Attempt to cancel the override - that also worked
    • Set override on the Loop phone, wait for it to show up on LF phone
    • Set a new override on top of the acting one - it accepted that - action was to remove the old one and set the new one
    • Acceptable behavior but perhaps a note could be added between the Active Override and Available Override sections that says - Setting a new override while one is active, will cancel the active override and set the new one.
  • Switch to another URL where the token is readable
    • Tap on remote in tool bar and be told explicitly that token must include admin

Test Trio Remote using 0.2.3

Use test phone that is viewing URL fed by Trio 0.2.3 app, set token to admin
Start with Trio phone set with Fetch and Remote commands disabled.
Configure LoopFollow phone as below

  • Set Remote settings to None
    • Tap on Remote and get "Please select a Remote Type in Settings"
  • Select Trio Remote Control - I don't think that option should be allowed
    • User is shown screen with places to fill out all the items needed for TRC
    • Tap on Remote and get "Trio Remote Control is only supported for Trio"
  • Select Nightscout
    • Attempt to cancel a Temp Target currently running - accepted by Nightscout, but Trio phone is not configured for remotes
    • Both LoopFollow and Nightscout think TT was canceled but Trio phone is still running it.
    • Now enable both Fetch Treatments and Remote Control on the Trio phone
    • The TT is now canceled
    • Send named TT from LoopFollow phone, seen on Nightscout and shortly thereafter on the Trio phone
    • Cancel on Trio phone and it updates in Nightscout and then in LoopFollow
  • Switch to another URL where the token is readable
    • Tap on remote in tool bar and be told explicitly that token must include both careportal and readable

Test Trio Remote using private beta

Use test phone that is viewing a Trio-private-beta URL and is configured to work with the Trio Remote Commands option - make sure it still works with this branch

  • Test send a bolus - sent without errors to Nightscout, but Trio phone has Enable Remote Control disabled (see note in NS treatments and if tap dot on LF screen)
  • Set Remote settings to None
    • It should no longer show me options for using TRC but they are shown
  • Set Remote settings to Nightscout
    • Now I am shown the expected named presets and option for custom TT
    • Enter custom TT and it appears on Trio phone
    • These work regardless of Trio feature setting
  • Set Remote settings to Trio Remote Commands
    • Enable Remote Control on the Trio phone and make sure shared secret matches
    • Test send a bolus and see bolus enacted on the Trio phone

Copy link
Collaborator

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

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

Please see previous comments for changes I think should be included.

@bjorkert
Copy link
Contributor Author

I have addressed all issues except disabling the TDC option for Trio 0.2.x. AFAIK there is no way to distinguish between the 0.2 and 1.0 version using data from Nightscout.

@marionbarker
Copy link
Collaborator

Status

All tests are good with latest commits

Code Review

All changes looked good from code inspection

Tests

Confirmed all (possible) updates appear appropriately
[y] Loop URL with insufficient token
[y] Trio URL with insufficient token
[y] Loop URL when build method does not match NS config var
[y] Mini hint for selecting Remote Types add the word Loop
[y] Loop URL, the TRC option should be disabled
[y] Add extra comment on Loop Remote control screen about what happens if new override is selected while another is running - nice touch that it is only visible when an active override is running
[y] Trio URL, when Remote Type is set to none, the TRC options should not be shown when tapping Remote in toolbar

Copy link
Collaborator

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

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

All requested changes made, reviewed and tested.

@marionbarker marionbarker merged commit 19d0c22 into dev Jan 30, 2025
@bjorkert bjorkert deleted the loop-override-pr branch January 30, 2025 15:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants