mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-26 12:16:07 +01:00
clear cache in main app if change made in extension
This commit is contained in:
parent
cf35d20adb
commit
62d8824450
@ -162,6 +162,7 @@ namespace Bit.App
|
|||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine("XF App: OnStart");
|
System.Diagnostics.Debug.WriteLine("XF App: OnStart");
|
||||||
await ClearCacheIfNeededAsync();
|
await ClearCacheIfNeededAsync();
|
||||||
|
await TryClearCiphersCacheAsync();
|
||||||
Prime();
|
Prime();
|
||||||
if(string.IsNullOrWhiteSpace(_appOptions.Uri))
|
if(string.IsNullOrWhiteSpace(_appOptions.Uri))
|
||||||
{
|
{
|
||||||
@ -185,7 +186,7 @@ namespace Bit.App
|
|||||||
await HandleLockingAsync();
|
await HandleLockingAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async override void OnResume()
|
protected override void OnResume()
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine("XF App: OnResume");
|
System.Diagnostics.Debug.WriteLine("XF App: OnResume");
|
||||||
if(Device.RuntimePlatform == Device.Android)
|
if(Device.RuntimePlatform == Device.Android)
|
||||||
@ -198,6 +199,7 @@ namespace Bit.App
|
|||||||
{
|
{
|
||||||
_messagingService.Send("cancelLockTimer");
|
_messagingService.Send("cancelLockTimer");
|
||||||
await ClearCacheIfNeededAsync();
|
await ClearCacheIfNeededAsync();
|
||||||
|
await TryClearCiphersCacheAsync();
|
||||||
Prime();
|
Prime();
|
||||||
SyncIfNeeded();
|
SyncIfNeeded();
|
||||||
if(Current.MainPage is NavigationPage navPage && navPage.CurrentPage is LockPage lockPage)
|
if(Current.MainPage is NavigationPage navPage && navPage.CurrentPage is LockPage lockPage)
|
||||||
@ -356,5 +358,19 @@ namespace Bit.App
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task TryClearCiphersCacheAsync()
|
||||||
|
{
|
||||||
|
if(Device.RuntimePlatform != Device.iOS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var clearCache = await _storageService.GetAsync<bool?>(Constants.ClearCiphersCacheKey);
|
||||||
|
if(clearCache.GetValueOrDefault())
|
||||||
|
{
|
||||||
|
_cipherService.ClearCache();
|
||||||
|
await _storageService.RemoveAsync(Constants.ClearCiphersCacheKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ using Bit.Core.Utilities;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.PlatformConfiguration;
|
||||||
|
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
@ -59,6 +61,9 @@ namespace Bit.App.Pages
|
|||||||
ToolbarItems.Add(_moreItem);
|
ToolbarItems.Add(_moreItem);
|
||||||
}
|
}
|
||||||
_vm.ShowNotesSeparator = true;
|
_vm.ShowNotesSeparator = true;
|
||||||
|
|
||||||
|
_typePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
|
||||||
|
_ownershipPicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
_typePicker.ItemDisplayBinding = new Binding("Key");
|
_typePicker.ItemDisplayBinding = new Binding("Key");
|
||||||
@ -156,7 +161,7 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
if(FromAutofillFramework)
|
if(FromAutofillFramework)
|
||||||
{
|
{
|
||||||
Application.Current.MainPage = new TabsPage();
|
Xamarin.Forms.Application.Current.MainPage = new TabsPage();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return base.OnBackButtonPressed();
|
return base.OnBackButtonPressed();
|
||||||
@ -166,7 +171,8 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
{
|
{
|
||||||
await Navigation.PushModalAsync(new NavigationPage(new PasswordHistoryPage(_vm.CipherId)));
|
await Navigation.PushModalAsync(
|
||||||
|
new Xamarin.Forms.NavigationPage(new PasswordHistoryPage(_vm.CipherId)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +199,7 @@ namespace Bit.App.Pages
|
|||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
{
|
{
|
||||||
var page = new AttachmentsPage(_vm.CipherId);
|
var page = new AttachmentsPage(_vm.CipherId);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +208,7 @@ namespace Bit.App.Pages
|
|||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
{
|
{
|
||||||
var page = new SharePage(_vm.CipherId);
|
var page = new SharePage(_vm.CipherId);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +228,7 @@ namespace Bit.App.Pages
|
|||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
{
|
{
|
||||||
var page = new CollectionsPage(_vm.CipherId);
|
var page = new CollectionsPage(_vm.CipherId);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +244,7 @@ namespace Bit.App.Pages
|
|||||||
await _vm.UpdateTotpKeyAsync(key);
|
await _vm.UpdateTotpKeyAsync(key);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,17 +271,17 @@ namespace Bit.App.Pages
|
|||||||
else if(selection == AppResources.Attachments)
|
else if(selection == AppResources.Attachments)
|
||||||
{
|
{
|
||||||
var page = new AttachmentsPage(_vm.CipherId);
|
var page = new AttachmentsPage(_vm.CipherId);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
else if(selection == AppResources.Collections)
|
else if(selection == AppResources.Collections)
|
||||||
{
|
{
|
||||||
var page = new CollectionsPage(_vm.CipherId);
|
var page = new CollectionsPage(_vm.CipherId);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
else if(selection == AppResources.Share)
|
else if(selection == AppResources.Share)
|
||||||
{
|
{
|
||||||
var page = new SharePage(_vm.CipherId);
|
var page = new SharePage(_vm.CipherId);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ namespace Bit.App.Services
|
|||||||
Constants.MigratedFromV1,
|
Constants.MigratedFromV1,
|
||||||
Constants.MigratedFromV1AutofillPromptShown,
|
Constants.MigratedFromV1AutofillPromptShown,
|
||||||
Constants.TriedV1Resync,
|
Constants.TriedV1Resync,
|
||||||
|
Constants.ClearCiphersCacheKey,
|
||||||
};
|
};
|
||||||
|
|
||||||
public MobileStorageService(
|
public MobileStorageService(
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
public static string LastBuildKey = "lastBuild";
|
public static string LastBuildKey = "lastBuild";
|
||||||
public static string OldUserIdKey = "userId";
|
public static string OldUserIdKey = "userId";
|
||||||
public static string AddSitePromptShownKey = "addSitePromptShown";
|
public static string AddSitePromptShownKey = "addSitePromptShown";
|
||||||
|
public static string ClearCiphersCacheKey = "clearCiphersCache";
|
||||||
public static string MigratedFromV1 = "migratedFromV1";
|
public static string MigratedFromV1 = "migratedFromV1";
|
||||||
public static string MigratedFromV1AutofillPromptShown = "migratedV1AutofillPromptShown";
|
public static string MigratedFromV1AutofillPromptShown = "migratedV1AutofillPromptShown";
|
||||||
public static string TriedV1Resync = "triedV1Resync";
|
public static string TriedV1Resync = "triedV1Resync";
|
||||||
|
@ -20,6 +20,7 @@ namespace Bit.iOS.Core.Controllers
|
|||||||
{
|
{
|
||||||
private ICipherService _cipherService;
|
private ICipherService _cipherService;
|
||||||
private IFolderService _folderService;
|
private IFolderService _folderService;
|
||||||
|
private IStorageService _storageService;
|
||||||
private IEnumerable<FolderView> _folders;
|
private IEnumerable<FolderView> _folders;
|
||||||
|
|
||||||
public LoginAddViewController(IntPtr handle)
|
public LoginAddViewController(IntPtr handle)
|
||||||
@ -47,6 +48,7 @@ namespace Bit.iOS.Core.Controllers
|
|||||||
{
|
{
|
||||||
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
|
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
|
||||||
_folderService = ServiceContainer.Resolve<IFolderService>("folderService");
|
_folderService = ServiceContainer.Resolve<IFolderService>("folderService");
|
||||||
|
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
|
||||||
|
|
||||||
BaseNavItem.Title = AppResources.AddItem;
|
BaseNavItem.Title = AppResources.AddItem;
|
||||||
BaseCancelButton.Title = AppResources.Cancel;
|
BaseCancelButton.Title = AppResources.Cancel;
|
||||||
@ -168,6 +170,7 @@ namespace Bit.iOS.Core.Controllers
|
|||||||
var cipherDomain = await _cipherService.EncryptAsync(cipher);
|
var cipherDomain = await _cipherService.EncryptAsync(cipher);
|
||||||
await _cipherService.SaveWithServerAsync(cipherDomain);
|
await _cipherService.SaveWithServerAsync(cipherDomain);
|
||||||
await loadingAlert.DismissViewControllerAsync(true);
|
await loadingAlert.DismissViewControllerAsync(true);
|
||||||
|
await _storageService.SaveAsync(Bit.Core.Constants.ClearCiphersCacheKey, true);
|
||||||
if(await ASHelpers.IdentitiesCanIncremental())
|
if(await ASHelpers.IdentitiesCanIncremental())
|
||||||
{
|
{
|
||||||
var identity = await ASHelpers.GetCipherIdentityAsync(cipherDomain.Id);
|
var identity = await ASHelpers.GetCipherIdentityAsync(cipherDomain.Id);
|
||||||
|
Loading…
Reference in New Issue
Block a user