diff --git a/src/Decho/App.axaml.cs b/src/Decho/App.axaml.cs index 9d81b86..7895816 100644 --- a/src/Decho/App.axaml.cs +++ b/src/Decho/App.axaml.cs @@ -78,4 +78,4 @@ public partial class App : Application Locator.Current.GetService()!, Locator.Current.GetService()!)); } -} +} \ No newline at end of file diff --git a/src/Decho/Services/AttachmentService.cs b/src/Decho/Services/AttachmentService.cs index da0367c..44704bd 100644 --- a/src/Decho/Services/AttachmentService.cs +++ b/src/Decho/Services/AttachmentService.cs @@ -97,4 +97,4 @@ internal sealed class AttachmentService : IAttachmentService return null; } } -} +} \ No newline at end of file diff --git a/src/Decho/Services/ChannelService.cs b/src/Decho/Services/ChannelService.cs index 27d1360..9e2b5a5 100644 --- a/src/Decho/Services/ChannelService.cs +++ b/src/Decho/Services/ChannelService.cs @@ -341,4 +341,4 @@ internal sealed class ChannelService : IChannelService attachments, dto.ReplyTo); } -} +} \ No newline at end of file diff --git a/src/Decho/Services/ConfigPersistenceService.cs b/src/Decho/Services/ConfigPersistenceService.cs index 1f14046..1753114 100644 --- a/src/Decho/Services/ConfigPersistenceService.cs +++ b/src/Decho/Services/ConfigPersistenceService.cs @@ -68,4 +68,4 @@ internal sealed class ConfigPersistenceService : IConfigPersistenceService action(config, saved); ConfigManager.Save(config); } -} +} \ No newline at end of file diff --git a/src/Decho/Services/ConnectionService.cs b/src/Decho/Services/ConnectionService.cs index 6fea1cd..35c8993 100644 --- a/src/Decho/Services/ConnectionService.cs +++ b/src/Decho/Services/ConnectionService.cs @@ -32,14 +32,23 @@ public sealed class ChannelJoinResult public sealed class ConnectionService : IConnectionService { public event Action? ServerAdded; + public event Action? ServerRemoved; + public event Action? ServerStateChanged; + public event Action? ChannelAdded; + public event Action? ChannelRemoved; + public event Action? MessageReceived; + public event Action? UserJoined; + public event Action? UserLeft; + public event Action? ErrorOccurred; + public event Action? ChannelDeleted; private readonly Dictionary _connections = new(StringComparer.OrdinalIgnoreCase); @@ -358,4 +367,4 @@ public sealed class ConnectionService : IConnectionService ServerStateChanged?.Invoke(entry.Server); }; } -} +} \ No newline at end of file diff --git a/src/Decho/Services/ConnectionStore.cs b/src/Decho/Services/ConnectionStore.cs index ca20737..029c64a 100644 --- a/src/Decho/Services/ConnectionStore.cs +++ b/src/Decho/Services/ConnectionStore.cs @@ -11,4 +11,4 @@ internal sealed class ConnectionStore : IConnectionStore public ServerConnection? Get(string serverUrl) => _connections.TryGetValue(serverUrl, out ServerConnection? entry) ? entry : null; -} +} \ No newline at end of file diff --git a/src/Decho/Services/CryptoService.cs b/src/Decho/Services/CryptoService.cs index 51ea367..ed0b4cc 100644 --- a/src/Decho/Services/CryptoService.cs +++ b/src/Decho/Services/CryptoService.cs @@ -37,4 +37,4 @@ internal sealed class CryptoService : ICryptoService return entry.Manager.RoomKeys.TryGetKey(channelName, out key); } -} +} \ No newline at end of file diff --git a/src/Decho/Services/IAttachmentService.cs b/src/Decho/Services/IAttachmentService.cs index 0b25099..9a02985 100644 --- a/src/Decho/Services/IAttachmentService.cs +++ b/src/Decho/Services/IAttachmentService.cs @@ -3,5 +3,6 @@ namespace Decho.Services; public interface IAttachmentService { Task DownloadAttachmentAsync(string serverUrl, string channelName, string relativeUrl, string fileName); + Task DownloadImageBytesAsync(string serverUrl, string channelName, string relativeUrl); -} +} \ No newline at end of file diff --git a/src/Decho/Services/IConfigPersistenceService.cs b/src/Decho/Services/IConfigPersistenceService.cs index 5586802..bf99f41 100644 --- a/src/Decho/Services/IConfigPersistenceService.cs +++ b/src/Decho/Services/IConfigPersistenceService.cs @@ -3,7 +3,10 @@ namespace Decho.Services; public interface IConfigPersistenceService { void SaveRefreshToken(string serverUrl, string token, string userId); + void RemoveServerFromConfig(string serverUrl); + void RemoveFromLeftChannels(string serverUrl, string channelName); + void AddLeftChannel(string serverUrl, string channelName); -} +} \ No newline at end of file diff --git a/src/Decho/Services/IConnectionStore.cs b/src/Decho/Services/IConnectionStore.cs index a68b4f9..4019e9d 100644 --- a/src/Decho/Services/IConnectionStore.cs +++ b/src/Decho/Services/IConnectionStore.cs @@ -3,4 +3,4 @@ namespace Decho.Services; internal interface IConnectionStore { ServerConnection? Get(string serverUrl); -} +} \ No newline at end of file diff --git a/src/Decho/Services/ICryptoService.cs b/src/Decho/Services/ICryptoService.cs index c78593b..9d238aa 100644 --- a/src/Decho/Services/ICryptoService.cs +++ b/src/Decho/Services/ICryptoService.cs @@ -3,6 +3,8 @@ namespace Decho.Services; public interface ICryptoService { void MarkChannelEncrypted(string serverUrl, string channelName, bool isEncrypted); + bool HasChannelKey(string serverUrl, string channelName); + bool TryGetRoomKey(string serverUrl, string channelName, out byte[]? key); -} +} \ No newline at end of file diff --git a/src/Decho/Services/IInviteService.cs b/src/Decho/Services/IInviteService.cs index 6df50fd..e11a8d0 100644 --- a/src/Decho/Services/IInviteService.cs +++ b/src/Decho/Services/IInviteService.cs @@ -9,4 +9,4 @@ public interface IInviteService Task> GetInvitesAsync(string serverUrl); Task RevokeInviteAsync(string serverUrl, string code); -} +} \ No newline at end of file diff --git a/src/Decho/Services/IUserService.cs b/src/Decho/Services/IUserService.cs index f9bc574..91fe5d1 100644 --- a/src/Decho/Services/IUserService.cs +++ b/src/Decho/Services/IUserService.cs @@ -34,4 +34,4 @@ public interface IUserService Task ExportMyDataAsync(string serverUrl); string? GetRefreshToken(string serverUrl); -} +} \ No newline at end of file diff --git a/src/Decho/Services/InviteService.cs b/src/Decho/Services/InviteService.cs index fc55d5d..db6cf4d 100644 --- a/src/Decho/Services/InviteService.cs +++ b/src/Decho/Services/InviteService.cs @@ -34,4 +34,4 @@ internal sealed class InviteService : IInviteService await entry.ApiClient.RevokeInviteAsync(code); } -} +} \ No newline at end of file diff --git a/src/Decho/Services/ServerConnection.cs b/src/Decho/Services/ServerConnection.cs index 650946e..def402e 100644 --- a/src/Decho/Services/ServerConnection.cs +++ b/src/Decho/Services/ServerConnection.cs @@ -18,4 +18,4 @@ internal sealed class ServerConnection Server = server; User = user; } -} +} \ No newline at end of file diff --git a/src/Decho/ViewModels/MainWindowViewModel.cs b/src/Decho/ViewModels/MainWindowViewModel.cs index e149f4c..8878abd 100644 --- a/src/Decho/ViewModels/MainWindowViewModel.cs +++ b/src/Decho/ViewModels/MainWindowViewModel.cs @@ -1276,4 +1276,4 @@ public sealed class MainWindowViewModel : ViewModelBase { return Chat.CurrentServerUrl; } -} +} \ No newline at end of file diff --git a/src/Decho/ViewModels/MessageComposerViewModel.cs b/src/Decho/ViewModels/MessageComposerViewModel.cs index 828b1c6..56ed598 100644 --- a/src/Decho/ViewModels/MessageComposerViewModel.cs +++ b/src/Decho/ViewModels/MessageComposerViewModel.cs @@ -86,7 +86,8 @@ public sealed class MessageComposerViewModel : ViewModelBase IObservable canSend = this.WhenAnyValue( x => x.Draft, x => x.HasStagedFiles, - (draft, hasFiles) => !string.IsNullOrWhiteSpace(draft) || hasFiles); + (draft, hasFiles) => + !string.IsNullOrWhiteSpace(draft) || hasFiles); SendCommand = ReactiveCommand.Create(Send, canSend); _ = this.WhenAnyValue(x => x.Draft).Subscribe(OnDraftChanged); @@ -179,20 +180,7 @@ public sealed class MessageComposerViewModel : ViewModelBase ReplyTarget = null; } - private void UpdateStagedSummary() - { - this.RaisePropertyChanged(nameof(HasStagedFiles)); - StagedFilesSummary = StagedFiles.Count > 0 - ? $"{StagedFiles.Count} file(s) staged" - : string.Empty; - } - - private void OnDraftChanged(string? draft) - { - Autocomplete.Update(draft ?? string.Empty); - } - - private void Send() + internal void Send() { string text = Draft.Trim(); Draft = string.Empty; @@ -212,4 +200,17 @@ public sealed class MessageComposerViewModel : ViewModelBase SendRequested?.Invoke(ServerUrl, text, filePaths, replyToId); } + + private void UpdateStagedSummary() + { + this.RaisePropertyChanged(nameof(HasStagedFiles)); + StagedFilesSummary = StagedFiles.Count > 0 + ? $"{StagedFiles.Count} file(s) staged" + : string.Empty; + } + + private void OnDraftChanged(string? draft) + { + Autocomplete.Update(draft ?? string.Empty); + } } \ No newline at end of file