summaryrefslogtreecommitdiff
path: root/Example Apps/Example Swift
diff options
context:
space:
mode:
authorJustin Beharry <justin.beharry@livio.io>2022-07-28 16:50:06 -0400
committerJustin Beharry <justin.beharry@livio.io>2022-07-28 16:50:06 -0400
commit6da2aae218f6d5798f8c908086ad2f888063b2a9 (patch)
tree3f89ccb3893358270ad4b343cd47b4f495837c13 /Example Apps/Example Swift
parent7324ff60ac0e7174c9a372e12804d6c9072b7bc9 (diff)
downloadsdl_ios-6da2aae218f6d5798f8c908086ad2f888063b2a9.tar.gz
Create remote control climate example
Add new menu item and toggle AC on or off
Diffstat (limited to 'Example Apps/Example Swift')
-rw-r--r--Example Apps/Example Swift/MenuManager.swift39
-rw-r--r--Example Apps/Example Swift/ProxyManager.swift1
2 files changed, 39 insertions, 1 deletions
diff --git a/Example Apps/Example Swift/MenuManager.swift b/Example Apps/Example Swift/MenuManager.swift
index 092670559..607ae8f21 100644
--- a/Example Apps/Example Swift/MenuManager.swift
+++ b/Example Apps/Example Swift/MenuManager.swift
@@ -24,7 +24,8 @@ class MenuManager: NSObject {
menuCellRecordInCarMicrophoneAudio(with: manager),
menuCellDialNumber(with: manager),
menuCellChangeTemplate(with: manager),
- menuCellWithSubmenu(with: manager)]
+ menuCellWithSubmenu(with: manager),
+ menuCellRemoteControl(with: manager)]
}
/// Creates and returns the voice commands. The voice commands are menu items that are selected using the voice recognition system.
@@ -206,6 +207,42 @@ private extension MenuManager {
})
})
}
+
+ /// Menu item that shows remote control example
+ ///
+ /// - Parameter manager: The SDL Manager
+ /// - Returns: A SDLMenuCell object
+ class func menuCellRemoteControl(with manager: SDLManager) -> SDLMenuCell {
+
+ /// Lets give an example of 2 templates
+ var submenuItems = [SDLMenuCell]()
+ let errorMessage = "Changing the template failed"
+
+ /// Non-Media
+ let submenuTitleNonMedia = "Climate Control"
+ submenuItems.append(SDLMenuCell(title: submenuTitleNonMedia, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, voiceCommands: nil, handler: { (triggerSource) in
+ manager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .nonMedia)) { err in
+ if err != nil {
+ AlertManager.sendAlert(textField1: errorMessage, sdlManager: manager)
+ return
+ }
+ let remoteControlManager = RemoteControlManager(sdlManager: manager)
+ }
+ }))
+
+ /// Graphic with Text
+ let submenuTitleGraphicText = "Radio Control"
+ submenuItems.append(SDLMenuCell(title: submenuTitleGraphicText, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, voiceCommands: nil, handler: { (triggerSource) in
+ manager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .graphicWithText)) { err in
+ if err != nil {
+ AlertManager.sendAlert(textField1: errorMessage, sdlManager: manager)
+ return
+ }
+ }
+ }))
+
+ return SDLMenuCell(title: "Remote Control", secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, submenuLayout: .list, subCells: submenuItems)
+ }
}
// MARK: - Menu Voice Commands
diff --git a/Example Apps/Example Swift/ProxyManager.swift b/Example Apps/Example Swift/ProxyManager.swift
index efd364784..e28b4dabc 100644
--- a/Example Apps/Example Swift/ProxyManager.swift
+++ b/Example Apps/Example Swift/ProxyManager.swift
@@ -94,6 +94,7 @@ private extension ProxyManager {
let appIcon = UIImage(named: ExampleAppLogoName)?.withRenderingMode(.alwaysOriginal)
lifecycleConfiguration.appIcon = appIcon != nil ? SDLArtwork(image: appIcon!, persistent: true, as: .PNG) : nil
lifecycleConfiguration.appType = .default
+ lifecycleConfiguration.additionalAppTypes = [.remoteControl]
lifecycleConfiguration.language = .enUs
lifecycleConfiguration.languagesSupported = [.enUs, .esMx, .frCa]
lifecycleConfiguration.ttsName = [SDLTTSChunk(text: "S D L", type: .text)]