//This will create texture from the pictue image path void LoadContactPictures(AddressBookContact[] _contactList) { m_contactPictures = new Texture[_contactList.Length]; for(int _i = 0; _i < _contactList.Length ; _i++) { AddressBookContact _each = _contactList[_i]; if (!string.IsNullOrEmpty(_each.ImagePath)) { //Create callback receiver and save the index to pass to completion block. int _textureIndex = _i; DownloadTexture.Completion _onCompletion = (Texture2D _texture, string _error)=>{ if (!string.IsNullOrEmpty(_error)) { Console.LogError(Constants.kDebugTag, "[AddressBook] Contact Picture download failed " + _error); m_contactPictures[_textureIndex] = null; } else { m_contactPictures[_textureIndex] = _texture; } }; //Start the texture fetching _each.GetImageAsync(_onCompletion); } } }
private void ABReadContactsFinished (eABAuthorizationStatus _authStatus, AddressBookContact[] _contactsList) { Console.Log(Constants.kDebugTag, string.Format("[AddressBook] Read contacts finished. Status= {0}.", _authStatus)); if (ReadContactsFinishedEvent != null) ReadContactsFinishedEvent(_authStatus, _contactsList); }
private void ABReadContactsFinished(AddressBookContact[] _contactsList) { Console.Log(Constants.kDebugTag, "[AddressBook] Reading contacts finished, Status=" + eABAuthorizationStatus.AUTHORIZED + " " + "Read contacts count=" + _contactsList.Length); // Invoke callback if (OnReadContactsFinished != null) OnReadContactsFinished(eABAuthorizationStatus.AUTHORIZED, _contactsList); }
/// <summary> /// Initializes a new instance of the <see cref="AddressBookContact"/> class by details from _source. /// </summary> /// <param name="_source">Source to copy from.</param> public AddressBookContact(AddressBookContact _source) { FirstName = _source.FirstName; LastName = _source.LastName; ImagePath = _source.ImagePath; PhoneNumberList = _source.PhoneNumberList; EmailIDList = _source.EmailIDList; }
/// <summary> /// Initializes a new instance of the <see cref="AddressBookContact"/> class by details from _source. /// </summary> /// <param name="_source">Source to copy from.</param> public AddressBookContact(AddressBookContact _source) { this.FirstName = _source.FirstName; this.LastName = _source.LastName; this.ImagePath = _source.ImagePath; this.m_image = _source.m_image; this.m_imageDownloadError = _source.m_imageDownloadError; this.PhoneNumberList = _source.PhoneNumberList; this.EmailIDList = _source.EmailIDList; }
//Callback triggered after fetching contacts void OnReceivingContacts(eABAuthorizationStatus _authorizationStatus, AddressBookContact[] _contactList) { if (_authorizationStatus == eABAuthorizationStatus.AUTHORIZED) { m_contactsInfo = _contactList; //This loads textures into m_contactPictures LoadContactPictures(m_contactsInfo); } else { Console.LogError(Constants.kDebugTag, "[AddressBook] " + _authorizationStatus); } AddNewResult("Received OnReceivingContacts Event. Authorization Status = " +_authorizationStatus); }
private void ABReadContactsFinished(string _contactsJsonStr) { IList _contactsJsonList = JSONUtility.FromJSON(_contactsJsonStr) as IList; int _count = _contactsJsonList.Count; AddressBookContact[] _contactsList = new AddressBookContact[_count]; for (int _iter = 0; _iter < _count; _iter++) { AddressBookContact _contact; IDictionary _contactInfoDict = _contactsJsonList[_iter] as IDictionary; // Parse native data ParseContactData(_contactInfoDict, out _contact); // Add parsed object _contactsList[_iter] = _contact; } // Triggers event ABReadContactsFinished(_contactsList); }
protected override void ParseReadContactsResponseData (IDictionary _dataDict, out eABAuthorizationStatus _authStatus, out AddressBookContact[] _contactsList) { List<object> _contactsJSONList = _dataDict.GetIfAvailable<List<object>>(kContactsListKey); if (_contactsJSONList != null) { int _count = _contactsJSONList.Count; AddressBookContact[] _newContactsList = new AndroidAddressBookContact[_count]; for (int _iter = 0; _iter < _count; _iter++) _newContactsList[_iter] = new AndroidAddressBookContact((IDictionary)_contactsJSONList[_iter]); // Set properties _authStatus = eABAuthorizationStatus.AUTHORIZED; _contactsList = _newContactsList; } else { // Set properties _authStatus = GetAuthorizationStatus(_dataDict.GetIfAvailable<string>(kAuthStatusKey)); _contactsList = null; } }
protected override void ParseContactData(IDictionary _contactInfoDict, out AddressBookContact _contact) { _contact = new iOSAddressBookContact(_contactInfoDict); }
protected virtual void ParseContactData(IDictionary _contactInfoDict, out AddressBookContact _contact) { _contact = null; }
/// <summary> /// Initializes a new instance of the <see cref="AddressBookContact"/> class by details from _source. /// </summary> /// <param name="_source">Source to copy from.</param> public AddressBookContact (AddressBookContact _source) { this.FirstName = _source.FirstName; this.LastName = _source.LastName; this.ImagePath = _source.ImagePath; this.m_image = _source.m_image; this.m_imageDownloadError = _source.m_imageDownloadError; this.PhoneNumberList = _source.PhoneNumberList; this.EmailIDList = _source.EmailIDList; }
protected virtual void ParseReadContactsResponseData (IDictionary _dataDict, out eABAuthorizationStatus _authStatus, out AddressBookContact[] _contactsList) { _contactsList = null; _authStatus = eABAuthorizationStatus.DENIED; }
private void OnReceivingContacts (eABAuthorizationStatus _authorizationStatus, AddressBookContact[] _contactList) { AddNewResult(string.Format("Read contacts request finished. Authorization Status = {0}.", _authorizationStatus)); if (_contactList != null) { AppendResult(string.Format("Total no of contacts info fetched is {0}.", _contactList.Length)); m_contactsInfo = _contactList; // This loads textures into m_contactPictures StartCoroutine(LoadContactPictures(m_contactsInfo)); } }
private IEnumerator LoadContactPictures (AddressBookContact[] _contactList) { m_contactPictures = new Texture[_contactList.Length]; for (int _cIndex = 0; _cIndex < _contactList.Length ; _cIndex++) { _contactList[_cIndex].GetImageAsync((Texture2D _texture, string _error)=>{ if (!string.IsNullOrEmpty(_error)) { Console.LogError(Constants.kDebugTag, "[AddressBook] Contact Picture download failed " + _error); m_contactPictures[_cIndex] = null; } else { m_contactPictures[_cIndex] = _texture; } }); yield return new WaitForEndOfFrame(); } }
public EditorAddressBookContact (AddressBookContact _source) : base(_source) {}