mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
needs migration flag
This commit is contained in:
parent
c7b62c8551
commit
419cfceef1
4 changed files with 20 additions and 9 deletions
|
@ -43,6 +43,11 @@ namespace Bit.Droid
|
|||
|
||||
private void RegisterLocalServices()
|
||||
{
|
||||
var settingsShim = new App.Migration.SettingsShim();
|
||||
ServiceContainer.Register("settingsShim", settingsShim);
|
||||
App.Utilities.AppHelpers.NeedsMigration =
|
||||
settingsShim.GetValueOrDefault(Constants.OldLastActivityKey, DateTime.MinValue) > DateTime.MinValue;
|
||||
|
||||
Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
|
||||
// Note: This might cause a race condition. Investigate more.
|
||||
Task.Run(() =>
|
||||
|
|
|
@ -12,6 +12,7 @@ using Java.Util;
|
|||
using Javax.Crypto.Spec;
|
||||
using Android.Preferences;
|
||||
using Bit.App.Migration;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Droid.Migration
|
||||
{
|
||||
|
@ -39,7 +40,7 @@ namespace Bit.Droid.Migration
|
|||
_oldAndroid = Build.VERSION.SdkInt < BuildVersionCodes.M;
|
||||
_rsaMode = _oldAndroid ? "RSA/ECB/PKCS1Padding" : "RSA/ECB/OAEPWithSHA-1AndMGF1Padding";
|
||||
|
||||
_settings = new SettingsShim();
|
||||
_settings = ServiceContainer.Resolve<SettingsShim>("settingsShim");
|
||||
|
||||
_keyStore = KeyStore.GetInstance(AndroidKeyStore);
|
||||
_keyStore.Load(null);
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace Bit.App.Utilities
|
|||
{
|
||||
public static class AppHelpers
|
||||
{
|
||||
public static bool NeedsMigration = false;
|
||||
|
||||
public static async Task<string> CipherListOptions(ContentPage page, CipherView cipher)
|
||||
{
|
||||
var platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||
|
@ -114,9 +116,10 @@ namespace Bit.App.Utilities
|
|||
public static async Task<bool> PerformUpdateTasksAsync(ISyncService syncService,
|
||||
IDeviceActionService deviceActionService, IStorageService storageService)
|
||||
{
|
||||
var lastSync = await syncService.GetLastSyncAsync();
|
||||
var currentBuild = deviceActionService.GetBuildNumber();
|
||||
var lastBuild = await storageService.GetAsync<string>(Constants.LastBuildKey);
|
||||
if(!NeedsMigration)
|
||||
{
|
||||
if(lastBuild == null)
|
||||
{
|
||||
// Installed
|
||||
|
@ -126,6 +129,7 @@ namespace Bit.App.Utilities
|
|||
// Updated
|
||||
var tasks = Task.Run(() => syncService.FullSyncAsync(true));
|
||||
}
|
||||
}
|
||||
if(lastBuild != currentBuild)
|
||||
{
|
||||
await storageService.SaveAsync(Constants.LastBuildKey, currentBuild);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
public static string ClearClipboardKey = "clearClipboard";
|
||||
public static string LastClipboardValueKey = "lastClipboardValue";
|
||||
public static string LastBuildKey = "lastBuild";
|
||||
public static string OldLastActivityKey = "other:lastActivityDate";
|
||||
public const int SelectFileRequestCode = 42;
|
||||
public const int SelectFilePermissionRequestCode = 43;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue