mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 15:53:44 +00:00
PM-2572 Fix pr comments
This commit is contained in:
@@ -576,10 +576,10 @@ namespace Bit.Core.Services
|
|||||||
var attachmentTasks = new List<Task>();
|
var attachmentTasks = new List<Task>();
|
||||||
Cipher cipher = null;
|
Cipher cipher = null;
|
||||||
//If the cipher doesn't have a key, we update it
|
//If the cipher doesn't have a key, we update it
|
||||||
if(cipherView.Key == null)
|
if(await ShouldUseCipherKeyEncryptionAsync() && cipherView.Key == null)
|
||||||
{
|
{
|
||||||
cipher = await EncryptAsync(cipherView);
|
cipher = await EncryptAsync(cipherView);
|
||||||
await UpdateAndUpsertAsync(async () => await _apiService.PutCipherAsync(cipherView.Id, new CipherRequest(cipher)));
|
await UpdateAndUpsertAsync(() => _apiService.PutCipherAsync(cipherView.Id, new CipherRequest(cipher)));
|
||||||
cipher = await GetAsync(cipherView.Id);
|
cipher = await GetAsync(cipherView.Id);
|
||||||
cipherView = await cipher.DecryptAsync();
|
cipherView = await cipher.DecryptAsync();
|
||||||
}
|
}
|
||||||
@@ -597,7 +597,7 @@ namespace Bit.Core.Services
|
|||||||
cipherView.OrganizationId = organizationId;
|
cipherView.OrganizationId = organizationId;
|
||||||
cipherView.CollectionIds = collectionIds;
|
cipherView.CollectionIds = collectionIds;
|
||||||
cipher = await EncryptAsync(cipherView);
|
cipher = await EncryptAsync(cipherView);
|
||||||
await UpdateAndUpsertAsync(async () => await _apiService.PutShareCipherAsync(cipherView.Id, new CipherShareRequest(cipher)), collectionIds);
|
await UpdateAndUpsertAsync(() => _apiService.PutShareCipherAsync(cipherView.Id, new CipherShareRequest(cipher)), collectionIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Cipher> SaveAttachmentRawWithServerAsync(Cipher cipher, CipherView cipherView, string filename, byte[] data)
|
public async Task<Cipher> SaveAttachmentRawWithServerAsync(Cipher cipher, CipherView cipherView, string filename, byte[] data)
|
||||||
@@ -1360,9 +1360,9 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateAndUpsertAsync(Func<Task<CipherResponse>> func, HashSet<string> collectionIds = null)
|
private async Task UpdateAndUpsertAsync(Func<Task<CipherResponse>> callPutCipherApi, HashSet<string> collectionIds = null)
|
||||||
{
|
{
|
||||||
var response = await func();
|
var response = await callPutCipherApi();
|
||||||
var data = new CipherData(response, await _stateService.GetActiveUserIdAsync(), collectionIds);
|
var data = new CipherData(response, await _stateService.GetActiveUserIdAsync(), collectionIds);
|
||||||
await UpsertAsync(data);
|
await UpsertAsync(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user