@@ -7,8 +7,6 @@ import 'package:cached_network_image/cached_network_image.dart';
7
7
import 'package:flutter/foundation.dart' ;
8
8
import 'package:flutter/painting.dart' ;
9
9
import 'package:immich_mobile/entities/asset.entity.dart' ;
10
- import 'package:immich_mobile/entities/store.entity.dart' ;
11
- import 'package:immich_mobile/services/app_settings.service.dart' ;
12
10
import 'package:photo_manager/photo_manager.dart' show ThumbnailSize;
13
11
14
12
/// The local image provider for an asset
@@ -19,12 +17,6 @@ class ImmichLocalImageProvider extends ImageProvider<ImmichLocalImageProvider> {
19
17
required this .asset,
20
18
}) : assert (asset.local != null , 'Only usable when asset.local is set' );
21
19
22
- /// Whether to show the original file or load a compressed version
23
- bool get _useOriginal => Store .get (
24
- AppSettingsEnum .loadOriginal.storeKey,
25
- AppSettingsEnum .loadOriginal.defaultValue,
26
- );
27
-
28
20
/// Converts an [ImageProvider] 's settings plus an [ImageConfiguration] to a key
29
21
/// that describes the precise image to load.
30
22
@override
@@ -68,34 +60,16 @@ class ImmichLocalImageProvider extends ImageProvider<ImmichLocalImageProvider> {
68
60
}
69
61
70
62
if (asset.isImage) {
71
- /// Using 2K thumbnail for local iOS image to avoid double swiping issue
72
- if (Platform .isIOS) {
73
- final largeImageBytes = _useOriginal
74
- ? await asset.local? .originBytes
75
- : await asset.local
76
- ? .thumbnailDataWithSize (const ThumbnailSize (3840 , 2160 ));
77
-
78
- if (largeImageBytes == null ) {
79
- throw StateError (
80
- "Loading thumb for local photo ${asset .fileName } failed" ,
81
- );
82
- }
83
- final buffer = await ui.ImmutableBuffer .fromUint8List (largeImageBytes);
63
+ final File ? file = await asset.local? .originFile;
64
+ if (file == null ) {
65
+ throw StateError ("Opening file for asset ${asset .fileName } failed" );
66
+ }
67
+ try {
68
+ final buffer = await ui.ImmutableBuffer .fromFilePath (file.path);
84
69
final codec = await decode (buffer);
85
70
yield codec;
86
- } else {
87
- // Use the original file for Android
88
- final File ? file = await asset.local? .originFile;
89
- if (file == null ) {
90
- throw StateError ("Opening file for asset ${asset .fileName } failed" );
91
- }
92
- try {
93
- final buffer = await ui.ImmutableBuffer .fromFilePath (file.path);
94
- final codec = await decode (buffer);
95
- yield codec;
96
- } catch (error) {
97
- throw StateError ("Loading asset ${asset .fileName } failed" );
98
- }
71
+ } catch (error) {
72
+ throw StateError ("Loading asset ${asset .fileName } failed" );
99
73
}
100
74
}
101
75
0 commit comments