mirror of
https://github.com/UrbanApps/Armchair.git
synced 2026-04-20 07:51:27 +02:00
Merge remote-tracking branch 'UrbanApps/master'
# Conflicts: # Source/Armchair.swift
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user