TF-267 Fix bug display a full page for sorting results
This commit is contained in:
@@ -21,6 +21,17 @@ abstract class ThreadRepository {
|
||||
}
|
||||
);
|
||||
|
||||
Stream<EmailsResponse> refreshAll(
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
Set<Comparator>? sort,
|
||||
EmailFilter? emailFilter,
|
||||
Properties? propertiesCreated,
|
||||
Properties? propertiesUpdated,
|
||||
}
|
||||
);
|
||||
|
||||
Stream<EmailsResponse> refreshChanges(
|
||||
AccountId accountId,
|
||||
jmap.State currentState,
|
||||
@@ -28,7 +39,8 @@ abstract class ThreadRepository {
|
||||
Set<Comparator>? sort,
|
||||
Properties? propertiesCreated,
|
||||
Properties? propertiesUpdated,
|
||||
MailboxId? inMailboxId
|
||||
MailboxId? inMailboxId,
|
||||
FilterMessageOption? filterOption,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:core/core.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/sort/comparator.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/email_response.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/repository/thread_repository.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/state/get_all_email_state.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
class RefreshAllEmailsInMailboxInteractor {
|
||||
final ThreadRepository threadRepository;
|
||||
|
||||
RefreshAllEmailsInMailboxInteractor(this.threadRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
Set<Comparator>? sort,
|
||||
EmailFilter? emailFilter,
|
||||
Properties? propertiesCreated,
|
||||
Properties? propertiesUpdated,
|
||||
}
|
||||
) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingState());
|
||||
|
||||
yield* threadRepository
|
||||
.refreshAll(
|
||||
accountId,
|
||||
limit: limit,
|
||||
sort: sort,
|
||||
emailFilter: emailFilter,
|
||||
propertiesCreated: propertiesCreated,
|
||||
propertiesUpdated: propertiesUpdated)
|
||||
.map(_toGetEmailState);
|
||||
} catch (e) {
|
||||
yield Left(GetAllEmailFailure(e));
|
||||
}
|
||||
}
|
||||
|
||||
Either<Failure, Success> _toGetEmailState(EmailsResponse emailResponse) {
|
||||
final presentationEmailList = emailResponse.emailList
|
||||
?.map((email) => email.toPresentationEmail()).toList() ?? List.empty();
|
||||
|
||||
return Right<Failure, Success>(GetAllEmailSuccess(
|
||||
emailList: presentationEmailList,
|
||||
currentEmailState: emailResponse.state));
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -22,7 +22,8 @@ class RefreshChangesEmailsInMailboxInteractor {
|
||||
Set<Comparator>? sort,
|
||||
Properties? propertiesCreated,
|
||||
Properties? propertiesUpdated,
|
||||
MailboxId? inMailboxId
|
||||
MailboxId? inMailboxId,
|
||||
FilterMessageOption? filterOption,
|
||||
}
|
||||
) async* {
|
||||
yield Right<Failure, Success>(RefreshingState());
|
||||
@@ -35,7 +36,8 @@ class RefreshChangesEmailsInMailboxInteractor {
|
||||
sort: sort,
|
||||
propertiesCreated: propertiesCreated,
|
||||
propertiesUpdated: propertiesUpdated,
|
||||
inMailboxId: inMailboxId)
|
||||
inMailboxId: inMailboxId,
|
||||
filterOption: filterOption)
|
||||
.map(_toGetEmailState);
|
||||
} catch (e) {
|
||||
yield Left(GetAllEmailFailure(e));
|
||||
|
||||
Reference in New Issue
Block a user