mirror of
https://github.com/bitwarden/mobile
synced 2026-01-07 11:03:54 +00:00
update and refactor for settings changes
This commit is contained in:
@@ -413,8 +413,8 @@
|
||||
<Reference Include="FFImageLoading.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\portable-net45+win8+wpa81+wp8\FFImageLoading.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HockeySDK, Version=1.0.6288.33979, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\HockeySDK.Xamarin.4.1.2\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\HockeySDK.dll</HintPath>
|
||||
<Reference Include="HockeySDK, Version=1.0.6387.33440, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\HockeySDK.Xamarin.4.1.5\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\HockeySDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
@@ -459,11 +459,11 @@
|
||||
<Reference Include="Plugin.Fingerprint.Abstractions, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Plugin.Fingerprint.1.4.4\lib\portable-net45+win8+wpa81+wp8\Plugin.Fingerprint.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Plugin.Settings, Version=2.5.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugins.Settings.2.5.4\lib\portable-net45+wp80+win8+wpa81\Plugin.Settings.dll</HintPath>
|
||||
<Reference Include="Plugin.Settings, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugins.Settings.3.0.1\lib\netstandard1.0\Plugin.Settings.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Plugin.Settings.Abstractions, Version=2.5.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugins.Settings.2.5.4\lib\portable-net45+wp80+win8+wpa81\Plugin.Settings.Abstractions.dll</HintPath>
|
||||
<Reference Include="Plugin.Settings.Abstractions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugins.Settings.3.0.1\lib\netstandard1.0\Plugin.Settings.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PushNotification.Plugin, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugin.PushNotification.1.2.4\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\PushNotification.Plugin.dll</HintPath>
|
||||
|
||||
@@ -77,7 +77,11 @@ namespace Bit.App.Pages
|
||||
|
||||
private void SetLastSync()
|
||||
{
|
||||
var lastSyncDate = _settings.GetValueOrDefault<DateTime?>(Constants.LastSync, null);
|
||||
DateTime? lastSyncDate = null;
|
||||
if(_settings.Contains(Constants.LastSync))
|
||||
{
|
||||
lastSyncDate = _settings.GetValueOrDefault(Constants.LastSync, DateTime.UtcNow);
|
||||
}
|
||||
try
|
||||
{
|
||||
LastSyncLabel.Text = AppResources.LastSync + " " + lastSyncDate?.ToLocalTime().ToString() ?? AppResources.Never;
|
||||
|
||||
@@ -239,9 +239,8 @@ namespace Bit.App.Pages
|
||||
var pushPromptShow = _settings.GetValueOrDefault(Constants.PushInitialPromptShown, false);
|
||||
Action registerAction = () =>
|
||||
{
|
||||
var lastPushRegistration = _settings.GetValueOrDefault<DateTime?>(Constants.PushLastRegistrationDate, null);
|
||||
if(!pushPromptShow || !lastPushRegistration.HasValue
|
||||
|| (DateTime.UtcNow - lastPushRegistration) > TimeSpan.FromDays(1))
|
||||
var lastPushRegistration = _settings.GetValueOrDefault(Constants.PushLastRegistrationDate, DateTime.MinValue);
|
||||
if(!pushPromptShow || DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1))
|
||||
{
|
||||
_pushNotification.Register();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.GetValueOrDefault<string>(Constants.SecurityStamp);
|
||||
return _settings.GetValueOrDefault(Constants.SecurityStamp, null);
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -90,7 +90,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.GetValueOrDefault<string>(Constants.BaseUrl);
|
||||
return _settings.GetValueOrDefault(Constants.BaseUrl, null);
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -108,7 +108,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.GetValueOrDefault<string>(Constants.WebVaultUrl);
|
||||
return _settings.GetValueOrDefault(Constants.WebVaultUrl, null);
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -126,7 +126,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.GetValueOrDefault<string>(Constants.ApiUrl);
|
||||
return _settings.GetValueOrDefault(Constants.ApiUrl, null);
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -144,7 +144,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.GetValueOrDefault<string>(Constants.IdentityUrl);
|
||||
return _settings.GetValueOrDefault(Constants.IdentityUrl, null);
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
if(_encKey == null && _settings.Contains(EncKeyKey))
|
||||
{
|
||||
var encKey = _settings.GetValueOrDefault<string>(EncKeyKey);
|
||||
var encKey = _settings.GetValueOrDefault(EncKeyKey, null);
|
||||
var encKeyCs = new CipherString(encKey);
|
||||
try
|
||||
{
|
||||
@@ -102,7 +102,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
if(_privateKey == null && _settings.Contains(PrivateKeyKey))
|
||||
{
|
||||
var encPrivateKey = _settings.GetValueOrDefault<string>(PrivateKeyKey);
|
||||
var encPrivateKey = _settings.GetValueOrDefault(PrivateKeyKey, null);
|
||||
var encPrivateKeyCs = new CipherString(encPrivateKey);
|
||||
try
|
||||
{
|
||||
@@ -125,7 +125,7 @@ namespace Bit.App.Services
|
||||
{
|
||||
if((!_orgKeys?.Any() ?? true) && _settings.Contains(OrgKeysKey))
|
||||
{
|
||||
var orgKeysEncDictJson = _settings.GetValueOrDefault<string>(OrgKeysKey);
|
||||
var orgKeysEncDictJson = _settings.GetValueOrDefault(OrgKeysKey, null);
|
||||
if(!string.IsNullOrWhiteSpace(orgKeysEncDictJson))
|
||||
{
|
||||
_orgKeys = new Dictionary<string, SymmetricCryptoKey>();
|
||||
|
||||
@@ -242,8 +242,8 @@ namespace Bit.App.Services
|
||||
|
||||
public async Task<bool> FullSyncAsync(TimeSpan syncThreshold, bool forceSync = false)
|
||||
{
|
||||
DateTime? lastSync = _settings.GetValueOrDefault<DateTime?>(Constants.LastSync, null);
|
||||
if(lastSync != null && DateTime.UtcNow - lastSync.Value < syncThreshold)
|
||||
var lastSync = _settings.GetValueOrDefault(Constants.LastSync, DateTime.MinValue);
|
||||
if(DateTime.UtcNow - lastSync < syncThreshold)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -307,11 +307,11 @@ namespace Bit.App.Services
|
||||
|
||||
private async Task<bool> NeedsToSyncAsync()
|
||||
{
|
||||
DateTime? lastSync = _settings.GetValueOrDefault<DateTime?>(Constants.LastSync, null);
|
||||
if(!lastSync.HasValue)
|
||||
if(!_settings.Contains(Constants.LastSync))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
var lastSync = _settings.GetValueOrDefault(Constants.LastSync, DateTime.MinValue);
|
||||
|
||||
var accountRevisionDate = await _accountsApiRepository.GetAccountRevisionDateAsync();
|
||||
if(accountRevisionDate.Succeeded && accountRevisionDate.Result.HasValue &&
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Bit.App.Utilities
|
||||
public static bool PerformUpdateTasks(ISettings settings, IAppInfoService appInfoService,
|
||||
IDatabaseService databaseService)
|
||||
{
|
||||
var lastBuild = settings.GetValueOrDefault<string>(Constants.LastBuildKey);
|
||||
var lastBuild = settings.GetValueOrDefault(Constants.LastBuildKey, null);
|
||||
if(InDebugMode() || lastBuild == null || lastBuild != appInfoService.Build)
|
||||
{
|
||||
settings.AddOrUpdateValue(Constants.LastBuildKey, appInfoService.Build);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="Acr.UserDialogs" version="6.3.10" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="HockeySDK.Xamarin" version="4.1.2" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="HockeySDK.Xamarin" version="4.1.5" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="PCLCrypto" version="2.0.147" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="PInvoke.BCrypt" version="0.3.152" targetFramework="portable45-net45+win8+wpa81" />
|
||||
@@ -17,7 +17,7 @@
|
||||
<package id="Validation" version="2.3.7" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xam.Plugin.Connectivity" version="2.3.0" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xam.Plugin.PushNotification" version="1.2.4" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />
|
||||
<package id="Xam.Plugins.Settings" version="2.5.4" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xam.Plugins.Settings" version="3.0.1" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xamarin.FFImageLoading" version="2.2.9" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xamarin.FFImageLoading.Forms" version="2.2.9" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xamarin.Forms" version="2.3.4.231" targetFramework="portable45-net45+win8+wpa81" />
|
||||
|
||||
Reference in New Issue
Block a user