mirror of
https://github.com/bitwarden/mobile
synced 2025-12-22 19:23:58 +00:00
update autofill identities if needed
This commit is contained in:
@@ -28,5 +28,7 @@
|
||||
public const string UTTypeAppExtensionFillWebViewAction = "org.appextension.fill-webview-action";
|
||||
public const string UTTypeAppExtensionFillBrowserAction = "org.appextension.fill-browser-action";
|
||||
public const string UTTypeAppExtensionSetup = "com.8bit.bitwarden.extension-setup";
|
||||
|
||||
public const string AutofillNeedsIdentityReplacementKey = "autofillNeedsIdentityReplacement";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,16 @@ namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
public static async Task ReplaceAllIdentities()
|
||||
{
|
||||
var cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
|
||||
if(await AutofillEnabled())
|
||||
{
|
||||
var storageService = ServiceContainer.Resolve<IStorageService>("storageService");
|
||||
var lockService = ServiceContainer.Resolve<ILockService>("lockService");
|
||||
if(await lockService.IsLockedAsync())
|
||||
{
|
||||
await storageService.SaveAsync(Constants.AutofillNeedsIdentityReplacementKey, true);
|
||||
return;
|
||||
}
|
||||
var cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
|
||||
var identities = new List<ASPasswordCredentialIdentity>();
|
||||
var ciphers = await cipherService.GetAllDecryptedAsync();
|
||||
foreach(var cipher in ciphers)
|
||||
@@ -28,6 +35,7 @@ namespace Bit.iOS.Core.Utilities
|
||||
if(identities.Any())
|
||||
{
|
||||
await ASCredentialIdentityStore.SharedStore?.ReplaceCredentialIdentitiesAsync(identities.ToArray());
|
||||
await storageService.SaveAsync(Constants.AutofillNeedsIdentityReplacementKey, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user