private PushNotification ParseRemoteMessage()

in src/Covi.Android/Services/FirebaseService.cs [151:201]


        private PushNotification ParseRemoteMessage(RemoteMessage message)
        {
            string title = null;
            string body = null;

            var notification = message.GetNotification();
            if (notification != null)
            {
                title = notification.Title;
                body = notification.Body;
            }

            if (message.Data?.Any() != true)
            {
                return new PushNotification
                {
                    Title = title,
                    Description = body
                };
            }

            message.Data.TryGetValue("title", out var title1);
            if (!string.IsNullOrEmpty(title1))
            {
                title = title1;
            }

            message.Data.TryGetValue("subtitle", out var subTitle);

            message.Data.TryGetValue("payload", out var body1);
            if (!string.IsNullOrEmpty(body1))
            {
                body = body1;
            }

            if (string.IsNullOrEmpty(body))
            {
                message.Data.TryGetValue("message", out var body2);
                if (!string.IsNullOrEmpty(body2))
                {
                    body = body2;
                }
            }

            return new PushNotification
            {
                Title = title,
                Description = body,
                SubTitle = subTitle,
            };
        }