mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-25 12:05:59 +01:00
PM-2572 Fix pr comments
This commit is contained in:
parent
df9fcd1aca
commit
c40eb9d3db
@ -578,8 +578,7 @@ namespace Bit.Core.Services
|
||||
//If the cipher doesn't have a key, we update it
|
||||
if(await ShouldUseCipherKeyEncryptionAsync() && cipherView.Key == null)
|
||||
{
|
||||
cipher = await EncryptAsync(cipherView);
|
||||
await UpdateAndUpsertAsync(() => _apiService.PutCipherAsync(cipherView.Id, new CipherRequest(cipher)));
|
||||
await UpdateAndUpsertAsync(cipherView, cipher => _apiService.PutCipherAsync(cipherView.Id, new CipherRequest(cipher)));
|
||||
cipher = await GetAsync(cipherView.Id);
|
||||
cipherView = await cipher.DecryptAsync();
|
||||
}
|
||||
@ -596,8 +595,15 @@ namespace Bit.Core.Services
|
||||
await Task.WhenAll(attachmentTasks);
|
||||
cipherView.OrganizationId = organizationId;
|
||||
cipherView.CollectionIds = collectionIds;
|
||||
cipher = await EncryptAsync(cipherView);
|
||||
await UpdateAndUpsertAsync(() => _apiService.PutShareCipherAsync(cipherView.Id, new CipherShareRequest(cipher)), collectionIds);
|
||||
await UpdateAndUpsertAsync(cipherView, cipher => _apiService.PutShareCipherAsync(cipherView.Id, new CipherShareRequest(cipher)), collectionIds);
|
||||
|
||||
async Task UpdateAndUpsertAsync(CipherView cipherView, Func<Cipher,Task<CipherResponse>> callPutCipherApi, HashSet<string> collectionIds = null)
|
||||
{
|
||||
var cipher = await EncryptAsync(cipherView);
|
||||
var response = await callPutCipherApi(cipher);
|
||||
var data = new CipherData(response, await _stateService.GetActiveUserIdAsync(), collectionIds);
|
||||
await UpsertAsync(data);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Cipher> SaveAttachmentRawWithServerAsync(Cipher cipher, CipherView cipherView, string filename, byte[] data)
|
||||
@ -1360,13 +1366,6 @@ namespace Bit.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
private async Task UpdateAndUpsertAsync(Func<Task<CipherResponse>> callPutCipherApi, HashSet<string> collectionIds = null)
|
||||
{
|
||||
var response = await callPutCipherApi();
|
||||
var data = new CipherData(response, await _stateService.GetActiveUserIdAsync(), collectionIds);
|
||||
await UpsertAsync(data);
|
||||
}
|
||||
|
||||
private class CipherLocaleComparer : IComparer<CipherView>
|
||||
{
|
||||
private readonly II18nService _i18nService;
|
||||
|
Loading…
Reference in New Issue
Block a user