1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-17 16:53:26 +00:00

replace vs created on save

This commit is contained in:
Kyle Spearrin
2018-09-21 21:53:04 -04:00
parent 045ce42168
commit d958dc6bce
4 changed files with 22 additions and 12 deletions

View File

@@ -155,18 +155,26 @@ namespace Bit.iOS
}
});
MessagingCenter.Subscribe<Xamarin.Forms.Application, string>(
Xamarin.Forms.Application.Current, "UpsertedCipher", async (sender, id) =>
MessagingCenter.Subscribe<Xamarin.Forms.Application, Tuple<string, bool>>(
Xamarin.Forms.Application.Current, "UpsertedCipher", async (sender, data) =>
{
if(await ASHelpers.IdentitiesCanIncremental())
{
var identity = await ASHelpers.GetCipherIdentityAsync(id, _cipherService);
var identity = await ASHelpers.GetCipherIdentityAsync(data.Item1, _cipherService);
if(identity == null)
{
return;
}
await ASCredentialIdentityStore.SharedStore.SaveCredentialIdentitiesAsync(
new ASPasswordCredentialIdentity[] { identity });
if(data.Item2)
{
await ASCredentialIdentityStore.SharedStore.SaveCredentialIdentitiesAsync(
new ASPasswordCredentialIdentity[] { identity });
}
else
{
await ASCredentialIdentityStore.SharedStore.ReplaceCredentialIdentitiesAsync(
new ASPasswordCredentialIdentity[] { identity });
}
return;
}
await ASHelpers.ReplaceAllIdentities(_cipherService);