chore: improvement to wasm delay fix from #720
This commit is contained in:
Родитель
f234d62984
Коммит
fb0bbf2269
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче