diff --git a/Armchair.podspec b/Armchair.podspec index 19d7d0a..d4d6402 100644 --- a/Armchair.podspec +++ b/Armchair.podspec @@ -28,7 +28,5 @@ Pod::Spec.new do |s| s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.10' s.requires_arc = true - - end diff --git a/Armchair.xcodeproj/project.pbxproj b/Armchair.xcodeproj/project.pbxproj index 0180ac0..97bbe9b 100644 --- a/Armchair.xcodeproj/project.pbxproj +++ b/Armchair.xcodeproj/project.pbxproj @@ -725,7 +725,6 @@ SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; - }; name = Debug; }; @@ -747,7 +746,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = ""; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/Source/Armchair.swift b/Source/Armchair.swift index 2ca2ded..e3e454b 100644 --- a/Source/Armchair.swift +++ b/Source/Armchair.swift @@ -69,6 +69,18 @@ public func reviewTitle(_ reviewTitle: String) { Manager.defaultManager.reviewTitle = reviewTitle } +/* + * If set to true, use SKStoreReviewController's requestReview() prompt instead of the default prompt. + * If not on iOS 10.3+, reort to the default prompt. + * Default => false. + */ +public func useStoreKitReviewPrompt() -> Bool { + return Manager.defaultManager.useStoreKitReviewPrompt +} +public func useStoreKitReviewPrompt(_ useStoreKitReviewPrompt: Bool) { + Manager.defaultManager.useStoreKitReviewPrompt = useStoreKitReviewPrompt +} + /* * Get/Set the message to use on the review prompt. * Default value is a localized @@ -869,6 +881,7 @@ open class Manager : ArmchairManager { fileprivate var tintColor: UIColor? = nil fileprivate lazy var usesAlertController: Bool = self.defaultUsesAlertController() fileprivate lazy var opensInStoreKit: Bool = self.defaultOpensInStoreKit() + fileprivate var useStoreKitReviewPrompt: Bool = false fileprivate func defaultOpensInStoreKit() -> Bool { return operatingSystemVersion >= 8 @@ -1198,7 +1211,7 @@ open class Manager : ArmchairManager { } } else { #if os(iOS) - /* 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: { (alert: UIAlertAction!) in @@ -1218,7 +1231,10 @@ open class Manager : ArmchairManager { // get the top most controller (= the StoreKit Controller) and dismiss it if let presentingController = UIApplication.shared.keyWindow?.rootViewController { if let topController = topMostViewController(presentingController) { - topController.present(alertView, animated: usesAnimation) { + topController.present(alertView, animated: usesAnimation) { [weak self] _ in + if let closure = self?.didDisplayAlertClosure { + closure() + } print("presentViewController() completed") } }