public void AddApplePayWorks()
        {
            SetupTestProject();
            ResetGuidGenerator();

            var capManager = new ProjectCapabilityManager(PBXProject.GetPBXProjectPath(GetTestOutputPath()), "test.entitlements", PBXProject.GetUnityTargetName());

            capManager.AddApplePay(new string[] { "test1", "test2" });
            capManager.WriteToFile();

            TestOutputProject(capManager.project, "add_applepay.pbxproj");
            TestOutput("test.entitlements", "add_applepay.entitlements");
        }
        public void AddMultipleCapabilitiesWithEntitlementWorks()
        {
            SetupTestProject();
            ResetGuidGenerator();

            var capManager = new ProjectCapabilityManager(PBXProject.GetPBXProjectPath(GetTestOutputPath()), "test.entitlements", PBXProject.GetUnityTargetName());

            capManager.AddiCloud(true, false, false, true, new string[] {});
            capManager.AddApplePay(new string[] { "test1", "test2" });
            capManager.AddSiri();
            capManager.WriteToFile();

            TestOutputProject(capManager.project, "add_multiple_entitlements.pbxproj");
            TestOutput("test.entitlements", "add_multiple_entitlements.entitlements");
        }
        static void AddCapabilities(PBXProject proj, string targetGuid, ProjectCapabilityManager capManager)
        {
            var capability = ISD_Settings.Instance.Capability;

            if (capability.iCloud.Enabled)
            {
                if (capability.iCloud.iCloudDocument || capability.iCloud.customContainers.Count > 0)
                {
                    capManager.AddiCloud(capability.iCloud.keyValueStorage, capability.iCloud.iCloudDocument, capability.iCloud.customContainers.ToArray());
                }
                else
                {
                    capManager.AddiCloud(capability.iCloud.keyValueStorage, false, null);
                }
            }

            if (capability.PushNotifications.Enabled)
            {
                capManager.AddPushNotifications(capability.PushNotifications.development);
            }

            if (capability.GameCenter.Enabled)
            {
                capManager.AddGameCenter();
            }

            if (capability.Wallet.Enabled)
            {
                capManager.AddWallet(capability.Wallet.passSubset.ToArray());
            }

            if (capability.Siri.Enabled)
            {
                capManager.AddSiri();
            }

            if (capability.ApplePay.Enabled)
            {
                capManager.AddApplePay(capability.ApplePay.merchants.ToArray());
            }

            if (capability.InAppPurchase.Enabled)
            {
                capManager.AddInAppPurchase();
            }

            if (capability.Maps.Enabled)
            {
                var options = MapsOptions.None;
                foreach (var opt in capability.Maps.options)
                {
                    MapsOptions opt2 = (MapsOptions)opt;
                    options |= opt2;
                }
                capManager.AddMaps(options);
            }

            if (capability.PersonalVPN.Enabled)
            {
                capManager.AddPersonalVPN();
            }

            if (capability.BackgroundModes.Enabled)
            {
                var options = BackgroundModesOptions.None;
                foreach (var opt in capability.BackgroundModes.options)
                {
                    BackgroundModesOptions opt2 = (BackgroundModesOptions)opt;
                    options |= opt2;
                }
                capManager.AddBackgroundModes(options);
            }


            if (capability.InterAppAudio.Enabled)
            {
                capManager.AddInterAppAudio();
            }

            if (capability.KeychainSharing.Enabled)
            {
                capManager.AddKeychainSharing(capability.KeychainSharing.accessGroups.ToArray());
            }

            if (capability.AssociatedDomains.Enabled)
            {
                capManager.AddAssociatedDomains(capability.AssociatedDomains.domains.ToArray());
            }

            if (capability.AppGroups.Enabled)
            {
                capManager.AddAppGroups(capability.AppGroups.groups.ToArray());
            }

            if (capability.DataProtection.Enabled)
            {
                capManager.AddDataProtection();
            }

            if (capability.HomeKit.Enabled)
            {
                capManager.AddHomeKit();
            }

            if (capability.HealthKit.Enabled)
            {
                capManager.AddHealthKit();
            }

            if (capability.WirelessAccessoryConfiguration.Enabled)
            {
                capManager.AddWirelessAccessoryConfiguration();
            }

            /*
             *
             *
             * if (ISD_Settings.Instance.Capabilities.Count == 0) {
             *  return;
             * }
             *
             *
             * foreach (var cap in ISD_Settings.Instance.Capabilities) {
             *  switch(cap.CapabilityType) {
             *
             *
             *       case ISD_CapabilityType.InAppPurchase:
             *          capManager.AddInAppPurchase();
             *          break;
             *      case ISD_CapabilityType.GameCenter:
             *          capManager.AddGameCenter();
             *          break;
             *      case ISD_CapabilityType.PushNotifications:
             *          var pushSettings = ISD_Settings.Instance.PushNotificationsCapabilitySettings;
             *          capManager.AddPushNotifications(pushSettings.Development);
             *          break;
             *
             *      default:
             *          var capability = ISD_PBXCapabilityTypeUtility.ToPBXCapability(cap.CapabilityType);
             *          string entitlementsFilePath = null;
             *          if(!string.IsNullOrEmpty(cap.EntitlementsFilePath)) {
             *              entitlementsFilePath = cap.EntitlementsFilePath;
             *          }
             *
             *
             *          proj.AddCapability(targetGuid, capability, entitlementsFilePath, cap.AddOptionalFramework);
             *          break;
             *  }
             * }
             */
        }
