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

Road name labeling functionality for CarPlay. #3527

Merged
merged 2 commits into from
Nov 15, 2021

Conversation

MaximAlien
Copy link
Contributor

@MaximAlien MaximAlien commented Oct 27, 2021

Closing #3480.

Road name labeling on CarPlay during free-drive:

Screen Shot 2021-10-27 at 3 06 07 PM

Screen Shot 2021-10-27 at 3 06 14 PM

Road name labeling on CarPlay during active-guidance:

Screen Shot 2021-10-27 at 5 32 27 PM

Screen Shot 2021-10-27 at 5 32 37 PM

@MaximAlien MaximAlien added UI Work related to visual components, Android Auto, Camera, 3D, voice, etc. CarPlay Bugs, improvements and feature requests on Apple CarPlay labels Oct 27, 2021
@MaximAlien MaximAlien added this to the v2.0.1 milestone Oct 27, 2021
@MaximAlien MaximAlien requested a review from a team October 27, 2021 22:09
@MaximAlien MaximAlien self-assigned this Oct 27, 2021
@MaximAlien MaximAlien changed the base branch from main to maxim/3507-add-current-activity-on-car-play October 27, 2021 22:09
@MaximAlien MaximAlien marked this pull request as draft October 27, 2021 22:09
@MaximAlien MaximAlien linked an issue Oct 27, 2021 that may be closed by this pull request
Comment on lines +7 to +10
func labelCurrentRoadFeature(at location: CLLocation,
router: Router,
wayNameView: WayNameView,
roadNameFromStatus: String?) {
Copy link
Contributor Author

@MaximAlien MaximAlien Oct 28, 2021

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.

Copy link
Contributor

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.

@MaximAlien MaximAlien changed the title Road name label functionality for CarPlay. Road name labeling functionality for CarPlay. Oct 28, 2021
@@ -22,12 +22,17 @@ open class CarPlayNavigationViewController: UIViewController {

This view is hidden by default.
*/
public weak var compassView: CarPlayCompassView!
Copy link
Contributor Author

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.

Copy link
Contributor

@frederoni frederoni Oct 29, 2021

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.

Base automatically changed from maxim/3507-add-current-activity-on-car-play to main October 28, 2021 23:26
@MaximAlien MaximAlien modified the milestones: v2.0.1, v2.1 Oct 29, 2021
@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 53e768d to 6b3982b Compare November 9, 2021 20:19
@mapbox-github-ci-issues-1
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-1
Copy link

No breaking changes detected in MapboxNavigation

@MaximAlien MaximAlien marked this pull request as ready for review November 9, 2021 22:09
@mapbox-github-ci-issues-3
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-3
Copy link

No breaking changes detected in MapboxNavigation

color: UIColor,
font: UIFont,
size: CGSize? = nil) -> UIImage {
let maxHeight = size?.height ?? font.lineHeight * 2
Copy link
Contributor Author

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.

@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 05e2902 to 2d67bfb Compare November 10, 2021 00:05
@mapbox-github-ci-issues-5
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-5
Copy link

No breaking changes detected in MapboxNavigation

@@ -10,10 +10,43 @@ open class WayNameLabel: StylableLabel {}
/// :nodoc:
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines +7 to +10
func labelCurrentRoadFeature(at location: CLLocation,
router: Router,
wayNameView: WayNameView,
roadNameFromStatus: String?) {
Copy link
Contributor

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.

@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 2d67bfb to c3c192e Compare November 11, 2021 02:10
@mapbox-github-ci-issues-1
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-1
Copy link

No breaking changes detected in MapboxNavigation

@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from c3c192e to a22b120 Compare November 11, 2021 21:30
@mapbox-github-ci-issues-5
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-5
Copy link

Breaking Changes in MapboxNavigation

Breaking API Changes

InstructionsBannerViewDelegate

  • modified protocol: InstructionsBannerViewDelegate
    Type of change: Inherited Types
    From: [["key.name": AnyObject], ["key.name": UnimplementedLogging]]
    To: [["key.name": VisualInstructionDelegate]]

@mapbox-github-ci-issues-3
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-3
Copy link

Breaking Changes in MapboxNavigation

Breaking API Changes

InstructionsBannerViewDelegate

  • modified protocol: InstructionsBannerViewDelegate
    Type of change: Inherited Types
    From: [["key.name": AnyObject], ["key.name": UnimplementedLogging]]
    To: [["key.name": VisualInstructionDelegate]]

@mapbox-github-ci-issues-2
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-2
Copy link

Breaking Changes in MapboxNavigation

Breaking API Changes

InstructionsBannerViewDelegate

  • modified protocol: InstructionsBannerViewDelegate
    Type of change: Inherited Types
    From: [["key.name": AnyObject], ["key.name": UnimplementedLogging]]
    To: [["key.name": VisualInstructionDelegate]]

@mapbox-github-ci-issues-3
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-3
Copy link

Breaking Changes in MapboxNavigation

Breaking API Changes

InstructionsBannerViewDelegate

  • modified protocol: InstructionsBannerViewDelegate
    Type of change: Inherited Types
    From: [["key.name": AnyObject], ["key.name": UnimplementedLogging]]
    To: [["key.name": VisualInstructionDelegate]]

@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 1617b4d to 789b4cf Compare November 12, 2021 04:25
@mapbox-github-ci-issues-5
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-5
Copy link

Breaking Changes in MapboxNavigation

Breaking API Changes

InstructionsBannerViewDelegate

  • modified protocol: InstructionsBannerViewDelegate
    Type of change: Inherited Types
    From: [["key.name": AnyObject], ["key.name": UnimplementedLogging]]
    To: [["key.name": VisualInstructionDelegate]]

Copy link
Contributor

@S2Ler S2Ler left a 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,
Copy link
Contributor

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?).

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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 👍

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

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.

@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 789b4cf to 9efbb76 Compare November 12, 2021 17:26
@mapbox-github-ci-issues-4
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-4
Copy link

No breaking changes detected in MapboxNavigation

@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 6e830a2 to 3063072 Compare November 12, 2021 18:28
@mapbox-github-ci-issues-5
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-5
Copy link

No breaking changes detected in MapboxNavigation


extension NavigationMapView {

func labelCurrentRoadFeature(at location: CLLocation,
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

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.

@mapbox-github-ci-issues-2
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-2
Copy link

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`.
@MaximAlien MaximAlien force-pushed the maxim/3480-road-name-label-on-car-play branch from 9916c1d to 75a2c60 Compare November 15, 2021 21:59
@mapbox-github-ci-issues-3
Copy link

No breaking changes detected in MapboxCoreNavigation

@mapbox-github-ci-issues-3
Copy link

No breaking changes detected in MapboxNavigation

@MaximAlien MaximAlien merged commit 6241d6e into main Nov 15, 2021
@MaximAlien MaximAlien deleted the maxim/3480-road-name-label-on-car-play branch November 15, 2021 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CarPlay Bugs, improvements and feature requests on Apple CarPlay UI Work related to visual components, Android Auto, Camera, 3D, voice, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show current road name label on CarPlay
4 participants