Exemplo n.º 1
0
        private static void DecompressTwitterFrameworkFiles()
        {
            string _projectPath = AssetsUtility.GetProjectPath();
            string _twitterNativeCodeFolderPath = Path.Combine(_projectPath, kRelativePathIOSNativeCodeFolder + "/Twitter");
            string _twitterTempFolderPath       = Path.Combine(_projectPath, kRelativePathNativePluginsTempFolder + "/Twitter");

            if (!Directory.Exists(_twitterNativeCodeFolderPath))
            {
                return;
            }

            Directory.CreateDirectory(_twitterTempFolderPath);

            // ***********************
            // Framework Section
            // ***********************
            string[] _zippedFiles = Directory.GetFiles(_twitterNativeCodeFolderPath, "*.gz", SearchOption.AllDirectories);
            string   _destFolder  = Path.Combine(_twitterTempFolderPath, "Framework");

            Directory.CreateDirectory(_destFolder);

            // Iterate through each zip files
            foreach (string _curZippedFile in _zippedFiles)
            {
                Zip.DecompressToDirectory(_curZippedFile, _destFolder);
            }
        }
Exemplo n.º 2
0
        private static string GetTwitterXcodeModFilePath()
        {
            string _projectPath    = AssetsUtility.GetProjectPath();
            string _externalFolder = Path.Combine(_projectPath, kExtenalFolderRelativePath);
            string _twitterModFile = Path.Combine(_externalFolder, "Twitter.xcodemods");

            return(_twitterModFile);
        }
Exemplo n.º 3
0
        private static void DecompressTwitterSDKFiles()
        {
            string _projectPath = AssetsUtility.GetProjectPath();
            string _twitterNativeCodeFolderPath = Path.Combine(_projectPath, kRelativePathIOSNativeCodeFolder + "/Twitter");

            if (!Directory.Exists(_twitterNativeCodeFolderPath))
            {
                return;
            }

            foreach (string _filePath in Directory.GetFiles(_twitterNativeCodeFolderPath, "*.gz", SearchOption.AllDirectories))
            {
                Zip.DecompressToDirectory(_filePath, kRelativePathNativePluginsSDKFolder);
            }
        }
Exemplo n.º 4
0
        private static void RemoveOlderVersionFiles()
        {
            string _projectPath    = AssetsUtility.GetProjectPath();
            string _externalFolder = Path.Combine(_projectPath, kExtenalFolderRelativePath);

            // Remove xcode mod file
            string _oldModFile = Path.Combine(_externalFolder, "NPFramework.xcodemods");

            if (File.Exists(_oldModFile))
            {
                File.Delete(_oldModFile);
            }

            // Remove framework folder
            string _oldFrameworkFolder = Path.Combine(_externalFolder, "Framework");

            if (Directory.Exists(_oldFrameworkFolder))
            {
                Directory.Delete(_oldFrameworkFolder, true);
            }
        }
Exemplo n.º 5
0
        private static void AddTwitterFilesToProject()
        {
            string _twitterNativeFolder = AssetsUtility.AssetPathToAbsolutePath(kRelativePathToTwitterNativeFiles);
            string _twitterConfileFile  = Path.Combine(_twitterNativeFolder, "Config.txt");

            // Re move the files if version has changed
            if (File.Exists(_twitterConfileFile))
            {
                string _fileVersion = File.ReadAllText(_twitterConfileFile);

                if (string.Compare(_fileVersion, EditorPrefs.GetString(kTwitterConfigKey, "0")) == 0)
                {
                    return;
                }

                EditorPrefs.SetString(kTwitterConfigKey, _fileVersion);
            }

            // Start moving files and framework
            string _projectPath           = AssetsUtility.GetProjectPath();
            string _twitterExternalFolder = Path.Combine(_projectPath, kExtenalFolderRelativePath + "/Twitter");

            if (Directory.Exists(_twitterExternalFolder))
            {
                Directory.Delete(_twitterExternalFolder, true);
            }

            Directory.CreateDirectory(_twitterExternalFolder);

            List <string> _twitterFilesList  = new List <string>();
            List <string> _twitterFolderList = new List <string>();

            // ***********************
            // Source code section
            // ***********************
            string _nativeCodeSourceFolder = Path.Combine(_twitterNativeFolder, "Source");
            string _nativeCodeDestFolder   = Path.Combine(_twitterExternalFolder, "Source");

            // Copying folder
            IOExtensions.CopyFilesRecursively(_nativeCodeSourceFolder, _nativeCodeDestFolder);

            // Adding source folder to modifier
            _twitterFolderList.Add("Twitter/Source:-fno-objc-arc");

            // ***********************
            // Framework Section
            // ***********************
            string[] _zippedFrameworkFiles = Directory.GetFiles(_twitterNativeFolder, "*.gz", SearchOption.AllDirectories);
            string   _destFrameworkFolder  = Path.Combine(_twitterExternalFolder, "Framework");

            if (!Directory.Exists(_destFrameworkFolder))
            {
                Directory.CreateDirectory(_destFrameworkFolder);
            }

            // Iterate through each zip files
            foreach (string _curZippedFile in _zippedFrameworkFiles)
            {
                Zip.DecompressToDirectory(_curZippedFile, _destFrameworkFolder);

                // Adding file to modifier
                _twitterFilesList.Add("Twitter/Framework/" + Path.GetFileNameWithoutExtension(_curZippedFile));
            }

            // ***********************
            // Xcode modifier Section
            // ***********************
            Dictionary <string, object> _xcodeModDict = new Dictionary <string, object>();

            _xcodeModDict["group"]      = "NativePlugins-Twitter";
            _xcodeModDict["libs"]       = new string[0];
            _xcodeModDict["frameworks"] = new string[] {
                "Accounts.framework:weak",
                "Social.framework:weak"
            };
            _xcodeModDict["headerpaths"] = new string[0];
            _xcodeModDict["files"]       = _twitterFilesList;
            _xcodeModDict["folders"]     = _twitterFolderList;
            _xcodeModDict["excludes"]    = new string[] {
                "^.*.meta$",
                "^.*.mdown$",
                "^.*.pdf$",
                "^.*.DS_Store"
            };
            _xcodeModDict["compiler_flags"] = new string[0];
            _xcodeModDict["linker_flags"]   = new string[0];

            File.WriteAllText(GetTwitterXcodeModFilePath(), _xcodeModDict.ToJSON());
        }