From be06581d562c1f5e359558a15efef10a870f3e62 Mon Sep 17 00:00:00 2001 From: Michiel Post Date: Wed, 15 May 2024 16:25:53 +0200 Subject: [PATCH] settings fix --- src/aoWebWallet/Models/UserSettings.cs | 15 ++++++++++----- src/aoWebWallet/Pages/Settings.razor | 8 ++++---- src/aoWebWallet/ViewModels/MainViewModel.cs | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/aoWebWallet/Models/UserSettings.cs b/src/aoWebWallet/Models/UserSettings.cs index 29d4430..86b8e5e 100644 --- a/src/aoWebWallet/Models/UserSettings.cs +++ b/src/aoWebWallet/Models/UserSettings.cs @@ -3,11 +3,8 @@ public class UserSettings { //public bool? IsDarkMode { get; set; } = true; - public string GatewayUrl { get; set; } = "https://arweave.net"; - public string GraphqlUrl { get; set; } = "https://arweave.net/graphql"; - public string ComputeUnitUrl { get; set; } = "https://cu.ao-testnet.xyz"; - public string MessengerUnitUrl { get; set; } = "https://mu.ao-testnet.xyz"; + public GatewayUrlConfig GatewayUrlConfig { get; set; } = new(); public bool Claimed1 { get; set; } public bool Claimed2 { get; set; } @@ -15,5 +12,13 @@ public class UserSettings } - + public class GatewayUrlConfig + { + public string GatewayUrl { get; set; } = "https://arweave.net"; + public string GraphqlUrl { get; set; } = "https://arweave.net/graphql"; + public string ComputeUnitUrl { get; set; } = "https://cu.ao-testnet.xyz"; + public string MessengerUnitUrl { get; set; } = "https://mu.ao-testnet.xyz"; + } + + } diff --git a/src/aoWebWallet/Pages/Settings.razor b/src/aoWebWallet/Pages/Settings.razor index c6e7b29..f16c3d2 100644 --- a/src/aoWebWallet/Pages/Settings.razor +++ b/src/aoWebWallet/Pages/Settings.razor @@ -27,10 +27,10 @@ - - - - + + + + Save diff --git a/src/aoWebWallet/ViewModels/MainViewModel.cs b/src/aoWebWallet/ViewModels/MainViewModel.cs index 9d974fe..b4d238c 100644 --- a/src/aoWebWallet/ViewModels/MainViewModel.cs +++ b/src/aoWebWallet/ViewModels/MainViewModel.cs @@ -183,7 +183,7 @@ public async Task LoadUserSettings() UserSettings = await storageService.GetUserSettings(); if (UserSettings != null) { - UpdateUserSettings(UserSettings); + UpdateUserSettings(UserSettings.GatewayUrlConfig); } } @@ -193,11 +193,11 @@ public async Task SaveUserSettings() { await storageService.SaveUserSettings(UserSettings); - UpdateUserSettings(UserSettings); + UpdateUserSettings(UserSettings.GatewayUrlConfig); } } - private void UpdateUserSettings(UserSettings userSettings) + private void UpdateUserSettings(GatewayUrlConfig userSettings) { graphqlConfig.ApiUrl = userSettings.GraphqlUrl; gatewayConfig.GatewayUrl = userSettings.GatewayUrl;