TF-1715 Load emails in favorite folder without filters
This commit is contained in:
@@ -18,6 +18,7 @@ class GetEmailRequest with EquatableMixin {
|
||||
final FilterMessageOption? filterOption;
|
||||
final Properties? properties;
|
||||
final EmailId? lastEmailId;
|
||||
final bool useCache;
|
||||
|
||||
GetEmailRequest(
|
||||
this.session,
|
||||
@@ -30,6 +31,7 @@ class GetEmailRequest with EquatableMixin {
|
||||
this.filterOption,
|
||||
this.properties,
|
||||
this.lastEmailId,
|
||||
this.useCache = true,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -43,6 +45,7 @@ class GetEmailRequest with EquatableMixin {
|
||||
filter,
|
||||
properties,
|
||||
lastEmailId,
|
||||
filterOption
|
||||
filterOption,
|
||||
useCache,
|
||||
];
|
||||
}
|
||||
@@ -24,6 +24,7 @@ abstract class ThreadRepository {
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
int? position,
|
||||
Set<Comparator>? sort,
|
||||
EmailFilter? emailFilter,
|
||||
Properties? propertiesCreated,
|
||||
@@ -32,6 +33,16 @@ abstract class ThreadRepository {
|
||||
}
|
||||
);
|
||||
|
||||
Stream<EmailsResponse> loadAllEmailInFolderWithoutCache({
|
||||
required Session session,
|
||||
required AccountId accountId,
|
||||
UnsignedInt? limit,
|
||||
int? position,
|
||||
Set<Comparator>? sort,
|
||||
EmailFilter? emailFilter,
|
||||
Properties? propertiesCreated,
|
||||
});
|
||||
|
||||
Stream<EmailsResponse> refreshChanges(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
|
||||
@@ -27,13 +27,14 @@ class GetEmailsInMailboxInteractor {
|
||||
Properties? propertiesCreated,
|
||||
Properties? propertiesUpdated,
|
||||
bool getLatestChanges = true,
|
||||
bool useCache = true,
|
||||
}
|
||||
) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetAllEmailLoading());
|
||||
|
||||
yield* threadRepository
|
||||
.getAllEmail(
|
||||
if (useCache) {
|
||||
yield* threadRepository.getAllEmail(
|
||||
session,
|
||||
accountId,
|
||||
limit: limit,
|
||||
@@ -41,11 +42,24 @@ class GetEmailsInMailboxInteractor {
|
||||
emailFilter: emailFilter,
|
||||
propertiesCreated: propertiesCreated,
|
||||
propertiesUpdated: propertiesUpdated,
|
||||
getLatestChanges: getLatestChanges)
|
||||
.map((emailResponse) => _toGetEmailState(
|
||||
getLatestChanges: getLatestChanges,
|
||||
).map((emailResponse) => _toGetEmailState(
|
||||
emailResponse: emailResponse,
|
||||
currentMailboxId: emailFilter?.mailboxId
|
||||
currentMailboxId: emailFilter?.mailboxId,
|
||||
));
|
||||
} else {
|
||||
yield* threadRepository.loadAllEmailInFolderWithoutCache(
|
||||
session: session,
|
||||
accountId: accountId,
|
||||
limit: limit,
|
||||
sort: sort,
|
||||
emailFilter: emailFilter,
|
||||
propertiesCreated: propertiesCreated,
|
||||
).map((emailResponse) => _toGetEmailState(
|
||||
emailResponse: emailResponse,
|
||||
currentMailboxId: emailFilter?.mailboxId,
|
||||
));
|
||||
}
|
||||
} catch (e) {
|
||||
yield Left(GetAllEmailFailure(e));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user