Fix check for provider eligibility
This commit is contained in:
parent
535caf4d37
commit
c1854ffd00
|
@ -173,13 +173,11 @@ class ProductManager: NSObject {
|
|||
return purchasedFeatures.contains(feature)
|
||||
}
|
||||
|
||||
func isEligible(forProvider name: Infrastructure.Name) -> Bool {
|
||||
func isEligible(forProvider metadata: Infrastructure.Metadata) -> Bool {
|
||||
guard !isFullVersion() else {
|
||||
return true
|
||||
}
|
||||
return purchasedFeatures.contains {
|
||||
return $0.rawValue.hasSuffix("providers.\(name)")
|
||||
}
|
||||
return purchasedFeatures.contains(metadata.product)
|
||||
}
|
||||
|
||||
func isEligibleForFeedback() -> Bool {
|
||||
|
@ -228,7 +226,10 @@ class ProductManager: NSObject {
|
|||
|
||||
log.debug("Checking providers")
|
||||
for name in service.currentProviderNames() {
|
||||
if !isEligible(forProvider: name) {
|
||||
guard let metadata = InfrastructureFactory.shared.metadata(forName: name) else {
|
||||
continue
|
||||
}
|
||||
if !isEligible(forProvider: metadata) {
|
||||
service.removeProfile(ProfileKey(name))
|
||||
log.debug("\tRefunded provider: \(name)")
|
||||
anyRefund = true
|
||||
|
|
|
@ -63,7 +63,7 @@ class WizardProviderViewController: UITableViewController, StrongTableHost {
|
|||
private func tryNext(withMetadata metadata: Infrastructure.Metadata) {
|
||||
selectedMetadata = metadata
|
||||
|
||||
guard ProductManager.shared.isEligible(forProvider: metadata.name) else {
|
||||
guard ProductManager.shared.isEligible(forProvider: metadata) else {
|
||||
presentPurchaseScreen(forProduct: metadata.product, delegate: self)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue