Optimize and refactor for MailboxVisibility

This commit is contained in:
dab246
2023-02-17 11:21:54 +07:00
committed by Dat Vu
parent 1f871ac8eb
commit f2a63c083a
17 changed files with 343 additions and 487 deletions
@@ -4,7 +4,7 @@ import 'package:model/mailbox/presentation_mailbox.dart';
extension ListPresentationMailboxExtension on List<PresentationMailbox> {
List<PresentationMailbox> get listSubscribedMailboxes =>
where((mailbox) => mailbox.supportedSubscribe).toList();
where((mailbox) => mailbox.isSubscribedMailbox).toList();
List<PresentationMailbox> get listPersonalMailboxes =>
where((mailbox) => mailbox.isPersonal).toList();
+2 -4
View File
@@ -103,10 +103,8 @@ class PresentationMailbox with EquatableMixin {
(namespace?.value.indexOf('[') ?? 0) + 1,
namespace?.value.indexOf(']'));
bool get supportedSubscribe => isSubscribed?.value == true;
bool get isSupportedDisableMailbox {
if (!supportedSubscribe) {
if (!isSubscribedMailbox) {
return false;
}
if (isPersonal) {
@@ -117,7 +115,7 @@ class PresentationMailbox with EquatableMixin {
}
bool get isSupportedEnableMailbox {
if (supportedSubscribe) {
if (isSubscribedMailbox) {
return false;
}
if (isPersonal) {