mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
improve ui
This commit is contained in:
@@ -10,8 +10,9 @@ import 'app_dio.dart';
|
||||
|
||||
class ImageDownloader {
|
||||
static Stream<ImageDownloadProgress> loadThumbnail(
|
||||
String url, String? sourceKey) async* {
|
||||
final cacheKey = "$url@$sourceKey";
|
||||
String url, String? sourceKey,
|
||||
[String? cid]) async* {
|
||||
final cacheKey = "$url@$sourceKey${cid != null ? '@$cid' : ''}";
|
||||
final cache = await CacheManager().findCache(cacheKey);
|
||||
|
||||
if (cache != null) {
|
||||
@@ -34,6 +35,16 @@ class ImageDownloader {
|
||||
configs['headers']['user-agent'] = webUA;
|
||||
}
|
||||
|
||||
if (((configs['url'] as String?) ?? url).startsWith('cover.') &&
|
||||
sourceKey != null) {
|
||||
var comicSource = ComicSource.find(sourceKey);
|
||||
if(comicSource != null) {
|
||||
var comicInfo = await comicSource.loadComicInfo!(cid!);
|
||||
yield* loadThumbnail(comicInfo.data.cover, sourceKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var dio = AppDio(BaseOptions(
|
||||
headers: Map<String, dynamic>.from(configs['headers']),
|
||||
method: configs['method'] ?? 'GET',
|
||||
@@ -171,9 +182,8 @@ class ImageDownloader {
|
||||
}
|
||||
configs = newConfig;
|
||||
retryLimit--;
|
||||
}
|
||||
finally {
|
||||
if(onLoadFailed != null) {
|
||||
} finally {
|
||||
if (onLoadFailed != null) {
|
||||
(configs['onLoadFailed'] as JSInvokable).free();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user