Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoia Pribytkova <niakris90@gmail.com>2019-07-31 18:08:15 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2019-07-31 18:12:26 +0300
commit0a3e6add76099a6f8d6f0556b7b51e397eb586de (patch)
treeefb68d634412da970fb30d9adf7ada0234fbb850
parent296339bfb15e640162646ffa6db5524d377ba6b3 (diff)
[iOS][CarPlay] fixed CPAlertTemplate crash. Only one template at the time can be presentedios-release-9110release-91
-rw-r--r--iphone/Maps/Classes/CarPlay/CarPlayService.swift16
1 files changed, 10 insertions, 6 deletions
diff --git a/iphone/Maps/Classes/CarPlay/CarPlayService.swift b/iphone/Maps/Classes/CarPlay/CarPlayService.swift
index c057886a03..a6c6d8f26d 100644
--- a/iphone/Maps/Classes/CarPlay/CarPlayService.swift
+++ b/iphone/Maps/Classes/CarPlay/CarPlayService.swift
@@ -143,6 +143,11 @@ final class CarPlayService: NSObject {
interfaceController?.popTemplate(animated: animated)
}
+ func presentAlert(_ template: CPAlertTemplate, animated: Bool) {
+ interfaceController?.dismissTemplate(animated: false)
+ interfaceController?.presentTemplate(template, animated: animated)
+ }
+
func cancelCurrentTrip() {
router?.cancelTrip()
if let carplayVC = carplayVC {
@@ -220,8 +225,7 @@ final class CarPlayService: NSObject {
}
let alert = CPAlertTemplate(titleVariants: [L("download_map_carplay")], actions: [])
alert.userInfo = [CPConstants.TemplateKey.alert: CPConstants.TemplateType.downloadMap]
- interfaceController?.dismissTemplate(animated: true)
- interfaceController?.presentTemplate(alert, animated: true)
+ presentAlert(alert, animated: true)
}
@objc func hideNoMapAlert() {
@@ -645,7 +649,7 @@ extension CarPlayService {
})
let alert = CPAlertTemplate(titleVariants: [L("redirect_route_alert")], actions: [noAction, yesAction])
alert.userInfo = [CPConstants.TemplateKey.alert: CPConstants.TemplateType.redirectRoute]
- interfaceController?.presentTemplate(alert, animated: true)
+ presentAlert(alert, animated: true)
}
func showKeyboardAlert() {
@@ -653,7 +657,7 @@ extension CarPlayService {
self.interfaceController?.dismissTemplate(animated: true)
})
let alert = CPAlertTemplate(titleVariants: [L("keyboard_availability_alert")], actions: [okAction])
- interfaceController?.presentTemplate(alert, animated: true)
+ presentAlert(alert, animated: true)
}
func showErrorAlert(code: RouterResultCode, countries: [String]) {
@@ -689,7 +693,7 @@ extension CarPlayService {
self.interfaceController?.dismissTemplate(animated: true)
})
let alert = CPAlertTemplate(titleVariants: titleVariants, actions: [okAction])
- interfaceController?.presentTemplate(alert, animated: true)
+ presentAlert(alert, animated: true)
}
func showRecoverRouteAlert(trip: CPTrip, isTypeCorrect: Bool) {
@@ -713,6 +717,6 @@ extension CarPlayService {
let title = isTypeCorrect ? L("dialog_routing_rebuild_from_current_location_carplay") : L("dialog_routing_rebuild_for_vehicle_carplay")
let alert = CPAlertTemplate(titleVariants: [title], actions: [noAction, yesAction])
alert.userInfo = [CPConstants.TemplateKey.alert: CPConstants.TemplateType.restoreRoute]
- interfaceController?.presentTemplate(alert, animated: true)
+ presentAlert(alert, animated: true)
}
}