mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +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()
|
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();
|
Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
|
||||||
// Note: This might cause a race condition. Investigate more.
|
// Note: This might cause a race condition. Investigate more.
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
|
|
|
@ -12,6 +12,7 @@ using Java.Util;
|
||||||
using Javax.Crypto.Spec;
|
using Javax.Crypto.Spec;
|
||||||
using Android.Preferences;
|
using Android.Preferences;
|
||||||
using Bit.App.Migration;
|
using Bit.App.Migration;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
|
|
||||||
namespace Bit.Droid.Migration
|
namespace Bit.Droid.Migration
|
||||||
{
|
{
|
||||||
|
@ -39,7 +40,7 @@ namespace Bit.Droid.Migration
|
||||||
_oldAndroid = Build.VERSION.SdkInt < BuildVersionCodes.M;
|
_oldAndroid = Build.VERSION.SdkInt < BuildVersionCodes.M;
|
||||||
_rsaMode = _oldAndroid ? "RSA/ECB/PKCS1Padding" : "RSA/ECB/OAEPWithSHA-1AndMGF1Padding";
|
_rsaMode = _oldAndroid ? "RSA/ECB/PKCS1Padding" : "RSA/ECB/OAEPWithSHA-1AndMGF1Padding";
|
||||||
|
|
||||||
_settings = new SettingsShim();
|
_settings = ServiceContainer.Resolve<SettingsShim>("settingsShim");
|
||||||
|
|
||||||
_keyStore = KeyStore.GetInstance(AndroidKeyStore);
|
_keyStore = KeyStore.GetInstance(AndroidKeyStore);
|
||||||
_keyStore.Load(null);
|
_keyStore.Load(null);
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace Bit.App.Utilities
|
||||||
{
|
{
|
||||||
public static class AppHelpers
|
public static class AppHelpers
|
||||||
{
|
{
|
||||||
|
public static bool NeedsMigration = false;
|
||||||
|
|
||||||
public static async Task<string> CipherListOptions(ContentPage page, CipherView cipher)
|
public static async Task<string> CipherListOptions(ContentPage page, CipherView cipher)
|
||||||
{
|
{
|
||||||
var platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
var platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||||
|
@ -114,17 +116,19 @@ namespace Bit.App.Utilities
|
||||||
public static async Task<bool> PerformUpdateTasksAsync(ISyncService syncService,
|
public static async Task<bool> PerformUpdateTasksAsync(ISyncService syncService,
|
||||||
IDeviceActionService deviceActionService, IStorageService storageService)
|
IDeviceActionService deviceActionService, IStorageService storageService)
|
||||||
{
|
{
|
||||||
var lastSync = await syncService.GetLastSyncAsync();
|
|
||||||
var currentBuild = deviceActionService.GetBuildNumber();
|
var currentBuild = deviceActionService.GetBuildNumber();
|
||||||
var lastBuild = await storageService.GetAsync<string>(Constants.LastBuildKey);
|
var lastBuild = await storageService.GetAsync<string>(Constants.LastBuildKey);
|
||||||
if(lastBuild == null)
|
if(!NeedsMigration)
|
||||||
{
|
{
|
||||||
// Installed
|
if(lastBuild == null)
|
||||||
}
|
{
|
||||||
else if(lastBuild != currentBuild)
|
// Installed
|
||||||
{
|
}
|
||||||
// Updated
|
else if(lastBuild != currentBuild)
|
||||||
var tasks = Task.Run(() => syncService.FullSyncAsync(true));
|
{
|
||||||
|
// Updated
|
||||||
|
var tasks = Task.Run(() => syncService.FullSyncAsync(true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(lastBuild != currentBuild)
|
if(lastBuild != currentBuild)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
public static string ClearClipboardKey = "clearClipboard";
|
public static string ClearClipboardKey = "clearClipboard";
|
||||||
public static string LastClipboardValueKey = "lastClipboardValue";
|
public static string LastClipboardValueKey = "lastClipboardValue";
|
||||||
public static string LastBuildKey = "lastBuild";
|
public static string LastBuildKey = "lastBuild";
|
||||||
|
public static string OldLastActivityKey = "other:lastActivityDate";
|
||||||
public const int SelectFileRequestCode = 42;
|
public const int SelectFileRequestCode = 42;
|
||||||
public const int SelectFilePermissionRequestCode = 43;
|
public const int SelectFilePermissionRequestCode = 43;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue