Root contact concept.
This commit is contained in:
@@ -17,6 +17,7 @@ namespace Wino.Core.Domain.Entities
|
||||
public string Address { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Base64ContactPicture { get; set; }
|
||||
public bool IsRootContact { get; set; }
|
||||
|
||||
public string DisplayName => Address == Name ? Address : $"{Name} <{Address}>";
|
||||
|
||||
|
||||
@@ -338,7 +338,8 @@ namespace Wino.Core.Services
|
||||
{
|
||||
Address = account.Address,
|
||||
Name = account.SenderName,
|
||||
Base64ContactPicture = account.Base64ProfilePictureData
|
||||
Base64ContactPicture = account.Base64ProfilePictureData,
|
||||
IsRootContact = true
|
||||
};
|
||||
|
||||
await Connection.InsertOrReplaceAsync(accountContact).ConfigureAwait(false);
|
||||
|
||||
@@ -52,7 +52,10 @@ namespace Wino.Core.Services
|
||||
{
|
||||
await Connection.InsertAsync(info).ConfigureAwait(false);
|
||||
}
|
||||
await Connection.InsertOrReplaceAsync(info).ConfigureAwait(false);
|
||||
else if (!currentContact.IsRootContact) // Don't update root contacts. They belong to accounts.
|
||||
{
|
||||
await Connection.InsertOrReplaceAsync(info).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Wino.Core.Services
|
||||
|
||||
mailCopy.AssignedFolder = folderAssignment;
|
||||
mailCopy.AssignedAccount = accountAssignment;
|
||||
mailCopy.SenderContact = contactAssignment;
|
||||
mailCopy.SenderContact = contactAssignment ?? new AccountContact() { Name = mailCopy.FromName, Address = mailCopy.FromAddress };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user