Exemplo n.º 1
0
        public static void DownloadiOSFramework(Action onSuccess = null, Action <string> onFailure = null)
        {
            IOSDownloadInProgress = true;

            var pluginFolderPath = Path.Combine(GetSocialSettings.GetPluginPath(), DestinationFolderPathiOS);

            RemoveOldVersions(pluginFolderPath);

            var downloadFrameworkRequest = DownloadFrameworkRequest.Create(string.Format(DownloadUrliOS, BuildConfig.UnitySdkVersion),
                                                                           pluginFolderPath,
                                                                           Path.Combine(pluginFolderPath, IOSArchiveName));

            downloadFrameworkRequest.Start(() =>
            {
                IOSDownloadInProgress = false;
                UnzipFramework(Path.Combine(pluginFolderPath, IOSArchiveName), pluginFolderPath);
                AddFrameworksToAssets(new[]
                {
                    Path.Combine(DestinationFolderPathiOS, IOSFrameworkName_Core),
                    Path.Combine(DestinationFolderPathiOS, IOSFrameworkName_UI)
                });
                if (onSuccess != null)
                {
                    onSuccess();
                }
            }, error =>
            {
                IOSDownloadInProgress = false;
                Debug.LogError(string.Format("GetSocial: Failed to download native iOS SDK, error: {0}", error));
                if (onFailure != null)
                {
                    onFailure(error);
                }
            }, IsInBatchMode());
        }
Exemplo n.º 2
0
        public static void DownloadiOSFramework(Action onSuccess = null, Action <string> onFailure = null)
        {
            IOSDownloadInProgress = true;

            var pluginFolderPath = Path.Combine(GetSocialSettings.GetPluginPath(), DestinationFolderPathiOS);

            RemoveOldVersions(pluginFolderPath);

            var downloadFrameworkRequest = DownloadFrameworkRequest.Create(string.Format(DownloadUrliOS, BuildConfig.UnitySdkVersion),
                                                                           pluginFolderPath,
                                                                           Path.Combine(pluginFolderPath, IOSArchiveName));

            downloadFrameworkRequest.Start(() =>
            {
                IOSDownloadInProgress = false;
                IOSDownloadProgress   = 0;
                if (UnzipFramework(Path.Combine(pluginFolderPath, IOSArchiveName), pluginFolderPath))
                {
                    AddFrameworksToAssets(new[]
                    {
                        Path.Combine(DestinationFolderPathiOS, IOSFrameworkName_Core),
                        Path.Combine(DestinationFolderPathiOS, IOSFrameworkName_Extension),
                        Path.Combine(DestinationFolderPathiOS, IOSFrameworkName_UI)
                    });

                    foreach (var framework in IOSFrameworks)
                    {
                        UpdatePlatformState(Path.Combine(pluginFolderPath, framework), BuildTarget.iOS, true);
                    }
                    if (onSuccess != null)
                    {
                        onSuccess();
                    }
                }
                else
                {
                    var error = "unzip command failed";
                    Debug.LogError(string.Format("GetSocial: Failed to download native iOS SDK, error: {0}", error));
                    if (onFailure != null)
                    {
                        onFailure(error);
                    }
                }
            }, progress =>
            {
                IOSDownloadProgress = progress;
            }, error =>
            {
                IOSDownloadInProgress = false;
                Debug.LogError(string.Format("GetSocial: Failed to download native iOS SDK, error: {0}", error));
                if (onFailure != null)
                {
                    onFailure(error);
                }
            }, IsInBatchMode());
        }