Files
xtool-mirror/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppIDRequestApplier.swift
2024-11-17 03:09:06 -05:00

34 lines
1.0 KiB
Swift

//
// DeveloperServicesAppIDRequestApplier.swift
// Supersign
//
// Created by Kabir Oberai on 11/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
enum DeveloperServicesAppIDRequestApplier {
static func apply(
entitlements: Entitlements, additionalFeatures: [DeveloperServicesFeature],
to dict: inout [String: Any], isFree: Bool
) {
var entitlements = entitlements
try? entitlements.updateEntitlements {
$0.removeAll {
let type = Swift.type(of: $0)
return !type.canList || (isFree && !type.isFree)
}
}
dict["entitlements"] = try? entitlements.plistValue()
let entFeatures = (try? entitlements.entitlements().compactMap { $0.feature() }) ?? []
let allFeatures = entFeatures + additionalFeatures
guard let features = try? DeveloperServicesFeatures(values: allFeatures).plistValue() as? [String: Any]
else { return }
dict.merge(features) { a, _ in a }
}
}