Skip to content

Commit

Permalink
Changes image cache manager to no longer be image cache managers
Browse files Browse the repository at this point in the history
  • Loading branch information
martyfuhry committed Apr 22, 2024
1 parent d5575cc commit 955d78d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import 'package:immich_mobile/shared/models/store.dart';
class ImageLoader {
static Future<ui.Codec> loadImageFromCache(
String uri, {
required ImageCacheManager cache,
required CacheManager cache,
required ImageDecoderCallback decode,
StreamController<ImageChunkEvent>? chunkEvents,
}) async {
final headers = {
'x-immich-user-token': Store.get(StoreKey.accessToken),
};

final stream = cache.getImageFile(
final stream = cache.getFileStream(
uri,
withProgress: chunkEvents != null,
headers: headers,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

/// The cache manager for full size images [ImmichRemoteImageProvider]
class RemoteImageCacheManager extends CacheManager with ImageCacheManager {
class RemoteImageCacheManager extends CacheManager {
static const key = 'remoteImageCacheKey';
static final RemoteImageCacheManager _instance = RemoteImageCacheManager._();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

/// The cache manager for thumbnail images [ImmichRemoteThumbnailProvider]
class ThumbnailImageCacheManager extends CacheManager with ImageCacheManager {
class ThumbnailImageCacheManager extends CacheManager {
static const key = 'thumbnailImageCacheKey';
static final ThumbnailImageCacheManager _instance =
ThumbnailImageCacheManager._();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ImmichRemoteImageProvider
final String assetId;

/// The image cache manager
final ImageCacheManager? cacheManager;
final CacheManager? cacheManager;

ImmichRemoteImageProvider({
required this.assetId,
Expand Down Expand Up @@ -66,7 +66,7 @@ class ImmichRemoteImageProvider
// Streams in each stage of the image as we ask for it
Stream<ui.Codec> _codec(
ImmichRemoteImageProvider key,
ImageCacheManager cache,
CacheManager cache,
ImageDecoderCallback decode,
StreamController<ImageChunkEvent> chunkEvents,
) async* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ImmichRemoteThumbnailProvider
final int? width;

/// The image cache manager
final ImageCacheManager? cacheManager;
final CacheManager? cacheManager;

ImmichRemoteThumbnailProvider({
required this.assetId,
Expand Down Expand Up @@ -55,7 +55,7 @@ class ImmichRemoteThumbnailProvider
// Streams in each stage of the image as we ask for it
Stream<ui.Codec> _codec(
ImmichRemoteThumbnailProvider key,
ImageCacheManager cache,
CacheManager cache,
ImageDecoderCallback decode,
) async* {
// Load a preview to the chunk events
Expand Down

0 comments on commit 955d78d

Please sign in to comment.