-
Notifications
You must be signed in to change notification settings - Fork 318
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
Road name labeling functionality for CarPlay. #3527
Conversation
func labelCurrentRoadFeature(at location: CLLocation, | ||
router: Router, | ||
wayNameView: WayNameView, | ||
roadNameFromStatus: String?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying implementation doesn't always work on CarPlay as expected, this leads to inconsistency with iOS. I'm also not sure that performing querying on iOS and CarPlay at the same time is the best approach. Though, I do not have any good ideas for handling cases like: CarPlay starts navigation without iOS app running etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying on both “screens” should be fine in principle, even simultaneously, but there could be a scaling issue going on. Maybe the map SDK’s querying functionality is confused about the fact that the CarPlay map has a different scale and aspect ratio.
@@ -22,12 +22,17 @@ open class CarPlayNavigationViewController: UIViewController { | |||
|
|||
This view is hidden by default. | |||
*/ | |||
public weak var compassView: CarPlayCompassView! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we've marked these as weak
before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weak
is the default attribute for IBOutlets and they are being used similarly here to keep the retain count at +1. view.addSubview(compassView)
will retain the view. Strongly held would make the retain count +2, which is also fine in this case, even necessary if you want to remove the view and add it back after viewDidLoad.
53e768d
to
6b3982b
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
color: UIColor, | ||
font: UIFont, | ||
size: CGSize? = nil) -> UIImage { | ||
let maxHeight = size?.height ?? font.lineHeight * 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case if size is set we'll use it to provide maximum height for the image. In this case this height is height of UILabel
container.
05e2902
to
2d67bfb
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
@@ -10,10 +10,43 @@ open class WayNameLabel: StylableLabel {} | |||
/// :nodoc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we expect the developer to use this class or any of its members, we should document it. Until now, these classes have largely been used in Style subclasses in a particular way, so they didn’t require much beyond an example in practice, though documentation is long overdue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created ticket for this in #3584.
func labelCurrentRoadFeature(at location: CLLocation, | ||
router: Router, | ||
wayNameView: WayNameView, | ||
roadNameFromStatus: String?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying on both “screens” should be fine in principle, even simultaneously, but there could be a scaling issue going on. Maybe the map SDK’s querying functionality is confused about the fact that the CarPlay map has a different scale and aspect ratio.
2d67bfb
to
c3c192e
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
c3c192e
to
a22b120
Compare
No breaking changes detected in MapboxCoreNavigation |
Breaking Changes in MapboxNavigationBreaking API Changes
|
Type of change: | Inherited Types |
---|---|
From: | [["key.name": AnyObject], ["key.name": UnimplementedLogging]] |
To: | [["key.name": VisualInstructionDelegate]] |
No breaking changes detected in MapboxCoreNavigation |
Breaking Changes in MapboxNavigationBreaking API Changes
|
Type of change: | Inherited Types |
---|---|
From: | [["key.name": AnyObject], ["key.name": UnimplementedLogging]] |
To: | [["key.name": VisualInstructionDelegate]] |
No breaking changes detected in MapboxCoreNavigation |
Breaking Changes in MapboxNavigationBreaking API Changes
|
Type of change: | Inherited Types |
---|---|
From: | [["key.name": AnyObject], ["key.name": UnimplementedLogging]] |
To: | [["key.name": VisualInstructionDelegate]] |
No breaking changes detected in MapboxCoreNavigation |
Breaking Changes in MapboxNavigationBreaking API Changes
|
Type of change: | Inherited Types |
---|---|
From: | [["key.name": AnyObject], ["key.name": UnimplementedLogging]] |
To: | [["key.name": VisualInstructionDelegate]] |
1617b4d
to
789b4cf
Compare
No breaking changes detected in MapboxCoreNavigation |
Breaking Changes in MapboxNavigationBreaking API Changes
|
Type of change: | Inherited Types |
---|---|
From: | [["key.name": AnyObject], ["key.name": UnimplementedLogging]] |
To: | [["key.name": VisualInstructionDelegate]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern is about duplicated code. The rest is just small comments about clarity.
|
||
extension NavigationMapView { | ||
|
||
func labelCurrentRoadFeature(at location: CLLocation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method a copy of the same code from OrnamentsController? If so, even if this code will diverge from the origin, it is a maintenance problem. I suggest extracting the code into a sensible function that can be customized in the future if needed (or already needed?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code already has a bug that incorrectly hides road labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2548 tracks consolidating and exposing the logic for labeling the current road name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@S2Ler, NavigationMapView.labelCurrentRoadFeature(at:router:wayNameView:roadNameFromStatus:)
is already reused by iOS and CarPlay. Can you elaborate regarding:
The original code already has a bug that incorrectly hides road labels.
WayNameView
is hidden whenever road name info is missing and we were not able to query it. It'll be shown back whenever is such info is available once again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NavigationMapView.labelCurrentRoadFeature(at:router:wayNameView:roadNameFromStatus:) is already reused by iOS and CarPlay.
I'm sorry, missed that part, that's cool that there is no duplication 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WayNameView
is hidden whenever road name info is missing and we were not able to query it. It'll be shown back whenever is such info is available once again.
I haven't got a chance to create a ticket, but on the freeways, I've noticed that road name disappears even though it shouldn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaximAlien #3594 created a bug for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Since querying depends on the zoom level we'll have to find more reliable ways of getting road name information. Hopefully in scope of #2548 we'll be able to fix that.
|
||
extension NavigationMapView { | ||
|
||
func labelCurrentRoadFeature(at location: CLLocation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2548 tracks consolidating and exposing the logic for labeling the current road name.
789b4cf
to
9efbb76
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
6e830a2
to
3063072
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
|
||
extension NavigationMapView { | ||
|
||
func labelCurrentRoadFeature(at location: CLLocation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NavigationMapView.labelCurrentRoadFeature(at:router:wayNameView:roadNameFromStatus:) is already reused by iOS and CarPlay.
I'm sorry, missed that part, that's cool that there is no duplication 👍
|
||
extension NavigationMapView { | ||
|
||
func labelCurrentRoadFeature(at location: CLLocation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WayNameView
is hidden whenever road name info is missing and we were not able to query it. It'll be shown back whenever is such info is available once again.
I haven't got a chance to create a ticket, but on the freeways, I've noticed that road name disappears even though it shouldn't.
|
||
extension NavigationMapView { | ||
|
||
func labelCurrentRoadFeature(at location: CLLocation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaximAlien #3594 created a bug for this.
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
…e navigation. Add the ability to fully hide `WayNameView`, improved its documentation, added the ability to style `backgroundColor` and `borderWidth`.
9916c1d
to
75a2c60
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
Closing #3480.
Road name labeling on CarPlay during free-drive:
Road name labeling on CarPlay during active-guidance: