mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-25 12:05:59 +01:00
Convert everything back to UTC since thats now settings plugin stores them. Move sync page ToLocalTime conversion.
This commit is contained in:
parent
625be7fdd4
commit
2947809d78
@ -95,7 +95,7 @@ namespace Bit.App
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
{
|
||||
_settings.AddOrUpdateValue(Constants.SettingLastBackgroundedDate, DateTime.Now);
|
||||
_settings.AddOrUpdateValue(Constants.SettingLastBackgroundedDate, DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace Bit.App.Pages
|
||||
private void SetLastSync()
|
||||
{
|
||||
var lastSyncDate = _settings.GetValueOrDefault<DateTime?>(Constants.SettingLastSync);
|
||||
LastSyncLabel.Text = "Last Sync: " + lastSyncDate?.ToString() ?? "Never";
|
||||
LastSyncLabel.Text = "Last Sync: " + lastSyncDate?.ToLocalTime().ToString() ?? "Never";
|
||||
}
|
||||
|
||||
public async Task SyncAsync()
|
||||
|
@ -158,7 +158,7 @@ namespace Bit.App.Pages
|
||||
Action registerAction = () =>
|
||||
{
|
||||
var lastPushRegistration = _settings.GetValueOrDefault<DateTime?>(Constants.PushLastRegistrationDate);
|
||||
if(!pushPromptShow || !lastPushRegistration.HasValue || (DateTime.Now - lastPushRegistration) > TimeSpan.FromDays(1))
|
||||
if(!pushPromptShow || !lastPushRegistration.HasValue || (DateTime.UtcNow - lastPushRegistration) > TimeSpan.FromDays(1))
|
||||
{
|
||||
_pushNotification.Register();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace Bit.App.Services
|
||||
}
|
||||
|
||||
// Has it been longer than lockSeconds since the last time the app was backgrounded?
|
||||
var now = DateTime.Now;
|
||||
var now = DateTime.UtcNow;
|
||||
var lastBackground = _settings.GetValueOrDefault(Constants.SettingLastBackgroundedDate, now.AddYears(-1));
|
||||
if((now - lastBackground).TotalSeconds < lockSeconds)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ namespace Bit.App.Services
|
||||
if(response.Succeeded)
|
||||
{
|
||||
Debug.WriteLine("Registered device with server.");
|
||||
_settings.AddOrUpdateValue(Constants.PushLastRegistrationDate, DateTime.Now);
|
||||
_settings.AddOrUpdateValue(Constants.PushLastRegistrationDate, DateTime.UtcNow);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ namespace Bit.App.Services
|
||||
|
||||
SyncStarted();
|
||||
|
||||
var now = DateTime.Now;
|
||||
var now = DateTime.UtcNow;
|
||||
var ciphers = await _cipherApiRepository.GetAsync();
|
||||
if(!ciphers.Succeeded)
|
||||
{
|
||||
@ -168,7 +168,7 @@ namespace Bit.App.Services
|
||||
public async Task<bool> IncrementalSyncAsync(TimeSpan syncThreshold)
|
||||
{
|
||||
DateTime? lastSync = _settings.GetValueOrDefault<DateTime?>(Constants.SettingLastSync);
|
||||
if(lastSync != null && DateTime.Now - lastSync.Value < syncThreshold)
|
||||
if(lastSync != null && DateTime.UtcNow - lastSync.Value < syncThreshold)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -183,7 +183,7 @@ namespace Bit.App.Services
|
||||
return false;
|
||||
}
|
||||
|
||||
var now = DateTime.Now;
|
||||
var now = DateTime.UtcNow;
|
||||
DateTime? lastSync = _settings.GetValueOrDefault<DateTime?>(Constants.SettingLastSync);
|
||||
if(lastSync == null)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ namespace Bit.iOS.Extension
|
||||
return;
|
||||
}
|
||||
|
||||
Resolver.Resolve<ISettings>().AddOrUpdateValue(App.Constants.SettingLastBackgroundedDate, DateTime.Now);
|
||||
Resolver.Resolve<ISettings>().AddOrUpdateValue(App.Constants.SettingLastBackgroundedDate, DateTime.UtcNow);
|
||||
|
||||
var item = _tableItems.ElementAt(indexPath.Row);
|
||||
if(item == null)
|
||||
|
@ -138,7 +138,7 @@ namespace Bit.iOS
|
||||
|
||||
// Log the date/time we last backgrounded
|
||||
|
||||
Settings.AddOrUpdateValue(Bit.App.Constants.SettingLastBackgroundedDate, DateTime.Now);
|
||||
Settings.AddOrUpdateValue(Bit.App.Constants.SettingLastBackgroundedDate, DateTime.UtcNow);
|
||||
|
||||
base.DidEnterBackground(uiApplication);
|
||||
Debug.WriteLine("DidEnterBackground");
|
||||
|
Loading…
Reference in New Issue
Block a user