about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Services
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-25 03:07:05 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-25 03:07:05 +0200
commitf866946fbbe962c712049327ade9dcbd43900295 (patch)
tree3400fcce20f68a6ef3eb130f4ef57733e346d0e9 /MatrixRoomUtils.Core/Services
parentWorking sync (diff)
downloadMatrixUtils-f866946fbbe962c712049327ade9dcbd43900295.tar.xz
Working state, refactored Rory&::LibMatrix
Diffstat (limited to 'MatrixRoomUtils.Core/Services')
-rw-r--r--MatrixRoomUtils.Core/Services/HomeserverProviderService.cs4
-rw-r--r--MatrixRoomUtils.Core/Services/ServiceInstaller.cs15
2 files changed, 14 insertions, 5 deletions
diff --git a/MatrixRoomUtils.Core/Services/HomeserverProviderService.cs b/MatrixRoomUtils.Core/Services/HomeserverProviderService.cs

index 3db4584..0f09a45 100644 --- a/MatrixRoomUtils.Core/Services/HomeserverProviderService.cs +++ b/MatrixRoomUtils.Core/Services/HomeserverProviderService.cs
@@ -1,5 +1,3 @@ -using MatrixRoomUtils.Core.Attributes; - namespace MatrixRoomUtils.Core.Services; public class HomeserverProviderService { @@ -13,6 +11,6 @@ public class HomeserverProviderService { } public async Task<AuthenticatedHomeServer> GetAuthenticatedWithToken(string homeserver, string accessToken) { - return await new AuthenticatedHomeServer(homeserver, accessToken, _tieredStorageService).Configure(); + return await new AuthenticatedHomeServer(_tieredStorageService, homeserver, accessToken).Configure(); } } \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Services/ServiceInstaller.cs b/MatrixRoomUtils.Core/Services/ServiceInstaller.cs
index 43255d8..1b275c5 100644 --- a/MatrixRoomUtils.Core/Services/ServiceInstaller.cs +++ b/MatrixRoomUtils.Core/Services/ServiceInstaller.cs
@@ -1,16 +1,27 @@ -using MatrixRoomUtils.Core.Interfaces.Services; using Microsoft.Extensions.DependencyInjection; namespace MatrixRoomUtils.Core.Services; public static class ServiceInstaller { - public static IServiceCollection AddRoryLibMatrixServices(this IServiceCollection services) { + public static IServiceCollection AddRoryLibMatrixServices(this IServiceCollection services, RoryLibMatrixConfiguration? config = null) { + //Check required services if (!services.Any(x => x.ServiceType == typeof(TieredStorageService))) throw new Exception("[MRUCore/DI] No TieredStorageService has been registered!"); + //Add config + if(config != null) + services.AddSingleton(config); + else { + services.AddSingleton(new RoryLibMatrixConfiguration()); + } + //Add services services.AddScoped<HomeserverProviderService>(); return services; } +} + +public class RoryLibMatrixConfiguration { + public string AppName { get; set; } = "Rory&::LibMatrix"; } \ No newline at end of file