66// Copyright (c) 2016 Xamarin Inc. (www.xamarin.com)
77//
88
9+ using System . Collections . Generic ;
10+ using System . Linq ;
11+ using System . Reflection ;
12+
913namespace Xamarin . MacDev
1014{
1115 public static class EntitlementKeys
1216 {
17+ public const string DataProtection = "com.apple.developer.default-data-protection" ;
1318 public const string WirelessAccessoryConfiguration = "com.apple.external-accessory.wireless-configuration" ;
1419 public const string UbiquityKeyValueStore = "com.apple.developer.ubiquity-kvstore-identifier" ;
1520 public const string UbiquityContainers = "com.apple.developer.ubiquity-container-identifiers" ;
@@ -20,6 +25,7 @@ public static class EntitlementKeys
2025 public const string ApplicationGroups = "com.apple.security.application-groups" ;
2126 public const string NetworkingVpnApi = "com.apple.developer.networking.vpn.api" ;
2227 public const string NetworkExtensions = "com.apple.developer.networking.networkextension" ;
28+ public const string NFC = "com.apple.developer.nfc.readersession.formats" ;
2329 public const string HotspotConfiguration = "com.apple.developer.networking.HotspotConfiguration" ;
2430 public const string Multipath = "com.apple.developer.networking.multipath" ;
2531 public const string InAppPayments = "com.apple.developer.in-app-payments" ;
@@ -30,6 +36,17 @@ public static class EntitlementKeys
3036 public const string GetTaskAllow = "get-task-allow" ;
3137 public const string Siri = "com.apple.developer.siri" ;
3238 public const string APS = "aps-environment" ;
39+
40+ public static IEnumerable < string > AllKeys {
41+ get {
42+ var entitlementKeys = typeof ( EntitlementKeys ) . GetFields ( BindingFlags . Public | BindingFlags . Static ) .
43+ Where ( f => f . FieldType == typeof ( string ) ) .
44+ Select ( field => ( string ) field . GetValue ( null ) ) .
45+ ToList ( ) ;
46+
47+ return entitlementKeys ;
48+ }
49+ }
3350 }
3451
3552 public static class EntitlementExtensions
@@ -138,5 +155,17 @@ public static void SetPassBookIdentifiers (this PDictionary dict, PArray value)
138155 else
139156 dict [ EntitlementKeys . PassBookIdentifiers ] = value ;
140157 }
158+
159+ public static IEnumerable < string > GetEntitlementKeys ( this PDictionary dict )
160+ {
161+ var enabledEntitlements = new List < string > ( ) ;
162+
163+ foreach ( var key in EntitlementKeys . AllKeys ) {
164+ if ( dict . ContainsKey ( key ) )
165+ enabledEntitlements . Add ( key ) ;
166+ }
167+
168+ return enabledEntitlements ;
169+ }
141170 }
142171}
0 commit comments