more refactors and logs page handling

This commit is contained in:
shenlong-tanwen
2024-10-23 02:30:46 +05:30
parent 8f47645cdb
commit a0afea04d8
90 changed files with 2386 additions and 584 deletions
@@ -14,8 +14,8 @@ class ImRemoteThumbnailCacheManager extends CacheManager {
: super(
Config(
kCacheThumbnailsKey,
maxNrOfCacheObjects: kCacheMaxNrOfThumbnails,
stalePeriod: const Duration(days: kCacheStalePeriod),
maxNrOfCacheObjects: kCacheMaxNrOfThumbnails,
),
);
}
@@ -33,8 +33,8 @@ class ImRemoteImageCacheManager extends CacheManager {
: super(
Config(
kCacheFullImagesKey,
maxNrOfCacheObjects: kCacheMaxNrOfFullImages,
stalePeriod: const Duration(days: kCacheStalePeriod),
maxNrOfCacheObjects: kCacheMaxNrOfFullImages,
),
);
}
@@ -19,7 +19,7 @@ class ImageLoadingException implements Exception {
///
/// Credit to [flutter_cached_network_image](https://github.com/Baseflow/flutter_cached_network_image/blob/develop/cached_network_image/lib/src/image_provider/_image_loader.dart)
/// for this wonderful implementation of their image loader
class ImageLoader {
abstract final class ImageLoader {
static Future<ui.Codec> loadImageFromCache(
String uri, {
required CacheManager cache,
@@ -28,8 +28,8 @@ class ImageLoader {
}) async {
final stream = cache.getFileStream(
uri,
withProgress: chunkEvents != null,
headers: di<ImApiClient>().headers,
withProgress: chunkEvents != null,
);
await for (final result in stream) {
@@ -44,8 +44,7 @@ class ImageLoader {
} else if (result is FileInfo) {
// We have the file
final buffer = await ui.ImmutableBuffer.fromFilePath(result.file.path);
final decoded = await decode(buffer);
return decoded;
return await decode(buffer);
}
}