From 1414080ea9debe3f43fe38579f3f043b1afe9e41 Mon Sep 17 00:00:00 2001 From: Davide Date: Mon, 20 Jan 2025 14:49:47 +0100 Subject: [PATCH] Do not require purchase for empty on-demand rules (#1089) Major issue with migrated profiles with the "Excluding" policy. Existing users are being opted into an unnecessary purchase. --- .../CommonLibrary/IAP/AppFeatureRequiring+Modules.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Packages/App/Sources/CommonLibrary/IAP/AppFeatureRequiring+Modules.swift b/Packages/App/Sources/CommonLibrary/IAP/AppFeatureRequiring+Modules.swift index b271103c..2b1def42 100644 --- a/Packages/App/Sources/CommonLibrary/IAP/AppFeatureRequiring+Modules.swift +++ b/Packages/App/Sources/CommonLibrary/IAP/AppFeatureRequiring+Modules.swift @@ -49,7 +49,11 @@ extension OnDemandModule.Builder: AppFeatureRequiring { guard isEnabled else { return [] } - return policy != .any ? [.onDemand] : [] + // empty rules require no purchase + if !withMobileNetwork && !withEthernetNetwork && !withSSIDs.map(\.value).contains(true) { + return [] + } + return [.onDemand] } }