Пример #1
0
        /// <summary>
        /// Fetches UserProfiles of contacts of the current user.
        /// Supported platforms: Facebook, Twitter, Google+.
        /// Missing contact information for Twitter: email, gender, birthday.
        /// Missing contact information for Google+: username, email, gender, bithday
        ///
        /// NOTE: This operation requires a successful login.
        /// </summary>
        /// <param name="provider">The <c>Provider</c> to fetch contacts from.</param>
        /// <param name="payload">A string to receive when the function returns.</param>
        public static void GetContacts(Provider provider, string payload = "")
        {
            SocialProvider targetProvider = GetSocialProvider(provider);
            string         userPayload    = (payload == null) ? "" : payload;

            if (targetProvider == null)
            {
                return;
            }

            if (targetProvider.IsNativelyImplemented())
            {
                //fallback to native
                instance._getContacts(provider, ProfilePayload.ToJSONObj(userPayload).ToString());
            }

            else
            {
                ProfileEvents.OnGetContactsStarted(provider, userPayload);
                targetProvider.GetContacts(
                    /* success */ (List <UserProfile> profiles) => {
                    ProfileEvents.OnGetContactsFinished(provider, profiles, userPayload);
                },
                    /* fail */ (string message) => { ProfileEvents.OnGetContactsFailed(provider, message, userPayload); }
                    );
            }
        }
Пример #2
0
        /// <summary>
        /// Fetches UserProfiles of contacts of the current user.
        /// Supported platforms: Facebook, Twitter, Google+.
        /// Missing contact information for Twitter: email, gender, birthday.
        /// Missing contact information for Google+: username, email, gender, bithday
        ///
        /// NOTE: This operation requires a successful login.
        /// </summary>
        /// <param name="provider">The <c>Provider</c> to fetch contacts from.</param>
        /// <param name="pageNumber">The contacts' page number to get.</param>
        /// <param name="payload">A string to receive when the function returns.</param>
        public static void GetContacts(Provider provider, int pageNumber = 0, string payload = "")
        {
            SocialProvider targetProvider = GetSocialProvider(provider);
            string         userPayload    = (payload == null) ? "" : payload;

            if (targetProvider == null)
            {
                return;
            }

            if (targetProvider.IsNativelyImplemented())
            {
                //fallback to native
                //TODO: add pageNumber here when implemented natively
                instance._getContacts(provider, ProfilePayload.ToJSONObj(userPayload).ToString());
            }

            else
            {
                ProfileEvents.OnGetContactsStarted(provider, pageNumber, userPayload);
                targetProvider.GetContacts(pageNumber,
                                           /* success */ (SocialPageData <UserProfile> contactsData) => {
                    ProfileEvents.OnGetContactsFinished(provider, contactsData, userPayload);
                },
                                           /* fail */ (string message) => { ProfileEvents.OnGetContactsFailed(provider, pageNumber, message, userPayload); }
                                           );
            }
        }