예제 #1
0
    public static void SendInvite(string title, string message, string callToAction, string linkURL)
    {
                #if invites
        Invite newInvite = new Invite()
        {
            TitleText        = title,
            MessageText      = message,
            CallToActionText = callToAction,
            DeepLinkUrl      = new Uri(linkURL)
        };

        FirebaseInvites.SendInviteAsync(newInvite).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Analytics.LogError("Firebase Send Invite", "SendInvite canceled!");
                return;
            }

            if (task.IsFaulted)
            {
                Analytics.LogError("Firebase Send Invite", "Error: " + task.Exception);
                return;
            }

            foreach (string id in task.Result.InvitationIds)
            {
                OnInviteSent(id);
            }
        });
                #endif
    }
예제 #2
0
    void OnInviteReceived(object sender, InviteReceivedEventArgs e)
    {
        if (e.InvitationId != "")
        {
            Analytics.LogEvent("Invite received", "Invitation ID: " + e.InvitationId);
            FirebaseInvites.ConvertInvitationAsync(e.InvitationId).ContinueWith(task => {
                if (task.IsCanceled)
                {
                    Analytics.LogError("Firebase Convert Invite", "Convert Invitation canceled!");
                    return;
                }

                if (task.IsFaulted)
                {
                    Analytics.LogError("Firebase Convert Invite", "Error: " + task.Exception);
                    return;
                }
            });
        }

        if (e.DeepLink.ToString() != "")
        {
            Analytics.LogEvent("Invite received", "Deep link: " + e.DeepLink);
        }
    }