From 44b930169cbb069ac9e44434fa66283205c222c7 Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Tue, 24 Jul 2018 10:28:57 +0200 Subject: [PATCH 1/3] changed ordering and make use of cancel action --- Source/Armchair.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Armchair.swift b/Source/Armchair.swift index 6d918a9..063c76f 100644 --- a/Source/Armchair.swift +++ b/Source/Armchair.swift @@ -1262,9 +1262,9 @@ open class Manager : ArmchairManager { } else { /// Didn't show storekit prompt, present app store manually let alertView : UIAlertController = UIAlertController(title: reviewTitle, message: reviewMessage, preferredStyle: UIAlertControllerStyle.alert) - alertView.addAction(UIAlertAction(title: cancelButtonTitle, style:UIAlertActionStyle.default, handler: { + alertView.addAction(UIAlertAction(title: rateButtonTitle, style:UIAlertActionStyle.cancel, handler: { (alert: UIAlertAction!) in - self.dontRate() + self._rateApp() })) if (showsRemindButton()) { alertView.addAction(UIAlertAction(title: remindButtonTitle!, style:UIAlertActionStyle.default, handler: { @@ -1272,9 +1272,9 @@ open class Manager : ArmchairManager { self.remindMeLater() })) } - alertView.addAction(UIAlertAction(title: rateButtonTitle, style:UIAlertActionStyle.cancel, handler: { + alertView.addAction(UIAlertAction(title: cancelButtonTitle, style:UIAlertActionStyle.cancel, handler: { (alert: UIAlertAction!) in - self._rateApp() + self.dontRate() })) ratingAlert = alertView From d5ba63a0a4284c95e4f175fd7c395761cfee1548 Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Tue, 24 Jul 2018 10:38:09 +0200 Subject: [PATCH 2/3] removed duplicate cancel action --- Source/Armchair.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Armchair.swift b/Source/Armchair.swift index 063c76f..5d71818 100644 --- a/Source/Armchair.swift +++ b/Source/Armchair.swift @@ -1262,7 +1262,7 @@ open class Manager : ArmchairManager { } else { /// Didn't show storekit prompt, present app store manually let alertView : UIAlertController = UIAlertController(title: reviewTitle, message: reviewMessage, preferredStyle: UIAlertControllerStyle.alert) - alertView.addAction(UIAlertAction(title: rateButtonTitle, style:UIAlertActionStyle.cancel, handler: { + alertView.addAction(UIAlertAction(title: rateButtonTitle, style:UIAlertActionStyle.default, handler: { (alert: UIAlertAction!) in self._rateApp() })) From 94817f1715c41cfeb571a1524986eafad5fd8454 Mon Sep 17 00:00:00 2001 From: BiNo Date: Tue, 18 Sep 2018 14:05:52 +0200 Subject: [PATCH 3/3] swift 4.2 fix --- .swift-version | 2 +- Source/Armchair.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.swift-version b/.swift-version index 5186d07..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +4.2 diff --git a/Source/Armchair.swift b/Source/Armchair.swift index 5bc0294..ee5491d 100644 --- a/Source/Armchair.swift +++ b/Source/Armchair.swift @@ -1261,18 +1261,18 @@ open class Manager : ArmchairManager { } else { /// Didn't show storekit prompt, present app store manually - let alertView : UIAlertController = UIAlertController(title: reviewTitle, message: reviewMessage, preferredStyle: UIAlertControllerStyle.alert) - alertView.addAction(UIAlertAction(title: rateButtonTitle, style:UIAlertActionStyle.default, handler: { + let alertView : UIAlertController = UIAlertController(title: reviewTitle, message: reviewMessage, preferredStyle: .alert) + alertView.addAction(UIAlertAction(title: rateButtonTitle, style: .default, handler: { (alert: UIAlertAction!) in self._rateApp() })) if (showsRemindButton()) { - alertView.addAction(UIAlertAction(title: remindButtonTitle!, style:UIAlertActionStyle.default, handler: { + alertView.addAction(UIAlertAction(title: remindButtonTitle!, style: .default, handler: { (alert: UIAlertAction!) in self.remindMeLater() })) } - alertView.addAction(UIAlertAction(title: cancelButtonTitle, style:UIAlertActionStyle.cancel, handler: { + alertView.addAction(UIAlertAction(title: cancelButtonTitle, style: .cancel, handler: { (alert: UIAlertAction!) in self.dontRate() })) @@ -1724,11 +1724,11 @@ open class Manager : ArmchairManager { private static func getRootViewController() -> UIViewController? { if var window = UIApplication.shared.keyWindow { - if window.windowLevel != UIWindowLevelNormal { + if window.windowLevel != .normal { let windows: NSArray = UIApplication.shared.windows as NSArray for candidateWindow in windows { if let candidateWindow = candidateWindow as? UIWindow { - if candidateWindow.windowLevel == UIWindowLevelNormal { + if candidateWindow.windowLevel == .normal { window = candidateWindow break } @@ -1834,9 +1834,9 @@ open class Manager : ArmchairManager { fileprivate func setupNotifications() { #if os(iOS) - NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSNotification.Name.UIApplicationWillResignActive, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationDidFinishLaunching(_:)), name: NSNotification.Name.UIApplicationDidFinishLaunching, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationDidFinishLaunching(_:)), name: UIApplication.didFinishLaunchingNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationWillEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) #elseif os(OSX) NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSApplication.willResignActiveNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationDidFinishLaunching(_:)), name: NSApplication.didFinishLaunchingNotification, object: nil)