in Facebook.Unity.Windows/WindowsWrapper.cs [184:255]
public void CurrentProfile(string callbackId, CallbackManager callbackManager)
{
Dictionary<string, object> result = new Dictionary<string, object>() { { Constants.CallbackIdKey, callbackId } };
if (IsLoggedIn())
{
fbg.Profile.getProfile((windowsProfile) =>
{
if (!String.IsNullOrEmpty(windowsProfile.Raw))
{
try
{
Dictionary<string, object> profile = MiniJSON.Json.Deserialize(windowsProfile.Raw) as Dictionary<string, object>;
profile.TryGetValue("first_name", out string firstName);
profile.TryGetValue("name", out string name);
profile.TryGetValue("email", out string email);
profile.TryGetValue("picture", out Dictionary<string, object> picture);
string imageURL = null;
if (picture.TryGetValue("data", out Dictionary<string, object> pictureData))
{
pictureData.TryGetValue("url", out imageURL);
}
profile.TryGetValue("link", out string link);
result[ProfileResult.ProfileKey] = new Profile(
userID,
firstName,
null,
null,
name,
email,
imageURL,
link,
null,
null,
null,
null,
null,
null);
}
catch (Exception e)
{
result[Constants.ErrorKey] = "ERROR: " + e.Message;
}
}
else
{
result[Constants.ErrorKey] = "ERROR: No profile data.";
}
callbackManager.OnFacebookResponse(new ProfileResult((new ResultContainer(result))));
}, (error) =>
{
string msg = "ERROR: " + error.Message + ",";
msg += "InnerErrorCode: " + error.InnerErrorCode.ToString() + ",";
msg += "InnerErrorMessage: " + error.InnerErrorMessage + ",";
msg += "InnerErrorSubcode: " + error.InnerErrorSubcode.ToString() + ",";
msg += "InnerErrorTraceId: " + error.InnerErrorTraceId;
result[Constants.ErrorKey] = msg;
callbackManager.OnFacebookResponse(new ProfileResult((new ResultContainer(result))));
});
}
else
{
result[Constants.ErrorKey] = "ERROR: user must by logged in.";
callbackManager.OnFacebookResponse(new ProfileResult((new ResultContainer(result))));
}
}