示例#1
0
        protected override ISN_XcodeRequirements GenerateRequirements()
        {
            var requirements = new ISN_XcodeRequirements();

            requirements.AddFramework(new ISD_Framework(ISD_iOSFramework.Accounts));
            requirements.AddFramework(new ISD_Framework(ISD_iOSFramework.Social));
            requirements.AddFramework(new ISD_Framework(ISD_iOSFramework.MessageUI));



            ISD_PlistKey LSApplicationQueriesSchemes = new ISD_PlistKey();

            LSApplicationQueriesSchemes.Name = "LSApplicationQueriesSchemes";
            LSApplicationQueriesSchemes.Type = ISD_PlistKeyType.Array;


            requirements.AddInfoPlistKey(LSApplicationQueriesSchemes);

            ISD_PlistKey instagram = new ISD_PlistKey();

            instagram.StringValue = "instagram";
            instagram.Type        = ISD_PlistKeyType.String;
            LSApplicationQueriesSchemes.AddChild(instagram);

            ISD_PlistKey whatsapp = new ISD_PlistKey();

            whatsapp.StringValue = "whatsapp";
            whatsapp.Type        = ISD_PlistKeyType.String;
            LSApplicationQueriesSchemes.AddChild(whatsapp);


            return(requirements);
        }
示例#2
0
 private void ResolvePlistKey(bool isEnabled, string name, string value, ISN_XcodeRequirements requirements)
 {
     if (isEnabled)
     {
         var plistKey = new ISD_PlistKey();
         plistKey.Name = name;
         plistKey.StringValue = value;
         plistKey.Type = ISD_PlistKeyType.String;
         requirements.AddInfoPlistKey(plistKey);
     }
     else
     {
         ISD_API.RemoveInfoPlistKey(name);
     }
 }
        private string GetPlistKeyValue(string key, string defaultValue)
        {
            var plistKey = ISD_API.GetInfoPlistKey(key);

            if (plistKey == null)
            {
                plistKey             = new ISD_PlistKey();
                plistKey.Name        = key;
                plistKey.StringValue = defaultValue;
                plistKey.Type        = ISD_PlistKeyType.String;
                ISD_API.SetInfoPlistKey(plistKey);
            }

            return(plistKey.StringValue);
        }
示例#4
0
        protected override ISN_XcodeRequirements GenerateRequirements()
        {
            var requirements = new ISN_XcodeRequirements();

            requirements.AddFramework(new ISD_Framework(ISD_iOSFramework.Contacts));
            requirements.AddFramework(new ISD_Framework(ISD_iOSFramework.ContactsUI));

            var NSContactsUsageDescription = new ISD_PlistKey();

            NSContactsUsageDescription.Name        = "NSContactsUsageDescription";
            NSContactsUsageDescription.StringValue = ISN_Settings.Instance.ContactsUsageDescription;
            NSContactsUsageDescription.Type        = ISD_PlistKeyType.String;

            requirements.AddInfoPlistKey(NSContactsUsageDescription);

            return(requirements);
        }
