Commit 52168ad9 authored by Zach Knox's avatar Zach Knox
Browse files

Merge branch '42-reviews' into 'dev-1.0.1'

Resolve "Add an SKStoreReviewController"

See merge request !28
parents fe834a65 dda271ce
......@@ -7,6 +7,7 @@
//
import UIKit
import StoreKit
class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
......@@ -68,6 +69,19 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(true)
// MARK - Begging for App Reviews
let prompt = UserDefaults.standard.integer(forKey: "reviewPrompt")
if(arc4random_uniform(100) > 85 && prompt >= 4) {
SKStoreReviewController.requestReview()
UserDefaults.standard.set(0, forKey: "reviewPrompt")
}
else {
UserDefaults.standard.set(prompt + 1, forKey: "reviewPrompt")
}
}
override func viewDidLoad() {
super.viewDidLoad()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment