mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
delete cipher messages passes object
This commit is contained in:
parent
a998ee84ec
commit
640beeed23
2 changed files with 15 additions and 7 deletions
|
@ -296,13 +296,17 @@ namespace Bit.App.Services
|
||||||
|
|
||||||
public async Task DeleteDataAsync(string id, bool sendMessage)
|
public async Task DeleteDataAsync(string id, bool sendMessage)
|
||||||
{
|
{
|
||||||
|
if(sendMessage)
|
||||||
|
{
|
||||||
|
var cipherData = await _cipherRepository.GetByIdAsync(id);
|
||||||
|
if(cipherData != null)
|
||||||
|
{
|
||||||
|
MessagingCenter.Send(Application.Current, "DeletedCipher", new Cipher(cipherData));
|
||||||
|
}
|
||||||
|
}
|
||||||
await _cipherRepository.DeleteAsync(id);
|
await _cipherRepository.DeleteAsync(id);
|
||||||
CachedCiphers = null;
|
CachedCiphers = null;
|
||||||
_appSettingsService.ClearCiphersCache = true;
|
_appSettingsService.ClearCiphersCache = true;
|
||||||
if(sendMessage)
|
|
||||||
{
|
|
||||||
MessagingCenter.Send(Application.Current, "DeletedCipher", id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<byte[]> DownloadAndDecryptAttachmentAsync(string url, string orgId = null)
|
public async Task<byte[]> DownloadAndDecryptAttachmentAsync(string url, string orgId = null)
|
||||||
|
|
|
@ -174,12 +174,16 @@ namespace Bit.iOS
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
MessagingCenter.Subscribe<Xamarin.Forms.Application, string>(
|
MessagingCenter.Subscribe<Xamarin.Forms.Application, Cipher>(
|
||||||
Xamarin.Forms.Application.Current, "DeletedCipher", async (sender, id) =>
|
Xamarin.Forms.Application.Current, "DeletedCipher", async (sender, cipher) =>
|
||||||
{
|
{
|
||||||
if(await ASHelpers.IdentitiesCanIncremental())
|
if(await ASHelpers.IdentitiesCanIncremental())
|
||||||
{
|
{
|
||||||
var identity = new ASPasswordCredentialIdentity(null, null, id);
|
var identity = ASHelpers.ToCredentialIdentity(cipher);
|
||||||
|
if(identity == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await ASCredentialIdentityStore.SharedStore.RemoveCredentialIdentitiesAsync(
|
await ASCredentialIdentityStore.SharedStore.RemoveCredentialIdentitiesAsync(
|
||||||
new ASPasswordCredentialIdentity[] { identity });
|
new ASPasswordCredentialIdentity[] { identity });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue