Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created May 27, 2020 23:24
Show Gist options
  • Save mattpodwysocki/bf94217d7a7d3000bc215ede71911214 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/bf94217d7a7d3000bc215ede71911214 to your computer and use it in GitHub Desktop.
using Foundation;
using WindowsAzure.Messaging.NotificationHubs;
namespace Microsoft.Azure.NotificationHubs
{
public partial class NotificationHub
{
private static readonly NotificationHubMessageDelegate _notificationHubMessageDelegate;
static NotificationHub()
{
_notificationHubMessageDelegate = new NotificationHubMessageDelegate
{
OnDidReceivePushNotification = message =>
{
var args = new NotificationHubMessageReceivedEventArgs
{
Title = message.Title,
Body = message.Body
};
NotificationReceived?.Invoke(null, args);
}
};
MSNotificationHub.SetDelegate(_notificationHubMessageDelegate);
}
public NotificationHub(string connectionString, string hubName)
{
MSNotificationHub.Init(connectionString, hubName);
}
// TODO: Make public
public static void FailedToRegisterForRemoteNotifications(NSError error)
{
MSNotificationHub.DidFailToRegisterForRemoteNotificationsWithError(error);
}
// TODO: Make public
public static bool DidReceiveRemoteNotification(NSDictionary userInfo)
{
return MSNotificationHub.DidReceiveRemoteNotification(userInfo);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment