mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-17 15:27:43 +01:00
perform sync on update
This commit is contained in:
parent
fea94f956d
commit
d4cd2b8be8
@ -15,8 +15,9 @@ namespace Bit.Android
|
||||
public override void OnReceive(Context context, Intent intent)
|
||||
{
|
||||
Debug.WriteLine("App updated!");
|
||||
Helpers.PerformUpdateTasks(Resolver.Resolve<ISettings>(), Resolver.Resolve<IAppInfoService>(),
|
||||
Resolver.Resolve<IDatabaseService>());
|
||||
Helpers.PerformUpdateTasks(Resolver.Resolve<ISettings>(),
|
||||
Resolver.Resolve<IAppInfoService>(),Resolver.Resolve<IDatabaseService>(),
|
||||
Resolver.Resolve<ISyncService>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace Bit.App
|
||||
|
||||
if(string.IsNullOrWhiteSpace(_uri))
|
||||
{
|
||||
Helpers.PerformUpdateTasks(_settings, _appInfoService, _databaseService);
|
||||
Helpers.PerformUpdateTasks(_settings, _appInfoService, _databaseService, _syncService);
|
||||
await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Bit.App.Abstractions;
|
||||
using Plugin.Settings.Abstractions;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Utilities
|
||||
@ -41,14 +42,15 @@ namespace Bit.App.Utilities
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool PerformUpdateTasks(ISettings settings, IAppInfoService appInfoService,
|
||||
IDatabaseService databaseService)
|
||||
public static bool PerformUpdateTasks(ISettings settings,
|
||||
IAppInfoService appInfoService, IDatabaseService databaseService, ISyncService syncService)
|
||||
{
|
||||
var lastBuild = settings.GetValueOrDefault(Constants.LastBuildKey, null);
|
||||
if(InDebugMode() || lastBuild == null || lastBuild != appInfoService.Build)
|
||||
{
|
||||
settings.AddOrUpdateValue(Constants.LastBuildKey, appInfoService.Build);
|
||||
databaseService.CreateTables();
|
||||
var task = Task.Run(async () => await syncService.FullSyncAsync(true));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user