public async Task <IActionResult> GetMyPolling([FromBody] PollRequest request) { var requestToken = request.Token ?? default; if (requestToken != default) { requestToken = requestToken.Minus(Duration.FromSeconds(10)); } #pragma warning disable MA0040 // Flow the cancellation token if (request.Delivered?.Length > 0) { var tokens = request.Delivered.Select(x => TrackingToken.Parse(x)); await userNotificationStore.TrackSeenAsync(tokens); } if (request.Seen?.Length > 0) { var tokens = request.Seen.Select(x => TrackingToken.Parse(x)); await userNotificationStore.TrackSeenAsync(tokens); } foreach (var id in request.Confirmed.OrEmpty()) { var token = TrackingToken.Parse(id); await userNotificationStore.TrackConfirmedAsync(token); } #pragma warning restore MA0040 // Flow the cancellation token foreach (var id in request.Deleted.OrEmpty()) { await userNotificationStore.DeleteAsync(id, HttpContext.RequestAborted); } var notifications = await userNotificationStore.QueryAsync(App.Id, UserId, DefaultQuery with { After = requestToken }, HttpContext.RequestAborted);
public async Task TrackSeenAsync(IEnumerable <TrackingToken> tokens) { await userNotificationsStore.TrackSeenAsync(tokens); foreach (var token in tokens.Where(x => x.IsValid && !string.IsNullOrWhiteSpace(x.Channel))) { var channel = channels.FirstOrDefault(x => x.Name == token.Channel); if (channel != null) { await channel.HandleSeenAsync(token); } } }
public Task TrackSeenAsync(IEnumerable <Guid> ids, string?channel = null) { return(userNotificationsStore.TrackSeenAsync(ids, channel)); }