private void appRequestCallback(FBResult result) { Debug.Log("appRequestCallback"); if (result.Error != null) { Debug.Log("appRequestCallback - invite request failed: " + result.Error); } else { var responseObject = Json.Deserialize(result.Text) as Dictionary <string, object>; object obj = null; if (responseObject.TryGetValue("cancelled", out obj)) { Debug.Log("appRequestCallback - invite request cancelled"); } else if (responseObject.TryGetValue("request", out obj)) { Debug.Log("appRequestCallback - invite request sent"); } } #if PROPELLER_SDK PropellerSDK.SdkSocialInviteCompleted(); #endif }
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; } } }
/* * ----------------------------------------------------- * FaceBook Invite * ----------------------------------------------------- */ public void onSocialInviteClicked(Dictionary <string, string> inviteInfo) { Debug.Log("onSocialInviteClicked"); /* * string message, * string[] to = null, * List<object> filters = null, * string[] excludeIds = null, * int? maxRecipients = null, * string data = "", * string title = "", * FacebookDelegate callback = null) */ if (FB.IsLoggedIn) { FB.AppRequest( inviteInfo ["long"], null, null, null, null, null, inviteInfo ["subject"], appRequestCallback); } else { if (socialPost != SocialPost.NONE) { socialPost = SocialPost.NONE; socialPostData = null; #if PROPELLER_SDK PropellerSDK.SdkSocialInviteCompleted(); #endif return; } socialPost = SocialPost.INVITE; socialPostData = inviteInfo; trySocialLogin(false); } }
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(); }