示例#1
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.GetContacts"/>
        /// </summary>
        /// <param name="pageNumber">The contacts' page number to get</param>
        /// <param name="success">Callback function that is called if the contacts were fetched successfully.</param>
        /// <param name="fail">Callback function that is called if fetching contacts failed.</param>
        public override void GetContacts(int pageNumber, ContactsSuccess success, ContactsFailed fail)
        {
            FB.API("/me/friends?fields=id,name,picture,email,first_name,last_name&limit=" + DEFAULT_CONTACTS_PAGE_SIZE + "&offset=" + DEFAULT_CONTACTS_PAGE_SIZE * pageNumber,
                   Facebook.HttpMethod.GET,
                   (FBResult result) => {
                if (result.Error != null)
                {
                    SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Error]: " + result.Error);
                    fail(result.Error);
                }
                else
                {
                    SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Text]: " + result.Text);
                    SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Texture]: " + result.Texture);
                    JSONObject jsonContacts = new JSONObject(result.Text);

                    SocialPageData <UserProfile> resultData = new SocialPageData <UserProfile>();
                    resultData.PageData   = UserProfilesFromFBJsonObjs(jsonContacts["data"].list);
                    resultData.PageNumber = pageNumber;

                    JSONObject paging = jsonContacts["paging"];
                    if (paging != null)
                    {
                        resultData.HasMore = (paging["next"] != null);
                    }

                    success(resultData);
                }
            });
        }
示例#2
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.GetContacts"/>
        /// </summary>
        /// <param name="fromStart">Should we reset pagination or request the next page</param>
        /// <param name="success">Callback function that is called if the contacts were fetched successfully.</param>
        /// <param name="fail">Callback function that is called if fetching contacts failed.</param>
        public override void GetContacts(bool fromStart, ContactsSuccess success, ContactsFailed fail)
        {
            checkPermission("user_friends", () => {
                int pageNumber;
                if (fromStart || this.lastPageNumber == 0)
                {
                    pageNumber = 1;
                }
                else
                {
                    pageNumber = this.lastPageNumber + 1;
                }

                this.lastPageNumber = 0;


                FB.API("/me/friends?fields=id,name,picture,email,first_name,last_name&limit=" + DEFAULT_CONTACTS_PAGE_SIZE + "&offset=" + DEFAULT_CONTACTS_PAGE_SIZE * (pageNumber - 1),
                       Facebook.HttpMethod.GET,
                       (FBResult result) => {
                    if (result.Error != null)
                    {
                        SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Error]: " + result.Error);
                        fail(result.Error);
                    }
                    else
                    {
                        SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Text]: " + result.Text);
                        SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Texture]: " + result.Texture);
                        JSONObject jsonContacts = new JSONObject(result.Text);

                        SocialPageData <UserProfile> resultData = new SocialPageData <UserProfile>();
                        resultData.PageData   = UserProfilesFromFBJsonObjs(jsonContacts["data"].list);
                        resultData.PageNumber = pageNumber;

                        this.lastPageNumber = pageNumber;

                        JSONObject paging = jsonContacts["paging"];
                        if (paging != null)
                        {
                            resultData.HasMore = (paging["next"] != null);
                        }

                        success(resultData);
                    }
                });
            }, (string errorMessage) => {
                fail(errorMessage);
            });
        }
