From e10fa389ce3c4d42deadfec8bf08c2fbb1a88d79 Mon Sep 17 00:00:00 2001 From: "Emma@Rory&" Date: Fri, 15 Sep 2023 09:55:36 +0200 Subject: Refactors --- MatrixRoomUtils.Desktop/App.axaml.cs | 1 - MatrixRoomUtils.Desktop/Components/RoomListEntry.axaml.cs | 4 ++-- MatrixRoomUtils.Desktop/FileStorageProvider.cs | 1 + MatrixRoomUtils.Desktop/MRUStorageWrapper.cs | 7 ++++--- MatrixRoomUtils.Desktop/MainWindow.axaml.cs | 1 - MatrixRoomUtils.Desktop/MatrixRoomUtils.Desktop.csproj | 13 ++++++------- MatrixRoomUtils.Desktop/RoomInfo.cs | 3 ++- 7 files changed, 15 insertions(+), 15 deletions(-) (limited to 'MatrixRoomUtils.Desktop') diff --git a/MatrixRoomUtils.Desktop/App.axaml.cs b/MatrixRoomUtils.Desktop/App.axaml.cs index e0b50a5..33f2c13 100644 --- a/MatrixRoomUtils.Desktop/App.axaml.cs +++ b/MatrixRoomUtils.Desktop/App.axaml.cs @@ -4,7 +4,6 @@ using Avalonia.Markup.Xaml; using LibMatrix.Services; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Sentry; namespace MatrixRoomUtils.Desktop; diff --git a/MatrixRoomUtils.Desktop/Components/RoomListEntry.axaml.cs b/MatrixRoomUtils.Desktop/Components/RoomListEntry.axaml.cs index 359deb3..6cdb767 100644 --- a/MatrixRoomUtils.Desktop/Components/RoomListEntry.axaml.cs +++ b/MatrixRoomUtils.Desktop/Components/RoomListEntry.axaml.cs @@ -28,7 +28,7 @@ public partial class RoomListEntry : UserControl { private async Task GetRoomName() { try { var nameEvent = await _roomInfo.GetStateEvent("m.room.name"); - if (nameEvent?.TypedContent is RoomNameEventData nameData) + if (nameEvent?.TypedContent is RoomNameEventContent nameData) RoomName.Content = nameData.Name; } catch (MatrixException e) { @@ -40,7 +40,7 @@ public partial class RoomListEntry : UserControl { private async Task GetRoomIcon() { try { var avatarEvent = await _roomInfo.GetStateEvent("m.room.avatar"); - if (avatarEvent?.TypedContent is RoomAvatarEventData avatarData) { + if (avatarEvent?.TypedContent is RoomAvatarEventContent avatarData) { var mxcUrl = avatarData.Url; await using var svc = _serviceScopeFactory.CreateAsyncScope(); var hs = await svc.ServiceProvider.GetService().GetCurrentSessionOrPrompt(); diff --git a/MatrixRoomUtils.Desktop/FileStorageProvider.cs b/MatrixRoomUtils.Desktop/FileStorageProvider.cs index b3850b0..7f73cf3 100644 --- a/MatrixRoomUtils.Desktop/FileStorageProvider.cs +++ b/MatrixRoomUtils.Desktop/FileStorageProvider.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using ArcaneLibs.Extensions; using LibMatrix.Extensions; using LibMatrix.Interfaces.Services; using Microsoft.Extensions.Logging; diff --git a/MatrixRoomUtils.Desktop/MRUStorageWrapper.cs b/MatrixRoomUtils.Desktop/MRUStorageWrapper.cs index 2243092..bc01774 100644 --- a/MatrixRoomUtils.Desktop/MRUStorageWrapper.cs +++ b/MatrixRoomUtils.Desktop/MRUStorageWrapper.cs @@ -1,4 +1,5 @@ using LibMatrix; +using LibMatrix.Homeservers; using LibMatrix.Responses; using LibMatrix.Services; @@ -44,7 +45,7 @@ public class MRUStorageWrapper(TieredStorageService storageService, HomeserverPr await SetCurrentToken(loginResponse); } - private async Task GetCurrentSession() { + private async Task GetCurrentSession() { var token = await GetCurrentToken(); if (token == null) { return null; @@ -53,8 +54,8 @@ public class MRUStorageWrapper(TieredStorageService storageService, HomeserverPr return await homeserverProviderService.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken); } - public async Task GetCurrentSessionOrPrompt() { - AuthenticatedHomeServer? session = null; + public async Task GetCurrentSessionOrPrompt() { + AuthenticatedHomeserverGeneric? session = null; try { //catch if the token is invalid diff --git a/MatrixRoomUtils.Desktop/MainWindow.axaml.cs b/MatrixRoomUtils.Desktop/MainWindow.axaml.cs index 135542b..0bed93d 100644 --- a/MatrixRoomUtils.Desktop/MainWindow.axaml.cs +++ b/MatrixRoomUtils.Desktop/MainWindow.axaml.cs @@ -1,5 +1,4 @@ using Avalonia.Controls; -using Avalonia.Data; using Avalonia.Interactivity; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/MatrixRoomUtils.Desktop/MatrixRoomUtils.Desktop.csproj b/MatrixRoomUtils.Desktop/MatrixRoomUtils.Desktop.csproj index 4dc9558..d21b5fe 100644 --- a/MatrixRoomUtils.Desktop/MatrixRoomUtils.Desktop.csproj +++ b/MatrixRoomUtils.Desktop/MatrixRoomUtils.Desktop.csproj @@ -20,13 +20,13 @@ - - - - + + + + - - + + @@ -35,7 +35,6 @@ - diff --git a/MatrixRoomUtils.Desktop/RoomInfo.cs b/MatrixRoomUtils.Desktop/RoomInfo.cs index 4e76247..ebd80ab 100644 --- a/MatrixRoomUtils.Desktop/RoomInfo.cs +++ b/MatrixRoomUtils.Desktop/RoomInfo.cs @@ -1,4 +1,5 @@ using LibMatrix; +using LibMatrix.Interfaces; using LibMatrix.Responses; using LibMatrix.RoomTypes; @@ -23,7 +24,7 @@ public class RoomInfo { StateKey = stateKey }; try { - @event.TypedContent = await Room.GetStateAsync(type, stateKey); + @event.TypedContent = await Room.GetStateAsync(type, stateKey); } catch (MatrixException e) { if (e is { ErrorCode: "M_NOT_FOUND" }) @event.TypedContent = default!; -- cgit 1.5.1