@@ -4,6 +4,7 @@ import CarPlay
44import MapboxCoreNavigation
55import MapboxNavigation
66import MapboxDirections
7+ import MapboxMaps
78
89@main
910class AppDelegate : UIResponder , UIWindowSceneDelegate {
@@ -73,13 +74,123 @@ extension AppDelegate: CPTemplateApplicationSceneDelegate {
7374extension AppDelegate : CarPlayManagerDelegate {
7475
7576 func carPlayManager( _ carPlayManager: CarPlayManager ,
76- navigationServiceAlong route: Route ,
77- routeIndex: Int ,
78- routeOptions: RouteOptions ,
79- desiredSimulationMode: SimulationMode ) -> NavigationService {
80- return MapboxNavigationService ( route: route,
81- routeIndex: routeIndex,
82- routeOptions: routeOptions,
83- simulating: desiredSimulationMode)
77+ leadingNavigationBarButtonsCompatibleWith traitCollection: UITraitCollection ,
78+ in carPlayTemplate: CPTemplate , for activity: CarPlayActivity ) -> [ CPBarButton ] ? {
79+ let barButton = CPBarButton ( type: . text) { _ in
80+
81+ }
82+ barButton. title = " Test "
83+
84+ return [ barButton]
85+ }
86+
87+ func carPlayManager( _ carPlayManager: CarPlayManager ,
88+ trailingNavigationBarButtonsCompatibleWith traitCollection: UITraitCollection ,
89+ in carPlayTemplate: CPTemplate ,
90+ for activity: CarPlayActivity ) -> [ CPBarButton ] ? {
91+ switch activity {
92+
93+ case . browsing:
94+ break
95+
96+ case . panningInBrowsingMode:
97+ break
98+
99+ case . previewing:
100+ break
101+
102+ case . navigating:
103+ break
104+
105+ }
106+
107+ let barButton = CPBarButton ( type: . text) { _ in
108+
109+ }
110+ barButton. title = " Test "
111+
112+ return [ barButton]
113+ }
114+
115+ func carPlayManager( _ carPlayManager: CarPlayManager ,
116+ mapButtonsCompatibleWith traitCollection: UITraitCollection ,
117+ in carPlayTemplate: CPTemplate ,
118+ for activity: CarPlayActivity ) -> [ CPMapButton ] {
119+ switch activity {
120+
121+ case . browsing:
122+ break
123+
124+ case . panningInBrowsingMode:
125+ break
126+
127+ case . previewing:
128+ break
129+
130+ case . navigating:
131+ break
132+
133+ }
134+
135+ let mapButton = CPMapButton { _ in
136+
137+ }
138+ mapButton. image = UIImage . checkmark
139+
140+ return [ mapButton]
141+ }
142+
143+ func carPlayManager( _ carPlayManager: CarPlayManager ,
144+ didFailToFetchRouteBetween waypoints: [ Waypoint ] ? ,
145+ options: RouteOptions ,
146+ error: DirectionsError ) -> CPNavigationAlert ? {
147+ return nil
148+ }
149+
150+ func carPlayManager( _ carPlayManager: CarPlayManager ,
151+ willPreview trip: CPTrip ) -> CPTrip {
152+ return trip
153+ }
154+
155+ func carPlayManager( _ carPlayManager: CarPlayManager ,
156+ willPreview trip: CPTrip ,
157+ with previewTextConfiguration: CPTripPreviewTextConfiguration ) -> CPTripPreviewTextConfiguration {
158+ return previewTextConfiguration
159+ }
160+
161+ func carPlayManager( _ carPlayManager: CarPlayManager ,
162+ selectedPreviewFor trip: CPTrip ,
163+ using routeChoice: CPRouteChoice ) {
164+
165+ }
166+
167+ func carPlayManager( _ carPlayManager: CarPlayManager ,
168+ didBeginNavigationWith service: NavigationService ) {
169+
170+ }
171+
172+ func carPlayManagerDidEndNavigation( _ carPlayManager: CarPlayManager ) {
173+
174+ }
175+
176+ func carPlayManager( _ carPlayManager: CarPlayManager ,
177+ shouldPresentArrivalUIFor waypoint: Waypoint ) -> Bool {
178+ return false
179+ }
180+
181+ func carPlayManagerShouldDisableIdleTimer( _ carPlayManager: CarPlayManager ) -> Bool {
182+ return false
183+ }
184+
185+ func carPlayManager( _ carPlayManager: CarPlayManager ,
186+ didPresent navigationViewController: CarPlayNavigationViewController ) {
187+
188+ }
189+
190+ func carPlayManager( _ carPlayManager: CarPlayManager ,
191+ didAdd finalDestinationAnnotation: PointAnnotation ,
192+ to parentViewController: UIViewController ,
193+ pointAnnotationManager: PointAnnotationManager ) {
194+
84195 }
85196}
0 commit comments