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()); }
protected void SendConfigInfoToNative(string[] _senderIDs, Dictionary<string,string> _customKeysInfo, bool _needsBigStyle, Texture2D _whiteSmallNotificationIcon) { if (_senderIDs.Length == 0) { Console.LogError(Constants.kDebugTag, "Add senderid list for notifications to work"); } List<string> list = new List<string>(_senderIDs); //Pass this to android Plugin.Call(NativeInfo.Methods.INITIALIZE,list.ToJSON(),_customKeysInfo.ToJSON(), _needsBigStyle, _whiteSmallNotificationIcon == null ? false : true); }
private void PickImageFinished (string _path) { Dictionary<string, object> _packedData = new Dictionary<string, object>(); _packedData[kImagePath] = _path; _packedData[kFinishReason] = (int)ePickImageFinishReason.SELECTED; if (NPBinding.MediaLibrary != null) NPBinding.MediaLibrary.InvokeMethod(kPickImageFinishedEvent, _packedData.ToJSON()); // Reset view ResetView(); }
private void PickImageCancelled() { Dictionary<string, int> _packedData = new Dictionary<string, int>(); _packedData[kFinishReason] = (int)ePickImageFinishReason.CANCELLED; if (NPBinding.MediaLibrary != null) NPBinding.MediaLibrary.InvokeMethod(kPickImageFinishedEvent, _packedData.ToJSON()); // Reset view ResetView(); }
void AlertDialogCallback(string _selectedButton, string _callerTag) { Dictionary<string, string> _dataDict = new Dictionary<string, string>(); _dataDict[kButtonPressed] = _selectedButton; _dataDict[kCaller] = _callerTag; if (NPBinding.UI != null) NPBinding.UI.InvokeMethod(kAlertDialogClosedEvent, _dataDict.ToJSON()); }
void LoginPromptCallback(string _selectedButton, GUIPromptDialog.InputFieldElement[] _inputList) { Dictionary<string, string> _dataDict = new Dictionary<string, string>(); _dataDict[kButtonPressed] = _selectedButton; //Adding some default text here _dataDict[kUserName] = ""; _dataDict[kPassword] = ""; if(_inputList != null) { if(_inputList[0] != null) { _dataDict[kUserName] = _inputList[0].GetCurrentText(); } if(_inputList[1] != null) { _dataDict[kPassword] = _inputList[1].GetCurrentText(); } } if (NPBinding.UI != null) NPBinding.UI.InvokeMethod(kLoginPromptDialogClosedEvent, _dataDict.ToJSON()); }
void SingleFieldPromptCallback(string _selectedButton, GUIPromptDialog.InputFieldElement[] _inputList) { Dictionary<string, string> _dataDict = new Dictionary<string, string>(); _dataDict[kButtonPressed] = _selectedButton; if(_inputList != null && _inputList[0] != null) { _dataDict[kInput] = _inputList[0].GetCurrentText(); } if (NPBinding.UI != null) NPBinding.UI.InvokeMethod(kSingleFieldPromptDialogClosedEvent, _dataDict.ToJSON()); }