Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.
ds: allow one app group on free teams (#284)
Cesar Andres Pereira Bernal0c63e6979fd3
diff --git a/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift b/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swiftindex d726e91..c2b5f51 100644--- a/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift+++ b/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift@@ -11,19 +11,23 @@ import DeveloperAPIpublic struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {- public enum Error: LocalizedError {+ public enum Error: LocalizedError, CustomStringConvertible {case invalidApp(URL)+ case tooManyAppGroups(bundleID: String, groups: [DeveloperServicesAppGroup.GroupID])public var errorDescription: String? {+ description+ }++ public var description: String {switch self {case .invalidApp(let url):- return url.path.withCString {- String.localizedStringWithFormat(- NSLocalizedString(- "add_app_operation.error.invalid_app", value: "Invalid app: %s", comment: ""- ), $0- )- }+ "Invalid app: \(url.path)"+ case .tooManyAppGroups(let bundleID, let groups):+ """+ App '\(bundleID)' requests multiple app groups: \(groups.map(\.rawValue).joined(separator: ", ")), \+ which is not permitted when using a free team.+ """}}}@@ -180,6 +184,10 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {// re-assign rather than using updateEntitlements since the latter will// retain unrecognized entitlementslet filtered = try entitlements.entitlements().filter { $0.anyCapability?.isFree != false }+ if let groups = filtered.lazy.compactMap({ $0 as? AppGroupEntitlement }).first?.rawValue,+ groups.count > 1 {+ throw Error.tooManyAppGroups(bundleID: bundleID, groups: groups)+ }entitlements = try Entitlements(entitlements: filtered)}} else {diff --git a/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift b/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swiftindex 1d12254..05aad38 100644--- a/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift+++ b/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift@@ -73,9 +73,7 @@ extension DataProtectionEntitlement: EntitlementWithCapability {extension AppGroupEntitlement: EntitlementWithCapability {var capability: DeveloperServicesCapability {- // FIXME: Enable app groups on free accounts- // but we need to always assign only one group- DeveloperServicesCapability(.appGroups, isFree: false)+ DeveloperServicesCapability(.appGroups, isFree: true)}}