├── .swift-version
├── screenshots
├── screencap-1.png
├── screencap-2.png
└── screencap-3.png
├── PoliteReview.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcuserdata
│ └── kevin.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
├── xcshareddata
│ └── xcschemes
│ │ └── PoliteReview.xcscheme
└── project.pbxproj
├── .gitignore
├── PoliteReview
├── Notifications.swift
├── PoliteReview.h
├── Info.plist
├── zh-Hans.lproj
│ └── Localizable.strings
├── zh-Hant.lproj
│ └── Localizable.strings
├── PoliteReview.swift
└── RequestPoliteReview.swift
├── PoliteReview.podspec
├── LICENSE
└── README.md
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.1
2 |
--------------------------------------------------------------------------------
/screenshots/screencap-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinchau/PoliteReview/HEAD/screenshots/screencap-1.png
--------------------------------------------------------------------------------
/screenshots/screencap-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinchau/PoliteReview/HEAD/screenshots/screencap-2.png
--------------------------------------------------------------------------------
/screenshots/screencap-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinchau/PoliteReview/HEAD/screenshots/screencap-3.png
--------------------------------------------------------------------------------
/PoliteReview.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## OS X Finder
2 | .DS_Store
3 |
4 | ## Build generated
5 | build/
6 | DerivedData
7 |
8 | ## Various settings
9 | *.pbxuser
10 | !default.pbxuser
11 | *.mode1v3
12 | !default.mode1v3
13 | *.mode2v3
14 | !default.mode2v3
15 | *.perspectivev3
16 | !default.perspectivev3
17 | xcuserdata
18 |
19 | ## Other
20 | *.xccheckout
21 | *.moved-aside
22 | *.xcuserstate
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 |
29 | # Swift Package Manager
30 | .build/
31 |
32 | # Carthage
33 | Carthage/Build
34 |
--------------------------------------------------------------------------------
/PoliteReview/Notifications.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Notifications.swift
3 | // PoliteReview
4 | //
5 | // Created by Kevin Chau on 8/2/17.
6 | // Copyright © 2017 likelylabs. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public extension Notification.Name {
12 | static let politeReviewLoveAlert = Notification.Name(rawValue: "politeReviewLoveAlert")
13 | static let politeReviewLegacyRequest = Notification.Name(rawValue: "politeReviewLegacyRequest")
14 | static let politeReviewContactAction = Notification.Name(rawValue: "politeReviewContactAction")
15 | }
16 |
--------------------------------------------------------------------------------
/PoliteReview.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "PoliteReview"
3 | s.version = "1.2.1"
4 | s.summary = "A Polite Way to Request Reviews for iOS"
5 | s.homepage = "https://github.com/kevinchau/PoliteReview"
6 | s.license = { type: 'MIT', file: 'LICENSE' }
7 | s.authors = { "Your Name" => 'chaukevin@gmail.com' }
8 | s.social_media_url = "http://twitter.com/kchau"
9 |
10 | s.platform = :ios, "9.1"
11 | s.requires_arc = true
12 | s.source = { git: "https://github.com/kevinchau/PoliteReview.git", :tag => s.version.to_s }
13 | s.source_files = "PoliteReview/**/*.{h,swift,strings}"
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/PoliteReview/PoliteReview.h:
--------------------------------------------------------------------------------
1 | //
2 | // PoliteReview.h
3 | // PoliteReview
4 | //
5 | // Created by Kevin Chau on 8/1/17.
6 | // Copyright © 2017 likelylabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for PoliteReview.
12 | FOUNDATION_EXPORT double PoliteReviewVersionNumber;
13 |
14 | //! Project version string for PoliteReview.
15 | FOUNDATION_EXPORT const unsigned char PoliteReviewVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/PoliteReview.xcodeproj/xcuserdata/kevin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PoliteReview.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 0A58206F1F30223C001FBB16
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/PoliteReview/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.2.1
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PoliteReview/zh-Hans.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | /* Used for question particle */
3 | "?" = "吗?";
4 |
5 | /* For the alert controller preceding the app name */
6 | "Do you love" = "你喜欢用";
7 |
8 | /* Message for the alert controller */
9 | "Give Us Your Feedback" = "希望你能提出用后意见";
10 |
11 | /* Message when user does not love your app */
12 | "Let us know how to improve." = "请跟我们分享改善建议。";
13 |
14 | /* Alert Action */
15 | "No" = "不喜欢";
16 |
17 | /* Alert Action */
18 | "Not Now" = "不要";
19 |
20 | /* Alert title when user does not love your app */
21 | "Oh No!" = "糟糕!";
22 |
23 | /* Ask legacy user for review */
24 | "Please Consider Writing a Review" = "请考虑留下你的意见";
25 |
26 | /* alert action */
27 | "Send Feedback" = "提交意见";
28 |
29 | /* Message when user love app */
30 | "Thank You!" = "谢谢!";
31 |
32 | /* Placeholder app name */
33 | "this app" = "此应用程式";
34 |
35 | /* Alert Action */
36 | "Write Review" = "感谢!";
37 |
38 | /* Alert Action */
39 | "Yes" = "喜欢";
40 |
--------------------------------------------------------------------------------
/PoliteReview/zh-Hant.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | /* Used for question particle */
3 | "?" = "嗎?";
4 |
5 | /* For the alert controller preceding the app name */
6 | "Do you love" = "你喜歡用";
7 |
8 | /* Message for the alert controller */
9 | "Give Us Your Feedback" = "希望你能提出用後意見";
10 |
11 | /* Message when user does not love your app */
12 | "Let us know how to improve." = "請跟我們分享改善建議。";
13 |
14 | /* Alert Action */
15 | "No" = "不喜歡";
16 |
17 | /* Alert Action */
18 | "Not Now" = "不要";
19 |
20 | /* Alert title when user does not love your app */
21 | "Oh No!" = "糟糕!";
22 |
23 | /* Ask legacy user for review */
24 | "Please Consider Writing a Review" = "請考慮留下你的意見";
25 |
26 | /* alert action */
27 | "Send Feedback" = "提交意見";
28 |
29 | /* Message when user love app */
30 | "Thank You!" = "多謝!";
31 |
32 | /* Placeholder app name */
33 | "this app" = "此應用程式";
34 |
35 | /* Alert Action */
36 | "Write Review" = "感謝!";
37 |
38 | /* Alert Action */
39 | "Yes" = "喜歡";
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2017 Kevin Chau
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/PoliteReview.xcodeproj/xcshareddata/xcschemes/PoliteReview.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PoliteReview
2 | A Polite Way to Request Reviews for iOS
3 |
4 |
5 |
6 | # Features
7 | Polite Review is an elegant way to request ratings and reviews from your users.
8 |
9 | * Automatically grabs your localized app name and uses "this app" as a default.
10 | * Localized, curently English, Chinese Simplied, and Chinese Traditional.
11 |
12 | * For 10.3 and above, uses `StoreKit` to request reviews, in compliance with store guidelines.
13 | * For below 10.3, falls back to a simple alert which will open the App Store to the review page.
14 |
15 |
16 |
17 | ## Coming Soon
18 |
19 | * Swift 4
20 | * Tests
21 |
22 | # Getting Started
23 |
24 | The best way to get started with PoliteReview is with Carthage(coming soon) and CocoaPods.
25 |
26 | ## Installation with CocoaPods
27 | ```swift
28 | pod 'PoliteReview'
29 | ```
30 |
31 | ## Installation with Carthage
32 | ```swift
33 | github "kevinchau/PoliteReview"
34 |
35 | ```
36 |
37 | ## Usage
38 |
39 | Add PoliteReview to `AppDelegate`
40 |
41 | ```swift
42 | import PoliteReview
43 |
44 | ...
45 |
46 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
47 |
48 | PoliteReview.main.setup(itunesID: , contactURL: , contactEmail: , triggerCount: )
49 | return true
50 | }
51 | ```
52 | * Your iTunes App ID is a string of numbers, found in iTunes connect.
53 | * Trigger count is the minimum number of times your app has been launched before any alerts are shown. If no value is specified, it will default to 5.
54 |
55 | In any ViewController, you can request a review by calling `requestPoliteReview()`. PoliteReview will determine if an alert will be shown.
56 |
57 | Example:
58 |
59 | ```swift
60 | class ViewController: UIViewController {
61 | ...
62 |
63 | func methodCalledByUser() {
64 | ...
65 | requestPoliteReview()
66 | }
67 | }
68 | ```
69 |
70 | ## Notifications
71 | PoliteReview supports Notifications. You can use these to trigger analytics events, or for other things. They will report with `userInfo` for the result of the action, with yes as `true` and no as `false`
72 |
73 | `Notification.Name` is extended, and you may observe the following.
74 | * `.politeReviewLoveAlert` with `userInfo`: `PoliteReviewNotification.loveAlert`
75 | * `.politeReviewLegacyRequest` with `userInfo`: `PoliteReviewNotification.legacyReview`
76 | * `.politeReviewContactAction` with `userInfo`: `PoliteReviewNotification.contactAction`
77 |
78 | `.politeReviewLegacyRequest` is only posted when a user is below `10.3`.
79 |
80 | Usage:
81 | ```swift
82 | // Register your observer
83 | NotificationCenter.default.addObserver(self, selector: #selector(observedMethod(_:)), name: .politeReviewLoveAlert, object: nil)
84 |
85 | // Method to handle your observer
86 | @objc private func observedMethod(_ notification: Notification) {
87 | if let action = notification.userInfo?[PoliteReviewNotification.loveAlert] as? Bool {
88 | if action == true {
89 | // Do stuff when user likes your app - they may have left a rating
90 | } else {
91 | // Do stuff when user did not like your app
92 | }
93 | }
94 | ```
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/PoliteReview/PoliteReview.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PoliteReview.swift
3 | // PoliteReview
4 | //
5 | // Created by Kevin Chau on 8/1/17.
6 | // Copyright © 2017 likelylabs. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | enum UserDefaultKeys: String {
12 | case politeReviewTotalLaunchCount
13 | case politeReviewVersionLaunchCount
14 | case politeReviewReviewedVersion
15 | case politeReviewHasReviewed
16 | }
17 |
18 | public class PoliteReview {
19 |
20 | static private(set) var storeID: String = "0000000000"
21 | static private(set) var contactURL: String = "https://www.google.com"
22 | static private(set) var contactEmail: String = "placeholder@gmail.com"
23 | static private(set) var triggerCount: Int = 5
24 | static public let main = PoliteReview()
25 |
26 | public func setup(itunesID: String, contactURL: String, contactEmail: String, triggerCount: Int = 5) {
27 | PoliteReview.storeID = itunesID
28 | PoliteReview.contactURL = contactURL
29 | PoliteReview.contactEmail = contactEmail
30 | PoliteReview.triggerCount = triggerCount
31 | incrementTotalLaunch()
32 | incrementVersionLaunch()
33 | }
34 |
35 | private init() {
36 | // init is private to force use of singleton
37 | }
38 |
39 | private func incrementTotalLaunch() {
40 | // Keep track of how many times the app has been launched
41 | let totalLaunchCount = UserDefaults.standard.integer(forKey: UserDefaultKeys.politeReviewTotalLaunchCount.rawValue)
42 | UserDefaults.standard.set(totalLaunchCount + 1, forKey: UserDefaultKeys.politeReviewTotalLaunchCount.rawValue)
43 | }
44 |
45 | private func incrementVersionLaunch() {
46 | let currentVersion = getVersion()
47 |
48 | // Reset the counter if the current app version is newer than a previous reviewed version
49 | if let storedVersion = UserDefaults.standard.string(forKey: UserDefaultKeys.politeReviewReviewedVersion.rawValue) {
50 | if currentVersion.compare(storedVersion, options: NSString.CompareOptions.numeric) != ComparisonResult.orderedDescending {
51 | UserDefaults.standard.set(0, forKey: UserDefaultKeys.politeReviewVersionLaunchCount.rawValue)
52 | }
53 | }
54 |
55 | // Keep track of how many times this particular version has been launched
56 | let currentCount = UserDefaults.standard.integer(forKey: UserDefaultKeys.politeReviewVersionLaunchCount.rawValue)
57 | UserDefaults.standard.set(currentCount + 1, forKey: UserDefaultKeys.politeReviewVersionLaunchCount.rawValue)
58 | }
59 |
60 | func shouldPresent() -> Bool {
61 | // Determines if a review should be presented based on a new version and if the user has been prompted before
62 | var should = false
63 | let currentVersion = getVersion()
64 | let hasReviewed = UserDefaults.standard.bool(forKey: UserDefaultKeys.politeReviewHasReviewed.rawValue)
65 | let versionCount = UserDefaults.standard.integer(forKey: UserDefaultKeys.politeReviewVersionLaunchCount.rawValue)
66 |
67 | if versionCount >= PoliteReview.triggerCount {
68 | if let storedVersion = UserDefaults.standard.string(forKey: "reviewVersion") {
69 | if currentVersion.compare(storedVersion, options: NSString.CompareOptions.numeric) == ComparisonResult.orderedDescending {
70 | should = true
71 | }
72 | }
73 | else if hasReviewed == false {
74 | should = true
75 | }
76 | }
77 | return should
78 | }
79 |
80 | func getVersion() -> String {
81 | // Get current app version string
82 | guard let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else {
83 | return "0.0.0"
84 | }
85 | return version
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/PoliteReview/RequestPoliteReview.swift:
--------------------------------------------------------------------------------
1 | //
2 | // RequestPoliteReview.swift
3 | // PoliteReview
4 | //
5 | // Created by Kevin Chau on 8/1/17.
6 | // Copyright © 2017 likelylabs. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 | import StoreKit
12 | import MessageUI
13 |
14 | public struct PoliteReviewNotification {
15 | static let loveAlert = "loveAlert"
16 | static let legacyReview = "legacyReview"
17 | static let contactAction = "contactAction"
18 | }
19 |
20 | extension UIViewController: MFMailComposeViewControllerDelegate {
21 |
22 | public func requestPoliteReview() {
23 | // Presents a UIAlertController for the initial prompt
24 | let appName = Bundle.main.localizedInfoDictionary?["CFBundleDisplayName"]
25 |
26 |
27 |
28 |
29 | let alertController = UIAlertController(title: String("\(NSLocalizedString("Do you love", comment: "For the alert controller preceding the app name")) \(appName ?? NSLocalizedString("this app", comment: "Placeholder app name"))\(NSLocalizedString("?", comment: "Used for question particle"))"), message: NSLocalizedString("Give Us Your Feedback", comment: "Message for the alert controller"), preferredStyle: .alert)
30 |
31 | // They love it action
32 | let yesAction = UIAlertAction(title: NSLocalizedString("Yes", comment: "Alert Action"), style: .default) { (UIAlertAction) in
33 |
34 | // Sets the reviewed status and sets the reviewed version
35 | self.setUserDefaultsHasReviewed()
36 |
37 | // Posts a Notification to Notification Center
38 | NotificationCenter.default.post(name: .politeReviewLoveAlert, object: nil, userInfo: [PoliteReviewNotification.loveAlert: true])
39 |
40 | // Requests a review via the StoreKit alert, or legacy if 10.3 is not available
41 | if #available(iOS 10.3, *) {
42 | SKStoreReviewController.requestReview()
43 | } else {
44 | self.legacyAlert()
45 | }
46 | }
47 |
48 | // They Don't love it action
49 | let noAction = UIAlertAction(title: NSLocalizedString("No", comment: "Alert Action"), style: .cancel) { (UIAlertAction) in
50 | // Sets the reviewed status and sets the reviewed version
51 | self.setUserDefaultsHasReviewed()
52 |
53 | // Posts a Notification to Notification Center
54 | NotificationCenter.default.post(name: .politeReviewLoveAlert, object: nil, userInfo: [PoliteReviewNotification.loveAlert: false])
55 |
56 | // Initiates the contact process
57 | self.contact()
58 | }
59 |
60 | // Adds the actions to the alert controller
61 | alertController.addAction(yesAction)
62 | alertController.addAction(noAction)
63 |
64 | if PoliteReview.main.shouldPresent() == true {
65 | self.present(alertController, animated: true, completion: nil)
66 | }
67 |
68 | }
69 |
70 | private func legacyAlert() {
71 | // Legacy alert prompts user to write a review if they are below 10.3
72 | let legacyAlertController = UIAlertController(title: NSLocalizedString("Thank You!", comment: "Message when user love app"), message: NSLocalizedString("Please Consider Writing a Review", comment: "Ask legacy user for review"), preferredStyle: .alert)
73 | // Action to write a review
74 | let legacyWriteAction = UIAlertAction(title: NSLocalizedString("Write Review", comment: "Alert Action"), style: .default) { (UIAlertAction) in
75 | let openAppStoreForRating = "itms-apps://itunes.apple.com/us/app/id\(PoliteReview.storeID)?action=write-review&mt=8"
76 | if UIApplication.shared.canOpenURL(URL(string: openAppStoreForRating)!) {
77 | if #available(iOS 10.0, *) {
78 | UIApplication.shared.open(URL(string: openAppStoreForRating)!, options: [:], completionHandler: nil)
79 | } else {
80 | UIApplication.shared.openURL(URL(string: openAppStoreForRating)!)
81 | }
82 | }
83 |
84 | // Posts a Notification to Notification Center
85 | NotificationCenter.default.post(name: .politeReviewLegacyRequest, object: nil, userInfo: [PoliteReviewNotification.legacyReview: true])
86 | }
87 | // Action to not write a review
88 | let legacyDeclineAction = UIAlertAction(title: NSLocalizedString("Not Now", comment: "Alert Action"), style: .cancel) { (UIAlertAction) in
89 | // Posts a Notification to Notification Center
90 | NotificationCenter.default.post(name: .politeReviewLegacyRequest, object: nil, userInfo: [PoliteReviewNotification.legacyReview: false])
91 | }
92 | // Adds the actions to the alert controller
93 | legacyAlertController.addAction(legacyWriteAction)
94 | legacyAlertController.addAction(legacyDeclineAction)
95 |
96 | present(legacyAlertController, animated: true, completion: nil)
97 | }
98 |
99 | private func contact() {
100 | let alertController = UIAlertController(title: NSLocalizedString("Oh No!", comment: "Alert title when user does not love your app"), message: NSLocalizedString("Let us know how to improve.", comment: "Message when user does not love your app"), preferredStyle: .alert)
101 | let contactAction = UIAlertAction(title: NSLocalizedString("Send Feedback", comment: "alert action"), style: .default) { (UIAlertAction) in
102 | let appName = Bundle.main.localizedInfoDictionary?["CFBundleDisplayName"]
103 | if MFMailComposeViewController.canSendMail() {
104 | let composeVC = MFMailComposeViewController()
105 | composeVC.mailComposeDelegate = self
106 |
107 | // Configure the fields of the interface.
108 | composeVC.setToRecipients([PoliteReview.contactEmail])
109 | composeVC.setSubject("Contact from \(appName ?? "iOS App")")
110 | composeVC.setMessageBody("Message: ", isHTML: false)
111 |
112 | // Present the view controller modally.
113 | self.present(composeVC, animated: true, completion: nil)
114 | } else {
115 | guard let url = URL(string: PoliteReview.contactURL) else {
116 | return
117 | }
118 | if UIApplication.shared.canOpenURL(url){
119 | if #available(iOS 10.0, *) {
120 | UIApplication.shared.open(url, options: [:], completionHandler: nil)
121 | } else {
122 | UIApplication.shared.openURL(url)
123 | }
124 | }
125 | }
126 |
127 | // Posts a Notification to Notification Center
128 | NotificationCenter.default.post(name: .politeReviewContactAction, object: nil, userInfo: [PoliteReviewNotification.contactAction: true])
129 | }
130 | let declineContactAction = UIAlertAction(title: NSLocalizedString("Not Now", comment: "Alert Action"), style: .cancel) { (UIAlertAction) in
131 | // Posts a Notification to Notification Center
132 | NotificationCenter.default.post(name: .politeReviewContactAction, object: nil, userInfo: [PoliteReviewNotification.contactAction: false])
133 | }
134 | alertController.addAction(contactAction)
135 | alertController.addAction(declineContactAction)
136 | self.present(alertController, animated: true, completion: nil)
137 | }
138 |
139 | private func setUserDefaultsHasReviewed() {
140 | // Sets the reviewed status and sets the reviewed version
141 | let currentVersion = PoliteReview.main.getVersion()
142 | UserDefaults.standard.set(true, forKey: UserDefaultKeys.politeReviewHasReviewed.rawValue)
143 | UserDefaults.standard.set(currentVersion, forKey: UserDefaultKeys.politeReviewReviewedVersion.rawValue)
144 | }
145 |
146 | public func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
147 | controller.dismiss(animated: true, completion: nil)
148 | }
149 |
150 | }
151 |
--------------------------------------------------------------------------------
/PoliteReview.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 0A5820751F30223C001FBB16 /* PoliteReview.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A5820731F30223C001FBB16 /* PoliteReview.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | 0A58207C1F3022D4001FBB16 /* PoliteReview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A58207B1F3022D4001FBB16 /* PoliteReview.swift */; };
12 | 0A6F89881F3175E7006B1636 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6F89871F3175E7006B1636 /* Notifications.swift */; };
13 | 0AF1FBC11F303AAB00959CF5 /* RequestPoliteReview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AF1FBC01F303AAB00959CF5 /* RequestPoliteReview.swift */; };
14 | 0AF1FBCA1F303CDC00959CF5 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0AF1FBCC1F303CDC00959CF5 /* Localizable.strings */; };
15 | 0AF1FBCF1F303E0C00959CF5 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 0AF1FBCE1F303E0C00959CF5 /* .gitignore */; };
16 | 0AF1FBD11F3041C600959CF5 /* PoliteReview.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 0AF1FBD01F3041C600959CF5 /* PoliteReview.podspec */; };
17 | 0AF1FBD31F30422300959CF5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 0AF1FBD21F30422300959CF5 /* LICENSE */; };
18 | 0AF1FBD51F3042B100959CF5 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 0AF1FBD41F3042B100959CF5 /* README.md */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXFileReference section */
22 | 0A5820701F30223C001FBB16 /* PoliteReview.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PoliteReview.framework; sourceTree = BUILT_PRODUCTS_DIR; };
23 | 0A5820731F30223C001FBB16 /* PoliteReview.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PoliteReview.h; sourceTree = ""; };
24 | 0A5820741F30223C001FBB16 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
25 | 0A58207B1F3022D4001FBB16 /* PoliteReview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PoliteReview.swift; sourceTree = ""; };
26 | 0A6F89871F3175E7006B1636 /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = ""; };
27 | 0AF1FBC01F303AAB00959CF5 /* RequestPoliteReview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestPoliteReview.swift; sourceTree = ""; };
28 | 0AF1FBCB1F303CDC00959CF5 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; };
29 | 0AF1FBCD1F303D7A00959CF5 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; };
30 | 0AF1FBCE1F303E0C00959CF5 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; };
31 | 0AF1FBD01F3041C600959CF5 /* PoliteReview.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PoliteReview.podspec; sourceTree = ""; };
32 | 0AF1FBD21F30422300959CF5 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; };
33 | 0AF1FBD41F3042B100959CF5 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; };
34 | /* End PBXFileReference section */
35 |
36 | /* Begin PBXFrameworksBuildPhase section */
37 | 0A58206C1F30223C001FBB16 /* Frameworks */ = {
38 | isa = PBXFrameworksBuildPhase;
39 | buildActionMask = 2147483647;
40 | files = (
41 | );
42 | runOnlyForDeploymentPostprocessing = 0;
43 | };
44 | /* End PBXFrameworksBuildPhase section */
45 |
46 | /* Begin PBXGroup section */
47 | 0A5820661F30223C001FBB16 = {
48 | isa = PBXGroup;
49 | children = (
50 | 0AF1FBD41F3042B100959CF5 /* README.md */,
51 | 0AF1FBD21F30422300959CF5 /* LICENSE */,
52 | 0AF1FBD01F3041C600959CF5 /* PoliteReview.podspec */,
53 | 0AF1FBCE1F303E0C00959CF5 /* .gitignore */,
54 | 0A5820721F30223C001FBB16 /* PoliteReview */,
55 | 0A5820711F30223C001FBB16 /* Products */,
56 | );
57 | sourceTree = "";
58 | };
59 | 0A5820711F30223C001FBB16 /* Products */ = {
60 | isa = PBXGroup;
61 | children = (
62 | 0A5820701F30223C001FBB16 /* PoliteReview.framework */,
63 | );
64 | name = Products;
65 | sourceTree = "";
66 | };
67 | 0A5820721F30223C001FBB16 /* PoliteReview */ = {
68 | isa = PBXGroup;
69 | children = (
70 | 0A5820731F30223C001FBB16 /* PoliteReview.h */,
71 | 0A5820741F30223C001FBB16 /* Info.plist */,
72 | 0A58207B1F3022D4001FBB16 /* PoliteReview.swift */,
73 | 0AF1FBC01F303AAB00959CF5 /* RequestPoliteReview.swift */,
74 | 0A6F89871F3175E7006B1636 /* Notifications.swift */,
75 | 0AF1FBCC1F303CDC00959CF5 /* Localizable.strings */,
76 | );
77 | path = PoliteReview;
78 | sourceTree = "";
79 | };
80 | /* End PBXGroup section */
81 |
82 | /* Begin PBXHeadersBuildPhase section */
83 | 0A58206D1F30223C001FBB16 /* Headers */ = {
84 | isa = PBXHeadersBuildPhase;
85 | buildActionMask = 2147483647;
86 | files = (
87 | 0A5820751F30223C001FBB16 /* PoliteReview.h in Headers */,
88 | );
89 | runOnlyForDeploymentPostprocessing = 0;
90 | };
91 | /* End PBXHeadersBuildPhase section */
92 |
93 | /* Begin PBXNativeTarget section */
94 | 0A58206F1F30223C001FBB16 /* PoliteReview */ = {
95 | isa = PBXNativeTarget;
96 | buildConfigurationList = 0A5820781F30223C001FBB16 /* Build configuration list for PBXNativeTarget "PoliteReview" */;
97 | buildPhases = (
98 | 0A58206B1F30223C001FBB16 /* Sources */,
99 | 0A58206C1F30223C001FBB16 /* Frameworks */,
100 | 0A58206D1F30223C001FBB16 /* Headers */,
101 | 0A58206E1F30223C001FBB16 /* Resources */,
102 | 0A6F89861F316C58006B1636 /* ShellScript */,
103 | );
104 | buildRules = (
105 | );
106 | dependencies = (
107 | );
108 | name = PoliteReview;
109 | productName = PoliteReview;
110 | productReference = 0A5820701F30223C001FBB16 /* PoliteReview.framework */;
111 | productType = "com.apple.product-type.framework";
112 | };
113 | /* End PBXNativeTarget section */
114 |
115 | /* Begin PBXProject section */
116 | 0A5820671F30223C001FBB16 /* Project object */ = {
117 | isa = PBXProject;
118 | attributes = {
119 | LastUpgradeCheck = 0830;
120 | ORGANIZATIONNAME = likelylabs;
121 | TargetAttributes = {
122 | 0A58206F1F30223C001FBB16 = {
123 | CreatedOnToolsVersion = 8.3.3;
124 | DevelopmentTeam = FTHBLX7S63;
125 | LastSwiftMigration = 0830;
126 | ProvisioningStyle = Automatic;
127 | };
128 | };
129 | };
130 | buildConfigurationList = 0A58206A1F30223C001FBB16 /* Build configuration list for PBXProject "PoliteReview" */;
131 | compatibilityVersion = "Xcode 3.2";
132 | developmentRegion = English;
133 | hasScannedForEncodings = 0;
134 | knownRegions = (
135 | en,
136 | "zh-Hant",
137 | "zh-Hans",
138 | );
139 | mainGroup = 0A5820661F30223C001FBB16;
140 | productRefGroup = 0A5820711F30223C001FBB16 /* Products */;
141 | projectDirPath = "";
142 | projectRoot = "";
143 | targets = (
144 | 0A58206F1F30223C001FBB16 /* PoliteReview */,
145 | );
146 | };
147 | /* End PBXProject section */
148 |
149 | /* Begin PBXResourcesBuildPhase section */
150 | 0A58206E1F30223C001FBB16 /* Resources */ = {
151 | isa = PBXResourcesBuildPhase;
152 | buildActionMask = 2147483647;
153 | files = (
154 | 0AF1FBD11F3041C600959CF5 /* PoliteReview.podspec in Resources */,
155 | 0AF1FBCF1F303E0C00959CF5 /* .gitignore in Resources */,
156 | 0AF1FBD31F30422300959CF5 /* LICENSE in Resources */,
157 | 0AF1FBCA1F303CDC00959CF5 /* Localizable.strings in Resources */,
158 | );
159 | runOnlyForDeploymentPostprocessing = 0;
160 | };
161 | /* End PBXResourcesBuildPhase section */
162 |
163 | /* Begin PBXShellScriptBuildPhase section */
164 | 0A6F89861F316C58006B1636 /* ShellScript */ = {
165 | isa = PBXShellScriptBuildPhase;
166 | buildActionMask = 2147483647;
167 | files = (
168 | );
169 | inputPaths = (
170 | );
171 | outputPaths = (
172 | );
173 | runOnlyForDeploymentPostprocessing = 0;
174 | shellPath = /bin/sh;
175 | shellScript = "if which bartycrouch > /dev/null; then\n# Incrementally update all Storyboards/XIBs strings files\nbartycrouch interfaces -p \"$PROJECT_DIR\"\n\n# Add new keys to Localizable.strings files from NSLocalizedString in code\nbartycrouch code -p \"$PROJECT_DIR\" -l \"$PROJECT_DIR\" -a -s\nelse\necho \"warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch\"\nfi";
176 | };
177 | /* End PBXShellScriptBuildPhase section */
178 |
179 | /* Begin PBXSourcesBuildPhase section */
180 | 0A58206B1F30223C001FBB16 /* Sources */ = {
181 | isa = PBXSourcesBuildPhase;
182 | buildActionMask = 2147483647;
183 | files = (
184 | 0A6F89881F3175E7006B1636 /* Notifications.swift in Sources */,
185 | 0AF1FBD51F3042B100959CF5 /* README.md in Sources */,
186 | 0AF1FBC11F303AAB00959CF5 /* RequestPoliteReview.swift in Sources */,
187 | 0A58207C1F3022D4001FBB16 /* PoliteReview.swift in Sources */,
188 | );
189 | runOnlyForDeploymentPostprocessing = 0;
190 | };
191 | /* End PBXSourcesBuildPhase section */
192 |
193 | /* Begin PBXVariantGroup section */
194 | 0AF1FBCC1F303CDC00959CF5 /* Localizable.strings */ = {
195 | isa = PBXVariantGroup;
196 | children = (
197 | 0AF1FBCB1F303CDC00959CF5 /* zh-Hant */,
198 | 0AF1FBCD1F303D7A00959CF5 /* zh-Hans */,
199 | );
200 | name = Localizable.strings;
201 | sourceTree = "";
202 | };
203 | /* End PBXVariantGroup section */
204 |
205 | /* Begin XCBuildConfiguration section */
206 | 0A5820761F30223C001FBB16 /* Debug */ = {
207 | isa = XCBuildConfiguration;
208 | buildSettings = {
209 | ALWAYS_SEARCH_USER_PATHS = NO;
210 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
211 | CLANG_ANALYZER_NONNULL = YES;
212 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
213 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
214 | CLANG_CXX_LIBRARY = "libc++";
215 | CLANG_ENABLE_MODULES = YES;
216 | CLANG_ENABLE_OBJC_ARC = YES;
217 | CLANG_WARN_BOOL_CONVERSION = YES;
218 | CLANG_WARN_CONSTANT_CONVERSION = YES;
219 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
220 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
221 | CLANG_WARN_EMPTY_BODY = YES;
222 | CLANG_WARN_ENUM_CONVERSION = YES;
223 | CLANG_WARN_INFINITE_RECURSION = YES;
224 | CLANG_WARN_INT_CONVERSION = YES;
225 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
226 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
227 | CLANG_WARN_UNREACHABLE_CODE = YES;
228 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
229 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
230 | COPY_PHASE_STRIP = NO;
231 | CURRENT_PROJECT_VERSION = 1;
232 | DEBUG_INFORMATION_FORMAT = dwarf;
233 | ENABLE_STRICT_OBJC_MSGSEND = YES;
234 | ENABLE_TESTABILITY = YES;
235 | GCC_C_LANGUAGE_STANDARD = gnu99;
236 | GCC_DYNAMIC_NO_PIC = NO;
237 | GCC_NO_COMMON_BLOCKS = YES;
238 | GCC_OPTIMIZATION_LEVEL = 0;
239 | GCC_PREPROCESSOR_DEFINITIONS = (
240 | "DEBUG=1",
241 | "$(inherited)",
242 | );
243 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
244 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
245 | GCC_WARN_UNDECLARED_SELECTOR = YES;
246 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
247 | GCC_WARN_UNUSED_FUNCTION = YES;
248 | GCC_WARN_UNUSED_VARIABLE = YES;
249 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
250 | MTL_ENABLE_DEBUG_INFO = YES;
251 | ONLY_ACTIVE_ARCH = YES;
252 | SDKROOT = iphoneos;
253 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
254 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
255 | TARGETED_DEVICE_FAMILY = "1,2";
256 | VERSIONING_SYSTEM = "apple-generic";
257 | VERSION_INFO_PREFIX = "";
258 | };
259 | name = Debug;
260 | };
261 | 0A5820771F30223C001FBB16 /* Release */ = {
262 | isa = XCBuildConfiguration;
263 | buildSettings = {
264 | ALWAYS_SEARCH_USER_PATHS = NO;
265 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
266 | CLANG_ANALYZER_NONNULL = YES;
267 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
269 | CLANG_CXX_LIBRARY = "libc++";
270 | CLANG_ENABLE_MODULES = YES;
271 | CLANG_ENABLE_OBJC_ARC = YES;
272 | CLANG_WARN_BOOL_CONVERSION = YES;
273 | CLANG_WARN_CONSTANT_CONVERSION = YES;
274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
275 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
276 | CLANG_WARN_EMPTY_BODY = YES;
277 | CLANG_WARN_ENUM_CONVERSION = YES;
278 | CLANG_WARN_INFINITE_RECURSION = YES;
279 | CLANG_WARN_INT_CONVERSION = YES;
280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
281 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
282 | CLANG_WARN_UNREACHABLE_CODE = YES;
283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
285 | COPY_PHASE_STRIP = NO;
286 | CURRENT_PROJECT_VERSION = 1;
287 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
288 | ENABLE_NS_ASSERTIONS = NO;
289 | ENABLE_STRICT_OBJC_MSGSEND = YES;
290 | GCC_C_LANGUAGE_STANDARD = gnu99;
291 | GCC_NO_COMMON_BLOCKS = YES;
292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
294 | GCC_WARN_UNDECLARED_SELECTOR = YES;
295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
296 | GCC_WARN_UNUSED_FUNCTION = YES;
297 | GCC_WARN_UNUSED_VARIABLE = YES;
298 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
299 | MTL_ENABLE_DEBUG_INFO = NO;
300 | SDKROOT = iphoneos;
301 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
302 | TARGETED_DEVICE_FAMILY = "1,2";
303 | VALIDATE_PRODUCT = YES;
304 | VERSIONING_SYSTEM = "apple-generic";
305 | VERSION_INFO_PREFIX = "";
306 | };
307 | name = Release;
308 | };
309 | 0A5820791F30223C001FBB16 /* Debug */ = {
310 | isa = XCBuildConfiguration;
311 | buildSettings = {
312 | CLANG_ENABLE_MODULES = YES;
313 | CODE_SIGN_IDENTITY = "";
314 | DEFINES_MODULE = YES;
315 | DEVELOPMENT_TEAM = FTHBLX7S63;
316 | DYLIB_COMPATIBILITY_VERSION = 1;
317 | DYLIB_CURRENT_VERSION = 1;
318 | DYLIB_INSTALL_NAME_BASE = "@rpath";
319 | INFOPLIST_FILE = PoliteReview/Info.plist;
320 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
322 | PRODUCT_BUNDLE_IDENTIFIER = com.likelylabs.PoliteReview;
323 | PRODUCT_NAME = "$(TARGET_NAME)";
324 | SKIP_INSTALL = YES;
325 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
326 | SWIFT_VERSION = 3.0;
327 | };
328 | name = Debug;
329 | };
330 | 0A58207A1F30223C001FBB16 /* Release */ = {
331 | isa = XCBuildConfiguration;
332 | buildSettings = {
333 | CLANG_ENABLE_MODULES = YES;
334 | CODE_SIGN_IDENTITY = "";
335 | DEFINES_MODULE = YES;
336 | DEVELOPMENT_TEAM = FTHBLX7S63;
337 | DYLIB_COMPATIBILITY_VERSION = 1;
338 | DYLIB_CURRENT_VERSION = 1;
339 | DYLIB_INSTALL_NAME_BASE = "@rpath";
340 | INFOPLIST_FILE = PoliteReview/Info.plist;
341 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
342 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
343 | PRODUCT_BUNDLE_IDENTIFIER = com.likelylabs.PoliteReview;
344 | PRODUCT_NAME = "$(TARGET_NAME)";
345 | SKIP_INSTALL = YES;
346 | SWIFT_VERSION = 3.0;
347 | };
348 | name = Release;
349 | };
350 | /* End XCBuildConfiguration section */
351 |
352 | /* Begin XCConfigurationList section */
353 | 0A58206A1F30223C001FBB16 /* Build configuration list for PBXProject "PoliteReview" */ = {
354 | isa = XCConfigurationList;
355 | buildConfigurations = (
356 | 0A5820761F30223C001FBB16 /* Debug */,
357 | 0A5820771F30223C001FBB16 /* Release */,
358 | );
359 | defaultConfigurationIsVisible = 0;
360 | defaultConfigurationName = Release;
361 | };
362 | 0A5820781F30223C001FBB16 /* Build configuration list for PBXNativeTarget "PoliteReview" */ = {
363 | isa = XCConfigurationList;
364 | buildConfigurations = (
365 | 0A5820791F30223C001FBB16 /* Debug */,
366 | 0A58207A1F30223C001FBB16 /* Release */,
367 | );
368 | defaultConfigurationIsVisible = 0;
369 | defaultConfigurationName = Release;
370 | };
371 | /* End XCConfigurationList section */
372 | };
373 | rootObject = 0A5820671F30223C001FBB16 /* Project object */;
374 | }
375 |
--------------------------------------------------------------------------------