Exemple #1
0
        private PushNotification ParseNotification(IDictionary <string, string> notification, bool ignoreInvalidNotification)
        {
            PushNotification pushNotification = null;

            if (this.knownNotificationTypes != null && notification != null)
            {
                PushNotificationParseResult result = PushNotification.FromDictionary(this.knownNotificationTypes, notification);
                if (result.Result == PushNotificationParseResult.ResultCode.Success)
                {
                    pushNotification = result.Notification;
                }
                else if (!ignoreInvalidNotification)
                {
                    throw new ArgumentException("Invalid notification data, failed to parse with result (" + result.Result + ").", nameof(notification));
                }
            }

            return(pushNotification);
        }