From 1eeb356874462ed1f58c3cad3874e6067ca5e44b Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 11 Nov 2021 16:26:33 +0100 Subject: [PATCH] Restrict macOS features in beta - Providers - Trusted networks Skip macOS deployment to TestFlight until beta check is fixed. --- .github/workflows/beta.yml | 10 +++++----- Passepartout/App/macOS/Global/Macros.swift | 5 +++++ .../App/macOS/Scenes/OrganizerViewController.swift | 3 +++ .../ProfileCustomizationViewController.swift | 7 +++++++ .../PassepartoutCore/Model/ProductManager.swift | 1 + 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index ad40a773..50fe0b89 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -102,11 +102,11 @@ jobs: export PILOT_APP_VERSION=`ci/version-number.sh ios` export PILOT_BUILD_NUMBER=`ci/build-number.sh ios` bundle exec fastlane --env ios,beta store_beta - - name: Publish on TestFlight (macOS) - run: | - export PILOT_APP_VERSION=`ci/version-number.sh mac` - export PILOT_BUILD_NUMBER=`ci/build-number.sh mac` - bundle exec fastlane --env mac,beta store_beta +# - name: Publish on TestFlight (macOS) +# run: | +# export PILOT_APP_VERSION=`ci/version-number.sh mac` +# export PILOT_BUILD_NUMBER=`ci/build-number.sh mac` +# bundle exec fastlane --env mac,beta store_beta submit_for_app_review: if: github.ref == 'refs/heads/stable' runs-on: ubuntu-latest diff --git a/Passepartout/App/macOS/Global/Macros.swift b/Passepartout/App/macOS/Global/Macros.swift index d5c21442..579c4105 100644 --- a/Passepartout/App/macOS/Global/Macros.swift +++ b/Passepartout/App/macOS/Global/Macros.swift @@ -97,6 +97,11 @@ extension NSViewController { vc.delegate = delegate presentAsModalWindow(vc) } + + func presentBetaFeatureUnavailable(_ title: String) { + let alert = Macros.warning(title, "The requested feature is unavailable in beta.") + alert.present(in: view.window, withOK: "OK", handler: nil) + } } extension NSView { diff --git a/Passepartout/App/macOS/Scenes/OrganizerViewController.swift b/Passepartout/App/macOS/Scenes/OrganizerViewController.swift index 912602c2..503248ff 100644 --- a/Passepartout/App/macOS/Scenes/OrganizerViewController.swift +++ b/Passepartout/App/macOS/Scenes/OrganizerViewController.swift @@ -89,6 +89,9 @@ class OrganizerViewController: NSViewController { } do { try ProductManager.shared.verifyEligible(forProvider: metadata) + } catch ProductError.beta { + presentBetaFeatureUnavailable("Providers") + return } catch { presentPurchaseScreen(forProduct: metadata.product) return diff --git a/Passepartout/App/macOS/Scenes/Service/Customization/ProfileCustomizationViewController.swift b/Passepartout/App/macOS/Scenes/Service/Customization/ProfileCustomizationViewController.swift index b387d381..63e97520 100644 --- a/Passepartout/App/macOS/Scenes/Service/Customization/ProfileCustomizationViewController.swift +++ b/Passepartout/App/macOS/Scenes/Service/Customization/ProfileCustomizationViewController.swift @@ -264,5 +264,12 @@ class ProfileCustomizationViewController: NSTabViewController { tabViewItems[4].label = L10n.NetworkSettings.Dns.title tabViewItems[5].label = L10n.NetworkSettings.Proxy.title tabViewItems[6].label = L10n.NetworkSettings.Mtu.title + + do { + try ProductManager.shared.verifyEligible(forFeature: .trustedNetworks) + } catch ProductError.beta { + tabViewItems.remove(at: 2) + } catch { + } } } diff --git a/PassepartoutCore/Sources/PassepartoutCore/Model/ProductManager.swift b/PassepartoutCore/Sources/PassepartoutCore/Model/ProductManager.swift index 823bcaaa..4d8ffcac 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Model/ProductManager.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Model/ProductManager.swift @@ -104,6 +104,7 @@ public class ProductManager: NSObject { return Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" #endif #else + // FIXME: skip TestFlight on macOS until beta condition is clearly determined return false #endif }