diff --git a/src/App/Services/CipherService.cs b/src/App/Services/CipherService.cs index 8f69b0db8..0f39e6cb4 100644 --- a/src/App/Services/CipherService.cs +++ b/src/App/Services/CipherService.cs @@ -270,9 +270,9 @@ namespace Bit.App.Services public async Task UpsertDataAsync(CipherData cipher, bool sendMessage) { await _cipherRepository.UpsertAsync(cipher); - CachedCiphers = null; + CachedCiphers = null; _appSettingsService.ClearCiphersCache = true; - if(sendMessage) + if(sendMessage && Application.Current != null) { MessagingCenter.Send(Application.Current, "UpsertedCipher", cipher.Id); } @@ -299,7 +299,7 @@ namespace Bit.App.Services if(sendMessage) { var cipherData = await _cipherRepository.GetByIdAsync(id); - if(cipherData != null) + if(cipherData != null && Application.Current != null) { MessagingCenter.Send(Application.Current, "DeletedCipher", new Cipher(cipherData)); } diff --git a/src/iOS.Autofill/LoginAddViewController.cs b/src/iOS.Autofill/LoginAddViewController.cs index d0d7d8179..e5d1b4099 100644 --- a/src/iOS.Autofill/LoginAddViewController.cs +++ b/src/iOS.Autofill/LoginAddViewController.cs @@ -28,7 +28,7 @@ namespace Bit.iOS.Autofill async partial void SaveBarButton_Activated(UIBarButtonItem sender) { - await this.SaveAsync(); + await SaveAsync(); } public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) diff --git a/src/iOS.Core/Controllers/LoginAddViewController.cs b/src/iOS.Core/Controllers/LoginAddViewController.cs index b35e53b8c..d2f7a082d 100644 --- a/src/iOS.Core/Controllers/LoginAddViewController.cs +++ b/src/iOS.Core/Controllers/LoginAddViewController.cs @@ -13,6 +13,7 @@ using Plugin.Connectivity.Abstractions; using Bit.iOS.Core.Utilities; using Bit.iOS.Core.Models; using System.Threading.Tasks; +using AuthenticationServices; namespace Bit.iOS.Core.Controllers { @@ -172,6 +173,20 @@ namespace Bit.iOS.Core.Controllers await loadingAlert.DismissViewControllerAsync(true); if(saveTask.Result.Succeeded) { + if (await ASHelpers.IdentitiesCanIncremental()) + { + var identity = await ASHelpers.GetCipherIdentityAsync(saveTask.Result.Result.Id, _cipherService); + if (identity == null) + { + return; + } + await ASCredentialIdentityStore.SharedStore.SaveCredentialIdentitiesAsync( + new ASPasswordCredentialIdentity[] { identity }); + } + else + { + await ASHelpers.ReplaceAllIdentities(_cipherService); + } Success(); } else if(saveTask.Result.Errors.Count() > 0)