Example #1
0
 void ChallengeCallback(IAppRequestResult result)
 {
     if (result.Cancelled)
     {
         Debug.Log("Challenge cancelled.");
     }
     else if (!string.IsNullOrEmpty(result.Error))
     {
         Debug.Log("Error in challenge:" + result.Error);
     }
     else
     {
         Debug.Log("Challenge was successful:" + result.RawResult);
     }
 }
Example #2
0
 void ShareWithUsersCallback(IAppRequestResult result)
 {
     if (result.Cancelled)
     {
         Debug.Log("Challenge Cancelled");
     }
     else if (!string.IsNullOrEmpty(result.Error))
     {
         Debug.Log("Error on Challenge!");
     }
     else if (!string.IsNullOrEmpty(result.RawResult))
     {
         Debug.Log("Success on Challenge");
     }
 }
Example #3
0
 private void CompartirConAppUsuariosCallback(IAppRequestResult result)
 {
     if (result.Cancelled)
     {
         Debug.Log("Desafio cancelado");
     }
     else if (!string.IsNullOrEmpty(result.Error))
     {
         Debug.Log("Error en el desafio!");
     }
     else if (!string.IsNullOrEmpty(result.RawResult))
     {
         Debug.Log("Exito en el desafio");
     }
 }
Example #4
0
 void ShareWithUsersCallback(IAppRequestResult result)    //invite who alr have our app
 {
     if (result.Cancelled)
     {
         Debug.Log("Request canceled");
     }
     else if (!String.IsNullOrEmpty(result.Error))
     {
         Debug.Log("Errors on request!");
     }
     else if (!String.IsNullOrEmpty(result.RawResult))
     {
         Debug.Log("Success on request!");
     }
 }
Example #5
0
 private void ShareWithUsersCallBack(IAppRequestResult result)
 {
     Debug.Log(result.RawResult);
     if (result.Cancelled)
     {
         Debug.Log("Invite is Cancelled");
     }
     else if (!string.IsNullOrEmpty(result.Error))
     {
         Debug.Log("Error on Invite");
     }
     else if (!string.IsNullOrEmpty(result.RawResult))
     {
         Debug.Log("Success On Invite");
     }
 }
Example #6
0
 private bool WasGiftSent(IAppRequestResult result)
 {
     if (result == null)
     {
         return(false);
     }
     if (!string.IsNullOrEmpty(result.Error))
     {
         return(false);
     }
     if (result.Cancelled)
     {
         return(false);
     }
     return(true);
 }
Example #7
0
    void ShareWithUsersCallBack(IAppRequestResult result)
    {
        Debug.Log(result.RawResult);

        if (result.Cancelled)
        {
            Debug.Log("Challenge Cancelled");
        }
        else if (result.Error != null)
        {
            Debug.Log("Error on Challenge");
        }
        else if (result.RawResult != null)
        {
            Debug.Log("Success on Challenge");
        }
    }
Example #8
0
    static void InviteAction(IAppRequestResult result)
    {
        inviteDebug = result.RawResult;

        foreach (KeyValuePair <string, object> pair in result.ResultDictionary)
        {
            if (pair.Key.Contains("Complete"))
            {
                inviteDebug += pair.Key + " " + pair.Value + '\n';
            }
        }

        if (act != null)
        {
            act();
        }
    }
Example #9
0
 private void GiftSentCallback(List <string> list, IAppRequestResult result)
 {
     if (!WasGiftSent(result))
     {
         foreach (string item in list)
         {
             GiftSendingFailed.OnNext(item);
         }
     }
     else
     {
         foreach (string item2 in list)
         {
             if (PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.ContainsKey(item2))
             {
                 PersistentSingleton <FacebookAPIService> .Instance.FBPlayers[item2].SetGiftTimeStamp(ServerTimeService.NowTicks());
                 GiftSendingSuccess.OnNext(item2);
             }
         }
     }
 }
        public void TestAppRequest()
        {
            IAppRequestResult result = null;

            string mockRequestId = "1234567890";
            var    toList        = new List <string>()
            {
                "1234567890", "9999999999"
            };

            this.Mock.ResultExtras = new Dictionary <string, object>()
            {
                { AppRequestResult.RequestIDKey, mockRequestId },
                { AppRequestResult.ToKey, string.Join(",", toList) },
            };

            FB.AppRequest("Test message", callback: (r) => (result = r));
            Assert.IsNotNull(result);
            Assert.AreEqual(result.RequestID, mockRequestId);
            Assert.IsTrue(new HashSet <string>(toList).SetEquals(result.To));
        }
