Created
May 27, 2020 23:24
-
-
Save mattpodwysocki/bf94217d7a7d3000bc215ede71911214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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