TF-2302 Fix rename folder

(cherry picked from commit 606ae303f92e711ffd0dbd8975a19c8fa02eb022)
This commit is contained in:
dab246
2023-11-07 16:15:22 +07:00
committed by Dat Vu
parent 5c5aaec976
commit f7ba168d7a
15 changed files with 133 additions and 62 deletions
@@ -0,0 +1,19 @@
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
import 'package:model/mailbox/mailbox_property.dart';
class MailboxConstants {
static final propertiesDefault = Properties({
MailboxProperty.id,
MailboxProperty.name,
MailboxProperty.parentId,
MailboxProperty.role,
MailboxProperty.sortOrder,
MailboxProperty.isSubscribed,
MailboxProperty.totalEmails,
MailboxProperty.totalThreads,
MailboxProperty.unreadEmails,
MailboxProperty.unreadThreads,
MailboxProperty.myRights,
MailboxProperty.namespace
});
}
@@ -21,7 +21,7 @@ import 'package:tmail_ui_user/features/mailbox/domain/model/subscribe_multiple_m
abstract class MailboxRepository {
Stream<MailboxResponse> getAllMailbox(Session session, AccountId accountId, {Properties? properties});
Stream<MailboxResponse> refresh(Session session, AccountId accountId, State currentState);
Stream<MailboxResponse> refresh(Session session, AccountId accountId, State currentState, {Properties? properties});
Future<Mailbox?> createNewMailbox(Session session, AccountId accountId, CreateNewMailboxRequest newMailboxRequest);
@@ -1,7 +1,9 @@
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:core/utils/app_logger.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
import 'package:jmap_dart_client/jmap/core/session/session.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap_state;
import 'package:model/extensions/mailbox_extension.dart';
@@ -15,11 +17,17 @@ class RefreshAllMailboxInteractor {
RefreshAllMailboxInteractor(this._mailboxRepository);
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, jmap_state.State currentState) async* {
Stream<Either<Failure, Success>> execute(
Session session,
AccountId accountId,
jmap_state.State currentState,
{Properties? properties}
) async* {
try {
log('RefreshAllMailboxInteractor::execute:properties: $properties');
yield Right<Failure, Success>(RefreshChangesAllMailboxLoading());
yield* _mailboxRepository
.refresh(session, accountId, currentState)
.refresh(session, accountId, currentState, properties: properties)
.map(_toGetMailboxState);
} catch (e) {
yield Left<Failure, Success>(RefreshChangesAllMailboxFailure(e));
@@ -16,7 +16,7 @@ class RenameMailboxInteractor {
yield Right<Failure, Success>(LoadingRenameMailbox());
final currentMailboxState = await _mailboxRepository.getMailboxState(session, accountId);
log('RenameMailboxInteractor::execute:currentMailboxState: $currentMailboxState');
final result = await _mailboxRepository.renameMailbox(session, accountId, request);
if (result) {
yield Right<Failure, Success>(RenameMailboxSuccess(currentMailboxState: currentMailboxState));