Skip to content

Conversation

@bjorkert
Copy link
Contributor

Overview

This PR introduces enhancements to the blood glucose chart's auto-scrolling behavior in the MainViewController. The primary goal is to improve the user experience by allowing manual chart interactions (like scrolling to view historical data) without being interrupted by auto-scrolling to the latest data point.

Changes

  • Added a Date? variable named autoScrollPauseUntil to MainViewController. This variable tracks the time until which auto-scrolling should be paused due to user interaction.
  • Modified the updateBGGraph method to check autoScrollPauseUntil before executing auto-scrolling logic. Auto-scrolling now only occurs if autoScrollPauseUntil is nil or the current time is past the autoScrollPauseUntil timestamp.
  • Implemented the chartTranslated delegate method to update autoScrollPauseUntil based on user scrolling. If the user scrolls to the latest data point, autoScrollPauseUntil is set to nil, allowing immediate resumption of auto-scrolling. If the user scrolls to view historical data, autoScrollPauseUntil is set to 5 minutes into the future, temporarily pausing auto-scrolling.

Rationale

The motivation behind these changes is to strike a balance between keeping users informed of the latest blood glucose data and allowing uninterrupted exploration of historical data. By intelligently managing auto-scrolling based on user interaction, we enhance the application's usability, particularly for users who actively engage with their historical blood glucose data.

Testing

These changes have been tested in the development environment to ensure that:

  • Auto-scrolling is paused for 5 minutes when the user manually scrolls the chart.
  • Auto-scrolling resumes immediately when the user scrolls back to the latest data point or after 5 minutes of inactivity post-scroll.
  • The overall functionality and performance of the chart remain unaffected by these updates.

@bjorkert bjorkert requested a review from marionbarker March 25, 2024 09:52
@dsnallfot
Copy link
Contributor

dsnallfot commented Mar 26, 2024

@bjorkert @marionbarker
Just wanted to feed in that I quickly borrowed this code as soon as i saw it and put it in my personal customized branch.

And I have been running it for a couple of hours to test the cases mentioned in the notes. Everything works as expected.

This is a really nice UX feature for everyone like me that frequently looks at historical data in the chart.

Great job Jonas!

@bjorkert
Copy link
Contributor Author

@bjorkert @marionbarker Just wanted to feed in that I quickly borrowed this code as soon as i saw it and put it in my personal customized branch.

And I have been running it for a couple of hours to test the cases mentioned in the notes. Everything works as expected.

This is a really nice UX feature for everyone like me that frequently looks at historical data in the chart.

Great job Jonas!

Thanks for the feedback and testing! =)

@marionbarker
Copy link
Collaborator

Code review looks good.

Testing on test phone.

  1. Build using dev branch (does not have this change)
    • Scroll to older time
    • When new glucose arrives, chart auto-scrolls to display new glucose
  2. Build using branch from this PR
    • Scroll to older time
    • When new glucose arrives, scroll position remains unchanged
    • Do not modify chart (no touching)
    • When next glucose arrives, chart auto-scrolls to display new glucose

@marionbarker marionbarker merged commit 5716f1b into dev Mar 26, 2024
@marionbarker marionbarker deleted the chart-scroll-management branch April 24, 2024 17:31
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.

4 participants