Skip to content

Commit 2d34ede

Browse files
committed
Update.
1 parent 13c6f3b commit 2d34ede

File tree

6 files changed

+403
-35
lines changed

6 files changed

+403
-35
lines changed

CarPlayExample/AppDelegate.swift

Lines changed: 119 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import CarPlay
44
import MapboxCoreNavigation
55
import MapboxNavigation
66
import MapboxDirections
7+
import MapboxMaps
78

89
@main
910
class AppDelegate: UIResponder, UIWindowSceneDelegate {
@@ -73,13 +74,123 @@ extension AppDelegate: CPTemplateApplicationSceneDelegate {
7374
extension 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
}
Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="kpJ-Zi-x0k">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
34
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
57
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
69
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
710
</dependencies>
811
<scenes>
12+
<!--Navigation Controller-->
13+
<scene sceneID="lgc-Ty-okg">
14+
<objects>
15+
<navigationController id="kpJ-Zi-x0k" sceneMemberID="viewController">
16+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="d2v-Le-rcF">
17+
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
18+
<autoresizingMask key="autoresizingMask"/>
19+
</navigationBar>
20+
<connections>
21+
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="FDE-AK-5A7"/>
22+
</connections>
23+
</navigationController>
24+
<placeholder placeholderIdentifier="IBFirstResponder" id="pYV-NQ-0Mk" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
25+
</objects>
26+
<point key="canvasLocation" x="-675" y="107"/>
27+
</scene>
928
<!--View Controller-->
1029
<scene sceneID="tne-QT-ifu">
1130
<objects>
12-
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
31+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="CarPlayExample" customModuleProvider="target" sceneMemberID="viewController">
1332
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
14-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
33+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
1534
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16-
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
1735
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
36+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
1837
</view>
38+
<navigationItem key="navigationItem" id="8uV-Kr-WPS"/>
1939
</viewController>
2040
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
2141
</objects>
42+
<point key="canvasLocation" x="71" y="106"/>
2243
</scene>
2344
</scenes>
45+
<resources>
46+
<systemColor name="systemBackgroundColor">
47+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
48+
</systemColor>
49+
</resources>
2450
</document>

CarPlayExample/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
</dict>
5959
<key>UIApplicationSupportsIndirectInputEvents</key>
6060
<true/>
61+
<key>UIBackgroundModes</key>
62+
<array>
63+
<string>audio</string>
64+
</array>
6165
<key>UILaunchStoryboardName</key>
6266
<string>LaunchScreen</string>
6367
<key>UIMainStoryboardFile</key>

0 commit comments

Comments
 (0)