Class MessageList
The open room's timeline as items: events become messages, while edits, deletions and reactions change the messages they refer to.
Inherited Members
Namespace: Uniform.Chat.Avalonia.ViewModels
Assembly: Uniform.Chat.Avalonia.dll
Syntax
public sealed class MessageList
Remarks
Methods taking a Room read room state, so call them under the room store's lock.
Constructors
| Edit this page View SourceMessageList(string)
Create an empty list for ownUserId.
Declaration
public MessageList(string ownUserId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ownUserId |
Properties
| Edit this page View SourceIsBlocked
Return whether the user has blocked, i.e. ignores, a sender, whose messages are then not shown; null shows all.
Declaration
public Func<string, bool>? IsBlocked { get; init; }
Property Value
| Type | Description |
|---|---|
| Func<string, bool> |
Items
Items in time order, unsent messages last.
Declaration
public ObservableCollection<MessageViewModel> Items { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<MessageViewModel> |
NewestEventId
Newest event ID shown, for read markers.
Declaration
public string? NewestEventId { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceAppend(Room, IEnumerable<ClientEvent>)
Add newer events, oldest first, before the unsent messages; an edit, reaction or deletion of a message not shown changes nothing, as it loads with that message's line.
Declaration
public void Append(Room room, IEnumerable<ClientEvent> events)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | |
| IEnumerable<ClientEvent> | events |
Find(string)
Return the item of eventId, or null.
Declaration
public MessageViewModel? Find(string eventId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | eventId |
Returns
| Type | Description |
|---|---|
| MessageViewModel |
Prepend(Room, IEnumerable<ClientEvent>)
Add older events, oldest first, before the current items.
Declaration
public void Prepend(Room room, IEnumerable<ClientEvent> events)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | |
| IEnumerable<ClientEvent> | events |
Reset(Room, IEnumerable<ClientEvent>)
Replace the items with events, oldest first.
Declaration
public void Reset(Room room, IEnumerable<ClientEvent> events)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | |
| IEnumerable<ClientEvent> | events |
SetPending(Room, IEnumerable<OutboxMessage>)
Show the room's unsent messages after the timeline, replacing the previous ones.
Declaration
public void SetPending(Room room, IEnumerable<OutboxMessage> unsent)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | |
| IEnumerable<OutboxMessage> | unsent |