Example #11
0
 public void HandleAppRequestResult(IAppRequestResult result)
 {
     if (result != null && result.To != null)
     {
         List <string> list  = new List <string>(result.To);
         int           count = PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.Count;
         foreach (string item in list)
         {
             if (!PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.ContainsKey(item))
             {
                 PersistentSingleton <FacebookAPIService> .Instance.LoadFriendAPI(item, delegate(FBPlayer player)
                 {
                     m_fbEventsInternal.OnNext(UniRx.Tuple.Create(FacebookEvent.FRIEND_REQUEST_RESULT, (object)player));
                 });
             }
             else
             {
                 PersistentSingleton <FacebookAPIService> .Instance.FBPlayers[item].Invited = true;
             }
         }
     }
 }
Example #12
0
    // Callback for FB.AppRequest
    private static void AppRequestCallback (IAppRequestResult result)
    {
        // Error checking
        Debug.Log("AppRequestCallback");
        if (result.Error != null)
        {
            Debug.LogError(result.Error);
            return;
        }
        Debug.Log(result.RawResult);

        // Check response for success - show user a success popup if so
        object obj;
        if (result.ResultDictionary.TryGetValue ("cancelled", out obj))
        {
            Debug.Log("Request cancelled");
        }
        else if (result.ResultDictionary.TryGetValue ("request", out obj))
        {
            PopupScript.SetPopup("Request Sent", 3f);
            Debug.Log("Request sent");
        }
    }
        private void AppRequestCallBack(IAppRequestResult result)
        {
            FBLog("AppRequestCallBack", result.RawResult);
            FacebookHelperResultType resultType     = FacebookHelperResultType.ERROR;
            List <string>            InvitedFriends = new List <string>();

            if (result != null && result.Error == null)
            {
                JSONObject jsonObject = JSONObject.Parse(result.RawResult);
                if (jsonObject.ContainsKey("cancelled"))
                {
                    resultType = FacebookHelperResultType.CANCELLED;
                }
                else if (jsonObject.ContainsKey("request"))
                {
                    //{   "request": "420211088059698",
                    //    "to": [
                    //        "100002669403922",
                    //        "100000048490273"
                    //    ]}
                    resultType        = FacebookHelperResultType.OK;
                    HasInvitedFriends = true;

                    JSONValue to = jsonObject.GetArray("to");
                    if (to != null || to.Type == JSONValueType.Array)
                    {
                        NumberOfInvitesSent += to.Array.Length;
                        foreach (JSONValue value in to.Array)
                        {
                            InvitedFriends.Add(value.Str);
                            Debug.Log("Value: " + value.Str);
                        }
                    }
                }
            }
            OnAppRequestCompleteAction(resultType, InvitedFriends, result);
        }
Example #14
0
 void ShareWithUsersCallback(IAppRequestResult result)
 {
     Debug.Log(result.RawResult);
     if (FBErrorEvent != null)
     {
         FBErrorEvent(result.RawResult);
     }
     if (result.Cancelled)
     {
         Debug.Log("Brag cancelled");
     }
     else if (!string.IsNullOrEmpty(result.Error))
     {
         Debug.Log("Error on Brag : " + result.Error);
         if (FBErrorEvent != null)
         {
             FBErrorEvent(result.Error);
         }
     }
     else if (!string.IsNullOrEmpty(result.RawResult))
     {
         Debug.Log("Brag succeeded");
     }
 }
