async Task <String> ISendNotificationService.SendNotification(SendNotificationInput input)
        {
            var notification = new Notification()
            {
                Title = input.NotificationTitle,
                Body  = input.NotificationBody,
            };

            var data = new Dictionary <string, string>()
            {
                { "displayedTitle", input.DisplayedTitle },
                { "displayedBody", input.DisplayedBody },
                { "click_action", "FLUTTER_NOTIFICATION_CLICK" },
            };

            var message = new Message()
            {
                Token        = input.RegistrationToken,
                Notification = notification,
                Data         = data,
                Topic        = input.Topic,
            };

            return(await FirebaseMessaging.DefaultInstance.SendAsync(message));
        }
Example #2
0
 public Task <OperationResult> SendNotificationAsync(SendNotificationInput input)
 => _apiClient.PostAsync <SendNotificationInput, OperationResult>(URL + "/sendnotification", input);
        public async Task <IActionResult> SendNotification([FromBody] SendNotificationPost model)
        {
            var input = new SendNotificationInput(model);

            return(new OkObjectResult(await sendNotificationService.SendNotification(input)));
        }
        public async Task <CommandResult> Send([FromServices] SendNotificationCommand sendNotificationCommand, [FromBody] SendNotificationInput saveUserInput)
        {
            var userInput = new UserInput <SendNotificationInput>
            {
                UserId = User.GetUserId(),
                Data   = saveUserInput
            };

            var result = await
                         Business.InvokeAsync <SendNotificationCommand, UserInput <SendNotificationInput>, CommandResult>(
                sendNotificationCommand, userInput);

            return(result);
        }