mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update create download task dialog
This commit is contained in:
@@ -1114,6 +1114,39 @@ class __EHApi implements _EHApi {
|
||||
return value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ApiResult<DownloadConfig>> getDefaultDownloadConfig(
|
||||
{CancelToken? cancel}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(
|
||||
_setStreamType<ApiResult<DownloadConfig>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/task/download_cfg',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
cancelToken: cancel,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
final value = ApiResult<DownloadConfig>.fromJson(
|
||||
_result.data!,
|
||||
(json) => DownloadConfig.fromJson(json as Map<String, dynamic>),
|
||||
);
|
||||
return value;
|
||||
}
|
||||
|
||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||
if (T != dynamic &&
|
||||
!(requestOptions.responseType == ResponseType.bytes ||
|
||||
|
||||
Reference in New Issue
Block a user