예제 #4
0
        private static void AddCapabilities(ProjectCapabilityManager capManager)
        {
            var capability = ISD_Settings.Instance.Capability;

            if (capability.iCloud.Enabled)
            {
                if (capability.iCloud.iCloudDocument || capability.iCloud.customContainers.Count > 0)
                {
                    capManager.AddiCloud(capability.iCloud.keyValueStorage, capability.iCloud.iCloudDocument, capability.iCloud.customContainers.ToArray());
                }
                else
                {
                    capManager.AddiCloud(capability.iCloud.keyValueStorage, false, null);
                }
            }

            if (capability.PushNotifications.Enabled)
            {
                capManager.AddPushNotifications(capability.PushNotifications.development);
            }

            if (capability.GameCenter.Enabled)
            {
                capManager.AddGameCenter();
            }

            if (capability.Wallet.Enabled)
            {
                capManager.AddWallet(capability.Wallet.passSubset.ToArray());
            }

            if (capability.Siri.Enabled)
            {
                capManager.AddSiri();
            }

            if (capability.ApplePay.Enabled)
            {
                capManager.AddApplePay(capability.ApplePay.merchants.ToArray());
            }

            if (capability.InAppPurchase.Enabled)
            {
                capManager.AddInAppPurchase();
            }

            if (capability.Maps.Enabled)
            {
                var options = MapsOptions.None;
                foreach (var opt in capability.Maps.options)
                {
                    MapsOptions opt2 = (MapsOptions)opt;
                    options |= opt2;
                }
                capManager.AddMaps(options);
            }

            if (capability.PersonalVPN.Enabled)
            {
                capManager.AddPersonalVPN();
            }

            if (capability.BackgroundModes.Enabled)
            {
                var options = BackgroundModesOptions.None;
                foreach (var opt in capability.BackgroundModes.options)
                {
                    BackgroundModesOptions opt2 = (BackgroundModesOptions)opt;
                    options |= opt2;
                }
                capManager.AddBackgroundModes(options);
            }


            if (capability.InterAppAudio.Enabled)
            {
                capManager.AddInterAppAudio();
            }

            if (capability.KeychainSharing.Enabled)
            {
                capManager.AddKeychainSharing(capability.KeychainSharing.accessGroups.ToArray());
            }

            if (capability.AssociatedDomains.Enabled)
            {
                capManager.AddAssociatedDomains(capability.AssociatedDomains.domains.ToArray());
            }

            if (capability.AppGroups.Enabled)
            {
                capManager.AddAppGroups(capability.AppGroups.groups.ToArray());
            }

            if (capability.DataProtection.Enabled)
            {
                capManager.AddDataProtection();
            }

            if (capability.HomeKit.Enabled)
            {
                capManager.AddHomeKit();
            }

            if (capability.HealthKit.Enabled)
            {
                capManager.AddHealthKit();
            }

            if (capability.WirelessAccessoryConfiguration.Enabled)
            {
                capManager.AddWirelessAccessoryConfiguration();
            }
        }