TF-2764 Add CancelToken to download attachment for web

This commit is contained in:
dab246
2024-05-15 09:56:43 +07:00
committed by Dat H. Pham
parent 8d8728ec97
commit 89a489eb06
7 changed files with 28 additions and 9 deletions
@@ -336,6 +336,7 @@ class EmailAPI with HandleSetErrorMixin {
String baseDownloadUrl,
AccountRequest accountRequest,
StreamController<Either<Failure, Success>> onReceiveController,
{CancelToken? cancelToken}
) async {
final authentication = accountRequest.authenticationType == AuthenticationType.oidc
? accountRequest.bearerToken
@@ -352,6 +353,7 @@ class EmailAPI with HandleSetErrorMixin {
options: Options(
headers: headerParam,
responseType: ResponseType.bytes),
cancelToken: cancelToken,
onReceiveProgress: (downloaded, total) {
log('EmailAPI::downloadFileForWeb(): downloaded = $downloaded | total: $total');
double progress = 0;