public static IDisposable BindNotifications( this MessengerModel model, INotificationSource notificationSource, INotificationController notificationController) { var chats = notificationSource.ChatNotifications(); var messages = notificationSource.MessagesNotifications(); return(chats.Merge(messages) .Buffer(TimeSpan.FromSeconds(2)) .SubscribeOn(RxApp.TaskpoolScheduler) .ObserveOn(RxApp.MainThreadScheduler) .Accept(notifications => { switch (notifications.Count) { case 0: break; case 1: notificationController.Show( NotificationModel.FromNotification(notifications[0])); break; default: notificationController.Show( NotificationModel.FromNotificationList(notifications)); break; } })); }
public NotificationConnector( INotificationSource source, INotificationTransport transport) { this.source = source; this.transport = transport; }
public async Task PermanentNotifyAsync(string[] tokenIds, string type, INotificationSource sourse) => await NotifyAsync(_permanentConnectionService.GetConnections(tokenIds), type, sourse);
public async Task NotifyAsync(string[] userIds, INotificationSource sourse, string type) => await NotifyAsync(_userConnectionService.GetUserConnections(userIds), type, sourse);
public async Task NotifyAsync(string userId, string tokenId, string type, INotificationSource sourse) => await NotifyAsync(_userConnectionService.GetUserConnections(userId, tokenId), type, sourse);
public async Task NotifyAsync(string[] conns, string type, INotificationSource sourse) => await _hubContext.Clients.Clients(conns).SendAsync(methodNotificationName, new NotificationDto { Type = type, Source = sourse });