From cc779051bf9dcf6489c03e8393bc36d769aa37b4 Mon Sep 17 00:00:00 2001 From: Gordon Pedersen Date: Tue, 16 Jul 2024 10:45:33 +1000 Subject: [PATCH] Renamed RestService -> ApiService --- Classes/{RestService.cs => ApiService.cs} | 5 ++--- Classes/State.cs | 4 ++-- Components/EditPicDialog.razor | 2 +- Components/EditProfilePicDialog.razor | 2 +- Components/EditStatusDialog.razor | 2 +- Components/ExternalPageComponent.razor | 2 +- Components/NewEphemeral.razor | 2 +- Components/NewPicDialog.razor | 2 +- Components/NewStatusDialog.razor | 2 +- Components/Pages/EditNow.razor | 2 +- Components/Pages/EditProfile.razor | 2 +- Components/ThemeDialog.razor | 2 +- MauiProgram.cs | 2 +- Models/Theme.cs | 2 +- XamlComponents/LoginWebViewPage.xaml.cs | 4 ++-- 15 files changed, 18 insertions(+), 19 deletions(-) rename Classes/{RestService.cs => ApiService.cs} (99%) diff --git a/Classes/RestService.cs b/Classes/ApiService.cs similarity index 99% rename from Classes/RestService.cs rename to Classes/ApiService.cs index 9a372f7..2863a2b 100644 --- a/Classes/RestService.cs +++ b/Classes/ApiService.cs @@ -5,16 +5,15 @@ using System.Diagnostics; using System.Net.Http.Json; using System.Text; using System.Text.Json; -using System.Text.RegularExpressions; namespace Neighbourhood.omg.lol { - public class RestService { + public class ApiService { HttpClient _client; JsonSerializerOptions _serializerOptions; public const string BaseUrl = "https://api.omg.lol"; - public RestService(string? token = null) { + public ApiService(string? token = null) { _client = new HttpClient(); _client.BaseAddress = new Uri(BaseUrl); _client.DefaultRequestHeaders.UserAgent.Add(new System.Net.Http.Headers.ProductInfoHeaderValue(App.Name, App.Version)); diff --git a/Classes/State.cs b/Classes/State.cs index 13eee09..eb56aa9 100644 --- a/Classes/State.cs +++ b/Classes/State.cs @@ -155,9 +155,9 @@ namespace Neighbourhood.omg.lol { } // api service - private RestService api { get; set; } + private ApiService api { get; set; } - public State(RestService restService) { + public State(ApiService restService) { api = restService; } diff --git a/Components/EditPicDialog.razor b/Components/EditPicDialog.razor index 1dcaeb2..aef5260 100644 --- a/Components/EditPicDialog.razor +++ b/Components/EditPicDialog.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api
diff --git a/Components/EditProfilePicDialog.razor b/Components/EditProfilePicDialog.razor index c463cda..b45e0a2 100644 --- a/Components/EditProfilePicDialog.razor +++ b/Components/EditProfilePicDialog.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api @inject NavigationManager navigationManager
diff --git a/Components/EditStatusDialog.razor b/Components/EditStatusDialog.razor index 6845ca4..4a38976 100644 --- a/Components/EditStatusDialog.razor +++ b/Components/EditStatusDialog.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api
diff --git a/Components/ExternalPageComponent.razor b/Components/ExternalPageComponent.razor index ca2f9fb..da982ce 100644 --- a/Components/ExternalPageComponent.razor +++ b/Components/ExternalPageComponent.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api @if(Html != null) { } diff --git a/Components/NewEphemeral.razor b/Components/NewEphemeral.razor index 0cadf3e..05a8ba7 100644 --- a/Components/NewEphemeral.razor +++ b/Components/NewEphemeral.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api @inject NavigationManager navigationManager
diff --git a/Components/NewPicDialog.razor b/Components/NewPicDialog.razor index 3c4433d..08b56e3 100644 --- a/Components/NewPicDialog.razor +++ b/Components/NewPicDialog.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api @inject NavigationManager navigationManager
diff --git a/Components/NewStatusDialog.razor b/Components/NewStatusDialog.razor index ebcc4a8..8fcce23 100644 --- a/Components/NewStatusDialog.razor +++ b/Components/NewStatusDialog.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api @inject NavigationManager navigationManager @inject NavigatorService navigatorService diff --git a/Components/Pages/EditNow.razor b/Components/Pages/EditNow.razor index 8a92d7b..9507b7f 100644 --- a/Components/Pages/EditNow.razor +++ b/Components/Pages/EditNow.razor @@ -1,6 +1,6 @@ @page "/editNow" @inject NavigationManager Nav -@inject RestService api +@inject ApiService api @inject State State @inject IJSRuntime JS diff --git a/Components/Pages/EditProfile.razor b/Components/Pages/EditProfile.razor index 99848ab..b6a1493 100644 --- a/Components/Pages/EditProfile.razor +++ b/Components/Pages/EditProfile.razor @@ -1,6 +1,6 @@ @page "/editProfile" @inject NavigationManager Nav -@inject RestService api +@inject ApiService api @inject State State @inject IJSRuntime JS diff --git a/Components/ThemeDialog.razor b/Components/ThemeDialog.razor index d24e92c..0c6da7c 100644 --- a/Components/ThemeDialog.razor +++ b/Components/ThemeDialog.razor @@ -1,6 +1,6 @@ @inject IJSRuntime JS @inject State State -@inject RestService api +@inject ApiService api @inject NavigationManager navigationManager
diff --git a/MauiProgram.cs b/MauiProgram.cs index d2eff9a..23d0025 100644 --- a/MauiProgram.cs +++ b/MauiProgram.cs @@ -12,7 +12,7 @@ namespace Neighbourhood.omg.lol { builder.Services.AddMauiBlazorWebView(); builder.Services.AddTransient(); - builder.Services.AddSingleton(); + builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/Models/Theme.cs b/Models/Theme.cs index 74a4b3b..4acfc1d 100644 --- a/Models/Theme.cs +++ b/Models/Theme.cs @@ -13,7 +13,7 @@ public string? SampleProfile { get; set; } = string.Empty; public PreviewCssData? PreviewCssData { - get => new RestService().Deserialize(this.PreviewCss); + get => new ApiService().Deserialize(this.PreviewCss); } } } diff --git a/XamlComponents/LoginWebViewPage.xaml.cs b/XamlComponents/LoginWebViewPage.xaml.cs index ec1b50e..ea2614e 100644 --- a/XamlComponents/LoginWebViewPage.xaml.cs +++ b/XamlComponents/LoginWebViewPage.xaml.cs @@ -10,13 +10,13 @@ public partial class LoginWebViewPage : ContentPage private AuthenticationStateProvider AuthStateProvider { get; set; } private NavigatorService NavigatorService { get; set; } private IConfiguration Configuration { get; set; } - private RestService api { get; set; } + private ApiService api { get; set; } private string? client_id; private string? client_secret; private string? redirect_uri; - public LoginWebViewPage(AuthenticationStateProvider authStateProvider, NavigatorService navigatorService, IConfiguration configuration, RestService restService) + public LoginWebViewPage(AuthenticationStateProvider authStateProvider, NavigatorService navigatorService, IConfiguration configuration, ApiService restService) { this.AuthStateProvider = authStateProvider; this.NavigatorService = navigatorService;