Example #1
0
        private IEnumerator CRDeleteContact(ContactView view, Contact contact)
        {
            yield return(StartCoroutine(CRRequestPermission(AndroidPermission.AndroidPermissionWriteContacts)));

            if (contact == null)
            {
                yield break;
            }

            var message = string.Format("Delete contact with id: " + (contact.Id ?? "null"));
            var alert   = NativeUI.ShowTwoButtonAlert("Delete Contact", message, "Yes", "No");

            alert.OnComplete += button =>
            {
                if (button == 1) // Click No
                {
                    return;
                }

                var deleteResult = DeviceContacts.DeleteContact(contact);
                if (deleteResult != null)
                {
                    Debug.LogWarning(deleteResult);
                    return;
                }

                createdViews.Remove(view);
                Destroy(view.gameObject);
            };
        }
Example #2
0
        public override void OnEnter()
        {
            ContactObject temp    = (ContactObject)contactObj.Value;
            Contact       contact = temp.Contact;
            string        error   = DeviceContacts.DeleteContact(contact);

            if (string.IsNullOrEmpty(error))
            {
                Fsm.Event(eventTarget, isSuccessEvent);
            }
            else
            {
                Fsm.Event(eventTarget, isNotSuccessEvent);
            }
        }