From 640beeed234c0367bdf3699a067d43922aac078b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 21 Sep 2018 17:04:54 -0400 Subject: [PATCH] delete cipher messages passes object --- src/App/Services/CipherService.cs | 12 ++++++++---- src/iOS/AppDelegate.cs | 10 +++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/App/Services/CipherService.cs b/src/App/Services/CipherService.cs index 5c9f63f60..8f69b0db8 100644 --- a/src/App/Services/CipherService.cs +++ b/src/App/Services/CipherService.cs @@ -296,13 +296,17 @@ namespace Bit.App.Services 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); CachedCiphers = null; _appSettingsService.ClearCiphersCache = true; - if(sendMessage) - { - MessagingCenter.Send(Application.Current, "DeletedCipher", id); - } } public async Task DownloadAndDecryptAttachmentAsync(string url, string orgId = null) diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 1618fdb3c..207fbcc1a 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -174,12 +174,16 @@ namespace Bit.iOS } }); - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "DeletedCipher", async (sender, id) => + MessagingCenter.Subscribe( + Xamarin.Forms.Application.Current, "DeletedCipher", async (sender, cipher) => { if(await ASHelpers.IdentitiesCanIncremental()) { - var identity = new ASPasswordCredentialIdentity(null, null, id); + var identity = ASHelpers.ToCredentialIdentity(cipher); + if(identity == null) + { + return; + } await ASCredentialIdentityStore.SharedStore.RemoveCredentialIdentitiesAsync( new ASPasswordCredentialIdentity[] { identity }); }