Esempio n. 1
0
        // clear cache in untiy and start over (see why Im getting stuck in loading window in create group)

        void OpenContacts()
        {
            FriendsPhones friendsPhones = new FriendsPhones()
            {
                numbers = new List <string>()
            };

            ISN_CNContactStore.ShowContactsPickerUI((result) => {
                ContactSelectButton.SetActive(false);
                LoadingInvites.SetActive(true);
                if (result.IsSucceeded)
                {
                    foreach (var contact in result.Contacts)
                    {
                        string fullNumber = contact.Phones[0].FullNumber;
                        friendsPhones.numbers.Add(fullNumber);
                    }
                    FriendManagerScript FMScript = FriendManager.GetComponent <FriendManagerScript>();
                    StartCoroutine(FMScript.SendGroupRequest(groupName, true, friendsPhones, () => { GroupSuccessCreation(); }, () => { GroupFailCreation(); }));
                }
                else
                {
                    LoadingInvites.SetActive(false);
                    ErrorInvites.SetActive(true);
                    ErrorInvitesText.GetComponent <TMPro.TextMeshProUGUI>().text = "Hmmmm... server error! Try again from the main menu!";
                    StartCoroutine(CloseModal(3));
                }
            });
        }
Esempio n. 2
0
        public void CheckContacts()
        {
            var status = ISN_CNContactStore.GetAuthorizationStatus(ISN_CNEntityType.Contacts);

            if (status == ISN_CNAuthorizationStatus.Authorized)
            {
                OpenContacts();
            }
            else
            {
                ISN_CNContactStore.RequestAccess(ISN_CNEntityType.Contacts, (result) => {
                    if (result.IsSucceeded)
                    {
                        OpenContacts();
                    }
                    else
                    {
                        ContactSelectButton.SetActive(false);
                        ErrorInvites.SetActive(true);
                        ErrorInvitesText.GetComponent <TMPro.TextMeshProUGUI>().text = "Contact permission denied. You can go to settings and give spaces access to your contacts so you can send them invitations!";
                        StartCoroutine(CloseModal(6));
                    }
                });
            }
        }
        public void AddContacts()
        {
            FriendsPhones friendsPhones = new FriendsPhones()
            {
                numbers = new List <string>()
            };

            ISN_CNContactStore.ShowContactsPickerUI((result) => {
                uiManagerScript.LoadingInviteFriend();
                if (result.IsSucceeded)
                {
                    foreach (var contact in result.Contacts)
                    {
                        if (contact.Phones.Count > 0)
                        {
                            string fullNumber = contact.Phones[0].FullNumber;
                            friendsPhones.numbers.Add(fullNumber);
                        }
                    }
                    StartCoroutine(SendInvites(friendsPhones));
                }
                else
                {
                    uiManagerScript.ResultFriendInvite(false, "Hmmmm... Server error, try again!");
                }
            });
        }
        public override void Test()
        {
            ISN_CNContactStore.ShowContactsPickerUI((result) => {
                if (result.IsSucceeded)
                {
                    ISN_CNFetchPhoneContacts_Test.PrintContacts(result.Contacts);
                }

                SetAPIResult(result);
            });
        }
 protected override void IOSRequestAccess(Action <AuthorizationStatus> callback)
 {
     ISN_CNContactStore.RequestAccess(ISN_CNEntityType.Contacts, (result) => {
         if (result.IsSucceeded)
         {
             callback.Invoke(AuthorizationStatus.Granted);
         }
         else
         {
             callback.Invoke(AuthorizationStatus.Denied);
         }
     });
 }
Esempio n. 6
0
        public override void Test()
        {
            ISN_CNContactStore.FetchPhoneContacts((result) => {
                if (result.IsSucceeded)
                {
                    if (result.Contacts.Count == 0)
                    {
                        SetResult(SA_TestResult.WithError("No Contacts inside the Sucsses result"));
                        return;
                    }

                    PrintContacts(result.Contacts);
                }

                SetAPIResult(result);
            });
        }
Esempio n. 7
0
        public void InviteFriend()
        {
            var status = ISN_CNContactStore.GetAuthorizationStatus(ISN_CNEntityType.Contacts);

            if (status == ISN_CNAuthorizationStatus.Authorized)
            {
                AddContacts();
            }
            else
            {
                ISN_CNContactStore.RequestAccess(ISN_CNEntityType.Contacts, (result) => {
                    if (result.IsSucceeded)
                    {
                        AddContacts();
                    }
                    else
                    {
                        uiManagerScript.ResultFriendInvite(false, "Contact permission denied. You can go to settings and give spaces access to your contacts so you can send them invitations!");
                    }
                });
            }
        }
        public void Retrieve(Action <UM_ContactsResult> callback)
        {
            ISN_CNContactStore.FetchPhoneContacts((result) => {
                UM_ContactsResult loadResult;
                if (result.IsSucceeded)
                {
                    List <UM_iContact> contacts = new List <UM_iContact>();

                    foreach (var contact in result.Contacts)
                    {
                        UM_iContact um_contact = new UM_IOSContact(contact);
                        contacts.Add(um_contact);
                    }

                    loadResult = new UM_ContactsResult(contacts);
                }
                else
                {
                    loadResult = new UM_ContactsResult(result.Error);
                }
                callback.Invoke(loadResult);
            });
        }
        void ContactsUse()
        {
            var status = ISN_CNContactStore.GetAuthorizationStatus(ISN_CNEntityType.Contacts);

            if (status == ISN_CNAuthorizationStatus.Authorized)
            {
                Debug.Log("Contacts Permission granted");
            }
            else
            {
                ISN_CNContactStore.RequestAccess(ISN_CNEntityType.Contacts, (result) => {
                    if (result.IsSucceeded)
                    {
                        Debug.Log("Contacts Permission granted");
                    }
                    else
                    {
                        Debug.Log("Contacts Permission denied");
                    }
                });
            }


            ISN_CNContactStore.FetchPhoneContacts((result) => {
                if (result.IsSucceeded)
                {
                    foreach (var contact in result.Contacts)
                    {
                        Debug.Log(contact.GivenName);
                    }
                }
                else
                {
                    Debug.Log("Error: " + result.Error.Message);
                }
            });


            ISN_CNContactStore.ShowContactsPickerUI((result) => {
                if (result.IsSucceeded)
                {
                    foreach (var contact in result.Contacts)
                    {
                        Debug.Log(contact.GivenName);
                    }
                }
                else
                {
                    Debug.Log("Error: " + result.Error.Message);
                }
            });

            ISN_UIApplication.ApplicationDelegate.ApplicationDidEnterBackground.AddListener(() => {
                //Do something
            });

            var iteam = ISN_UIApplication.ApplicationDelegate.GetAppOpenShortcutItem();

            if (iteam != null)
            {
                Debug.Log(iteam.Type);
            }



            ISN_UIApplication.ApplicationDelegate.ContinueUserActivity.AddListener((string url) => {
            });
        }