Root contact concept.

This commit is contained in:
Burak Kaan Köse
2024-08-24 00:14:32 +02:00
parent d272b62c45
commit 20f4857405
4 changed files with 8 additions and 3 deletions

View File

@@ -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}>";

View File

@@ -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);

View File

@@ -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);
}
}
}
}

View File

@@ -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 };
}
}
}