Save different account ids for debug

This commit is contained in:
Liza 2022-10-23 17:13:49 +02:00
parent aae717955d
commit c1cc696fec
3 changed files with 12 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace Pal.Client
#region Saved configuration values
public bool FirstUse { get; set; } = true;
public EMode Mode { get; set; } = EMode.Offline;
public string DebugAccountId { get; set; }
public string AccountId { get; set; }
public bool ShowTraps { get; set; } = true;

View File

@ -57,7 +57,6 @@ namespace Pal.Client
var configWindow = pluginInterface.Create<ConfigWindow>();
if (configWindow is not null)
{
configWindow.IsOpen = true;
Service.WindowSystem.AddWindow(configWindow);
}

View File

@ -43,13 +43,23 @@ namespace Pal.Client
}
var accountClient = new AccountService.AccountServiceClient(_channel);
#if DEBUG
string accountId = Service.Configuration.DebugAccountId;
#else
string accountId = Service.Configuration.AccountId;
#endif
if (string.IsNullOrEmpty(accountId))
{
var createAccountReply = await accountClient.CreateAccountAsync(new CreateAccountRequest(), deadline: DateTime.UtcNow.AddSeconds(10), cancellationToken: cancellationToken);
if (createAccountReply.Success)
{
Service.Configuration.AccountId = accountId = createAccountReply.AccountId;
accountId = createAccountReply.AccountId;
#if DEBUG
Service.Configuration.DebugAccountId = accountId;
#else
Service.Configuration.AccountId = accountId;
#endif
Service.Configuration.Save();
}
}