Esempio n. 1
0
        public async Task Confirm([FromBody] TrackNotificationDto request)
        {
            if (request.Confirmed.HasValue)
            {
                await userNotificationService.TrackConfirmedAsync(request.Confirmed.Value, request.Channel);
            }

            if (request.Seen?.Length > 0)
            {
                await userNotificationService.TrackSeenAsync(request.Seen, request.Channel);
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> ConfirmMe([FromBody] TrackNotificationDto request)
        {
            if (request.Confirmed != null)
            {
                var token = TrackingToken.Parse(request.Confirmed, request.Channel, request.DeviceIdentifier);

                await userNotificationService.TrackConfirmedAsync(token);
            }

            if (request.Seen?.Length > 0)
            {
                var tokens = request.Seen.Select(x => TrackingToken.Parse(x, request.Channel, request.DeviceIdentifier));

                await userNotificationService.TrackSeenAsync(tokens);
            }

            return(NoContent());
        }
Esempio n. 3
0
        private async Task TrackNotificationsAsync(IEnumerable <NotificationDto> notifications)
        {
            try
            {
                var seenIds = notifications.Select(x => x.Id).ToArray();

                _ = settings.TrackNotificationsAsync(seenIds);

                var trackNotificationDto = new TrackNotificationDto
                {
                    Seen             = seenIds,
                    DeviceIdentifier = settings.Token
                };

                await Notifications.ConfirmAsync(trackNotificationDto);
            }
            catch (Exception ex)
            {
                Log.Error(Strings.TrackingException, ex);
            }
        }