public async Task ProcessAsync(UserNotificationInfo userNotificationsInfo) { if (userNotificationsInfo == null) { return; } var notification = await _notificationStore.GetNotificationOrNullAsync(userNotificationsInfo.NotificationId); if (notification == null) { return; } var firebaseNotificationData = FirebaseNotificationData.FromJsonString(notification.Data); firebaseNotificationData.Notification.Badge = (await _notificationStore.GetUserNotificationCountAsync(userNotificationsInfo.UserId, UserNotificationState.Unread)).ToString(); var firebaseRegistrations = await _firebaseService.GetAllRegistrationAsync(userNotificationsInfo.UserId); if (firebaseRegistrations.IsNullOrEmpty()) { return; } firebaseNotificationData.RegistrationIds.AddRange(firebaseRegistrations.Select(x => x.RegistrationId)); var json = firebaseNotificationData.ToString(); var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync(_configuration.Url, content); if (response.IsSuccessStatusCode) { await ProcessResponseOk(response, firebaseNotificationData); } else { await ProcessReponseError(response, firebaseNotificationData); } }
public Task <int> GetUserNotificationCountAsync(UserIdentifier user, UserNotificationState?state = null) { return(_store.GetUserNotificationCountAsync(user, state)); }
public Task <int> GetUserNotificationCountAsync(Guid userId, UserNotificationState?state = null, DateTime?startDate = null, DateTime?endDate = null) { return(_store.GetUserNotificationCountAsync(userId, state, startDate, endDate)); }
public Task <int> GetUserNotificationCountAsync(long userId, UserNotificationState?state = null) { return(_store.GetUserNotificationCountAsync(userId, state)); }