示例#3
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 /// <param name="success">Callback function that is called if the contacts were fetched successfully.</param>
 /// <param name="fail">Callback function that is called if fetching contacts failed.</param>
 public override void GetContacts(ContactsSuccess success, ContactsFailed fail)
 {
     FB.API("/me/friends?fields=id,name,picture,email,first_name,last_name",
            Facebook.HttpMethod.GET,
            (FBResult result) => {
         if (result.Error != null)
         {
             SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Error]: " + result.Error);
             fail(result.Error);
         }
         else
         {
             SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Text]: " + result.Text);
             SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Texture]: " + result.Texture);
             JSONObject jsonContacts = new JSONObject(result.Text);
             success(UserProfilesFromFBJsonObjs(jsonContacts["data"].list));
         }
     });
 }
        /// <summary>
		/// See docs in <see cref="SoomlaProfile.GetContacts"/>
		/// </summary>
		/// <param name="fromStart">Should we reset pagination or request the next page</param>
		/// <param name="success">Callback function that is called if the contacts were fetched successfully.</param>
		/// <param name="fail">Callback function that is called if fetching contacts failed.</param>
		public override void GetContacts(bool fromStart, ContactsSuccess success, ContactsFailed fail) {
			checkPermission("user_friends", ()=> {
				int pageNumber;
				if (fromStart || this.lastPageNumber == 0) {
					pageNumber = 1;
				} else {
					pageNumber = this.lastPageNumber + 1;
				}
				
				this.lastPageNumber = 0;


				FB.API ("/me/friends?fields=id,name,picture,email,first_name,last_name&limit=" + DEFAULT_CONTACTS_PAGE_SIZE + "&offset=" + DEFAULT_CONTACTS_PAGE_SIZE * (pageNumber - 1),
				        HttpMethod.GET,
				        (IGraphResult result) => {
					if (result.Error != null) {
						SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Error]: "+result.Error);
						fail(result.Error);
					}
					else {
						SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Text]: "+result.RawResult);
						SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Texture]: "+result.Texture);
						JSONObject jsonContacts = new JSONObject(result.RawResult);
						
						SocialPageData<UserProfile> resultData = new SocialPageData<UserProfile>(); 
						resultData.PageData = UserProfilesFromFBJsonObjs(jsonContacts["data"].list);
                        resultData.PageNumber = pageNumber;
                        
                        this.lastPageNumber = pageNumber;
                        
                        JSONObject paging = jsonContacts["paging"];
                        if (paging != null) {
                            resultData.HasMore = (paging["next"] != null);
                        }
                        
                        success(resultData);
                    }
                });
			}, (string errorMessage)=>{
				fail(errorMessage);
            });
        }
示例#5
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public override void GetContacts(bool fromStart, ContactsSuccess success, ContactsFailed fail)
 {
 }
示例#6
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public override void GetContacts(int pageNumber, ContactsSuccess success, ContactsFailed fail)
 {
 }
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.GetContacts"/>
        /// </summary>
        /// <param name="pageNumber">The contacts' page number to get</param>
        /// <param name="success">Callback function that is called if the contacts were fetched successfully.</param>
        /// <param name="fail">Callback function that is called if fetching contacts failed.</param>
        public override void GetContacts(int pageNumber, ContactsSuccess success, ContactsFailed fail)
        {
            FB.API ("/me/friends?fields=id,name,picture,email,first_name,last_name&limit=" + DEFAULT_CONTACTS_PAGE_SIZE + "&offset=" + DEFAULT_CONTACTS_PAGE_SIZE * pageNumber,
                    Facebook.HttpMethod.GET,
                    (FBResult result) => {
                        if (result.Error != null) {
                            SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Error]: "+result.Error);
                            fail(result.Error);
                         }
                        else {
                            SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Text]: "+result.Text);
                            SoomlaUtils.LogDebug(TAG, "GetContactsCallback[result.Texture]: "+result.Texture);
                            JSONObject jsonContacts = new JSONObject(result.Text);

                            SocialPageData<UserProfile> resultData = new SocialPageData<UserProfile>();
                            resultData.PageData = UserProfilesFromFBJsonObjs(jsonContacts["data"].list);
                            resultData.PageNumber = pageNumber;

                            JSONObject paging = jsonContacts["paging"];
                            if (paging != null) {
                                resultData.HasMore = (paging["next"] != null);
                            }

                            success(resultData);
                        }
                    });
        }
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public abstract void GetContacts(bool fromStart, ContactsSuccess success, ContactsFailed fail);
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.GetContacts"/>
		/// </summary>
		public override void GetContacts(int pageNumber, ContactsSuccess success, ContactsFailed fail) {}
示例#10
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public abstract void GetContacts(int pageNumber, ContactsSuccess success, ContactsFailed fail);
示例#11
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public abstract void GetContacts(int pageNumber, ContactsSuccess success, ContactsFailed fail);
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public override void GetContacts(bool fromStart, ContactsSuccess success, ContactsFailed fail)
 {
 }
示例#13
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public abstract void GetContacts(bool fromStart, ContactsSuccess success, ContactsFailed fail);
示例#14
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public abstract void GetContacts(ContactsSuccess success, ContactsFailed fail);
示例#15
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.GetContacts"/>
 /// </summary>
 public override void GetContacts(ContactsSuccess success, ContactsFailed fail)
 {
 }