- HealthKit workout importing with multi-segment workout support (BIG-70)
Ok so this one sounds like not much, but it’s actually a pretty chunky bit of work. Because the workout importer lays the foundation for the GPX importer, and … well, other importers too.
The workout importer and the more generic/reusable underlying bits have been rearchitected from what was in old Arc Timeline app. It’s hardier, more resilient to data weirdness, and this time also support multi-segment workouts, including workouts with pauses, correctly creating TimelineItems for each. It also allows for selective import from multi-segment workouts, importing only the segments you want.
Beyond that, I’m not going to describe in more detail. It’ll be best if you play with it and let me know your questions and feedback! That way I can learn what’s working well and self documenting, versus what’s acting weirdly or not presenting intuitively or self documenting.
Oh! Must be yeah. Though I don’t recall what the database migration would be. I’ll check the code now…
Aah yeah, ok, I see it now. It’s actually a kind of cool technical improvement that I’d totally forgotten.
TimelineItems now have a “locked” flag, that can stop them from being merged. This is useful for when importing workouts with multiple segments of the same activity type, eg a running workout with lap segments. You don’t want the processing engine merging all of those lap items back together, which is what it’d want to do normally (running → running → running should, according to the rules, get merged into being a single running item).
So the new item.locked flag allows the importer to say “these items, you’re not allowed to merge them”. Which then means the imported segments will be preserved in their original form.
Though you can still manually edit them, by fiddling about with the segments inside them, splitting them etc. That will then break away from the locked state, and those new bits will then be treated as normal timeline items which will auto merge. But in their initial state after import, if you don’t make any changes yourself, they’ll stay locked, so that processing can’t mess with your carefully segmented workouts with laps etc.
Yeah, for this one I copied Arc Timeline’s GPX importer UI, which I think was much better than Arc Timeline’s workout importer UI. And has those toggle buttons for “show on map”, which really help to understand what you’re looking at.
I never liked Arc Timeline’s workout importer UI. This new UI is … I like it a lot more.
First Matt convinces me to accept a split-shift at work just to see how well it tracks oddball shifts, now he’s making me run a half marathon to see how well it tracks workouts I will report back with my findings
@DotKern Hahah. You should see the test data I had to create for building and testing this! A bunch of 10 minute walks outside then back home again. Tapping to add random segments, pausing for random seconds, all while looking like an idiot as neighbours look at me thinking “wtf is he doing?”
The main reason why I haven’t yet added the “multi activity / triathlon” import functionality is because I didn’t want to go outside and pretend to do a 10 minute triathlon I’ll have to do it eventually though. That’s kind of the one big remaining functionality gap in the workout importer.
Haha if you need someone to do a triathlon let me know. I’ll dust off the BMX and put on the swim cap. Rivers a bit chilly this time of year though, maybe wait until spring? Developing GPS based apps is surely no joke. I had a brief foray into Niantic Lighthouse and the debugging process seemed horrifying
It can get quite silly The worst is when you have to walk around outside carrying an open laptop, tapping away at it while you walk. That gets the best “wtf is that guy doing?” looks.
Sorry if this is the wrong forum for this, but I did try for a few minutes to figure out the best way to go. Is there any chance you will open up the beta to more people? Or is there a way to get on a waiting list? Thanks!
I see there’s 24 slots open in the public beta group, so you should be able to join it and install.
I add a bunch more slots with each new beta release, as well as removing people who haven’t been installing updates, to free up their slots. So there’s a bit of room spare still there from the last update.
If it’s still not letting you in, let me know and I can add you by email address or something. Sometimes TestFlight acts a bit weird.
New bug I found just now: the map rendered halfway and then just suddenly stopped. It can be seen that the left side is somewhat complete but lacking street names, and the right side is just gray. I slid down the timeline view and it’s still like this. Zooming in on the map doesn’t seem to change anything.
@trackerminerfs I bet that was a network issue inside the Mapbox system. Presumably it was trying to fetch some map data from their servers and it failed.
If that happens you can sometimes nudge it into self correcting by doing exactly what you tried: zooming and panning around. But if that doesn’t work I think the only thing you can do is wait. It’s probably got something like a 60 second timeout going on, like it’s waiting for another network request to succeed or fail, and if it nothing comes back after 60 seconds it’ll try again.
Oh on the Mapbox network thing, I have a semi related little trick I use before airplane flights.
Mapbox will cache map data that it’s loaded recently so that it doesn’t have to repeatedly load it over the network. Not sure how long it holds it for, but it’s long enough for flights. So before a flight takes off I’ll pan and zoom the map so that it loads all the map details for the places I’ll be passing over, and also the airport I’ll be landing at.
That way, during the flight when there’s no internet access, the map will still show full detail if I want to poke around the map and see what things are I can see out the window.
Same trick works for Google Maps and Apple Maps too of course. But I like to do it in Arc because there I can see the path line of my flight, so have a better sense of it all.