         return (daysBeforeReminding > 0 && remindButtonTitle != nil)
     }
     
+    public var shouldTryStoreKitReviewPrompt : Bool {
+        if #available(iOS 10.3, *), useStoreKitReviewPrompt { return true }
+        return false
+    }
+    
+    fileprivate func requestStoreKitReviewPrompt() -> Bool {
+        if #available(iOS 10.3, *), useStoreKitReviewPrompt {
+            SKStoreReviewController.requestReview()
+            // Assume this version is rated. There is no API to tell if the user actaully rated.
+            userDefaultsObject?.setBool(true, forKey: keyForArmchairKeyType(ArmchairKey.RatedCurrentVersion))
+            userDefaultsObject?.setBool(true, forKey: keyForArmchairKeyType(ArmchairKey.RatedAnyVersion))
+            userDefaultsObject?.synchronize()
+            
+            closeModalPanel()
+            return true
+        }
+        return false
+    }
+    
     fileprivate func showRatingAlert() {
         if let customClosure = customAlertClosure {
-            customClosure({[weak self] in self?._rateApp()}, {[weak self] in self?.remindMeLater()}, {[weak self] in self?.dontRate()})
+            customClosure({[weak self] in
+                if let result = self?.requestStoreKitReviewPrompt(), result {
+                    ///Showed storekit prompt, all done
+                } else {
+                    /// Didn't show storekit prompt, present app store manually
+                    self?._rateApp()
+                }
+
+            }, {[weak self] in self?.remindMeLater()}, {[weak self] in self?.dontRate()})
             if let closure = self.didDisplayAlertClosure {
                 closure()
             }
         } else {
             #if os(iOS)
-                if #available(iOS 10.3, *), useStoreKitReviewPrompt {
-                    SKStoreReviewController.requestReview()
-                    // Assume this version is rated. There is no API to tell if the user actaully rated.
-                    userDefaultsObject?.setBool(true, forKey: keyForArmchairKeyType(ArmchairKey.RatedCurrentVersion))
-                    userDefaultsObject?.setBool(true, forKey: keyForArmchairKeyType(ArmchairKey.RatedAnyVersion))
-                    userDefaultsObject?.synchronize()
-                    return
-                }
+                if requestStoreKitReviewPrompt() {
+                    ///Showed storekit prompt, all done
+                    
+                } 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.cancel, handler: {
                         (alert: UIAlertAction!) in

    #endif
    
    private func hideRatingAlert() {
        if let alert = ratingAlert {
            debugLog("Hiding Alert")
            #if os(iOS)
                if alert.isVisible {
                    alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: false)
                }
            #elseif os(OSX)
                if let window = NSApplication.shared().keyWindow {
                    if let parent = window.sheetParent {
                        parent.endSheet(window)
                    }
                }
                
            #else
            #endif
            ratingAlert = nil
        }
    }
    
    fileprivate func defaultAffiliateCode() -> String {

                        // note that tint color has to be set after the controller is presented in order to take effect (last checked in iOS 9.3)
                        alertView.view.tintColor = tintColor
                    }
                }
                
                    
                
                
