diff --git a/lib/models/photo.dart b/lib/models/photo.dart index 5e82108ce..cd64792da 100644 --- a/lib/models/photo.dart +++ b/lib/models/photo.dart @@ -60,34 +60,21 @@ class Photo { } Future getBytes({int quality = 100}) { - final asset = getAsset(); - Future dataFuture; - final start = DateTime.now(); if (localId == null) { - dataFuture = - HttpClient().getUrl(Uri.parse(getRemoteUrl())).then((request) { + return HttpClient().getUrl(Uri.parse(getRemoteUrl())).then((request) { return request.close().then((response) { return consolidateHttpClientResponseBytes(response); }); }); } else { - dataFuture = asset.originBytes; - } - if (extension(title) == ".HEIC" || quality != 100) { - return dataFuture.then((bytes) => - FlutterImageCompress.compressWithList(bytes, quality: quality) - .then((result) { - log("Time taken: " + - DateTime.now().difference(start).inMilliseconds.toString()); - return Uint8List.fromList(result); - })); - } else { - return dataFuture; + return getAsset().originBytes; } } String getRemoteUrl() { - return Configuration.instance.getHttpEndpoint() + "/" + remotePath; + return Configuration.instance.getHttpEndpoint() + + "/files/file/" + + uploadedFileId.toString(); } String getThumbnailUrl() { diff --git a/pubspec.lock b/pubspec.lock index bc406eefa..5615e7fcf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -132,13 +132,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" - flutter_image_compress: - dependency: "direct main" - description: - name: flutter_image_compress - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.7" flutter_launcher_icons: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 21b89da8a..c801326b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,6 @@ dependencies: esys_flutter_share: ^1.0.2 draggable_scrollbar: ^0.0.4 photo_view: ^0.9.2 - flutter_image_compress: ^0.6.5+1 visibility_detector: ^0.1.4 connectivity: ^0.4.8+2 event_bus: ^1.1.1