TF-644 Add accessToken in download interactor attachments for web

This commit is contained in:
dab246
2022-06-13 18:01:06 +07:00
committed by Dat H. Pham
parent 4b91ce2d7c
commit 4a2addd77a
5 changed files with 90 additions and 37 deletions
@@ -218,8 +218,6 @@ class EmailAPI {
? accountRequest.bearerToken
: accountRequest.basicAuth;
log('EmailAPI::exportAttachment(): authentication: $authentication');
return _downloadManager.downloadFile(
attachment.getDownloadUrl(baseDownloadUrl, accountId),
getTemporaryDirectory(),
@@ -234,10 +232,14 @@ class EmailAPI {
String baseDownloadUrl,
AccountRequest accountRequest,
) async {
final authentication = accountRequest.authenticationType == AuthenticationType.oidc
? accountRequest.bearerToken
: accountRequest.basicAuth;
return _downloadManager.downloadFileForWeb(
attachment.getDownloadUrl(baseDownloadUrl, accountId),
attachment.name ?? '',
accountRequest.basicAuth,
authentication,
);
}