Drop hosts restriction

Makes "Unlimited hosts" in-app useless.
This commit is contained in:
Davide De Rosa 2021-01-07 23:26:34 +01:00
parent e21e0b06cb
commit a7fc4dcc39
6 changed files with 6 additions and 42 deletions

View File

@ -105,12 +105,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
fatalError("No window.rootViewController?") fatalError("No window.rootViewController?")
} }
let topmost = root.presentedViewController ?? root let topmost = root.presentedViewController ?? root
if TransientStore.shared.service.hasReachedMaximumNumberOfHosts {
guard ProductManager.shared.isEligible(forFeature: .unlimitedHosts) else {
topmost.presentPurchaseScreen(forProduct: .unlimitedHosts)
return false
}
}
return tryParseURL(url, passphrase: nil, target: topmost) return tryParseURL(url, passphrase: nil, target: topmost)
} }

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Drop hosts restriction in free version ("Unlimited hosts").
## 1.14.0 (2021-01-07) ## 1.14.0 (2021-01-07)
### Added ### Added

View File

@ -38,7 +38,5 @@ extension AppConstants {
static let isBetaFullVersion = true static let isBetaFullVersion = true
static let lastFullVersionBuild = 2016 static let lastFullVersionBuild = 2016
static let limitedNumberOfHosts = 2
} }
} }

View File

@ -71,18 +71,6 @@ extension ProductManager {
} }
} }
log.debug("Checking 'Unlimited hosts'")
if !isEligible(forFeature: .unlimitedHosts) {
let ids = service.hostIds()
if ids.count > AppConstants.InApp.limitedNumberOfHosts {
for id in ids {
service.removeProfile(ProfileKey(.host, id))
}
log.debug("\tRefunded")
anyRefund = true
}
}
log.debug("Checking providers") log.debug("Checking providers")
for name in service.providerNames() { for name in service.providerNames() {
guard let metadata = InfrastructureFactory.shared.metadata(forName: name) else { guard let metadata = InfrastructureFactory.shared.metadata(forName: name) else {
@ -108,10 +96,3 @@ extension ProductManager {
NotificationCenter.default.post(name: ProductManager.didReviewPurchases, object: nil) NotificationCenter.default.post(name: ProductManager.didReviewPurchases, object: nil)
} }
} }
extension ConnectionService {
var hasReachedMaximumNumberOfHosts: Bool {
let numberOfHosts = hostIds().count
return numberOfHosts >= AppConstants.InApp.limitedNumberOfHosts
}
}

View File

@ -222,12 +222,6 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
} }
private func addNewHost() { private func addNewHost() {
if TransientStore.shared.service.hasReachedMaximumNumberOfHosts {
guard ProductManager.shared.isEligible(forFeature: .unlimitedHosts) else {
presentPurchaseScreen(forProduct: .unlimitedHosts)
return
}
}
let picker = UIDocumentPickerViewController(documentTypes: AppConstants.URLs.filetypes, in: .import) let picker = UIDocumentPickerViewController(documentTypes: AppConstants.URLs.filetypes, in: .import)
picker.allowsMultipleSelection = false picker.allowsMultipleSelection = false
picker.delegate = self picker.delegate = self
@ -243,12 +237,6 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
} }
private func importNewHost() { private func importNewHost() {
if TransientStore.shared.service.hasReachedMaximumNumberOfHosts {
guard ProductManager.shared.isEligible(forFeature: .unlimitedHosts) else {
presentPurchaseScreen(forProduct: .unlimitedHosts)
return
}
}
perform(segue: StoryboardSegue.Organizer.showImportedHostsSegueIdentifier) perform(segue: StoryboardSegue.Organizer.showImportedHostsSegueIdentifier)
} }

View File

@ -71,8 +71,6 @@ public struct Product: RawRepresentable, Equatable, Hashable {
// MARK: Features // MARK: Features
#if os(iOS) #if os(iOS)
public static let unlimitedHosts = Product(featureId: "unlimited_hosts")
public static let trustedNetworks = Product(featureId: "trusted_networks") public static let trustedNetworks = Product(featureId: "trusted_networks")
public static let siriShortcuts = Product(featureId: "siri") public static let siriShortcuts = Product(featureId: "siri")
@ -82,7 +80,6 @@ public struct Product: RawRepresentable, Equatable, Hashable {
#if os(iOS) #if os(iOS)
public static let allFeatures: [Product] = [ public static let allFeatures: [Product] = [
.unlimitedHosts,
.trustedNetworks, .trustedNetworks,
.siriShortcuts, .siriShortcuts,
.fullVersion .fullVersion