public void OnAppRequestsComplete(string message)
{
var rawResult = (Dictionary<string, object>)MiniJSON.Json.Deserialize(message);
if (rawResult.ContainsKey(CallbackIdKey))
{
var result = new Dictionary<string, object>();
var callbackId = (string)rawResult[CallbackIdKey];
rawResult.Remove(CallbackIdKey);
if (rawResult.Count > 0)
{
List<string> to = new List<string>(rawResult.Count - 1);
foreach (string key in rawResult.Keys)
{
if (!key.StartsWith("to"))
{
result[key] = rawResult[key];
continue;
}
to.Add((string)rawResult[key]);
}
result.Add("to", to);
rawResult.Clear();
OnFacebookResponse(callbackId, new FBResult(MiniJSON.Json.Serialize(result)));
}
else
{
//if we make it here java returned a callback message with only an id
//this isnt supposed to happen
OnFacebookResponse(callbackId, new FBResult(MiniJSON.Json.Serialize(result), "Malformed request response. Please file a bug with facebook here: https://developers.facebook.com/bugs/create"));
}
}
}