public IObservable <Message> LoadMessage(long chatId, long messageId) { var scope = new MessageLoaderScope(_agent); return(scope.GetMessage(chatId, messageId) .SelectSeq(m => MapToMessage(scope, m)) .Finally(() => { scope.Dispose(); })); }
public IObservable <Message> LoadPinnedMessage(Chat chat) { var scope = new MessageLoaderScope(_agent); return(GetPinnedMessage(chat.ChatData) .Where(m => m != null) .SelectSeq(m => MapToMessage(scope, m)) .Finally(() => { scope.Dispose(); })); }
public IObservable <Message> LoadMessages( Aggregate feed, AggregateLoadingState state) { var scope = new MessageLoaderScope(_agent); return(LoadAggregateMessages(feed, state) .SelectSeq(m => MapToMessage(scope, m)) .Finally(() => { scope.Dispose(); })); }
public IObservable <Message> LoadPrevMessages( Chat chat, long fromMessageId, int limit) { var scope = new MessageLoaderScope(_agent); return(GetMessages(chat.ChatData, fromMessageId, limit, 0) .SelectSeq(m => MapToMessage(scope, m)) .Finally(() => { scope.Dispose(); })); }