Beispiel #1
0
    void UserCallBack(FBResult result)
    {
        Debug.Log("UserCallBack");

        if (result.Error != null)
        {
            Debug.Log("UserCallBack - user graph request failed: " + result.Error + " - " + result.Text);

#if PROPELLER_SDK
            PropellerSDK.SdkSocialLoginCompleted(null);
#endif

            if (socialPost != SocialPost.NONE)
            {
#if PROPELLER_SDK
                switch (socialPost)
                {
                case SocialPost.INVITE:
                    PropellerSDK.SdkSocialInviteCompleted();
                    break;

                case SocialPost.SHARE:
                    PropellerSDK.SdkSocialShareCompleted();
                    break;
                }
#endif

                socialPost     = SocialPost.NONE;
                socialPostData = null;
            }

            return;
        }

        string get_data = result.Text;

        var dict = Json.Deserialize(get_data) as IDictionary;
        fbname      = dict ["name"].ToString();
        fbemail     = dict ["email"].ToString();
        fbgender    = dict ["gender"].ToString();
        fbfirstname = dict ["first_name"].ToString();

        PushFBDataToFuel();

        if (socialPost != SocialPost.NONE)
        {
            switch (socialPost)
            {
            case SocialPost.INVITE:
                onSocialInviteClicked(socialPostData);
                break;

            case SocialPost.SHARE:
                onSocialShareClicked(socialPostData);
                break;
            }
        }
    }
Beispiel #2
0
    void LoginCallback(FBResult result)
    {
        Debug.Log("LoginCallback");

        if (!FB.IsLoggedIn)
        {
            if (result.Error != null)
            {
                Debug.Log("LoginCallback - login request failed: " + result.Error);
            }
            else
            {
                Debug.Log("LoginCallback - login request cancelled");
            }

#if PROPELLER_SDK
            PropellerSDK.SdkSocialLoginCompleted(null);
#endif

            if (socialPost != SocialPost.NONE)
            {
#if PROPELLER_SDK
                switch (socialPost)
                {
                case SocialPost.INVITE:
                    PropellerSDK.SdkSocialInviteCompleted();
                    break;

                case SocialPost.SHARE:
                    PropellerSDK.SdkSocialShareCompleted();
                    break;
                }
#endif

                socialPost     = SocialPost.NONE;
                socialPostData = null;
            }

            return;
        }

        OnLoggedIn();
    }
Beispiel #3
0
    public void PushFBDataToFuel()
    {
        Debug.Log("PushFBDataToFuel");

        string   provider   = "facebook";
        string   email      = fbemail;
        string   id         = FB.UserId;
        string   token      = FB.AccessToken;
        DateTime expireDate = FB.AccessTokenExpiresAt;
        string   nickname   = fbfirstname;    //not available from FB using first name
        string   name       = fbname;
        string   gender     = fbgender;

        Dictionary <string, string> loginInfo = null;

        loginInfo = new Dictionary <string, string> ();
        loginInfo.Add("provider", provider);
        loginInfo.Add("email", email);
        loginInfo.Add("id", id);
        loginInfo.Add("token", token);
        loginInfo.Add("nickname", nickname);
        loginInfo.Add("name", name);
        loginInfo.Add("gender", gender);

        Debug.Log
        (
            "*** loginInfo ***" + "\n" +
            "provider = " + loginInfo ["provider"].ToString() + "\n" +
            "email = " + loginInfo ["email"].ToString() + "\n" +
            "id = " + loginInfo ["id"].ToString() + "\n" +
            "token = " + loginInfo ["token"].ToString() + "\n" +
            "nickname = " + loginInfo ["nickname"].ToString() + "\n" +
            "name = " + loginInfo ["name"].ToString() + "\n" +
            "gender = " + loginInfo ["gender"].ToString() + "\n" +
            "expireDate = " + expireDate.ToLongDateString()
        );

#if PROPELLER_SDK
        PropellerSDK.SdkSocialLoginCompleted(loginInfo);
#endif
    }