public async Task HandleSimplePushAsync(ServerNotification notification) { var message = _serialiser.Deserialise<SimplePushMessage>(notification.Data.ToString()); var expired = message.ExpiryTimeStamp.HasValue && message.ExpiryTimeStamp <= DateTime.UtcNow; await _commonMessagingManager.NotifyMessageReceivedAsync(message, notification); if (!expired) { var messageEvent = new SimplePushMessageReceivedEvent { NotificationId = notification.NotificationId, Message = message }; // See if we have interactive config for this platform. if (message.ButtonSets != null) { messageEvent.PlatformButtonSet = message.ButtonSets .SingleOrDefault(b => b.Platform == INTERACTIVE_PLATFORM); await ProcessPendingActionsOrSaveMessage(message); } _donkyCore.PublishLocalEvent(messageEvent, DonkyPushLogic.Module); } }
private static void HandleSimplePushReceived(SimplePushMessageReceivedEvent messageEvent) { if (DonkyCore.Instance.GetService<IAppState>().IsOpen) { DonkyCore.Instance.PublishLocalEvent(new DisplaySimplePushAlertEvent { MessageReceivedEvent = messageEvent }, Module); } else { ShowNativeNotification(messageEvent.Message, messageEvent.NotificationId, messageEvent.PlatformButtonSet); } }
private static void HandleSimplePushReceived(SimplePushMessageReceivedEvent messageEvent) { // Decrement badge count DonkyCore.Instance.PublishLocalEvent(new DecrementBadgeCountEvent(), Module); // If this was the notification we were launched from, don't display the banner var appState = DonkyCore.Instance.GetService<IAppState>(); if (appState.WasOpenedFromNotification && appState.LaunchingNotificationId == messageEvent.NotificationId) { return; } // Publish event for the common UI layer DonkyCore.Instance.PublishLocalEvent(new DisplaySimplePushAlertEvent { MessageReceivedEvent = messageEvent }, Module); }