private static void AddSwiftSupportIfNeeded(string buildPath, PBXProject project, string targetGuid)
        {
            var swiftFileRelativePath             = "Classes/MAXSwiftSupport.swift";
            var swiftFilePath                     = Path.Combine(buildPath, swiftFileRelativePath);
            var maxMediationDirectory             = PluginMediationDirectory;
            var hasSwiftLanguageNetworksInProject = SwiftLanguageNetworks.Any(network => Directory.Exists(Path.Combine(maxMediationDirectory, network)));

            // Remove Swift file if no need to support Swift
            if (!hasSwiftLanguageNetworksInProject)
            {
                if (File.Exists(swiftFilePath))
                {
                    MaxSdkLogger.D("Removing Swift file references.");

                    var fileGuid = project.FindFileGuidByRealPath(swiftFilePath, PBXSourceTree.Source);
                    if (!string.IsNullOrEmpty(fileGuid))
                    {
                        project.RemoveFile(fileGuid);
                        project.RemoveFileFromBuild(targetGuid, fileGuid);

                        FileUtil.DeleteFileOrDirectory(swiftFilePath);
                    }
                }

                return;
            }

            // Add Swift file
            CreateSwiftFile(swiftFilePath);
            var swiftFileGuid = project.AddFile(swiftFilePath, swiftFileRelativePath, PBXSourceTree.Source);

            project.AddFileToBuild(targetGuid, swiftFileGuid);

            // Add Swift build properties
            project.AddBuildProperty(targetGuid, "SWIFT_VERSION", "5");
            project.AddBuildProperty(targetGuid, "CLANG_ENABLE_MODULES", "YES");
        }
Exemplo n.º 2
0
 private static void LogUnsubscribedToEvent(string eventName)
 {
     MaxSdkLogger.D("Listener has been removed from callback: " + eventName);
 }
Exemplo n.º 3
0
 private static void LogSubscribedToEvent(string eventName)
 {
     MaxSdkLogger.D("Listener has been added to callback: " + eventName);
 }