Class ChatViewModel
The signed-in screen: the room list, the open room's messages and the message box.
Inheritance
ChatViewModel
Assembly: Uniform.Chat.Avalonia.dll
public sealed class ChatViewModel : ViewModelBase, INotifyPropertyChanged, INotifyPropertyChanging, IAsyncDisposable
Constructors
|
Edit this page
View Source
Create the screen over a started connection.
Declaration
public ChatViewModel(ClientConnection connection, IUiDispatcher ui, bool singlePane, Func<Task> signOut, INotifier? notifier = null, SettingsViewModel? settings = null, CallViewModel? call = null)
Parameters
| Type |
Name |
Description |
| ClientConnection |
connection |
Engine of the signed-in account.
|
| IUiDispatcher |
ui |
Dispatcher of the user interface thread.
|
| bool |
singlePane |
Whether the screen shows one pane at a time, as on phones.
|
| Func<Task> |
signOut |
Called by SignOutCommand to end the session and return to the sign-in form.
|
| INotifier |
notifier |
System notifications, or null for none.
|
| SettingsViewModel |
settings |
App settings, shown in the settings panel; null hides it.
|
| CallViewModel |
call |
The call bar; null for no calls.
|
Properties
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.AcceptInviteAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand AcceptInviteCommand { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public ActionSheetViewModel? ActionSheet { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public AdminViewModel? Admin { get; set; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.Back().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand BackCommand { get; }
Property Value
|
Edit this page
View Source
The call bar; null for no calls.
Declaration
public CallViewModel? Call { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.CallRoomAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand CallRoomCommand { get; }
Property Value
|
Edit this page
View Source
Whether the open room has one other member, who can be voice called.
Declaration
public bool CanCallRoom { get; }
Property Value
|
Edit this page
View Source
Whether the open room takes messages: not while suspended, nor in the server's notices room.
Declaration
public bool CanCompose { get; }
Property Value
|
Edit this page
View Source
Whether the open room can be video called: a direct room, on a device with a camera.
Declaration
public bool CanVideoCallRoom { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.CancelCompose().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand CancelComposeCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.CancelShare().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand CancelShareCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.CloseAdmin().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand CloseAdminCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.CloseDirectory().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand CloseDirectoryCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.CloseSecurity().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand CloseSecurityCommand { get; }
Property Value
|
Edit this page
View Source
Get what the composer does besides sending a new message, e.g. Replying to Bob: snippet.
Declaration
public string ComposeMode { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyCanExecuteChangedFor("SendCommand")]
[ExcludeFromCodeCoverage]
public string Composer { get; set; }
Property Value
|
Edit this page
View Source
Copies text to the clipboard; set by the view, which has the clipboard.
Declaration
public Func<string, Task>? CopyToClipboard { get; set; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.DeclineInviteAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand DeclineInviteCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.DismissNotice().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand DismissNoticeCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.DismissSecuritySuggestion().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand DismissSecuritySuggestionCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.DismissSuspension().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand DismissSuspensionCommand { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("ComposeMode", new string[] { "IsComposingSpecial" })]
[ExcludeFromCodeCoverage]
public MessageViewModel? Editing { get; set; }
Property Value
|
Edit this page
View Source
Declaration
public bool HasOpenRoom { get; }
Property Value
|
Edit this page
View Source
Whether a room should be chosen for shared content.
Declaration
public bool HasPendingShare { get; }
Property Value
|
Edit this page
View Source
Whether there is a security suggestion.
Declaration
public bool HasSecuritySuggestion { get; }
Property Value
|
Edit this page
View Source
Whether shared files wait to be sent.
Declaration
public bool HasSharedFiles { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.InviteAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand InviteCommand { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyCanExecuteChangedFor("InviteCommand")]
[ExcludeFromCodeCoverage]
public string InviteTarget { get; set; }
Property Value
|
Edit this page
View Source
Whether the app's window has the focus; notifications are shown only while it has not.
Declaration
public bool IsActive { get; set; }
Property Value
|
Edit this page
View Source
Get whether the composer replies or edits.
Declaration
public bool IsComposingSpecial { get; }
Property Value
|
Edit this page
View Source
IsLoadingHistory
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public bool IsLoadingHistory { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("ShowRoomList", new string[] { "ShowRoom" })]
[ExcludeFromCodeCoverage]
public bool IsNarrow { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public bool IsServerAdmin { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public bool IsSettingsOpen { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("CanCompose")]
[NotifyCanExecuteChangedFor("SendCommand")]
[ExcludeFromCodeCoverage]
public bool IsSuspended { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyCanExecuteChangedFor("OpenTargetCommand")]
[NotifyPropertyChangedFor("OpenTargetText")]
[ExcludeFromCodeCoverage]
public string JoinTarget { get; set; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.LeaveRoomAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand LeaveRoomCommand { get; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.LoadMembers().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand LoadMembersCommand { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.LoadOlderAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand LoadOlderCommand { get; }
Property Value
|
Edit this page
View Source
Declaration
public ObservableCollection<MemberItem> Members { get; }
Property Value
|
Edit this page
View Source
The open room's timeline.
Declaration
public MessageList Messages { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public string Notice { get; set; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.OpenAdminAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand OpenAdminCommand { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.OpenDirectoryAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand OpenDirectoryCommand { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.OpenSecurityAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand OpenSecurityCommand { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.OpenTargetAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand OpenTargetCommand { get; }
Property Value
|
Edit this page
View Source
OpenTargetText
Get the room box's button text: Join, Chat or Create by what was typed.
Declaration
public string OpenTargetText { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("HasPendingShare", new string[] { "PendingShareText" })]
[ExcludeFromCodeCoverage]
public SharedContent? PendingShare { get; set; }
Property Value
|
Edit this page
View Source
PendingShareText
What to ask while a room is chosen.
Declaration
public string PendingShareText { get; }
Property Value
|
Edit this page
View Source
Reactions offered first, in the sheet's row and the menu.
Declaration
public static IReadOnlyList<string> QuickReactions { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("ComposeMode", new string[] { "IsComposingSpecial" })]
[ExcludeFromCodeCoverage]
public MessageViewModel? ReplyingTo { get; set; }
Property Value
|
Edit this page
View Source
Reasons offered when reporting a message, a user or a room.
Declaration
public static IReadOnlyList<string> ReportReasons { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public DirectoryViewModel? RoomDirectory { get; set; }
Property Value
|
Edit this page
View Source
Rooms, invites first, then favourites, others and low priority, each by name.
Declaration
public ObservableCollection<RoomItemViewModel> Rooms { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public SecurityViewModel? Security { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("HasSecuritySuggestion")]
[ExcludeFromCodeCoverage]
public string SecuritySuggestion { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("HasOpenRoom", new string[] { "ShowRoomList", "ShowRoom", "CanCallRoom", "CanVideoCallRoom" })]
[ExcludeFromCodeCoverage]
public RoomItemViewModel? SelectedRoom { get; set; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.SendAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand SendCommand { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.SendSharedFilesAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand SendSharedFilesCommand { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.SetTopicAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand SetTopicCommand { get; }
Property Value
|
Edit this page
View Source
App settings, or null when not offered.
Declaration
public SettingsViewModel? Settings { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("HasSharedFiles", new string[] { "SharedFilesText" })]
[ExcludeFromCodeCoverage]
public IReadOnlyList<SharedFile>? SharedFiles { get; set; }
Property Value
|
Edit this page
View Source
SharedFilesText
What waits to be sent, e.g. Share photo.jpg.
Declaration
public string SharedFilesText { get; }
Property Value
|
Edit this page
View Source
Whether the open room is shown: always on wide screens, on narrow ones once a room is opened.
Declaration
public bool ShowRoom { get; }
Property Value
|
Edit this page
View Source
Whether the room list is shown: always on wide screens, on narrow ones until a room is opened.
Declaration
public bool ShowRoomList { get; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.SignOutAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand SignOutCommand { get; }
Property Value
|
Edit this page
View Source
StatusText
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public string StatusText { get; set; }
Property Value
Gets an IRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.ToggleSettings().
Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand ToggleSettingsCommand { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public string TopicDraft { get; set; }
Property Value
|
Edit this page
View Source
TypingText
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public string TypingText { get; set; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public int UnreadRooms { get; set; }
Property Value
|
Edit this page
View Source
Declaration
public string UserId { get; }
Property Value
|
Edit this page
View Source
Declaration
[ObservableProperty]
[ExcludeFromCodeCoverage]
public VerificationViewModel? Verification { get; set; }
Property Value
Gets an IAsyncRelayCommand instance wrapping Uniform.Chat.Avalonia.ViewModels.ChatViewModel.VideoCallRoomAsync().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand VideoCallRoomCommand { get; }
Property Value
Methods
|
Edit this page
View Source
Accept the invite to room.
Declaration
public Task AcceptAsync(RoomItemViewModel room)
Parameters
Returns
|
Edit this page
View Source
Return the details and actions of message in the open room: reply, react, edit, copy, delete, report and block, as they apply.
Declaration
public ActionSheetViewModel CreateMessageActions(MessageViewModel message)
Parameters
Returns
|
Edit this page
View Source
Return the details and actions of room in the list: join or decline an invite; else mark read, favourite, low priority, copy its link, report and leave.
Declaration
public ActionSheetViewModel CreateRoomActions(RoomItemViewModel room)
Parameters
Returns
|
Edit this page
View Source
Decline the invite to room, and close it when it is open.
Declaration
public Task DeclineAsync(RoomItemViewModel room)
Parameters
Returns
|
Edit this page
View Source
Delete own message for everyone.
Declaration
public Task DeleteAsync(MessageViewModel message)
Parameters
Returns
|
Edit this page
View Source
Stop following the engine.
Declaration
public ValueTask DisposeAsync()
Returns
|
Edit this page
View Source
Download an attachment into the media cache, decrypting it when needed; return its local path, or null when it failed.
Declaration
public Task<string?> DownloadAsync(MessageViewModel message)
Parameters
Returns
|
Edit this page
View Source
Download an attachment and return a copy under its own file name, so the system knows which app opens it; null when it failed.
Declaration
public Task<string?> DownloadForOpeningAsync(MessageViewModel message)
Parameters
Returns
|
Edit this page
View Source
Go back one step, as Android's back button does: close the panel on top, else leave the open room on narrow screens; return false when there is nothing to go back from, so the app may close.
Declaration
Returns
|
Edit this page
View Source
Leave room, and close it when it is open.
Declaration
public Task LeaveAsync(RoomItemViewModel room)
Parameters
Returns
|
Edit this page
View Source
Mark everything in room read, without opening it.
Declaration
public void MarkRoomRead(RoomItemViewModel room)
Parameters
|
Edit this page
View Source
Follow a matrix.to link or matrix: URI inside the app: open a room already joined, or put a room, a room ID with the servers to join through, or a person in the room box to join or chat with; return false for other links.
Declaration
public bool OpenMatrixLink(string href)
Parameters
| Type |
Name |
Description |
| string |
href |
|
Returns
|
Edit this page
View Source
React to message with key, usually an emoji; reacting again with the same key does nothing.
Declaration
public Task ReactAsync(MessageViewModel message, string key)
Parameters
Returns
|
Edit this page
View Source
Report message of the open room to the admins of the user's server.
Declaration
public Task ReportMessageAsync(MessageViewModel message, string reason)
Parameters
Returns
|
Edit this page
View Source
Report the open room to the admins of the user's server.
Declaration
public Task ReportRoomAsync(string reason)
Parameters
| Type |
Name |
Description |
| string |
reason |
|
Returns
|
Edit this page
View Source
Report room to the admins of the user's server.
Declaration
public Task ReportRoomAsync(RoomItemViewModel room, string reason)
Parameters
Returns
|
Edit this page
View Source
Report the user userId to the admins of the user's server.
Declaration
public Task ReportUserAsync(string userId, string reason)
Parameters
Returns
|
Edit this page
View Source
Send a file to the open room as an image, video, audio or file message by its type; files to encrypted rooms are encrypted first.
Declaration
public Task SendFileAsync(Stream content, string fileName)
Parameters
| Type |
Name |
Description |
| Stream |
content |
File contents.
|
| string |
fileName |
Name shown to others.
|
Returns
|
Edit this page
View Source
Block userId, so their messages and invites no longer show, or unblock them.
Declaration
public Task SetBlockedAsync(string userId, bool blocked)
Parameters
Returns
|
Edit this page
View Source
Add or remove the tag tag of room; favourite and low priority exclude each other, as in other clients.
Declaration
public Task SetTagAsync(RoomItemViewModel room, string tag, bool on)
Parameters
Returns
|
Edit this page
View Source
Start following the engine: connection state, sync changes and late-decrypted messages.
Declaration
|
Edit this page
View Source
Edit own message: its text goes to the composer.
Declaration
public void StartEdit(MessageViewModel message)
Parameters
|
Edit this page
View Source
Answer message with the next message.
Declaration
public void StartReply(MessageViewModel message)
Parameters
|
Edit this page
View Source
Ask member to verify each other by comparing emoji; the request shows in the verification panel.
Declaration
public Task VerifyMemberAsync(MemberItem member)
Parameters
Returns
Events
|
Edit this page
View Source
Raised when an action wants the message box focused, such as Reply and Edit.
Declaration
public event Action? ComposerFocusRequested
Event Type
Implements