Closed treidio closed 5 years ago
Similar attempt for android.
unsure about the bolded line, I'm unsure if the sharecallback will work. The Dialog is a Xamarin.Facebook.Share.Widget so maybe it will.
line 352 insert this
public async Task<FacebookResponse<Dictionary<string, object>>> GameRequestDialog(string message, string title = "")
{
_shareTcs = new TaskCompletionSource<FacebookResponse<Dictionary<string, object>>>();
Dictionary<string, object> parameters = new Dictionary<string, object>()
{
{"message",message},
};
if (!string.IsNullOrEmpty(title))
{
parameters.Add("title", title);
}
return await PerformAction(RequestGameRequestDialog, parameters, _shareTcs.Task, FacebookPermissionType.Read, new string[] { "email" });
}
line 756, this..
void RequestGameRequestDialog(Dictionary<string, object> paramsDictionary)
{
if (paramsDictionary != null && paramsDictionary.ContainsKey("message") && paramsDictionary.ContainsKey("title"))
{
var activity = Android.App.Application.Context as Activity;
string Message = paramsDictionary["message"] as string;
string Title = "";
if (paramsDictionary.ContainsKey("title"))
{
Title = $"{paramsDictionary["title"]}" as string; ;
}
var content = new GameRequestContent.Builder().
SetTitle(Title).
SetMessage(Message).
Build() as GameRequestContent;
GameRequestDialog dialog = new GameRequestDialog(activity);
**dialog.RegisterCallback(mCallbackManager, shareCallback);**
dialog.Show(content);
}
}
Feature added to beta version:
https://www.nuget.org/packages/Plugin.FacebookClient/2.1.16-beta
Hi,
sorry I don't know how to do pull requests, and besides my code is so amateur. :)
For IOS i got the game request dialog working, sharing it back with the project.. I don't get the alert in the destination account, but expect that's because my app isn't published or approved.
Presented at your own risk..
FacebookClientManager.cs ~line 216
~line 487
iFacebookClient.cs ~line 121 Task<FacebookResponse<Dictionary<string, object>>> GameRequestDialog(string message, string title = "");
Called by
await CrossFacebookClient.Current.GameRequestDialog("A message", "a Title");