From ec1191ffc775d7acef02bf3a272fe69690af1696 Mon Sep 17 00:00:00 2001 From: connorivy <43247197+connorivy@users.noreply.github.com> Date: Wed, 13 Mar 2024 06:40:49 -0500 Subject: [PATCH] Feat(Core) : Remove account from db and save new one (#3221) * removeAccountAndResave * make operation async --------- Co-authored-by: Connor Ivy --- Core/Core/Credentials/AccountManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/Core/Credentials/AccountManager.cs b/Core/Core/Credentials/AccountManager.cs index 66888f0325..b304aaa573 100644 --- a/Core/Core/Credentials/AccountManager.cs +++ b/Core/Core/Credentials/AccountManager.cs @@ -238,7 +238,7 @@ public static string GetDefaultServerUrl() /// Upgrades an account from the account.serverInfo.movedFrom account to the account.serverInfo.movedTo account /// /// Id of the account to upgrade - public static void UpgradeAccount(string id) + public static async Task UpgradeAccount(string id) { var account = GetAccounts().FirstOrDefault(acc => acc.id == id) @@ -259,7 +259,9 @@ public static void UpgradeAccount(string id) // setting the id to null will force it to be recreated account.id = null; - s_accountStorage.UpdateObject(account.id!, JsonConvert.SerializeObject(account)); + RemoveAccount(id); + s_accountStorage.SaveObject(account.id, JsonConvert.SerializeObject(account)); + await s_accountStorage.WriteComplete().ConfigureAwait(false); } ///