示例#5
0
        protected override ISN_XcodeRequirements GenerateRequirements() 
        {
            var requirements = new ISN_XcodeRequirements();
            var property = new ISD_BuildProperty("GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
            requirements.AddBuildProperty(property);
            
            if (ISN_Settings.Instance.ApplicationQueriesSchemes.Count > 0) 
            {
                var LSApplicationQueriesSchemes = new ISD_PlistKey();
                LSApplicationQueriesSchemes.Name = "LSApplicationQueriesSchemes";
                LSApplicationQueriesSchemes.Type = ISD_PlistKeyType.Array;

                requirements.AddInfoPlistKey(LSApplicationQueriesSchemes);

                foreach (var scheme in ISN_Settings.Instance.ApplicationQueriesSchemes) 
                {
                    var schemeName = new ISD_PlistKey();
                    schemeName.StringValue = scheme.Identifier;
                    schemeName.Type = ISD_PlistKeyType.String;
                    LSApplicationQueriesSchemes.AddChild(schemeName);
                }
            }

            var settings = ISN_Settings.Instance;
            ResolvePlistKey(settings.CameraUsageDescriptionEnabled, 
                "NSCameraUsageDescription",
                settings.CameraUsageDescription, requirements);
            
            ResolvePlistKey(settings.PhotoLibraryUsageDescriptionEnabled, 
                "NSPhotoLibraryUsageDescription",
                settings.PhotoLibraryUsageDescription, requirements);
            
            ResolvePlistKey(settings.PhotoLibraryAddUsageDescriptionEnabled, 
                "NSPhotoLibraryAddUsageDescription",
                settings.PhotoLibraryAddUsageDescription, requirements);
            
            ResolvePlistKey(settings.MicrophoneUsageDescriptionEnabled, 
                "NSMicrophoneUsageDescription",
                settings.MicrophoneUsageDescription, requirements);

            return requirements;
        }
        protected override void AddXcodePlistKey(ISD_PlistKey key)
        {
            if (key.Name.Equals("LSApplicationQueriesSchemes"))
            {
                var existingKey = ISD_API.GetInfoPlistKey("LSApplicationQueriesSchemes");
                if (existingKey == null)
                {
                    ISD_API.SetInfoPlistKey(key);
                }
                else
                {
                    List <ISD_PlistKey> missingKeys = new List <ISD_PlistKey>();

                    foreach (var testeChild in key.Children)
                    {
                        bool contains = false;
                        foreach (var child in existingKey.Children)
                        {
                            if (child.StringValue.Equals(testeChild.StringValue))
                            {
                                contains = true;
                            }
                        }
                        if (!contains)
                        {
                            missingKeys.Add(testeChild);
                        }
                    }

                    foreach (var child in missingKeys)
                    {
                        existingKey.AddChild(child);
                    }
                }
            }
            else
            {
                base.AddXcodePlistKey(key);
            }
        }
示例#7
0
        protected override ISN_XcodeRequirements GenerateRequirements()
        {
            var requirements = new ISN_XcodeRequirements();

            requirements.AddFramework(new ISD_Framework(ISD_iOSFramework.CoreLocation));

            var nsLocationWhenInUseUsageDescription = new ISD_PlistKey();

            nsLocationWhenInUseUsageDescription.Name        = "NSLocationWhenInUseUsageDescription";
            nsLocationWhenInUseUsageDescription.StringValue = ISN_Settings.Instance.LocationWhenInUseUsageDescription;
            nsLocationWhenInUseUsageDescription.Type        = ISD_PlistKeyType.String;
            requirements.AddInfoPlistKey(nsLocationWhenInUseUsageDescription);

            var nsLocationAlwaysAndWhenInUseUsageDescription = new ISD_PlistKey();

            nsLocationAlwaysAndWhenInUseUsageDescription.Name        = "NSLocationAlwaysAndWhenInUseUsageDescription";
            nsLocationAlwaysAndWhenInUseUsageDescription.StringValue = ISN_Settings.Instance.LocationAlwaysAndWhenInUseUsageDescription;
            nsLocationAlwaysAndWhenInUseUsageDescription.Type        = ISD_PlistKeyType.String;
            requirements.AddInfoPlistKey(nsLocationAlwaysAndWhenInUseUsageDescription);

            return(requirements);
        }
        protected override void RemoveXcodePlistKey(ISD_PlistKey key)
        {
            if (key.Name.Equals("LSApplicationQueriesSchemes"))
            {
                var existingKey = ISD_API.GetInfoPlistKey("LSApplicationQueriesSchemes");
                if (existingKey == null)
                {
                    return;
                }

                List <ISD_PlistKey> keysToRemove = new List <ISD_PlistKey>();
                foreach (var testeChild in key.Children)
                {
                    var existingChild = existingKey.GetChildByStringValue(testeChild.StringValue);
                    if (existingChild != null)
                    {
                        keysToRemove.Add(existingChild);
                    }
                }

                if (keysToRemove.Count == existingKey.Children.Count)
                {
                    ISD_API.RemoveInfoPlistKey(existingKey);
                }
                else
                {
                    foreach (var removeKey in keysToRemove)
                    {
                        existingKey.RemoveChild(removeKey);
                    }
                }
            }
            else
            {
                base.RemoveXcodePlistKey(key);
            }
        }
示例#9
0
 public void AddInfoPlistKey(ISD_PlistKey variables)
 {
     m_plistKeys.Add(variables);
 }
示例#10
0
 protected virtual void AddXcodePlistKey(ISD_PlistKey key)
 {
     ISD_API.SetInfoPlistKey(key);
 }
示例#11
0
 protected virtual void RemoveXcodePlistKey(ISD_PlistKey key)
 {
     ISD_API.RemoveInfoPlistKey(key);
 }
        protected override ISN_XcodeRequirements GenerateRequirements()
        {
            var requirements = new ISN_XcodeRequirements();

            if (ISN_Settings.Instance.ShortcutItems.Count > 0)
            {
                ISD_PlistKey UIApplicationShortcutItems = new ISD_PlistKey();
                UIApplicationShortcutItems.Name = "UIApplicationShortcutItems";
                UIApplicationShortcutItems.Type = ISD_PlistKeyType.Array;

                requirements.AddInfoPlistKey(UIApplicationShortcutItems);

                foreach (var shortcut in ISN_Settings.Instance.ShortcutItems)
                {
                    var ShortcutItem = new ISD_PlistKey();
                    ShortcutItem.Type = ISD_PlistKeyType.Dictionary;
                    UIApplicationShortcutItems.AddChild(ShortcutItem);

                    var ShortcutItemTitle = new ISD_PlistKey();
                    ShortcutItemTitle.Name        = "UIApplicationShortcutItemTitle";
                    ShortcutItemTitle.StringValue = shortcut.Title;
                    ShortcutItem.AddChild(ShortcutItemTitle);

                    var ShortcutItemSubtitle = new ISD_PlistKey();
                    ShortcutItemSubtitle.Name        = "UIApplicationShortcutItemSubtitle";
                    ShortcutItemSubtitle.StringValue = shortcut.Subtitle;
                    ShortcutItem.AddChild(ShortcutItemSubtitle);


                    var ShortcutItemType = new ISD_PlistKey();
                    ShortcutItemType.Name        = "UIApplicationShortcutItemType";
                    ShortcutItemType.StringValue = shortcut.Type;
                    ShortcutItem.AddChild(ShortcutItemType);
                }
            }


            if (ISN_Settings.Instance.UrlTypes.Count > 0)
            {
                ISD_PlistKey CFBundleURLTypes = new ISD_PlistKey();
                CFBundleURLTypes.Name = "CFBundleURLTypes";
                CFBundleURLTypes.Type = ISD_PlistKeyType.Array;

                requirements.AddInfoPlistKey(CFBundleURLTypes);


                foreach (ISN_UIUrlType url in ISN_Settings.Instance.UrlTypes)
                {
                    ISD_PlistKey URLTypeHolder = new ISD_PlistKey();
                    URLTypeHolder.Type = ISD_PlistKeyType.Dictionary;
                    CFBundleURLTypes.AddChild(URLTypeHolder);


                    ISD_PlistKey CFBundleURLName = new ISD_PlistKey();
                    CFBundleURLName.Type        = ISD_PlistKeyType.String;
                    CFBundleURLName.Name        = "CFBundleURLName";
                    CFBundleURLName.StringValue = url.Identifier;
                    URLTypeHolder.AddChild(CFBundleURLName);


                    ISD_PlistKey CFBundleURLSchemes = new ISD_PlistKey();
                    CFBundleURLSchemes.Type = ISD_PlistKeyType.Array;
                    CFBundleURLSchemes.Name = "CFBundleURLSchemes";
                    URLTypeHolder.AddChild(CFBundleURLSchemes);

                    foreach (string scheme in url.Schemes)
                    {
                        ISD_PlistKey Scheme = new ISD_PlistKey();
                        Scheme.Type        = ISD_PlistKeyType.String;
                        Scheme.StringValue = scheme;
                        CFBundleURLSchemes.AddChild(Scheme);
                    }
                }
            }


            return(requirements);
        }
示例#13
0
    public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
    {
        if (IOSNativeSettings.Instance.EnableForceTouchAPI && IOSNativeSettings.Instance.ForceTouchMenu.Count > 0)
        {
            ISD_PlistKey UIApplicationShortcutItems = new ISD_PlistKey();
            UIApplicationShortcutItems.Name = "UIApplicationShortcutItems";
            UIApplicationShortcutItems.Type = ISD_PlistKeyType.Array;

            foreach (var item in IOSNativeSettings.Instance.ForceTouchMenu)
            {
                var ShortcutItem = new ISD_PlistKey();
                ShortcutItem.Type = ISD_PlistKeyType.Dictionary;
                UIApplicationShortcutItems.AddChild(ShortcutItem);


                var ShortcutItemTitle = new ISD_PlistKey();
                ShortcutItemTitle.Name        = "UIApplicationShortcutItemTitle";
                ShortcutItemTitle.StringValue = item.Title;
                ShortcutItem.AddChild(ShortcutItemTitle);

                var ShortcutItemSubtitle = new ISD_PlistKey();
                ShortcutItemSubtitle.Name        = "UIApplicationShortcutItemSubtitle";
                ShortcutItemSubtitle.StringValue = item.Subtitle;
                ShortcutItem.AddChild(ShortcutItemSubtitle);


                var ShortcutItemType = new ISD_PlistKey();
                ShortcutItemType.Name        = "UIApplicationShortcutItemType";
                ShortcutItemType.StringValue = item.Action;
                ShortcutItem.AddChild(ShortcutItemType);
            }


            ISD_API.SetInfoPlistKey(UIApplicationShortcutItems);
        }


        if (IOSNativeSettings.Instance.EnablePermissionAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.Photos);
            ISD_API.AddFramework(ISD_iOSFramework.Contacts);
            ISD_API.AddFramework(ISD_iOSFramework.EventKit);
        }


        if (IOSNativeSettings.Instance.EnablePushNotificationsAPI)
        {
            ISD_PlistKey UIBackgroundModes = new ISD_PlistKey();
            UIBackgroundModes.Name = "UIBackgroundModes";
            UIBackgroundModes.Type = ISD_PlistKeyType.Array;

            ISD_PlistKey remoteNotification = new ISD_PlistKey();
            remoteNotification.Name        = "remote-notification";
            remoteNotification.StringValue = "remote-notification";
            remoteNotification.Type        = ISD_PlistKeyType.String;

            UIBackgroundModes.AddChild(remoteNotification);
            ISD_API.SetInfoPlistKey(UIBackgroundModes);
        }



        if (IOSNativeSettings.Instance.EnableInAppsAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.StoreKit);
        }

        if (IOSNativeSettings.Instance.EnableGameCenterAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.GameKit);

            ISD_PlistKey UIRequiredDeviceCapabilities = new ISD_PlistKey();
            UIRequiredDeviceCapabilities.Name = "UIRequiredDeviceCapabilities";
            UIRequiredDeviceCapabilities.Type = ISD_PlistKeyType.Array;

            ISD_PlistKey gamekit = new ISD_PlistKey();
            gamekit.StringValue = "gamekit";
            gamekit.Type        = ISD_PlistKeyType.String;
            UIRequiredDeviceCapabilities.AddChild(gamekit);


            ISD_PlistKey armv7 = new ISD_PlistKey();
            armv7.StringValue = "armv7";
            armv7.Type        = ISD_PlistKeyType.String;
            UIRequiredDeviceCapabilities.AddChild(armv7);


            ISD_API.SetInfoPlistKey(UIRequiredDeviceCapabilities);
        }

        if (IOSNativeSettings.Instance.UrlTypes.Count > 0)
        {
            ISD_PlistKey CFBundleURLTypes = new ISD_PlistKey();
            CFBundleURLTypes.Name = "CFBundleURLTypes";
            CFBundleURLTypes.Type = ISD_PlistKeyType.Array;



            foreach (SA.IOSNative.Models.UrlType url in IOSNativeSettings.Instance.UrlTypes)
            {
                ISD_PlistKey URLTypeHolder = new ISD_PlistKey();
                URLTypeHolder.Type = ISD_PlistKeyType.Dictionary;

                CFBundleURLTypes.AddChild(URLTypeHolder);


                ISD_PlistKey CFBundleURLName = new ISD_PlistKey();
                CFBundleURLName.Type        = ISD_PlistKeyType.String;
                CFBundleURLName.Name        = "CFBundleURLName";
                CFBundleURLName.StringValue = url.Identifier;
                URLTypeHolder.AddChild(CFBundleURLName);


                ISD_PlistKey CFBundleURLSchemes = new ISD_PlistKey();
                CFBundleURLSchemes.Type = ISD_PlistKeyType.Array;
                CFBundleURLSchemes.Name = "CFBundleURLSchemes";
                URLTypeHolder.AddChild(CFBundleURLSchemes);

                foreach (string scheme in url.Schemes)
                {
                    ISD_PlistKey Scheme = new ISD_PlistKey();
                    Scheme.Type        = ISD_PlistKeyType.String;
                    Scheme.StringValue = scheme;

                    CFBundleURLSchemes.AddChild(Scheme);
                }
            }

            foreach (ISD_PlistKey v in  SA.IOSDeploy.ISD_Settings.Instance.PlistVariables)
            {
                if (v.Name.Equals(CFBundleURLTypes.Name))
                {
                    SA.IOSDeploy.ISD_Settings.Instance.PlistVariables.Remove(v);
                    break;
                }
            }
            SA.IOSDeploy.ISD_Settings.Instance.PlistVariables.Add(CFBundleURLTypes);
        }



        if (IOSNativeSettings.Instance.EnableSocialSharingAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.Accounts);
            ISD_API.AddFramework(ISD_iOSFramework.Social);
            ISD_API.AddFramework(ISD_iOSFramework.MessageUI);



            string       QueriesSchemesName          = "LSApplicationQueriesSchemes";
            ISD_PlistKey LSApplicationQueriesSchemes = ISD_API.GetInfoPlistKey(QueriesSchemesName);
            if (LSApplicationQueriesSchemes == null)
            {
                LSApplicationQueriesSchemes      = new ISD_PlistKey();
                LSApplicationQueriesSchemes.Name = QueriesSchemesName;
                LSApplicationQueriesSchemes.Type = ISD_PlistKeyType.Array;
            }

            ISD_PlistKey instagram = new ISD_PlistKey();
            instagram.StringValue = "instagram";
            instagram.Type        = ISD_PlistKeyType.String;
            LSApplicationQueriesSchemes.AddChild(instagram);

            ISD_PlistKey whatsapp = new ISD_PlistKey();
            whatsapp.StringValue = "whatsapp";
            whatsapp.Type        = ISD_PlistKeyType.String;
            LSApplicationQueriesSchemes.AddChild(whatsapp);


            ISD_API.SetInfoPlistKey(LSApplicationQueriesSchemes);
        }


        if (IOSNativeSettings.Instance.ApplicationQueriesSchemes.Count > 0)
        {
            string       QueriesSchemesName          = "LSApplicationQueriesSchemes";
            ISD_PlistKey LSApplicationQueriesSchemes = ISD_API.GetInfoPlistKey(QueriesSchemesName);
            if (LSApplicationQueriesSchemes == null)
            {
                LSApplicationQueriesSchemes      = new ISD_PlistKey();
                LSApplicationQueriesSchemes.Name = QueriesSchemesName;
                LSApplicationQueriesSchemes.Type = ISD_PlistKeyType.Array;
            }


            foreach (var scheme in IOSNativeSettings.Instance.ApplicationQueriesSchemes)
            {
                ISD_PlistKey schemeName = new ISD_PlistKey();
                schemeName.StringValue = scheme.Identifier;
                schemeName.Type        = ISD_PlistKeyType.String;
                LSApplicationQueriesSchemes.AddChild(schemeName);
            }

            ISD_API.SetInfoPlistKey(LSApplicationQueriesSchemes);
        }



        if (IOSNativeSettings.Instance.EnableMediaPlayerAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.MediaPlayer);


            var NSAppleMusicUsageDescription = new ISD_PlistKey();
            NSAppleMusicUsageDescription.Name        = "NSAppleMusicUsageDescription";
            NSAppleMusicUsageDescription.StringValue = IOSNativeSettings.Instance.AppleMusicUsageDescription;
            NSAppleMusicUsageDescription.Type        = ISD_PlistKeyType.String;


            ISD_API.SetInfoPlistKey(NSAppleMusicUsageDescription);
        }


        if (IOSNativeSettings.Instance.EnableCameraAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.MobileCoreServices);


            var NSCameraUsageDescription = new ISD_PlistKey();
            NSCameraUsageDescription.Name        = "NSCameraUsageDescription";
            NSCameraUsageDescription.StringValue = IOSNativeSettings.Instance.CameraUsageDescription;
            NSCameraUsageDescription.Type        = ISD_PlistKeyType.String;


            ISD_API.SetInfoPlistKey(NSCameraUsageDescription);



            var NSPhotoLibraryUsageDescription = new ISD_PlistKey();
            NSPhotoLibraryUsageDescription.Name        = "NSPhotoLibraryUsageDescription";
            NSPhotoLibraryUsageDescription.StringValue = IOSNativeSettings.Instance.PhotoLibraryUsageDescription;
            NSPhotoLibraryUsageDescription.Type        = ISD_PlistKeyType.String;


            ISD_API.SetInfoPlistKey(NSPhotoLibraryUsageDescription);


            var NSPhotoLibraryAddUsageDescription = new ISD_PlistKey();
            NSPhotoLibraryAddUsageDescription.Name        = "NSPhotoLibraryAddUsageDescription";
            NSPhotoLibraryAddUsageDescription.StringValue = IOSNativeSettings.Instance.PhotoLibraryUsageDescription;
            NSPhotoLibraryAddUsageDescription.Type        = ISD_PlistKeyType.String;


            ISD_API.SetInfoPlistKey(NSPhotoLibraryAddUsageDescription);
        }

        if (IOSNativeSettings.Instance.EnableReplayKit)
        {
            ISD_API.AddFramework(ISD_iOSFramework.ReplayKit, weak: true);
        }


        if (IOSNativeSettings.Instance.EnableCloudKit)
        {
            ISD_API.AddFramework(ISD_iOSFramework.CloudKit, weak: true);
            string inheritedflag = "$(inherited)";
            ISD_API.AddFlag(inheritedflag, ISD_FlagType.LinkerFlag);
        }

        if (IOSNativeSettings.Instance.EnablePickerAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.AssetsLibrary, weak: true);
        }


        if (IOSNativeSettings.Instance.EnableContactsAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.Contacts, weak: true);
            ISD_API.AddFramework(ISD_iOSFramework.ContactsUI, weak: true);


            var NSContactsUsageDescription = new ISD_PlistKey();
            NSContactsUsageDescription.Name        = "NSContactsUsageDescription";
            NSContactsUsageDescription.StringValue = IOSNativeSettings.Instance.ContactsUsageDescription;
            NSContactsUsageDescription.Type        = ISD_PlistKeyType.String;


            ISD_API.SetInfoPlistKey(NSContactsUsageDescription);
        }

        if (IOSNativeSettings.Instance.EnableSoomla)
        {
            ISD_API.AddFramework(ISD_iOSFramework.AdSupport);
            ISD_API.AddLibrary(ISD_iOSLibrary.libsqlite3);

                        #if UNITY_5
            string soomlaLinkerFlag = "-force_load Libraries/Plugins/iOS/libSoomlaGrowLite.a";
                        #else
            string soomlaLinkerFlag = "-force_load Libraries/libSoomlaGrowLite.a";
#endif

            ISD_API.AddFlag(soomlaLinkerFlag, ISD_FlagType.LinkerFlag);
        }

        if (IOSNativeSettings.Instance.EnableUserNotificationsAPI)
        {
            ISD_API.AddFramework(ISD_iOSFramework.UserNotifications);
        }

        Debug.Log("ISN Postprocess Done");
    }