From a7fc4dcc39d43ccfe7d20840a81c967badc262b5 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 7 Jan 2021 23:26:34 +0100 Subject: [PATCH] Drop hosts restriction Makes "Unlimited hosts" in-app useless. --- Passepartout/App/iOS/AppDelegate.swift | 6 ------ Passepartout/App/iOS/CHANGELOG.md | 6 ++++++ .../App/iOS/Global/AppConstants+App.swift | 2 -- .../App/iOS/Global/ProductManager+App.swift | 19 ------------------- .../Organizer/OrganizerViewController.swift | 12 ------------ Passepartout/Core/Sources/Model/Product.swift | 3 --- 6 files changed, 6 insertions(+), 42 deletions(-) diff --git a/Passepartout/App/iOS/AppDelegate.swift b/Passepartout/App/iOS/AppDelegate.swift index f47c3380..e9fb4920 100644 --- a/Passepartout/App/iOS/AppDelegate.swift +++ b/Passepartout/App/iOS/AppDelegate.swift @@ -105,12 +105,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele fatalError("No window.rootViewController?") } 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) } diff --git a/Passepartout/App/iOS/CHANGELOG.md b/Passepartout/App/iOS/CHANGELOG.md index 3144ab16..158efe50 100644 --- a/Passepartout/App/iOS/CHANGELOG.md +++ b/Passepartout/App/iOS/CHANGELOG.md @@ -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/), 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) ### Added diff --git a/Passepartout/App/iOS/Global/AppConstants+App.swift b/Passepartout/App/iOS/Global/AppConstants+App.swift index 0c02f749..449e91bc 100644 --- a/Passepartout/App/iOS/Global/AppConstants+App.swift +++ b/Passepartout/App/iOS/Global/AppConstants+App.swift @@ -38,7 +38,5 @@ extension AppConstants { static let isBetaFullVersion = true static let lastFullVersionBuild = 2016 - - static let limitedNumberOfHosts = 2 } } diff --git a/Passepartout/App/iOS/Global/ProductManager+App.swift b/Passepartout/App/iOS/Global/ProductManager+App.swift index 0571cffb..f751095b 100644 --- a/Passepartout/App/iOS/Global/ProductManager+App.swift +++ b/Passepartout/App/iOS/Global/ProductManager+App.swift @@ -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") for name in service.providerNames() { guard let metadata = InfrastructureFactory.shared.metadata(forName: name) else { @@ -108,10 +96,3 @@ extension ProductManager { NotificationCenter.default.post(name: ProductManager.didReviewPurchases, object: nil) } } - -extension ConnectionService { - var hasReachedMaximumNumberOfHosts: Bool { - let numberOfHosts = hostIds().count - return numberOfHosts >= AppConstants.InApp.limitedNumberOfHosts - } -} diff --git a/Passepartout/App/iOS/Scenes/Organizer/OrganizerViewController.swift b/Passepartout/App/iOS/Scenes/Organizer/OrganizerViewController.swift index 8a452f22..56a0e735 100644 --- a/Passepartout/App/iOS/Scenes/Organizer/OrganizerViewController.swift +++ b/Passepartout/App/iOS/Scenes/Organizer/OrganizerViewController.swift @@ -222,12 +222,6 @@ class OrganizerViewController: UITableViewController, StrongTableHost { } 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) picker.allowsMultipleSelection = false picker.delegate = self @@ -243,12 +237,6 @@ class OrganizerViewController: UITableViewController, StrongTableHost { } private func importNewHost() { - if TransientStore.shared.service.hasReachedMaximumNumberOfHosts { - guard ProductManager.shared.isEligible(forFeature: .unlimitedHosts) else { - presentPurchaseScreen(forProduct: .unlimitedHosts) - return - } - } perform(segue: StoryboardSegue.Organizer.showImportedHostsSegueIdentifier) } diff --git a/Passepartout/Core/Sources/Model/Product.swift b/Passepartout/Core/Sources/Model/Product.swift index 0eff5313..ea8a7795 100644 --- a/Passepartout/Core/Sources/Model/Product.swift +++ b/Passepartout/Core/Sources/Model/Product.swift @@ -71,8 +71,6 @@ public struct Product: RawRepresentable, Equatable, Hashable { // MARK: Features #if os(iOS) - public static let unlimitedHosts = Product(featureId: "unlimited_hosts") - public static let trustedNetworks = Product(featureId: "trusted_networks") public static let siriShortcuts = Product(featureId: "siri") @@ -82,7 +80,6 @@ public struct Product: RawRepresentable, Equatable, Hashable { #if os(iOS) public static let allFeatures: [Product] = [ - .unlimitedHosts, .trustedNetworks, .siriShortcuts, .fullVersion