TF-233 Implement create new mailbox and sub-folder

This commit is contained in:
dab246
2022-02-23 12:39:37 +07:00
committed by Dat H. Pham
parent 9c521cde9b
commit e739e23c62
30 changed files with 460 additions and 172 deletions
+28 -12
View File
@@ -8,7 +8,7 @@ extension MailboxExtension on Mailbox {
PresentationMailbox toPresentationMailbox({SelectMode selectMode = SelectMode.INACTIVE}) {
return PresentationMailbox(
id,
id!,
name: name,
parentId: parentId,
role: role,
@@ -25,17 +25,33 @@ extension MailboxExtension on Mailbox {
Mailbox combineMailbox(Mailbox newMailbox, Properties updatedProperties) {
return Mailbox(
newMailbox.id,
updatedProperties.contain(MailboxProperty.name) ? newMailbox.name : name,
updatedProperties.contain(MailboxProperty.parentId) ? newMailbox.parentId : parentId,
updatedProperties.contain(MailboxProperty.role) ? newMailbox.role : role,
updatedProperties.contain(MailboxProperty.sortOrder) ? newMailbox.sortOrder : sortOrder,
updatedProperties.contain(MailboxProperty.totalEmails) ? newMailbox.totalEmails : totalEmails,
updatedProperties.contain(MailboxProperty.unreadEmails) ? newMailbox.unreadEmails : unreadEmails,
updatedProperties.contain(MailboxProperty.totalThreads) ? newMailbox.totalThreads : totalThreads,
updatedProperties.contain(MailboxProperty.unreadThreads) ? newMailbox.unreadThreads : unreadThreads,
updatedProperties.contain(MailboxProperty.myRights) ? newMailbox.myRights : myRights,
updatedProperties.contain(MailboxProperty.isSubscribed) ? newMailbox.isSubscribed : isSubscribed,
id: newMailbox.id,
name: updatedProperties.contain(MailboxProperty.name) ? newMailbox.name : name,
parentId: updatedProperties.contain(MailboxProperty.parentId) ? newMailbox.parentId : parentId,
role: updatedProperties.contain(MailboxProperty.role) ? newMailbox.role : role,
sortOrder: updatedProperties.contain(MailboxProperty.sortOrder) ? newMailbox.sortOrder : sortOrder,
totalEmails: updatedProperties.contain(MailboxProperty.totalEmails) ? newMailbox.totalEmails : totalEmails,
unreadEmails: updatedProperties.contain(MailboxProperty.unreadEmails) ? newMailbox.unreadEmails : unreadEmails,
totalThreads: updatedProperties.contain(MailboxProperty.totalThreads) ? newMailbox.totalThreads : totalThreads,
unreadThreads: updatedProperties.contain(MailboxProperty.unreadThreads) ? newMailbox.unreadThreads : unreadThreads,
myRights: updatedProperties.contain(MailboxProperty.myRights) ? newMailbox.myRights : myRights,
isSubscribed: updatedProperties.contain(MailboxProperty.isSubscribed) ? newMailbox.isSubscribed : isSubscribed,
);
}
Mailbox addMailboxName(Mailbox newMailbox, MailboxName mailboxName, {MailboxId? parentId}) {
return Mailbox(
id: id,
name: mailboxName,
parentId: parentId,
role: role,
sortOrder: sortOrder,
totalEmails: totalEmails,
unreadEmails: unreadEmails,
totalThreads: totalThreads,
unreadThreads: unreadThreads,
myRights: myRights,
isSubscribed: isSubscribed,
);
}
}
@@ -23,17 +23,17 @@ extension PresentationMailboxExtension on PresentationMailbox {
Mailbox toMailbox() {
return Mailbox(
id,
name,
parentId,
role,
sortOrder,
totalEmails,
unreadEmails,
totalThreads,
unreadThreads,
myRights,
isSubscribed
id: id,
name: name,
parentId: parentId,
role: role,
sortOrder: sortOrder,
totalEmails: totalEmails,
unreadEmails: unreadEmails,
totalThreads: totalThreads,
unreadThreads: unreadThreads,
myRights: myRights,
isSubscribed: isSubscribed
);
}
}