Set the default value of useAlertController based off ios version and only use alert controllers if ios version is >= 9

This commit is contained in:
Daniel Bolella
2016-02-29 21:03:45 -05:00
parent be83189c67
commit 7e8b62a07e

View File

@@ -329,7 +329,7 @@ public func resetDefaults() {
#if os(iOS)
Manager.defaultManager.usesAnimation = true
Manager.defaultManager.usesAlertController = false
Manager.defaultManager.usesAlertController = Manager.defaultManager.defaultUsesAlertController()
Manager.defaultManager.opensInStoreKit = Manager.defaultManager.defaultOpensInStoreKit()
Manager.defaultManager.willPresentModalViewClosure = nil
Manager.defaultManager.didDismissModalViewClosure = nil
@@ -807,12 +807,15 @@ public class Manager : ArmchairManager {
#if os(iOS)
private var usesAnimation: Bool = true
private var usesAlertController: Bool = false
private lazy var usesAlertController: Bool = self.defaultUsesAlertController()
private lazy var opensInStoreKit: Bool = self.defaultOpensInStoreKit()
private func defaultOpensInStoreKit() -> Bool {
return operatingSystemVersion >= 8
}
private func defaultUsesAlertController() -> Bool {
return operatingSystemVersion >= 9
}
#endif
// MARK: Tracking Keys with sensible defaults
@@ -1136,7 +1139,7 @@ public class Manager : ArmchairManager {
private func showRatingAlert() {
#if os(iOS)
if operatingSystemVersion >= 8 && usesAlertController {
if (operatingSystemVersion >= 8 && usesAlertController) || operatingSystemVersion >= 9 {
/* iOS 8 uses new UIAlertController API*/
let alertView : UIAlertController = UIAlertController(title: reviewTitle, message: reviewMessage, preferredStyle: UIAlertControllerStyle.Alert)
alertView.addAction(UIAlertAction(title: cancelButtonTitle, style:UIAlertActionStyle.Cancel, handler: {