TF-495 Implement linter for thread view
This commit is contained in:
@@ -3,9 +3,6 @@ import 'package:tmail_ui_user/features/thread/data/model/email_cache.dart';
|
||||
|
||||
extension ListEmailCacheExtension on List<EmailCache> {
|
||||
Map<String, EmailCache> toMap() {
|
||||
return Map<String, EmailCache>.fromIterable(
|
||||
this,
|
||||
key: (emailCache) => emailCache.id,
|
||||
value: (emailCache) => emailCache);
|
||||
return { for (var emailCache in this) emailCache.id : emailCache };
|
||||
}
|
||||
}
|
||||
@@ -30,9 +30,9 @@ class EmailCacheManager {
|
||||
.where((email) => filterOption.filterEmail(email))
|
||||
.toList();
|
||||
if (sort != null) {
|
||||
sort.forEach((comparator) {
|
||||
for (var comparator in sort) {
|
||||
emailList.sortBy(comparator);
|
||||
});
|
||||
}
|
||||
}
|
||||
return emailList;
|
||||
}
|
||||
|
||||
@@ -39,19 +39,19 @@ class ThreadAPI {
|
||||
|
||||
final queryEmailMethod = QueryEmailMethod(accountId);
|
||||
|
||||
if (limit != null) queryEmailMethod..addLimit(limit);
|
||||
if (limit != null) queryEmailMethod.addLimit(limit);
|
||||
|
||||
if (sort != null) queryEmailMethod..addSorts(sort);
|
||||
if (sort != null) queryEmailMethod.addSorts(sort);
|
||||
|
||||
if (filter != null) queryEmailMethod..addFilters(filter);
|
||||
if (filter != null) queryEmailMethod.addFilters(filter);
|
||||
|
||||
final queryEmailInvocation = jmapRequestBuilder.invocation(queryEmailMethod);
|
||||
|
||||
final getEmailMethod = GetEmailMethod(accountId);
|
||||
|
||||
if (properties != null) getEmailMethod..addProperties(properties);
|
||||
if (properties != null) getEmailMethod.addProperties(properties);
|
||||
|
||||
getEmailMethod..addReferenceIds(processingInvocation.createResultReference(
|
||||
getEmailMethod.addReferenceIds(processingInvocation.createResultReference(
|
||||
queryEmailInvocation.methodCallId,
|
||||
ReferencePath.idsPath));
|
||||
|
||||
@@ -66,9 +66,9 @@ class ThreadAPI {
|
||||
getEmailInvocation.methodCallId, GetEmailResponse.deserialize);
|
||||
|
||||
if (sort != null && resultList != null) {
|
||||
sort.forEach((comparator) {
|
||||
resultList..sortEmails(comparator);
|
||||
});
|
||||
for (var comparator in sort) {
|
||||
resultList.sortEmails(comparator);
|
||||
}
|
||||
}
|
||||
|
||||
return EmailsResponse(emailList: resultList?.list, state: resultList?.state);
|
||||
@@ -96,7 +96,7 @@ class ThreadAPI {
|
||||
ReferencePath.updatedPath));
|
||||
|
||||
if (propertiesUpdated != null) {
|
||||
getMailboxUpdated..addProperties(propertiesUpdated);
|
||||
getMailboxUpdated.addProperties(propertiesUpdated);
|
||||
}
|
||||
|
||||
final getEmailCreated = GetEmailMethod(accountId)
|
||||
@@ -105,7 +105,7 @@ class ThreadAPI {
|
||||
ReferencePath.createdPath));
|
||||
|
||||
if (propertiesCreated != null) {
|
||||
getEmailCreated..addProperties(propertiesCreated);
|
||||
getEmailCreated.addProperties(propertiesCreated);
|
||||
}
|
||||
|
||||
final getEmailUpdatedInvocation = jmapRequestBuilder.invocation(getMailboxUpdated);
|
||||
|
||||
@@ -242,9 +242,9 @@ class ThreadRepositoryImpl extends ThreadRepository {
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<EmailsResponse> loadMoreEmails(GetEmailRequest getEmailRequest) async* {
|
||||
Stream<EmailsResponse> loadMoreEmails(GetEmailRequest emailRequest) async* {
|
||||
bench.start('loadMoreEmails in computed');
|
||||
final response = await compute(_getAllEmailsWithoutLastEmailId, getEmailRequest);
|
||||
final response = await compute(_getAllEmailsWithoutLastEmailId, emailRequest);
|
||||
bench.end('loadMoreEmails in computed');
|
||||
await _updateEmailCache(newCreated: response.emailList);
|
||||
yield response;
|
||||
@@ -335,7 +335,7 @@ class ThreadRepositoryImpl extends ThreadRepository {
|
||||
|
||||
final emailsResponse = await mapDataSource[DataSourceType.network]!.getAllEmail(
|
||||
accountId,
|
||||
sort: Set()
|
||||
sort: <Comparator>{}
|
||||
..add(EmailComparator(EmailComparatorProperty.receivedAt)
|
||||
..setIsAscending(false)),
|
||||
filter: EmailFilterCondition(inMailbox: trashMailboxId, before: lastEmail?.receivedAt),
|
||||
|
||||
Reference in New Issue
Block a user