Overland-iOS
Overland-iOS copied to clipboard
Adding Trip Controls to Homescreen Quick Actions
iOS allows for quick actions that allows a user to control the app from the home screen. These actions can be dynamically added and removed as the app runs code with a limit of 4 actions at any given time.
I find when I'm about to go out for a walk or get in my car for a drive, sometimes I feels like I have to stop what I'm doing and go through a decent number of steps in order to track my activity. Open my phone, open the app. Hold down on the trip icon for a couple of seconds until the trip mode view comes up, select the type I'm doing, and then click the "Start" button.
A thought I had was that it would be great if there was always a "Start/Stop Trip" quick action. Obviously whether it was start or stop would update at the same time that the "Start/Stop" button updates.
If the user isn't in a trip, it could display the 4 most recent (but not active) trip types.
Example: A user has recently tracked a Train Ride, a Taxi ride and a Walk. The user is currently in a Car Trip. If they open the Quick Action menu, it would display "Stop Car Trip".
If the user selects "Stop Car Trip", and then open the Quick Action menu again, it would display:
- Start Car Trip
- Start Train Ride
- Start Taxi Ride
- Start Walk
These are just some initial thoughts, I'd love to hear what you think.
This is a great idea. I guess I got so used to doing the steps you outlined that I don't really think about it anymore.
I like the idea of the app keeping track of the most used trip types and providing those options.
One thing related to this that I'm not quite sure about is whether starting a trip should (temporarily) adjust the actual CoreLocation settings. Right now it's possible to set 1km accuracy and then start a trip and barely any location data will be recorded. I'm thinking it might be a good idea to turn up the resolution during an active trip, then restore it to the user setting after the trip ends. In fact, i'm going to open that as a new issue :-)
New link for the Apple docs, the old one 404s
https://developer.apple.com/design/human-interface-guidelines/home-screen-quick-actions
In the sceneWillResignActive delegate, we'll need to set the actions to show
https://developer.apple.com/documentation/uikit/uiscenedelegate/3197919-scenewillresignactive?language=objc
https://developer.apple.com/documentation/uikit/menus_and_shortcuts/add_home_screen_quick_actions?language=objc
This means we'll need to keep track of the most frequently used trip modes in order to sort the list by common modes. We can store a dictionary in NSUserDefaults, keys are the trip modes, and values are the number of uses. Then we can use keysSortedByValueUsingComparator to return a list of trip modes by most frequently used.
Progress!
Need to figure out how to respond to triggered scene actions, but the sample code in the docs is not Obj-C
https://developer.apple.com/documentation/uikit/menus_and_shortcuts/add_home_screen_quick_actions#3701696