Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(HomeMapView): center on user's current location #38

Merged
merged 11 commits into from
Feb 13, 2024

Conversation

KaylaBrady
Copy link
Collaborator

@KaylaBrady KaylaBrady commented Feb 12, 2024

Summary

Ticket: Initial map setup

What is this PR for?

Center's the map on the user's current location when we have it.

In earlier commits I tried doing some custom logic based on this issue which describes high CPU usage when using the default .followPuck viewport.

I replicated that high usage (~40% while idle). However, when implementing custom follow puck logic instead the location-following behavior was pretty jumpy, even when using transitions. I opted to stick with the default .followPuck implementation for now with the idea that we can revisit if performance ends up being a problem.

Testing

What testing have you done?

I tested this out on a local device and moved around, confirming that the map follows my location.
I wrote a test to try to assert this is the case but ended up skipping it - I think there is something finicky about the timing of location updates that is causing this to fail. I think going back to commit b68bfe5 would be easier to test.

var sut = HomeMapView(locationDataManager: locationDataManager)

let hasAppeared = sut.on(\.didAppear) { _ in
XCTAssertNotNil(sut.viewport.followPuck)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this test is skipped - I'm guessing that there is something going on in mapbox to not set the viewport to followPuck before there is a known location, so this doesn't happen until the location update is published.

@@ -51,6 +47,15 @@ struct ContentView: View {
}
}

struct _HomeMapView: View {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't want to init the locationManager inline in ContentView, which would have re-init every time the search text changed.

@KaylaBrady KaylaBrady marked this pull request as ready for review February 12, 2024 20:54
@KaylaBrady KaylaBrady requested a review from a team as a code owner February 12, 2024 20:54
"revision" : "67319287749b83f39dcc2f20edd520c610c012fd",
"version" : "0.9.10"
"revision" : "a1422d4749ccf7f32b1d14a9ec19ec9a0b0fd337",
"version" : "0.9.9"
Copy link
Member

Choose a reason for hiding this comment

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

Was this downgrade intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, thanks for catching

Copy link
Member

Choose a reason for hiding this comment

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

This imageset (and Image alongside it) appears not to contain an image at all; is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yep none of these image sets are necessary - I was playing around with them in earlier iterations.

Copy link
Member

Choose a reason for hiding this comment

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

This image appears to be missing the imageset metadata that location-puck has.

@@ -51,6 +47,15 @@ struct ContentView: View {
}
}

struct _HomeMapView: View {
@StateObject var locationManager: LocationDataManager = .init(distanceFilter: 1)
var body: some View {
Copy link
Member

Choose a reason for hiding this comment

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

This indentation looks incorrect to me. Do you have pre-commit properly configured?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I did a --no-verify commit at some point along the way. Pushed a cleanup

…ht/dark mode to prevent timeouts

This test was taking 53 seconds on my machine because it really runs 8 tests. I don't think we need to assess launch time for each orientation
this test passes locally, but runs in CI. punting to figure out why
@@ -40,6 +43,9 @@
},
{
"parallelizable" : true,
"skippedTests" : [
"IosAppUITestsLaunchTests\/testLaunch()"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Skipping this test after discussion at standup - ticket to revisit here.

@KaylaBrady KaylaBrady merged commit 7406d2d into main Feb 13, 2024
3 checks passed
@KaylaBrady KaylaBrady deleted the kb-map-location branch February 13, 2024 18:04
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.

2 participants