mirror of
https://github.com/UrbanApps/Armchair.git
synced 2026-01-15 08:03:39 +01:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ea2201dd3 | ||
|
|
fb6e2444be | ||
|
|
ddc5a0d7ea | ||
|
|
7f05ad9ef6 | ||
|
|
94817f1715 | ||
|
|
abeb3eb4b1 | ||
|
|
3d9c47bf60 | ||
|
|
fcd99c015a | ||
|
|
66fb9abb8d | ||
|
|
d5ba63a0a4 | ||
|
|
44b930169c | ||
|
|
f7ed2b2063 | ||
|
|
de6e53da44 | ||
|
|
ead9ec4656 | ||
|
|
ffd05b16a5 | ||
|
|
a8c1dfdae5 | ||
|
|
b3bd6ecc16 | ||
|
|
773c9c9ddd | ||
|
|
90ce675259 | ||
|
|
f53bf4637d | ||
|
|
804141486d | ||
|
|
86bb26031d | ||
|
|
74ae451630 | ||
|
|
c70e28dd42 | ||
|
|
04208a6f75 | ||
|
|
5c963bda6a | ||
|
|
04cb290dc1 | ||
|
|
adc0a0d580 | ||
|
|
dddaa62c25 | ||
|
|
ea3ab5ed28 | ||
|
|
068c4b92c1 |
@@ -1 +1 @@
|
||||
3.0
|
||||
4.2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "Armchair"
|
||||
s.version = "0.3.2"
|
||||
s.version = "0.3.6"
|
||||
s.summary = "A simple yet powerful App Review Manager for iOS and OSX in Swift"
|
||||
s.description = <<-DESC
|
||||
A simple yet powerful App Review Manager for iOS and OSX in Swift.
|
||||
@@ -28,5 +28,6 @@ Pod::Spec.new do |s|
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.requires_arc = true
|
||||
|
||||
s.swift_version = '4.2'
|
||||
|
||||
end
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = Armchair;
|
||||
TargetAttributes = {
|
||||
E6A0AF6419C9CFF400C3A7DC = {
|
||||
@@ -626,12 +626,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -685,12 +687,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,7 +26,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
@@ -56,7 +55,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,7 +26,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@@ -37,7 +36,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Cảm ơn bạn đã sử dụng ứng dụng %@ trong thời gian qua, bạn có thể dành chút thời gian để đánh giá ứng dụng trong AppStore không? Sẽ không mất quá 1 phút nhưng chúng tôi rất trân trọng điều đó!"
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Cảm ơn bạn đã sử dụng ứng dụng %@ trong thời gian qua, bạn có thể dành chút thời gian để đánh giá ứng dụng trong AppStore không? Sẽ không mất quá 1 phút nhưng chúng tôi rất trân trọng điều đó!";
|
||||
"Rate %@" = "Đánh giá %@";
|
||||
"No, Thanks" = "Không, xin cảm ơn";
|
||||
"Remind me later" = "Hãy nhắc nhở tôi sau";
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = Armchair;
|
||||
TargetAttributes = {
|
||||
E60FA7B919C908FE00179D70 = {
|
||||
@@ -289,12 +289,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -342,12 +344,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
|
||||
@@ -284,6 +284,14 @@ Armchair.shouldPromptIfRated() -> Bool
|
||||
Armchair.shouldPromptIfRated(shouldPromptIfRated: Bool)
|
||||
```
|
||||
|
||||
The `useStoreKitReviewPrompt` configuration determines wether or not to try showing the SKStoreReviewController's requestReview() prompt instead of the default prompt. This setting has some effects only on iOS version >= 10.3. It's default value is `false`.
|
||||
```swift
|
||||
// GETTER
|
||||
Armchair.useStoreKitReviewPrompt() -> Bool
|
||||
// SETTER
|
||||
Armchair.useStoreKitReviewPrompt(useStoreKitReviewPrompt: Bool)
|
||||
```
|
||||
|
||||
The `useMainAppBundleForLocalizations` configuration is a way to tell Armchair that you are providing your own translations for the review prompt popup strings. This may be because you are just customizing them, or that you have set your own text for the popup. If set to `true`, the main bundle will always be used to load localized strings. You have to include the translations either in a file called `ArmchairLocalizable.strings` or the standard `Localizable.strings`. If set to `false` Armchair will look in its own translation bundle for the translating strings. It's default value is `false`.
|
||||
|
||||
```swift
|
||||
|
||||
@@ -243,6 +243,13 @@ public func shouldPromptIfRated(_ shouldPromptIfRated: Bool) {
|
||||
Manager.defaultManager.shouldPromptIfRated = shouldPromptIfRated
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether Armchair will try and present the Storekit review prompt (useful for custom dialog modification)
|
||||
*/
|
||||
public var shouldTryStoreKitReviewPrompt : Bool {
|
||||
return Manager.defaultManager.shouldTryStoreKitReviewPrompt
|
||||
}
|
||||
|
||||
/*
|
||||
* If set to true, the main bundle will always be used to load localized strings.
|
||||
* Set this to true if you have provided your own custom localizations in
|
||||
@@ -710,7 +717,7 @@ public enum ArmchairKey: String, CustomStringConvertible {
|
||||
}
|
||||
|
||||
open class ArmchairTrackingInfo: CustomStringConvertible {
|
||||
open let info: Dictionary<ArmchairKey, AnyObject>
|
||||
public let info: Dictionary<ArmchairKey, AnyObject>
|
||||
|
||||
init(info: Dictionary<ArmchairKey, AnyObject>) {
|
||||
self.info = info
|
||||
@@ -742,7 +749,7 @@ public struct AppiraterKey {
|
||||
// MARK: PRIVATE Interface
|
||||
|
||||
#if os(iOS)
|
||||
open class ArmchairManager : NSObject, UIAlertViewDelegate, SKStoreProductViewControllerDelegate { }
|
||||
open class ArmchairManager : NSObject, SKStoreProductViewControllerDelegate { }
|
||||
#elseif os(OSX)
|
||||
open class ArmchairManager : NSObject, NSAlertDelegate { }
|
||||
#else
|
||||
@@ -762,8 +769,9 @@ open class Manager : ArmchairManager {
|
||||
// MARK: Review Alert & Properties
|
||||
|
||||
#if os(iOS)
|
||||
fileprivate var ratingAlert: UIAlertView? = nil
|
||||
fileprivate let reviewURLTemplate = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&id=APP_ID&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE&action=write-review"
|
||||
fileprivate var ratingAlert: UIAlertController? = nil
|
||||
fileprivate let reviewURLTemplate = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&id=APP_ID&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE&action=write-review"
|
||||
fileprivate let reviewURLTemplateiOS11 = "https://itunes.apple.com/us/app/idAPP_ID?ls=1&mt=8&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE&action=write-review"
|
||||
#elseif os(OSX)
|
||||
private var ratingAlert: NSAlert? = nil
|
||||
private let reviewURLTemplate = "macappstore://itunes.apple.com/us/app/idAPP_ID?ls=1&mt=12&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE"
|
||||
@@ -1206,40 +1214,71 @@ open class Manager : ArmchairManager {
|
||||
return (daysBeforeReminding > 0 && remindButtonTitle != nil)
|
||||
}
|
||||
|
||||
public var shouldTryStoreKitReviewPrompt : Bool {
|
||||
#if os(iOS)
|
||||
if #available(iOS 10.3, *), useStoreKitReviewPrompt {
|
||||
return true
|
||||
}
|
||||
#endif
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
fileprivate func requestStoreKitReviewPrompt() -> Bool {
|
||||
#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()
|
||||
|
||||
closeModalPanel()
|
||||
return true
|
||||
}
|
||||
#endif
|
||||
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 (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: {
|
||||
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: .alert)
|
||||
alertView.addAction(UIAlertAction(title: rateButtonTitle, style: .default, handler: {
|
||||
(alert: UIAlertAction!) in
|
||||
self.dontRate()
|
||||
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: rateButtonTitle, style:UIAlertActionStyle.default, handler: {
|
||||
alertView.addAction(UIAlertAction(title: cancelButtonTitle, style: .cancel, handler: {
|
||||
(alert: UIAlertAction!) in
|
||||
self._rateApp()
|
||||
self.dontRate()
|
||||
}))
|
||||
|
||||
|
||||
ratingAlert = alertView
|
||||
|
||||
// get the top most controller (= the StoreKit Controller) and dismiss it
|
||||
if let presentingController = UIApplication.shared.keyWindow?.rootViewController {
|
||||
if let topController = Manager.topMostViewController(presentingController) {
|
||||
@@ -1253,25 +1292,6 @@ open class Manager : ArmchairManager {
|
||||
// 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
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Otherwise we use UIAlertView still */
|
||||
var alertView: UIAlertView
|
||||
if (showsRemindButton()) {
|
||||
alertView = UIAlertView(title: reviewTitle, message: reviewMessage, delegate: self, cancelButtonTitle: cancelButtonTitle, otherButtonTitles: remindButtonTitle!, rateButtonTitle)
|
||||
} else {
|
||||
alertView = UIAlertView(title: reviewTitle, message: reviewMessage, delegate: self, cancelButtonTitle: cancelButtonTitle, otherButtonTitles: rateButtonTitle)
|
||||
}
|
||||
// If we have a remind button, show it first. Otherwise show the rate button
|
||||
// If we have a remind button, show the rate button next. Otherwise stop adding buttons.
|
||||
|
||||
alertView.cancelButtonIndex = -1
|
||||
ratingAlert = alertView
|
||||
alertView.show()
|
||||
|
||||
if let closure = didDisplayAlertClosure {
|
||||
closure()
|
||||
}
|
||||
}
|
||||
|
||||
#elseif os(OSX)
|
||||
@@ -1309,19 +1329,6 @@ open class Manager : ArmchairManager {
|
||||
// MARK: PRIVATE Alert View / StoreKit Delegate Methods
|
||||
|
||||
#if os(iOS)
|
||||
open func alertView(_ alertView: UIAlertView, didDismissWithButtonIndex buttonIndex: Int) {
|
||||
// cancelButtonIndex is set to -1 to show the cancel button up top, but a tap on it ends up here with index 0
|
||||
if (alertView.cancelButtonIndex == buttonIndex || 0 == buttonIndex) {
|
||||
// they don't want to rate it
|
||||
dontRate()
|
||||
} else if (showsRemindButton() && 1 == buttonIndex) {
|
||||
// remind them later
|
||||
remindMeLater()
|
||||
} else {
|
||||
// they want to rate it
|
||||
_rateApp()
|
||||
}
|
||||
}
|
||||
|
||||
//Delegate call from the StoreKit view.
|
||||
open func productViewControllerDidFinish(_ viewController: SKStoreProductViewController!) {
|
||||
@@ -1330,23 +1337,23 @@ open class Manager : ArmchairManager {
|
||||
|
||||
//Close the in-app rating (StoreKit) view and restore the previous status bar style.
|
||||
fileprivate func closeModalPanel() {
|
||||
let usedAnimation = usesAnimation
|
||||
if modalPanelOpen {
|
||||
UIApplication.shared.setStatusBarStyle(currentStatusBarStyle, animated:usesAnimation)
|
||||
let usedAnimation = usesAnimation
|
||||
|
||||
modalPanelOpen = false
|
||||
|
||||
// get the top most controller (= the StoreKit Controller) and dismiss it
|
||||
if let presentingController = UIApplication.shared.keyWindow?.rootViewController {
|
||||
if let topController = Manager.topMostViewController(presentingController) {
|
||||
topController.dismiss(animated: usesAnimation) {
|
||||
if let closure = self.didDismissModalViewClosure {
|
||||
closure(usedAnimation)
|
||||
}
|
||||
}
|
||||
topController.dismiss(animated: usesAnimation) {}
|
||||
currentStatusBarStyle = UIStatusBarStyle.default
|
||||
}
|
||||
}
|
||||
}
|
||||
if let closure = self.didDismissModalViewClosure {
|
||||
closure(usedAnimation)
|
||||
}
|
||||
}
|
||||
|
||||
#elseif os(OSX)
|
||||
@@ -1440,8 +1447,8 @@ open class Manager : ArmchairManager {
|
||||
UIApplication.shared.openURL(url)
|
||||
}
|
||||
}
|
||||
// Check for iOS simulator
|
||||
#if (arch(i386) || arch(x86_64)) && os(iOS)
|
||||
|
||||
#if targetEnvironment(simulator)
|
||||
debugLog("iTunes App Store is not supported on the iOS simulator.")
|
||||
debugLog(" - We would have went to \(reviewURLString()).")
|
||||
debugLog(" - Try running on a test-device")
|
||||
@@ -1462,7 +1469,12 @@ open class Manager : ArmchairManager {
|
||||
}
|
||||
|
||||
fileprivate func reviewURLString() -> String {
|
||||
let template = reviewURLTemplate
|
||||
#if os(iOS)
|
||||
let template = operatingSystemVersion >= 11 ? reviewURLTemplateiOS11 : reviewURLTemplate
|
||||
#elseif os(OSX)
|
||||
let template = reviewURLTemplate
|
||||
#else
|
||||
#endif
|
||||
var reviewURL = template.replacingOccurrences(of: "APP_ID", with: "\(appID)")
|
||||
reviewURL = reviewURL.replacingOccurrences(of: "AFFILIATE_CODE", with: "\(affiliateCode)")
|
||||
reviewURL = reviewURL.replacingOccurrences(of: "AFFILIATE_CAMPAIGN_CODE", with: "\(affiliateCampaignCode)")
|
||||
@@ -1712,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
|
||||
}
|
||||
@@ -1752,8 +1764,11 @@ open class Manager : ArmchairManager {
|
||||
if let alert = ratingAlert {
|
||||
debugLog("Hiding Alert")
|
||||
#if os(iOS)
|
||||
if alert.isVisible {
|
||||
alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: false)
|
||||
let isAlertVisible = alert.isViewLoaded && alert.view.window != nil
|
||||
if isAlertVisible {
|
||||
alert.dismiss(animated: false, completion: {
|
||||
self.dontRate()
|
||||
})
|
||||
}
|
||||
#elseif os(OSX)
|
||||
if let window = NSApplication.shared.keyWindow {
|
||||
@@ -1761,7 +1776,7 @@ open class Manager : ArmchairManager {
|
||||
parent.endSheet(window)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
#endif
|
||||
ratingAlert = nil
|
||||
@@ -1819,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)
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = Armchair;
|
||||
TargetAttributes = {
|
||||
F8111E0419A951050040E7D1 = {
|
||||
@@ -331,12 +331,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -385,12 +387,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
|
||||
Reference in New Issue
Block a user