mirror of
https://github.com/bitwarden/mobile
synced 2025-12-10 05:13:31 +00:00
fixed migration and account removal issues (#1818)
This commit is contained in:
@@ -147,8 +147,10 @@ namespace Bit.App.Pages
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var buttons = _email.IsEnabled ? new[] { AppResources.GetPasswordHint }
|
||||||
|
: new[] { AppResources.GetPasswordHint, AppResources.RemoveAccount };
|
||||||
var selection = await DisplayActionSheet(AppResources.Options,
|
var selection = await DisplayActionSheet(AppResources.Options,
|
||||||
AppResources.Cancel, null, AppResources.GetPasswordHint, AppResources.RemoveAccount);
|
AppResources.Cancel, null, buttons);
|
||||||
|
|
||||||
if (selection == AppResources.GetPasswordHint)
|
if (selection == AppResources.GetPasswordHint)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -326,19 +326,19 @@ namespace Bit.Core.Services
|
|||||||
return lastVersion.Value;
|
return lastVersion.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for original v1 migration
|
// check for v1 state
|
||||||
var envUrlsLiteDb = await GetValueAsync<EnvironmentUrlData>(Storage.LiteDb, V1Keys.EnvironmentUrlsKey);
|
var v1EnvUrls = await GetValueAsync<EnvironmentUrlData>(Storage.LiteDb, V1Keys.EnvironmentUrlsKey);
|
||||||
if (envUrlsLiteDb != null)
|
if (v1EnvUrls != null)
|
||||||
{
|
{
|
||||||
// environmentUrls still in LiteDB (never migrated to prefs), this is v1
|
// environmentUrls still in LiteDB (never migrated to prefs), this is v1
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for original v2 migration
|
// check for v2 state
|
||||||
var envUrlsPrefs = await GetValueAsync<EnvironmentUrlData>(Storage.Prefs, V2Keys.EnvironmentUrlsKey);
|
var v2UserId = await GetValueAsync<string>(Storage.LiteDb, V2Keys.Keys_UserId);
|
||||||
if (envUrlsPrefs != null)
|
if (v2UserId != null)
|
||||||
{
|
{
|
||||||
// environmentUrls in Prefs (migrated from LiteDB), this is v2
|
// standalone userId still exists (never moved to Account object), this is v2
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1377,6 +1377,7 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
await CheckStateAsync();
|
await CheckStateAsync();
|
||||||
var currentTheme = await GetThemeAsync();
|
var currentTheme = await GetThemeAsync();
|
||||||
|
var currentDisableFavicons = await GetDisableFaviconAsync();
|
||||||
|
|
||||||
account.Settings.EnvironmentUrls = await GetPreAuthEnvironmentUrlsAsync();
|
account.Settings.EnvironmentUrls = await GetPreAuthEnvironmentUrlsAsync();
|
||||||
|
|
||||||
@@ -1405,6 +1406,7 @@ namespace Bit.Core.Services
|
|||||||
account.Settings.VaultTimeoutAction = VaultTimeoutAction.Lock;
|
account.Settings.VaultTimeoutAction = VaultTimeoutAction.Lock;
|
||||||
}
|
}
|
||||||
await SetThemeAsync(currentTheme, account.Profile.UserId);
|
await SetThemeAsync(currentTheme, account.Profile.UserId);
|
||||||
|
await SetDisableFaviconAsync(currentDisableFavicons, account.Profile.UserId);
|
||||||
|
|
||||||
state.Accounts[account.Profile.UserId] = account;
|
state.Accounts[account.Profile.UserId] = account;
|
||||||
await SaveStateToStorageAsync(state);
|
await SaveStateToStorageAsync(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user