Beispiel #1
0
        //Network Extensions
        void ApplyNetworkExtensionsCapability(NetworkExtensionsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.NetworkExtensions.iOS", true);
            _pbxproj.AddSystemFramework("NetworkExtension.framework", LinkType.Required);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            if (capability.AppProxy)
            {
                groups.Add("app-proxy-provider");
            }

            if (capability.ContentFilter)
            {
                groups.Add("content-filter-provider");
            }

            if (capability.PacketTunnel)
            {
                groups.Add("packet-tunnel-provider");
            }

            if (capability.DNSProxy)
            {
                groups.Add("dns-proxy");
            }

            entitlementChanges.Add("com.apple.developer.networking.networkextension", groups);
            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #2
0
        //Game Controllers
        void ApplyGameControllersCapability(GameControllersCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.GameControllers.appletvos", true);
            _pbxproj.AddSystemFramework("GameController.framework", LinkType.Required);
            //update info.plist
            var changes = new PListDictionary();

            changes.Add("GCSupportsControllerUserInteraction", true);
            ApplyInfoPlistChanges(changes);

            if (capability.GameControllers != null && capability.GameControllers.Length > 0)
            {
                var controllerChanges = new PListDictionary();
                var controllers       = new PListArray();

                foreach (var c in capability.GameControllers)
                {
                    var dic = new PListDictionary();
                    dic.Add("ProfileName", c.ToString());
                    controllers.Add(dic);
                }

                controllerChanges.Add("GCSupportedGameControllers", controllers);
                ApplyInfoPlistChanges(controllerChanges, true);
            }
        }
        protected PListArray Serialize <T>(List <T> changeEntries) where T : BaseChangeEntry
        {
            var array = new PListArray();

            foreach (var item in changeEntries)
            {
                array.Add(item.Serialize());
            }

            return(array);
        }
Beispiel #4
0
        public IPListElement Copy()
        {
            var copy = new PListArray();

            foreach (var element in this)
            {
                copy.Add(element.Copy());
            }

            return(copy);
        }
Beispiel #5
0
        void ApplyNFCTagReadingCapability(NFCTagReadingCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.NearFieldCommunicationTagReading", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var formats            = new PListArray();

            formats.Add("NDEF");
            entitlementChanges.Add("com.apple.developer.nfc.readersession.formats", formats);
            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #6
0
        void MergeArrays(PListArray original, PListArray toMerge, bool keepEmpty)
        {
            foreach (var element in toMerge)
            {
                if (element is PListDictionary)
                {
                    var originalDic = new PListDictionary();
                    MergeDictionaries(originalDic, element as PListDictionary, keepEmpty, false);

                    if (!keepEmpty && originalDic.Count > 0)
                    {
                        original.Add(originalDic);
                    }
                }
                else if (element is PListArray)
                {
                    var originalArray = new PListArray();
                    MergeArrays(originalArray, element as PListArray, keepEmpty);

                    if (!keepEmpty && originalArray.Count > 0)
                    {
                        original.Add(originalArray);
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(element.ToString()))
                    {
                        continue;
                    }

                    var matchedElements = ArrayContainsElement(original, element);

                    if (matchedElements == null)
                    {
                        original.Add(element);
                    }
                }
            }
        }
Beispiel #7
0
        //Personal VPN
        void ApplyPersonalVPNCapability(PersonalVPNCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.VPNLite", true);
            _pbxproj.AddSystemFramework("NetworkExtension.framework", LinkType.Required);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            groups.Add("allow-vpn");
            entitlementChanges.Add("com.apple.developer.networking.vpn.api", groups);
            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #8
0
        PListArray ParseArray(IEnumerable <XElement> elements)
        {
            PListArray arrayElement = new PListArray();

            foreach (XElement e in elements)
            {
                IPListElement value = ParseValue(e);

                if (value != null)
                {
                    arrayElement.Add(value);
                }
            }

            return(arrayElement);
        }
Beispiel #9
0
        //Apple Pay (In App Payments)
        void ApplyApplePayCapability(ApplePayCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.ApplePay", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            entitlementChanges.Add("com.apple.developer.in-app-payments", groups);

            foreach (var item in capability.MerchantIds)
            {
                groups.Add(item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #10
0
        //Associated Domains
        void ApplyAssociatedDomainsCapability(AssociatedDomainsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.SafariKeychain", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var domains            = new PListArray();

            entitlementChanges.Add("com.apple.developer.associated-domains", domains);

            foreach (var item in capability.AssociatedDomains)
            {
                domains.Add(item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #11
0
        //Keychain Sharing
        void ApplyKeychainSharingCapability(KeychainSharingCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.Keychain", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            entitlementChanges.Add("keychain-access-groups", groups);

            foreach (var item in capability.KeychainGroups)
            {
                groups.Add("$(AppIdentifierPrefix)" + item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #12
0
        //App Groups
        void ApplyAppGroupsCapability(AppGroupsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.ApplicationGroups.iOS", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            entitlementChanges.Add("com.apple.security.application-groups", groups);

            foreach (var item in capability.AppGroups)
            {
                groups.Add(item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #13
0
        void MergePListArray(PListArray main, PListArray other)
        {
            foreach (var el in other)
            {
                //don't overwrite string with empty strings
                var str = el as PListString;

                if (str != null)
                {
                    if (main.Contains(el) && string.IsNullOrEmpty(str.Value))
                    {
                        continue;
                    }
                }

                main.Add(el);
            }
        }
Beispiel #14
0
        public override PListDictionary Serialize()
        {
            var dic = base.Serialize();

            if (_entries.Count > 0)
            {
                var entriesArray = new PListArray();

                foreach (var entry in _entries)
                {
                    entriesArray.Add(entry.Serialize());
                }

                dic.Add(ENTRIES_KEY, entriesArray);
            }

            return(dic);
        }
Beispiel #15
0
        public override PListDictionary Serialize()
        {
            var dic = new PListDictionary();

            if (GameControllers != null && GameControllers.Length > 0)
            {
                var controllers = new PListArray();

                foreach (var c in GameControllers)
                {
                    controllers.Add(c.ToString());
                }

                dic.Add(SUPPORTED_GAME_CONTROLLERS_KEY, controllers);
            }

            return(dic);
        }
Beispiel #16
0
        public override PListDictionary Serialize()
        {
            var dic = new PListDictionary();

            if (UserManagement != null && UserManagement.Length > 0)
            {
                var controllers = new PListArray();

                foreach (var c in UserManagement)
                {
                    controllers.Add(c.ToString());
                }

                dic.Add(USER_MANAGEMENT_KEY, controllers);
            }

            return(dic);
        }
Beispiel #17
0
        public override IPListElement Serialize()
        {
            var array = new PListArray();

            foreach (var entry in _buildSettings)
            {
                //don't save empty entries
                if (entry is CustomStringBuildSettingEntry)
                {
                    var custom = entry as CustomStringBuildSettingEntry;

                    if (string.IsNullOrEmpty(custom.Name) && string.IsNullOrEmpty(custom.Value))
                    {
                        continue;
                    }
                }

                array.Add(entry.Serialize());
            }

            return(array);
        }
Beispiel #18
0
        public PListDictionary Serialize()
        {
            var dic = new PListDictionary();

            dic.Add(ACTIVE_CONFIGURATION_KEY, _activeConfiguration);
            var configs = new PListDictionary();

            foreach (var kvp in _configurations)
            {
                var entries = new PListArray();

                foreach (var e in kvp.Value)
                {
                    entries.Add(e);
                }

                configs.Add(kvp.Key, entries);
            }

            dic.Add(CONFIGURATIONS_KEY, configs);
            return(dic);
        }
Beispiel #19
0
        //Background Modes
        void ApplyBackgroundModesCapability(BackgroundModesCapability capability)
        {
            //update pbxproject
            switch (_platform)
            {
            case BuildPlatform.tvOS:
                _pbxproj.EnableSystemCapability("com.apple.BackgroundModes.appletvos", true);
                break;

            case BuildPlatform.iOS:
            default:
                _pbxproj.EnableSystemCapability("com.apple.BackgroundModes", true);
                break;
            }

            //update info.plist
            var modes = new PListArray();

            if (capability.UsesBTLEAcc)
            {
                modes.Add("bluetooth-central");
            }

            if (capability.AudioAirplayPIP)
            {
                modes.Add("audio");
            }

            if (capability.ActsAsBTLEAcc)
            {
                modes.Add("bluetooth-peripheral");
            }

            if (capability.ExternalAccComms)
            {
                modes.Add("external-accessory");
            }

            if (capability.BackgroundFetch)
            {
                modes.Add("fetch");
            }

            if (capability.LocationUpdates)
            {
                modes.Add("location");
            }

            if (capability.NewsstandDownloads)
            {
                modes.Add("newsstand-content");
            }

            if (capability.RemoteNotifications)
            {
                modes.Add("remote-notification");
            }

            if (capability.VOIP)
            {
                modes.Add("voip");
            }

            if (modes.Count > 0)
            {
                var changes = new PListDictionary();
                changes.Add("UIBackgroundModes", modes);
                ApplyInfoPlistChanges(changes);
            }

            //update entitlements file
        }
Beispiel #20
0
        //iCloud
        void ApplyICloudCapability(ICloudCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.iCloud", true);

            if (capability.CloudKit)
            {
                _pbxproj.AddSystemFramework("CloudKit.framework", LinkType.Required);
                //ensure push is enabled with cloudkit
                ApplyPushNotificationsCapability(new PushNotificationsCapability());
            }

            //update entitlements file
            var entitlementChanges   = new PListDictionary();
            var services             = new PListArray();
            var ubiquityContainerIds = new PListArray();
            var iCloudContainerIds   = new PListArray();

            if (capability.iCloudDocuments)
            {
                services.Add("CloudDocuments");
            }

            if (capability.CloudKit)
            {
                services.Add("CloudKit");
            }

            if (capability.iCloudDocuments || capability.CloudKit)
            {
                if (capability.UseCustomContainers)
                {
                    foreach (var item in capability.CustomContainers)
                    {
                        iCloudContainerIds.Add(item);

                        if (capability.iCloudDocuments)
                        {
                            ubiquityContainerIds.Add(item);
                        }
                    }
                }
                else
                {
                    iCloudContainerIds.Add("iCloud.$(CFBundleIdentifier)");

                    if (capability.iCloudDocuments)
                    {
                        ubiquityContainerIds.Add("iCloud.$(CFBundleIdentifier)");
                    }
                }
            }

            //always add, even if empty
            entitlementChanges.Add("com.apple.developer.icloud-container-identifiers", iCloudContainerIds);

            if (services.Count > 0)
            {
                entitlementChanges.Add("com.apple.developer.icloud-services", services);
            }

            if (ubiquityContainerIds.Count > 0)
            {
                entitlementChanges.Add("com.apple.developer.ubiquity-container-identifiers", ubiquityContainerIds);
            }

            if (capability.KeyValueStorage)
            {
                entitlementChanges.Add("com.apple.developer.ubiquity-kvstore-identifier", "$(TeamIdentifierPrefix)$(CFBundleIdentifier)");
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Beispiel #21
0
        //Maps
        void ApplyMapsCapability(MapsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.Maps.iOS", true);
            _pbxproj.AddSystemFramework("MapKit.framework", LinkType.Required);
            //update info.plist
            var changes = new PListDictionary();
            var modes   = new PListArray();

            if (capability.Airplane)
            {
                modes.Add("MKDirectionsModePlane");
            }

            if (capability.Bike)
            {
                modes.Add("MKDirectionsModeBike");
            }

            if (capability.Bus)
            {
                modes.Add("MKDirectionsModeBus");
            }

            if (capability.Car)
            {
                modes.Add("MKDirectionsModeCar");
            }

            if (capability.Ferry)
            {
                modes.Add("MKDirectionsModeFerry");
            }

            if (capability.Other)
            {
                modes.Add("MKDirectionsModeOther");
            }

            if (capability.Pedestrian)
            {
                modes.Add("MKDirectionsModePedestrian");
            }

            if (capability.RideSharing)
            {
                modes.Add("MKDirectionsModeRideShare");
            }

            if (capability.Streetcar)
            {
                modes.Add("MKDirectionsModeStreetCar");
            }

            if (capability.Subway)
            {
                modes.Add("MKDirectionsModeSubway");
            }

            if (capability.Taxi)
            {
                modes.Add("MKDirectionsModeTaxi");
            }

            if (capability.Train)
            {
                modes.Add("MKDirectionsModeTrain");
            }

            if (modes.Count > 0)
            {
                changes.Add("MKDirectionsApplicationSupportedModes", modes);
                var docType = new PListDictionary();
                docType.Add("CFBundleTypeName", "MKDirectionsRequest");
                docType.Add("LSItemContentTypes", new PListArray("com.apple.maps.directionsrequest"));
                var docTypes = new PListArray(docType);
                changes.Add("CFBundleDocumentTypes", docTypes);
                ApplyInfoPlistChanges(changes);
            }
        }