TF-2532 Only clear old data stream when add object to stream in share file

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 181e1ec20dafe4f865d0f2ce606311cf216e06fd)
This commit is contained in:
dab246
2024-02-02 16:26:14 +07:00
committed by Dat H. Pham
parent 797a14c483
commit 1c3ca5485a
2 changed files with 8 additions and 13 deletions
@@ -416,7 +416,6 @@ class MailboxDashBoardController extends ReloadableController {
_emailAddressStreamSubscription =
_emailReceiveManager.pendingEmailAddressInfo.stream.listen((emailAddress) {
if (emailAddress?.email?.isNotEmpty == true) {
_emailReceiveManager.clearPendingEmailAddress();
goToComposer(ComposerArguments.fromEmailAddress(emailAddress!));
}
});
@@ -426,7 +425,6 @@ class MailboxDashBoardController extends ReloadableController {
_emailContentStreamSubscription =
_emailReceiveManager.pendingEmailContentInfo.stream.listen((emailContent) {
if (emailContent?.content.isNotEmpty == true) {
_emailReceiveManager.clearPendingEmailContent();
goToComposer(ComposerArguments.fromContentShared([emailContent!].asHtmlString));
}
});
@@ -436,7 +434,6 @@ class MailboxDashBoardController extends ReloadableController {
_fileReceiveManagerStreamSubscription =
_emailReceiveManager.pendingFileInfo.stream.listen((listFile) {
if (listFile.isNotEmpty) {
_emailReceiveManager.clearPendingFileInfo();
goToComposer(ComposerArguments.fromFileShared(listFile));
}
});
+8 -10
View File
@@ -29,16 +29,16 @@ class EmailReceiveManager {
}
void setPendingEmailAddress(EmailAddress emailAddress) async {
clearPendingEmailAddress();
_clearPendingEmailAddress();
_pendingEmailAddressInfo.add(emailAddress);
}
void setPendingEmailContent(EmailContent emailContent) async {
clearPendingEmailAddress();
_clearPendingEmailContent();
_pendingEmailContentInfo.add(emailContent);
}
void clearPendingEmailContent() {
void _clearPendingEmailContent() {
if (_pendingEmailContentInfo.isClosed) {
_pendingEmailContentInfo = BehaviorSubject.seeded(null);
} else {
@@ -46,7 +46,7 @@ class EmailReceiveManager {
}
}
void clearPendingEmailAddress() {
void _clearPendingEmailAddress() {
if(_pendingEmailAddressInfo.isClosed) {
_pendingEmailAddressInfo = BehaviorSubject.seeded(null);
} else {
@@ -56,22 +56,20 @@ class EmailReceiveManager {
void closeEmailReceiveManagerStream() {
_pendingEmailAddressInfo.close();
_pendingEmailContentInfo.close();
_pendingFileInfo.close();
}
void setPendingFileInfo(List<SharedMediaFile> list) async {
clearPendingFileInfo();
_clearPendingFileInfo();
_pendingFileInfo.add(list);
}
void clearPendingFileInfo() {
void _clearPendingFileInfo() {
if(_pendingFileInfo.isClosed) {
_pendingFileInfo = BehaviorSubject.seeded(List.empty(growable: true));
} else {
_pendingFileInfo.add(List.empty(growable: true));
}
}
void closeFileSharingStream() {
_pendingFileInfo.close();
}
}