mirror of
https://github.com/bitwarden/mobile
synced 2026-01-10 12:33:28 +00:00
Send file model changes (#1293)
* Remove Url from SendFile. Add file length hit to SendRequest * Populate SendRequest file length
This commit is contained in:
@@ -3,7 +3,6 @@ namespace Bit.Core.Models.Api
|
||||
public class SendFileApi
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Size { get; set; }
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Bit.Core.Models.Data
|
||||
public SendFileData(SendFileApi data)
|
||||
{
|
||||
Id = data.Id;
|
||||
Url = data.Url;
|
||||
FileName = data.FileName;
|
||||
Key = data.Key;
|
||||
Size = data.Size;
|
||||
@@ -18,7 +17,6 @@ namespace Bit.Core.Models.Data
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Size { get; set; }
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace Bit.Core.Models.Domain
|
||||
public class SendFile : Domain
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Size { get; set; }
|
||||
public string SizeName { get; set; }
|
||||
public CipherString FileName { get; set; }
|
||||
@@ -18,7 +17,7 @@ namespace Bit.Core.Models.Domain
|
||||
public SendFile(SendFileData file, bool alreadyEncrypted = false) : base()
|
||||
{
|
||||
Size = file.Size;
|
||||
BuildDomainModel(this, file, new HashSet<string> { "Id", "Url", "SizeName", "FileName" }, alreadyEncrypted, new HashSet<string> { "Id", "Url", "SizeName" });
|
||||
BuildDomainModel(this, file, new HashSet<string> { "Id", "SizeName", "FileName" }, alreadyEncrypted, new HashSet<string> { "Id", "SizeName" });
|
||||
}
|
||||
|
||||
public Task<SendFileView> DecryptAsync(SymmetricCryptoKey key) =>
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Bit.Core.Models.Request
|
||||
public class SendRequest
|
||||
{
|
||||
public SendType Type { get; set; }
|
||||
public long? FileLength { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public string Key { get; set; }
|
||||
@@ -19,9 +20,10 @@ namespace Bit.Core.Models.Request
|
||||
public string Password { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public SendRequest(Send send)
|
||||
public SendRequest(Send send, long? fileLength)
|
||||
{
|
||||
Type = send.Type;
|
||||
Type = send.Type ;
|
||||
FileLength = fileLength;
|
||||
Name = send.Name?.EncryptedString;
|
||||
Notes = send.Notes?.EncryptedString;
|
||||
MaxAccessCount = send.MaxAccessCount;
|
||||
|
||||
@@ -10,13 +10,11 @@ namespace Bit.Core.Models.View
|
||||
public SendFileView(SendFile file)
|
||||
{
|
||||
Id = file.Id;
|
||||
Url = file.Url;
|
||||
Size = file.Size;
|
||||
SizeName = file.SizeName;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Size { get; set; }
|
||||
public string SizeName { get; set; }
|
||||
public string FileName { get; set; }
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace Bit.Core.Services
|
||||
|
||||
public async Task<string> SaveWithServerAsync(Send send, byte[] encryptedFileData)
|
||||
{
|
||||
var request = new SendRequest(send);
|
||||
var request = new SendRequest(send, encryptedFileData?.LongLength);
|
||||
SendResponse response;
|
||||
if (send.Id == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user