Skip to content

Commit

Permalink
fixup! TF-3235 Create seach emails in thread API, datasource and repo…
Browse files Browse the repository at this point in the history
…sitory
  • Loading branch information
tddang-linagora committed Oct 31, 2024
1 parent 3b7c2a8 commit e75cd0b
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions lib/features/thread/data/network/thread_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,31 @@ class ThreadAPI {
}
}

final searchSnippets = result.parse<SearchSnippetGetResponse>(
getSearchSnippetInvocation.methodCallId,
SearchSnippetGetResponse.fromJson);

return SearchEmailsResponse(
emailList: emailResultList?.list,
state: emailResultList?.state,
searchSnippets: searchSnippets?.list);
try {
final searchSnippets = result.parse<SearchSnippetGetResponse>(
getSearchSnippetInvocation.methodCallId,
SearchSnippetGetResponse.fromJson);

return SearchEmailsResponse(
emailList: emailResultList?.list,
state: emailResultList?.state,
searchSnippets: searchSnippets?.list);
} catch (_) {
final searchResultWithoutSnippets = await getAllEmail(
session,
accountId,
limit: limit,
position: position,
sort: sort,
filter: filter,
properties: properties
);

return SearchEmailsResponse(
searchSnippets: null,
emailList: searchResultWithoutSnippets.emailList,
state: searchResultWithoutSnippets.state);
}
}

Future<EmailChangeResponse> getChanges(
Expand Down

0 comments on commit e75cd0b

Please sign in to comment.