diff options
author | NicoleYarroch <nicole@livio.io> | 2020-11-25 10:09:14 -0500 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-11-25 10:09:14 -0500 |
commit | a20bf0b2c4ceebe62f642fb8a45e95075b6d2706 (patch) | |
tree | a85ad22e97f025823b8e2a95c11ea95fca3bca61 /Example Apps/Example Swift | |
parent | 84ae726ceae55a49a70a52133e8f0db1bf8c696a (diff) | |
download | sdl_ios-a20bf0b2c4ceebe62f642fb8a45e95075b6d2706.tar.gz |
Ex. apps now use the alert mng
Signed-off-by: NicoleYarroch <nicole@livio.io>
Diffstat (limited to 'Example Apps/Example Swift')
-rw-r--r-- | Example Apps/Example Swift/AlertManager.swift | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Example Apps/Example Swift/AlertManager.swift b/Example Apps/Example Swift/AlertManager.swift index 9e37dd1c5..df1fcd430 100644 --- a/Example Apps/Example Swift/AlertManager.swift +++ b/Example Apps/Example Swift/AlertManager.swift @@ -8,6 +8,7 @@ import Foundation import SmartDeviceLink +import SmartDeviceLinkSwift class AlertManager { /// Sends an alert with up to two lines of text, an image, and a close button that will dismiss the alert when tapped. @@ -17,18 +18,16 @@ class AlertManager { /// - textField2: The second line of text in the alert /// - sdlManager: The SDLManager class func sendAlert(imageName: String? = nil, textField1: String, textField2: String? = nil, sdlManager: SDLManager) { - let okSoftButton = SDLSoftButton(type: .text, text: AlertOKButtonText, image: nil, highlighted: true, buttonId: 1, systemAction: nil, handler: nil) - let alert = SDLAlert(alertText1: textField1, alertText2: textField2, alertText3: nil, softButtons: [okSoftButton], playTone: true, ttsChunks: nil, duration: 5000, progressIndicator: false, alertIcon: nil, cancelID: 0) - + let okSoftButton = SDLSoftButtonObject(name: AlertOKButtonText, text: AlertOKButtonText, artwork: nil, handler: nil) + let alert = SDLAlertView(text: textField1, buttons: [okSoftButton]) + alert.secondaryText = textField2 if let imageName = imageName { - sendImage(imageName, sdlManager: sdlManager) { (success, artworkName) in - if success { - alert.alertIcon = SDLImage(name: artworkName, isTemplate: true) - } - sdlManager.send(alert) + alert.icon = SDLArtwork(image: UIImage(named: imageName)!.withRenderingMode(.alwaysTemplate), persistent: false, as: .PNG) + } + sdlManager.screenManager.presentAlert(alert) { error in + if let error = error { + SDLLog.e("There was an error presenting the alert: \(error.localizedDescription)") } - } else { - sdlManager.send(alert) } } |