summaryrefslogtreecommitdiff
path: root/Example Apps/Example Swift
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-10-30 10:55:47 -0400
committerGitHub <noreply@github.com>2019-10-30 10:55:47 -0400
commit8ee188990f23421d76437194dde386a14a2f5986 (patch)
tree07b37557098ee608cde094e8700546ba34ed5b69 /Example Apps/Example Swift
parent734db0c69305f5d7cf8b0884a607e7b421be9085 (diff)
parenta32c89af9ef31c552e875fbe4e4bbadc0cc43d85 (diff)
downloadsdl_ios-8ee188990f23421d76437194dde386a14a2f5986.tar.gz
Merge pull request #1343 from smartdevicelink/develop6.4.0
v6.4.0 Release
Diffstat (limited to 'Example Apps/Example Swift')
-rw-r--r--Example Apps/Example Swift/AlertManager.swift19
-rw-r--r--Example Apps/Example Swift/ButtonManager.swift6
-rw-r--r--Example Apps/Example Swift/ConnectionIAPTableViewController.storyboard15
-rw-r--r--Example Apps/Example Swift/ConnectionTCPTableViewController.storyboard23
-rw-r--r--Example Apps/Example Swift/Main.storyboard16
-rw-r--r--Example Apps/Example Swift/MenuManager.swift36
-rw-r--r--Example Apps/Example Swift/PerformInteractionManager.swift26
-rw-r--r--Example Apps/Example Swift/ProxyManager.swift21
-rw-r--r--Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist2
-rw-r--r--Example Apps/Example Swift/VehicleDataManager.swift2
10 files changed, 93 insertions, 73 deletions
diff --git a/Example Apps/Example Swift/AlertManager.swift b/Example Apps/Example Swift/AlertManager.swift
index c463e7d36..718210777 100644
--- a/Example Apps/Example Swift/AlertManager.swift
+++ b/Example Apps/Example Swift/AlertManager.swift
@@ -11,26 +11,17 @@ import SmartDeviceLink
class AlertManager {
private class var okSoftButton: SDLSoftButton {
- return SDLSoftButton(type: .text, text: "OK", image: nil, highlighted: true, buttonId: 1, systemAction: nil, handler: nil)
+ return SDLSoftButton(type: .text, text: AlertOKButtonText, image: nil, highlighted: true, buttonId: 1, systemAction: nil, handler: nil)
}
- /// Creates an alert with one or two lines of text.
+ /// Creates an alert with up to two lines of text, an image, and a close button that will dismiss the alert when tapped.
///
/// - Parameters:
/// - textField1: The first line of a message to display in the alert
/// - textField2: The second line of a message to display in the alert
+ /// - iconName: The name of the uploaded icon artwork
/// - Returns: An SDLAlert object
- class func alertWithMessage(_ textField1: String, textField2: String? = nil) -> SDLAlert {
- return SDLAlert(alertText1: textField1, alertText2: nil, alertText3: nil)
- }
-
- /// Creates an alert with up to two lines of text and a close button that will dismiss the alert when tapped
- ///
- /// - Parameters:
- /// - textField1: The first line of a message to display in the alert
- /// - textField2: The second line of a message to display in the alert
- /// - Returns: An SDLAlert object
- class func alertWithMessageAndCloseButton(_ textField1: String, textField2: String? = nil) -> SDLAlert {
- return SDLAlert(alertText1: textField1, alertText2: textField2, alertText3: nil, duration: 5000, softButtons: [AlertManager.okSoftButton])
+ class func alertWithMessageAndCloseButton(_ textField1: String, textField2: String? = nil, iconName: String? = nil) -> SDLAlert {
+ return SDLAlert(alertText1: textField1, alertText2: textField2, alertText3: nil, softButtons: [okSoftButton], playTone: true, ttsChunks: nil, duration: 5000, progressIndicator: false, alertIcon: (iconName != nil) ? SDLImage(name: iconName!, isTemplate: true) : nil, cancelID: 0)
}
}
diff --git a/Example Apps/Example Swift/ButtonManager.swift b/Example Apps/Example Swift/ButtonManager.swift
index 2a7b7ccf7..e0953accc 100644
--- a/Example Apps/Example Swift/ButtonManager.swift
+++ b/Example Apps/Example Swift/ButtonManager.swift
@@ -70,8 +70,10 @@ private extension ButtonManager {
let textSoftButtonState = SDLSoftButtonState(stateName: AlertSoftButtonTextState, text: AlertSoftButtonText, image: nil)
return SDLSoftButtonObject(name: AlertSoftButton, states: [imageSoftButtonState, textSoftButtonState], initialStateName: imageSoftButtonState.name) { (buttonPress, buttonEvent) in
guard buttonPress != nil else { return }
- let alert = AlertManager.alertWithMessageAndCloseButton("You pressed the button!")
- manager.send(alert)
+ manager.fileManager.upload(artwork: SDLArtwork(image: UIImage(named: CarBWIconImageName)!, persistent: false, as: .PNG), completionHandler: { (success, artworkName, bytesAvailable, err) in
+ let alert = AlertManager.alertWithMessageAndCloseButton("You pressed the button!", iconName: artworkName)
+ manager.send(alert)
+ })
}
}
diff --git a/Example Apps/Example Swift/ConnectionIAPTableViewController.storyboard b/Example Apps/Example Swift/ConnectionIAPTableViewController.storyboard
index 44ec1e58b..736ebf493 100644
--- a/Example Apps/Example Swift/ConnectionIAPTableViewController.storyboard
+++ b/Example Apps/Example Swift/ConnectionIAPTableViewController.storyboard
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="J12-ul-Tx1">
- <device id="retina4_7" orientation="portrait">
- <adaptation id="fullscreen"/>
- </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="J12-ul-Tx1">
+ <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
- <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -17,15 +14,15 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="MzB-GZ-Ook">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection id="Qz3-D9-j37">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2sd-U1-9xV">
- <rect key="frame" x="0.0" y="35" width="375" height="44"/>
+ <rect key="frame" x="0.0" y="10" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2sd-U1-9xV" id="EhZ-2E-WQ5">
- <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rjq-vZ-OjB">
diff --git a/Example Apps/Example Swift/ConnectionTCPTableViewController.storyboard b/Example Apps/Example Swift/ConnectionTCPTableViewController.storyboard
index ff8be7363..6cf589b73 100644
--- a/Example Apps/Example Swift/ConnectionTCPTableViewController.storyboard
+++ b/Example Apps/Example Swift/ConnectionTCPTableViewController.storyboard
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="l5Q-ZP-1BO">
- <device id="retina4_7" orientation="portrait">
- <adaptation id="fullscreen"/>
- </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="l5Q-ZP-1BO">
+ <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
- <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -17,7 +14,7 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="7ZH-AV-Zyf">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection headerTitle="TCP Server" id="bF6-yi-Ial">
<cells>
@@ -25,7 +22,7 @@
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pbJ-oz-jNt" id="B7X-yY-lwJ">
- <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="IP Address" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xqM-s4-9RV">
@@ -43,12 +40,13 @@
<constraint firstItem="xqM-s4-9RV" firstAttribute="leading" secondItem="B7X-yY-lwJ" secondAttribute="leadingMargin" id="pBt-SK-tuZ"/>
</constraints>
</tableViewCellContentView>
+ <color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="C5b-fS-v3d">
<rect key="frame" x="0.0" y="99.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="C5b-fS-v3d" id="ZD4-xA-og5">
- <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Port" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hsI-ld-8xY">
@@ -66,20 +64,21 @@
<constraint firstItem="hsI-ld-8xY" firstAttribute="trailing" secondItem="ZD4-xA-og5" secondAttribute="trailingMargin" id="wXl-bK-7vU"/>
</constraints>
</tableViewCellContentView>
+ <color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="" id="rgl-Lm-uDH">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="ybX-Eh-Hbx">
- <rect key="frame" x="0.0" y="163.5" width="375" height="44"/>
+ <rect key="frame" x="0.0" y="175.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ybX-Eh-Hbx" id="uI9-fK-205">
- <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t37-4W-6F4">
- <rect key="frame" x="16" y="0.0" width="343" height="43"/>
+ <rect key="frame" x="16" y="0.0" width="343" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="23"/>
<state key="normal" title="Connect">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
diff --git a/Example Apps/Example Swift/Main.storyboard b/Example Apps/Example Swift/Main.storyboard
index 7415d792f..3adca9d22 100644
--- a/Example Apps/Example Swift/Main.storyboard
+++ b/Example Apps/Example Swift/Main.storyboard
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="mM3-m6-I5t">
- <device id="retina4_7" orientation="portrait">
- <adaptation id="fullscreen"/>
- </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="mM3-m6-I5t">
+ <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -15,7 +13,7 @@
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="mM3-m6-I5t" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="eMh-g9-C8T">
- <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+ <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
@@ -38,12 +36,12 @@
<view key="view" contentMode="scaleToFill" id="jkb-9Y-Hwh">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="t1a-s2-nn6">
<nil key="title"/>
- <segmentedControl key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="RYa-fE-Qek">
- <rect key="frame" x="67.5" y="7" width="240" height="30"/>
+ <segmentedControl key="titleView" opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="RYa-fE-Qek">
+ <rect key="frame" x="67.5" y="6" width="240" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="TCP Debug"/>
diff --git a/Example Apps/Example Swift/MenuManager.swift b/Example Apps/Example Swift/MenuManager.swift
index c5171510d..e014fa44b 100644
--- a/Example Apps/Example Swift/MenuManager.swift
+++ b/Example Apps/Example Swift/MenuManager.swift
@@ -19,6 +19,8 @@ class MenuManager: NSObject {
return [menuCellSpeakName(with: manager),
menuCellGetAllVehicleData(with: manager),
menuCellShowPerformInteraction(with: manager, choiceSetManager: choiceSetManager),
+ sliderMenuCell(with: manager),
+ scrollableMessageMenuCell(with: manager),
menuCellRecordInCarMicrophoneAudio(with: manager),
menuCellDialNumber(with: manager),
menuCellChangeTemplate(with: manager),
@@ -65,7 +67,7 @@ private extension MenuManager {
})
}
- return SDLMenuCell(title: ACGetAllVehicleDataMenuName, icon: SDLArtwork(image: UIImage(named: CarBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), subCells: submenuItems)
+ return SDLMenuCell(title: ACGetAllVehicleDataMenuName, icon: SDLArtwork(image: UIImage(named: CarBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), submenuLayout: .tiles, subCells: submenuItems)
}
/// A list of all possible vehicle data types
@@ -130,7 +132,7 @@ private extension MenuManager {
submenuItems.append(SDLMenuCell(title: submenuTitleNonMedia, icon: nil, voiceCommands: nil, handler: { (triggerSource) in
let display = SDLSetDisplayLayout(predefinedLayout: .nonMedia)
manager.send(request: display) { (request, response, error) in
- guard response?.resultCode == .success else {
+ guard response?.success.boolValue == .some(true) else {
manager.send(AlertManager.alertWithMessageAndCloseButton(errorMessage))
return
}
@@ -142,14 +144,14 @@ private extension MenuManager {
submenuItems.append(SDLMenuCell(title: submenuTitleGraphicText, icon: nil, voiceCommands: nil, handler: { (triggerSource) in
let display = SDLSetDisplayLayout(predefinedLayout: .graphicWithText)
manager.send(request: display) { (request, response, error) in
- guard response?.resultCode == .success else {
+ guard response?.success.boolValue == .some(true) else {
manager.send(AlertManager.alertWithMessageAndCloseButton(errorMessage))
return
}
}
}))
- return SDLMenuCell(title: ACSubmenuTemplateMenuName, icon: nil, subCells: submenuItems)
+ return SDLMenuCell(title: ACSubmenuTemplateMenuName, icon: nil, submenuLayout: .list, subCells: submenuItems)
}
/// Menu item that opens a submenu when selected
@@ -172,7 +174,31 @@ private extension MenuManager {
}))
}
- return SDLMenuCell(title: ACSubmenuMenuName, icon: SDLArtwork(image: #imageLiteral(resourceName: "choice_set").withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), subCells: submenuItems)
+ return SDLMenuCell(title: ACSubmenuMenuName, icon: SDLArtwork(image: #imageLiteral(resourceName: "choice_set").withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), submenuLayout: .list, subCells: submenuItems)
+ }
+
+ private class func sliderMenuCell(with manager: SDLManager) -> SDLMenuCell {
+ return SDLMenuCell(title: ACSliderMenuName, icon: nil, voiceCommands: [ACSliderMenuName], handler: { _ in
+ let slider = SDLSlider(numTicks: 3, position: 1, sliderHeader: "Select a letter", sliderFooters: ["A", "B", "C"], timeout: 3000)
+ manager.send(request: slider, responseHandler: { (request, response, error) in
+ guard let response = response, response.resultCode == .success else {
+ manager.send(AlertManager.alertWithMessageAndCloseButton("Slider could not be displayed"))
+ return
+ }
+ })
+ })
+ }
+
+ private class func scrollableMessageMenuCell(with manager: SDLManager) -> SDLMenuCell {
+ return SDLMenuCell(title: ACScrollableMessageMenuName, icon: nil, voiceCommands: [ACScrollableMessageMenuName], handler: { _ in
+ let scrollableMessage = SDLScrollableMessage(message: "This is a scrollable message\nIt can contain many lines")
+ manager.send(request: scrollableMessage, responseHandler: { (request, response, error) in
+ guard let response = response, response.resultCode == .success else {
+ manager.send(AlertManager.alertWithMessageAndCloseButton("Scrollable could not be displayed"))
+ return
+ }
+ })
+ })
}
}
diff --git a/Example Apps/Example Swift/PerformInteractionManager.swift b/Example Apps/Example Swift/PerformInteractionManager.swift
index 13e26e7fe..793f6526c 100644
--- a/Example Apps/Example Swift/PerformInteractionManager.swift
+++ b/Example Apps/Example Swift/PerformInteractionManager.swift
@@ -30,15 +30,23 @@ class PerformInteractionManager: NSObject {
private extension PerformInteractionManager {
/// The PICS menu items
var choiceCells: [SDLChoiceCell] {
- let firstChoice = SDLChoiceCell(text: PICSFirstChoice, artwork: SDLArtwork(staticIcon: .key), voiceCommands: nil)
- let secondChoice = SDLChoiceCell(text: PICSSecondChoice)
- let thirdChoice = SDLChoiceCell(text: PICSThirdChoice)
+ let firstChoice = SDLChoiceCell(text: PICSFirstChoice, artwork: SDLArtwork(staticIcon: .key), voiceCommands: [VCPICSFirstChoice])
+ let secondChoice = SDLChoiceCell(text: PICSSecondChoice, artwork: SDLArtwork(staticIcon: .microphone), voiceCommands: [VCPICSecondChoice])
+ let thirdChoice = SDLChoiceCell(text: PICSThirdChoice, artwork: SDLArtwork(staticIcon: .key), voiceCommands: [VCPICSThirdChoice])
return [firstChoice, secondChoice, thirdChoice]
}
+ var vrHelpList: [SDLVRHelpItem] {
+ let vrHelpListFirst = SDLVRHelpItem(text: VCPICSFirstChoice, image: nil)
+ let vrHelpListSecond = SDLVRHelpItem(text: VCPICSecondChoice, image: nil)
+ let vrHelpListThird = SDLVRHelpItem(text: VCPICSThirdChoice, image: nil)
+
+ return [vrHelpListFirst, vrHelpListSecond, vrHelpListThird]
+ }
+
/// Creates a PICS with three menu items and customized voice commands
var choiceSet: SDLChoiceSet {
- return SDLChoiceSet(title: PICSInitialPrompt, delegate: self, layout: .list, timeout: 10, initialPromptString: PICSInitialPrompt, timeoutPromptString: PICSTimeoutPrompt, helpPromptString: PICSHelpPrompt, vrHelpList: nil, choices: choiceCells)
+ return SDLChoiceSet(title: PICSInitialPrompt, delegate: self, layout: .list, timeout: 10, initialPromptString: PICSInitialPrompt, timeoutPromptString: PICSTimeoutPrompt, helpPromptString: PICSHelpPrompt, vrHelpList: vrHelpList, choices: choiceCells)
}
func interactionMode(for triggerSource: SDLTriggerSource) -> SDLInteractionMode {
@@ -77,15 +85,15 @@ extension PerformInteractionManager: SDLKeyboardDelegate {
}
}
- func updateAutocomplete(withInput currentInputText: String, completionHandler: @escaping SDLKeyboardAutocompleteCompletionHandler) {
+ func updateAutocomplete(withInput currentInputText: String, autoCompleteResultsHandler resultsHandler: @escaping SDLKeyboardAutoCompleteResultsHandler) {
if currentInputText.lowercased().hasPrefix("f") {
- completionHandler(PICSFirstChoice)
+ resultsHandler([PICSFirstChoice])
} else if currentInputText.lowercased().hasPrefix("s") {
- completionHandler(PICSSecondChoice)
+ resultsHandler([PICSSecondChoice])
} else if currentInputText.lowercased().hasPrefix("t") {
- completionHandler(PICSThirdChoice)
+ resultsHandler([PICSThirdChoice])
} else {
- completionHandler(nil)
+ resultsHandler(nil)
}
}
}
diff --git a/Example Apps/Example Swift/ProxyManager.swift b/Example Apps/Example Swift/ProxyManager.swift
index 40a703e4a..ac3913955 100644
--- a/Example Apps/Example Swift/ProxyManager.swift
+++ b/Example Apps/Example Swift/ProxyManager.swift
@@ -266,20 +266,19 @@ private extension ProxyManager {
screenManager.beginUpdates()
screenManager.textAlignment = .left
+ screenManager.title = isTextVisible ? "Home" : nil
screenManager.textField1 = isTextVisible ? SmartDeviceLinkText : nil
screenManager.textField2 = isTextVisible ? "Swift \(ExampleAppText)" : nil
screenManager.textField3 = isTextVisible ? vehicleDataManager.vehicleOdometerData : nil
- if sdlManager.systemCapabilityManager.displayCapabilities?.graphicSupported.boolValue ?? false {
- // Primary graphic
- if imageFieldSupported(imageFieldName: .graphic) {
- screenManager.primaryGraphic = areImagesVisible ? SDLArtwork(image: UIImage(named: ExampleAppLogoName)!.withRenderingMode(.alwaysOriginal), persistent: false, as: .PNG) : nil
- }
-
- // Secondary graphic
- if imageFieldSupported(imageFieldName: .secondaryGraphic) {
- screenManager.secondaryGraphic = areImagesVisible ? SDLArtwork(image: UIImage(named: CarBWIconImageName)!, persistent: false, as: .PNG) : nil
- }
+ // Primary graphic
+ if imageFieldSupported(imageFieldName: .graphic) {
+ screenManager.primaryGraphic = areImagesVisible ? SDLArtwork(image: UIImage(named: ExampleAppLogoName)!.withRenderingMode(.alwaysOriginal), persistent: false, as: .PNG) : nil
+ }
+
+ // Secondary graphic
+ if imageFieldSupported(imageFieldName: .secondaryGraphic) {
+ screenManager.secondaryGraphic = areImagesVisible ? SDLArtwork(image: UIImage(named: CarBWIconImageName)!, persistent: false, as: .PNG) : nil
}
screenManager.endUpdates(completionHandler: { (error) in
@@ -304,6 +303,6 @@ private extension ProxyManager {
/// - Parameter imageFieldName: The name for the image field
/// - Returns: True if the image field is supported, false if not
func imageFieldSupported(imageFieldName: SDLImageFieldName) -> Bool {
- return sdlManager.systemCapabilityManager.displayCapabilities?.imageFields?.first { $0.name == imageFieldName } != nil ? true : false
+ return sdlManager.systemCapabilityManager.defaultMainWindowCapability?.imageFields?.first { $0.name == imageFieldName } != nil ? true : false
}
}
diff --git a/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist b/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
index 34a7b097a..9b5e3074e 100644
--- a/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
+++ b/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>6.3.1</string>
+ <string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
diff --git a/Example Apps/Example Swift/VehicleDataManager.swift b/Example Apps/Example Swift/VehicleDataManager.swift
index 1d78edd42..34ac4352c 100644
--- a/Example Apps/Example Swift/VehicleDataManager.swift
+++ b/Example Apps/Example Swift/VehicleDataManager.swift
@@ -111,7 +111,7 @@ extension VehicleDataManager {
guard hasPermissionToAccessVehicleData(with: manager) else { return }
SDLLog.d("App has permission to access vehicle data. Requesting all vehicle data...")
- let getAllVehicleData = SDLGetVehicleData(accelerationPedalPosition: true, airbagStatus: true, beltStatus: true, bodyInformation: true, clusterModeStatus: true, deviceStatus: true, driverBraking: true, eCallInfo: true, electronicParkBrakeStatus: true, emergencyEvent: true, engineOilLife: true, engineTorque: true, externalTemperature: true, fuelLevel: true, fuelLevelState: true, fuelRange: true, gps: true, headLampStatus: true, instantFuelConsumption: true, myKey: true, odometer: true, prndl: true, rpm: true, speed: true, steeringWheelAngle: true, tirePressure: true, turnSignal: true, vin: true, wiperStatus: true)
+ let getAllVehicleData = SDLGetVehicleData(accelerationPedalPosition: true, airbagStatus: true, beltStatus: true, bodyInformation: true, cloudAppVehicleID: true, clusterModeStatus: true, deviceStatus: true, driverBraking: true, eCallInfo: true, electronicParkBrakeStatus: true, emergencyEvent: true, engineOilLife: true, engineTorque: true, externalTemperature: true, fuelLevel: true, fuelLevelState: true, fuelRange: true, gps: true, headLampStatus: true, instantFuelConsumption: true, myKey: true, odometer: true, prndl: true, rpm: true, speed: true, steeringWheelAngle: true, tirePressure: true, turnSignal: true, vin: true, wiperStatus: true)
manager.send(request: getAllVehicleData) { (request, response, error) in
guard didAccessVehicleDataSuccessfully(with: manager, response: response, error: error) else { return }