Skip to content

Commit

Permalink
Support for visual sub-maneuvers
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedre committed Oct 21, 2024
1 parent 93b13b4 commit 0e20949
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ fun PreviewInstructionsView() {
text = "Hyde Street",
maneuverType = ManeuverType.TURN,
maneuverModifier = ManeuverModifier.LEFT,
roundaboutExitDegrees = null),
roundaboutExitDegrees = null,
laneInfo = null),
secondaryContent = null,
subContent = null,
triggerDistanceBeforeManeuver = 42.0)

InstructionsView(instructions = instructions, distanceToNextManeuver = 42.0)
Expand All @@ -85,8 +87,10 @@ fun PreviewRTLInstructionsView() {
text = "ادمج يسارًا",
maneuverType = ManeuverType.TURN,
maneuverModifier = ManeuverModifier.LEFT,
roundaboutExitDegrees = null),
roundaboutExitDegrees = null,
laneInfo = null),
secondaryContent = null,
subContent = null,
triggerDistanceBeforeManeuver = 42.0)

InstructionsView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ fun ManeuverImagePreview() {
text = "",
maneuverType = ManeuverType.TURN,
maneuverModifier = ManeuverModifier.LEFT,
roundaboutExitDegrees = null))
roundaboutExitDegrees = null,
laneInfo = null))
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ fun NavigationState.Companion.pedestrianExample(): NavigationState {
text = "Head east",
maneuverType = ManeuverType.TURN,
maneuverModifier = ManeuverModifier.RIGHT,
roundaboutExitDegrees = null),
roundaboutExitDegrees = null,
laneInfo = null),
secondaryContent = null,
subContent = null,
triggerDistanceBeforeManeuver = 0.0,
),
spokenInstruction = null,
Expand Down
7 changes: 5 additions & 2 deletions apple/Sources/FerrostarCore/Mock/MockNavigationState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ public extension NavigationState {
text: "Hyde Street",
maneuverType: .turn,
maneuverModifier: .left,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
secondaryContent: nil, triggerDistanceBeforeManeuver: 42.0
secondaryContent: nil,
subContent: nil,
triggerDistanceBeforeManeuver: 42.0
),
],
spokenInstructions: [],
Expand Down
4 changes: 3 additions & 1 deletion apple/Sources/FerrostarSwiftUI/TestFixtureFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ struct VisualInstructionContentFactory: TestFixtureFactory {
text: textBuilder(n),
maneuverType: .turn,
maneuverModifier: .left,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
)
}
}
Expand All @@ -53,6 +54,7 @@ struct VisualInstructionFactory: TestFixtureFactory {
VisualInstruction(
primaryContent: primaryContentBuilder(n),
secondaryContent: secondaryContentBuilder(n),
subContent: nil,
triggerDistanceBeforeManeuver: 42.0
)
}
Expand Down
22 changes: 16 additions & 6 deletions apple/Sources/FerrostarSwiftUI/Views/InstructionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,17 @@ public struct InstructionsView: View {
text: "Turn right on Something Dr.",
maneuverType: .turn,
maneuverModifier: .right,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
secondaryContent: VisualInstructionContent(
text: "Merge onto Hwy 123",
maneuverType: .merge,
maneuverModifier: .right,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
subContent: nil,
triggerDistanceBeforeManeuver: 123
)
)
Expand All @@ -174,9 +177,11 @@ public struct InstructionsView: View {
text: "Use the second exit to leave the roundabout.",
maneuverType: .rotary,
maneuverModifier: .slightRight,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
secondaryContent: nil,
subContent: nil,
triggerDistanceBeforeManeuver: 123
)
)
Expand All @@ -187,9 +192,11 @@ public struct InstructionsView: View {
text: "Links einfädeln.",
maneuverType: .merge,
maneuverModifier: .slightLeft,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
secondaryContent: nil,
subContent: nil,
triggerDistanceBeforeManeuver: 123
),
distanceFormatter: germanFormatter,
Expand All @@ -202,14 +209,17 @@ public struct InstructionsView: View {
text: "Turn right on Something Dr.",
maneuverType: .turn,
maneuverModifier: .right,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
secondaryContent: VisualInstructionContent(
text: "Merge onto Hwy 123",
maneuverType: .merge,
maneuverModifier: .right,
roundaboutExitDegrees: nil
roundaboutExitDegrees: nil,
laneInfo: nil
),
subContent: nil,
triggerDistanceBeforeManeuver: 123
)
)
Expand Down
Loading

0 comments on commit 0e20949

Please sign in to comment.