public void ShowAppInviteDialogRequest(Dictionary <string, object> parameters) { var appLinkUrl = $"{parameters["appLinkUrl"]}"; var previewImageUrl = $"{parameters["previewImageUrl"]}"; var promotionCode = $"{parameters["promotionCode"]}"; var promotionText = $"{parameters["promotionText"]}"; var destination = FacebookAppInviteDestination.Facebook; if (parameters["destination"] is FacebookAppInviteDestination) { destination = (FacebookAppInviteDestination)parameters["destination"]; } if (AppInviteDialog.CanShow() && !string.IsNullOrEmpty(appLinkUrl)) { AppInviteContent.Builder appInviteContentBuilder = new AppInviteContent.Builder(); appInviteContentBuilder.SetApplinkUrl(appLinkUrl); appInviteContentBuilder.SetDestination(destination == FacebookAppInviteDestination.Facebook?AppInviteContent.Builder.Destination.Facebook: AppInviteContent.Builder.Destination.Messenger); if (!string.IsNullOrEmpty(previewImageUrl)) { appInviteContentBuilder.SetPreviewImageUrl(previewImageUrl); } if (!string.IsNullOrEmpty(promotionText) || !string.IsNullOrEmpty(promotionCode)) { appInviteContentBuilder.SetPromotionDetails(promotionText, promotionCode); } AppInviteDialog AppInv = new AppInviteDialog(CurrentActivity); AppInv.RegisterCallback(mCallbackManager, appInviteCallback); AppInv.Show(appInviteContentBuilder.Build().JavaCast <AppInviteContent>()); } }
public void DidFail(AppInviteDialog appInviteDialog, NSError error) { var fbArgs = new FBEventArgs <Dictionary <string, object> >(null, FacebookActionStatus.Error, $"Facebook App Invite Failed - {error.Code} - {error.Description}"); OnAppInvite(this, fbArgs); _appInviteTcs?.TrySetResult(new FacebookResponse <Dictionary <string, object> >(fbArgs)); }
public void DidComplete(AppInviteDialog appInviteDialog, NSDictionary results) { Dictionary <string, object> parameters = new Dictionary <string, object>(); foreach (var r in results) { parameters.Add($"{r.Key}", $"{r.Value}"); } var fbArgs = new FBEventArgs <Dictionary <string, object> >(parameters, FacebookActionStatus.Completed); OnAppInvite(this, fbArgs); _appInviteTcs?.TrySetResult(new FacebookResponse <Dictionary <string, object> >(fbArgs)); }
public void ShowAppInviteDialogRequest(Dictionary <string, object> parameters) { var appLinkUrl = $"{parameters["appLinkUrl"]}"; var previewImageUrl = $"{parameters["previewImageUrl"]}"; var promotionCode = $"{parameters["promotionCode"]}"; var promotionText = $"{parameters["promotionText"]}"; var destination = FacebookAppInviteDestination.Facebook; if (parameters["destination"] is FacebookAppInviteDestination) { destination = (FacebookAppInviteDestination)parameters["destination"]; } if (!string.IsNullOrEmpty(appLinkUrl)) { AppInviteContent content = new AppInviteContent() { AppLinkURL = NSUrl.FromString(appLinkUrl) }; if (!string.IsNullOrEmpty(previewImageUrl)) { content.PreviewImageURL = NSUrl.FromString(previewImageUrl); } content.Destination = destination == FacebookAppInviteDestination.Facebook ? AppInviteDestination.Facebook : AppInviteDestination.Messenger; if (!string.IsNullOrEmpty(promotionText)) { content.PromotionText = promotionText; } if (!string.IsNullOrEmpty(promotionCode)) { content.PromotionCode = promotionCode; } UIApplication.SharedApplication.InvokeOnMainThread(() => { var window = UIApplication.SharedApplication.KeyWindow; var vc = window.RootViewController; while (vc.PresentedViewController != null) { vc = vc.PresentedViewController; } AppInviteDialog.Show(vc, content, this); }); } }
public void DidFail (AppInviteDialog appInviteDialog, NSError error) { new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); }
public void DidComplete (AppInviteDialog appInviteDialog, NSDictionary results) { Console.WriteLine (results); if (results["completionGesture"] != null && results["completionGesture"].ToString () != "cancel") new UIAlertView ("Success!!", "Successfully invited to some friends to use your app!", null, "Ok", null).Show (); }