cuappdev/ithaca-transit-ios

Wonky behavior on returning to previous app state

Closed this issue · 0 comments

Problem

If you re-open the app after a previous session and the app state is still in memory, the app will keep the same now out-dated "Leave At" or "Arrive By" time as when the app was first used. Not only is this confusing, but all routes will update to "Board Now", when the bus has actually come and gone hours ago.

Goal

Update the time option accordingly so it is up-to-date when it should be, whether you return to this screen from the Route Detail view or another application on the phone.

Discussion

We need to refresh this screen when a user comes back to it from a different app (1). The easiest thing to do is when coming back to this screen, update "Leave At" to be the current time and refresh the page. However, what is a user is looking at a future time to plan a route, this would reset the options they punched in. I think we should add a boolean that tracks whether the user is interested in the current time. For example, this would be true on first loading route options after tapping a place, or after tapping "Leave Now" in the DatePicker screen. If this variable is true, then update this time to be current upon returning to this screen, from another app or possibly every minute to stay up to date.

Technical Notes

  1. This logic could go in RouteOptionViewController's viewDidAppear or applicationDidBecomeActive(_:).

It might be over zealous to reload every single time the screen appears, because the bug really only happens when you exit the app and come back to it. However, if someone uses the app for even say 5 minutes, the time will again stay old which leads to all this confusion.