Merge branch 'wrong-provider-eligibility'
This commit is contained in:
commit
02a2dc0512
|
@ -137,7 +137,7 @@ struct Product: RawRepresentable, Equatable, Hashable {
|
|||
|
||||
extension Infrastructure.Metadata {
|
||||
var product: Product {
|
||||
return Product(providerId: inApp ?? description)
|
||||
return Product(providerId: inApp ?? name)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,19 +167,11 @@ class ProductManager: NSObject {
|
|||
}
|
||||
|
||||
func isEligible(forFeature feature: Product) -> Bool {
|
||||
guard !isFullVersion() else {
|
||||
return true
|
||||
}
|
||||
return purchasedFeatures.contains(feature)
|
||||
return isFullVersion() || purchasedFeatures.contains(feature)
|
||||
}
|
||||
|
||||
func isEligible(forProvider name: Infrastructure.Name) -> Bool {
|
||||
guard !isFullVersion() else {
|
||||
return true
|
||||
}
|
||||
return purchasedFeatures.contains {
|
||||
return $0.rawValue.hasSuffix("providers.\(name)")
|
||||
}
|
||||
func isEligible(forProvider metadata: Infrastructure.Metadata) -> Bool {
|
||||
return isFullVersion() || purchasedFeatures.contains(metadata.product)
|
||||
}
|
||||
|
||||
func isEligibleForFeedback() -> Bool {
|
||||
|
@ -228,7 +220,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
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 32fbaa0f44904a303e9bb3353030237232ee26f2
|
||||
Subproject commit aa7e45d1d26def8d9645bf533e432fddce6ddf8d
|
Loading…
Reference in New Issue