Ejemplo n.º 1
0
        internal void ResolveProfileImageUrl(string id, SA_FB_ProfileImageSize size, Action <string> callback)
        {
            var request = new SA_FB_RequestBuilder(string.Format("/{0}?fields=picture.type({1})", id, size));

            SA_FB.API(request.RequestString, HttpMethod.GET,
                      graphResult =>
            {
                var result = new SA_FB_GetProfileImageUrlResult(graphResult);
                callback.Invoke(result.URL);
            });
        }
Ejemplo n.º 2
0
        internal void GetLoggedInUserInfo(Action <SA_FB_GetUserResult> callback)
        {
            var request = new SA_FB_RequestBuilder("/me?fields=id,name,first_name,last_name,email,gender,birthday,age_range,location,picture");

            SA_FB.API(request.RequestString, HttpMethod.GET,
                      (IGraphResult graphResult) =>
            {
                var result = new SA_FB_GetUserResult(graphResult);
                callback.Invoke(result);
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This edge allows you to:
        /// get the User's friends who have installed the app making the query
        /// get the User's total number of friends (including those who have not installed the app making the query)
        /// <para>Requires  <b>"user_friends" </b> permission
        /// <see cref="https://developers.facebook.com/docs/graph-api/reference/user/friends"/> for information </para>
        /// </summary>
        /// <param name="limit">Result limit </param>
        /// <param name="callback">Request callback </param>
        /// <param name="cursor">Pagination cursor pointer </param>
        public void GetFriends(int limit, Action <SA_FB_GraphFriendsListResult> callback, SA_FB_Cursor cursor = null)
        {
            var request = new SA_FB_RequestBuilder("/me?fields=friends");

            request.AddLimit(limit);
            request.AddCommand("fields", "first_name,id,last_name,name,link,locale,picture");
            request.AddCursor(cursor);

            SA_FB.API(request.RequestString, HttpMethod.GET,
                      (IGraphResult graphResult) =>
            {
                var result = new SA_FB_GraphFriendsListResult(graphResult);
                callback.Invoke(result);
            });
        }
Ejemplo n.º 4
0
 private static void OnInitCompleted()
 {
     if (SA_FB.IsLoggedIn)
     {
         DispatchLoginSucceeded();
     }
     else
     {
         SA_FB.Login((result) => {
             if (result.IsSucceeded)
             {
                 DispatchLoginSucceeded();
             }
             else
             {
                 DispatchLoginFailed();
             }
         });
     }
 }
Ejemplo n.º 5
0
        public static void ConfirmLoginStatus(Action <SA_FB_LoginUtilResult> callback)
        {
            m_callbacks.Add(callback);

            if (SA_FB.IsLoggedIn)
            {
                DispatchLoginSucceeded();
                return;
            }

            if (m_waitingLoginResult)
            {
                return;
            }


            m_waitingLoginResult = true;

            if (SA_FB.IsInitialized)
            {
                OnInitCompleted();
            }
            else
            {
                SA_FB.Init(() => {
                    if (SA_FB.IsInitialized)
                    {
                        OnInitCompleted();
                    }
                    else
                    {
                        DispatchLoginFailed();
                    }
                });
            }
        }