chore: improvement to wasm delay fix from #720

This commit is contained in:
Mike Irving 2024-06-19 16:08:37 +01:00 коммит произвёл GitHub
Родитель f234d62984
Коммит fb0bbf2269
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 0 добавлений и 14 удалений

Просмотреть файл

@ -209,7 +209,6 @@ namespace UnoChat.Client
private IDisposable ShouldSendModelsAddedToAllMessagesToMessageObserver(IObserver<Model> messageObserver)
{
#if !__WASM__
return Observable
.FromEvent<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
handler => (s, e) => handler(e),
@ -218,24 +217,11 @@ namespace UnoChat.Client
.Where(args => args.Action == NotifyCollectionChangedAction.Add)
.Select(args => args.NewItems.OfType<Message.Model>().FirstOrDefault())
.Where(model => model != null)
#if !__WASM__
.Delay(TimeSpan.FromMilliseconds(10), Schedulers.Default) // Wait for the list view to have been updated
#endif
.ObserveOn(Schedulers.Dispatcher)
.Subscribe(messageObserver);
#else
return Observable
.FromEvent<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
handler => (s, e) => handler(e),
handler => _allMessages.CollectionChanged += handler,
handler => _allMessages.CollectionChanged -= handler)
.Where(args => args.Action == NotifyCollectionChangedAction.Add)
.Select(args => args.NewItems.OfType<Message.Model>().FirstOrDefault())
.Where(model => model != null)
.ObserveOn(Schedulers.Dispatcher)
.Subscribe(messageObserver);
#endif
}
public IDisposable Activate(IObservable<object> messageToSendBoxReturn, IObserver<string> themeObserver, IObserver<Message.Model> messageObserver)