Example #15
0
    // Callback for FB.AppRequest
    private static void AppRequestCallback(IAppRequestResult result)
    {
        // Error checking
        Debug.Log("AppRequestCallback");
        if (result.Error != null)
        {
            Debug.LogError(result.Error);
            return;
        }
        Debug.Log(result.RawResult);

        // Check response for success - show user a success popup if so
        object obj;

        if (result.ResultDictionary.TryGetValue("cancelled", out obj))
        {
            Debug.Log("Request cancelled");
        }
        else if (result.ResultDictionary.TryGetValue("request", out obj))
        {
            PopupScript.SetPopup("Request Sent", 3f);
            Debug.Log("Request sent");
        }
    }
Example #16
0
    private void SendLiveCallback(IAppRequestResult result)
    {
        if (!string.IsNullOrEmpty(result.Error))
        {
            Debug.LogError("Lives not sended with error: " + result.Error);
        }

        RequestsSendData data;

        if (PlayerPrefs.HasKey(_ppUserSendLivesKey))
        {
            data = JsonUtility.FromJson <RequestsSendData>(PlayerPrefs.GetString(_ppUserSendLivesKey));
            foreach (var id in result.To)
            {
                if (!data.IdsList.Contains(id))
                {
                    data.IdsList.Add(id);
                }
            }
        }
        else
        {
            data = new RequestsSendData(DateTime.Now, result.To.ToList());
        }

        var dataString = JsonUtility.ToJson(data);

        PlayerPrefs.SetString(_ppUserSendLivesKey, dataString);

        if (OnSendLivesSuccess != null)
        {
            OnSendLivesSuccess.Invoke();
        }

        UpdateFriendsList();
    }
Example #17
0
 private void InviteFriendsCallback(IAppRequestResult result)
 {
     Service.GalaxyPlanetController.UpdatePlanetsFriendData();
     this.squadmatesCountLabel.Text = this.currentPlanet.FriendsOnPlanet.Count.ToString();
 }
Example #18
0
 void ShareWithUsersCallback(IAppRequestResult result)
 {
     if (result.Cancelled) {
         Debug.Log ("Challenge Cancelled");
     } else if (!string.IsNullOrEmpty (result.Error)) {
         Debug.Log ("Error on Challenge!");
     } else if (!string.IsNullOrEmpty (result.RawResult)) {
         Debug.Log ("Success on Challenge");
     }
 }
 void ShareWithUsersCallBack(IAppRequestResult result)
 {
     Debug.Log(result.RawResult);
     if (result.Cancelled)
     {
         Debug.Log("Challange Cancelled");
     }
     else if (!string.IsNullOrEmpty(result.Error)) Debug.Log("Challange on Shared!");
     else if (string.IsNullOrEmpty(result.RawResult)) Debug.Log("Challange on SHared");
 }
Example #20
0
 void ShareWithUsersCallback(IAppRequestResult result)
 {
     Debug.Log(result.RawResult);
 }
	//--------------------------------------
	//  Handlers
	//--------------------------------------

	#if FBV7_API_ENABLED

	private void AppRequestCallback(IAppRequestResult result) {
		FB_AppRequestResult res =  new FB_AppRequestResult(result.RawResult, result.Error);
		SPFacebook.Instance.AppRequestCallback(res);
	}
Example #22
0
    //--------------------------------------
    //  Handlers
    //--------------------------------------

        #if FBV7_API_ENABLED
    private void AppRequestCallback(IAppRequestResult result)
    {
        FB_AppRequestResult res = new FB_AppRequestResult(result.RawResult, result.Error);

        SPFacebook.Instance.AppRequestCallback(res);
    }
Example #23
0
    private void appRequestCallback(IAppRequestResult result)
    {
        if (result != null)
        {
            var responseObject = Json.Deserialize(result.RawResult) as Dictionary<string, object>;
            Debug.Log(result.RawResult);
            object obj = 0;
            if (responseObject.TryGetValue ("cancelled", out obj))
            {
                UnityEngine.Debug.Log("Cancelled");
            }

            else if (responseObject.TryGetValue ("request", out obj))
            {
                MessageWindow.Show("Invitación","Tu invitación fue enviada!");
                challengeCallback( responseObject );
                challengeCallback = null;
            }
        }
    }