1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-23 03:33:59 +00:00

implement ASHelpers from messages

This commit is contained in:
Kyle Spearrin
2019-06-27 16:22:58 -04:00
parent 9c2cbc0ecb
commit be4ae605a9
5 changed files with 53 additions and 13 deletions

View File

@@ -175,7 +175,7 @@ namespace Bit.iOS.Core.Controllers
await loadingAlert.DismissViewControllerAsync(true);
if(await ASHelpers.IdentitiesCanIncremental())
{
var identity = await ASHelpers.GetCipherIdentityAsync(cipherDomain.Id, _cipherService);
var identity = await ASHelpers.GetCipherIdentityAsync(cipherDomain.Id);
if(identity != null)
{
await ASCredentialIdentityStore.SharedStore.SaveCredentialIdentitiesAsync(
@@ -184,7 +184,7 @@ namespace Bit.iOS.Core.Controllers
}
else
{
await ASHelpers.ReplaceAllIdentities(_cipherService);
await ASHelpers.ReplaceAllIdentities();
}
Success();
}

View File

@@ -4,13 +4,15 @@ using System.Threading.Tasks;
using AuthenticationServices;
using Bit.Core.Abstractions;
using Bit.Core.Models.View;
using Bit.Core.Utilities;
namespace Bit.iOS.Core.Utilities
{
public static class ASHelpers
{
public static async Task ReplaceAllIdentities(ICipherService cipherService)
public static async Task ReplaceAllIdentities()
{
var cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
if(await AutofillEnabled())
{
var identities = new List<ASPasswordCredentialIdentity>();
@@ -42,8 +44,9 @@ namespace Bit.iOS.Core.Utilities
return state != null && state.Enabled;
}
public static async Task<ASPasswordCredentialIdentity> GetCipherIdentityAsync(string cipherId, ICipherService cipherService)
public static async Task<ASPasswordCredentialIdentity> GetCipherIdentityAsync(string cipherId)
{
var cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
var cipher = await cipherService.GetAsync(cipherId);
if(cipher == null)
{