Restrict "Feedback" sections to beta/paying users

Act as a rudimental spam filter.
This commit is contained in:
Davide De Rosa 2019-11-02 11:16:14 +01:00
parent 14edeab889
commit ebbcaa674b
3 changed files with 18 additions and 9 deletions

View File

@ -41,7 +41,7 @@ class ProductManager: NSObject {
private var purchasedAppBuild: Int?
private(set) var purchasedFeatures: Set<Product>
private var purchasedFeatures: Set<Product>
private var refreshRequest: SKReceiptRefreshRequest?
@ -157,6 +157,10 @@ class ProductManager: NSObject {
return $0.rawValue.hasSuffix("providers.\(name.rawValue)")
}
}
func isEligibleForFeedback() -> Bool {
return AppConstants.Flags.isBeta || !purchasedFeatures.isEmpty
}
}
extension ConnectionService {

View File

@ -44,8 +44,10 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
// MARK: StrongTableHost
let model: StrongTableModel<SectionType, RowType> = {
let model: StrongTableModel<SectionType, RowType> = StrongTableModel()
let model: StrongTableModel<SectionType, RowType> = StrongTableModel()
func reloadModel() {
model.clear()
model.add(.vpn)
model.add(.providers)
model.add(.hosts)
@ -53,7 +55,9 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
model.add(.siri)
}
model.add(.support)
model.add(.feedback)
if ProductManager.shared.isEligibleForFeedback() {
model.add(.feedback)
}
model.add(.about)
model.add(.destruction)
model.setHeader(L10n.App.Service.Sections.Vpn.header, forSection: .vpn)
@ -78,10 +82,9 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
model.setHeader("Beta", forSection: .test)
model.set([.testDisplayLog, .testTermination], forSection: .test)
}
return model
}()
func reloadModel() {
//
providers = service.ids(forContext: .provider).sorted()
hosts = service.ids(forContext: .host).sortedCaseInsensitive()

View File

@ -1158,7 +1158,9 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
model.add(.trusted)
model.add(.trustedPolicy)
model.add(.diagnostics)
model.add(.feedback)
if ProductManager.shared.isEligibleForFeedback() {
model.add(.feedback)
}
}
// headers