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