Skip to content

Commit

Permalink
settings fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed May 15, 2024
1 parent eec5ade commit be06581
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
15 changes: 10 additions & 5 deletions src/aoWebWallet/Models/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
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; }
public bool Claimed3 { get; set; }

}


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";
}


}
8 changes: 4 additions & 4 deletions src/aoWebWallet/Pages/Settings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<MudItem xs="12" sm="6" md="6">
<MudPaper Class="pa-4">

<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.GatewayUrl" Label="Gateway" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.GraphqlUrl" Label="GraphQL" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.ComputeUnitUrl" Label="Compute Unit" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.MessengerUnitUrl" Label="Messenger Unit" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.GatewayUrlConfig.GatewayUrl" Label="Gateway" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.GatewayUrlConfig.GraphqlUrl" Label="GraphQL" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.GatewayUrlConfig.ComputeUnitUrl" Label="Compute Unit" InputType="InputType.Url" />
<MudTextField T="string" @bind-Value="BindingContext.UserSettings!.GatewayUrlConfig.MessengerUnitUrl" Label="Messenger Unit" InputType="InputType.Url" />

<MudButton Class="pa-4" OnClick="Submit">Save</MudButton>

Expand Down
6 changes: 3 additions & 3 deletions src/aoWebWallet/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public async Task LoadUserSettings()
UserSettings = await storageService.GetUserSettings();
if (UserSettings != null)
{
UpdateUserSettings(UserSettings);
UpdateUserSettings(UserSettings.GatewayUrlConfig);
}
}

Expand All @@ -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;
Expand Down

0 comments on commit be06581

Please sign in to comment.