Skip to content

Allow application to insert visual instructions on demand #2011

Open
@1ec5

Description

@1ec5

An application can call RouteVoiceController.speak(_:) at any time to interrupt any in-progress spoken instruction with a custom spoken instruction. However, there’s no way for the application to couple custom spoken instructions with custom visual instructions. #1530 added VisualInstructionDelegate.label(_:willPresent:as:) for tweaking a visual instruction predefined by the Directions API, but not for inserting an arbitrary instruction midstream. In other words, the customization hook is passive, not active.

NavigationService is the class that informs the application that the user has passed a predefined visual instruction point, so it should also have a present(_:duration:) method that presents the given visual instruction for a certain duration. There may need to be a priority argument of some sort to determine whether the message can be interrupted by a predefined instruction.

This would be useful for application-specific messages that the developer may need to present midroute, independently of any spoken instructions that the Directions API knows the user needs to hear about. An example would be a reminder to take a break after prolonged use of the application, considering that the application may be in the foreground across multiple navigation sessions. The application could present a modal alert, but a message that fits into the existing banner UI would result in a less confusing – and safer – driver experience.

We should probably pair this new method with a NavigationService.present(_:) method that accepts a spoken instruction. The current method on RouteVoiceController works OK but is less discoverable there, and navigation service has to know about all the instructions if it is to effectively coordinate them.

/cc @mapbox/navigation-ios @riastrad

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions