Browse Source

Remove client side conversion of HEIC to JPG

Vishnu Mohandas 5 years ago
parent
commit
d14015ed30
3 changed files with 5 additions and 26 deletions
  1. 5 18
      lib/models/photo.dart
  2. 0 7
      pubspec.lock
  3. 0 1
      pubspec.yaml

+ 5 - 18
lib/models/photo.dart

@@ -60,34 +60,21 @@ class Photo {
   }
   }
 
 
   Future<Uint8List> getBytes({int quality = 100}) {
   Future<Uint8List> getBytes({int quality = 100}) {
-    final asset = getAsset();
-    Future<Uint8List> dataFuture;
-    final start = DateTime.now();
     if (localId == null) {
     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 request.close().then((response) {
           return consolidateHttpClientResponseBytes(response);
           return consolidateHttpClientResponseBytes(response);
         });
         });
       });
       });
     } else {
     } 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() {
   String getRemoteUrl() {
-    return Configuration.instance.getHttpEndpoint() + "/" + remotePath;
+    return Configuration.instance.getHttpEndpoint() +
+        "/files/file/" +
+        uploadedFileId.toString();
   }
   }
 
 
   String getThumbnailUrl() {
   String getThumbnailUrl() {

+ 0 - 7
pubspec.lock

@@ -132,13 +132,6 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "3.0.1"
     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:
   flutter_launcher_icons:
     dependency: "direct dev"
     dependency: "direct dev"
     description:
     description:

+ 0 - 1
pubspec.yaml

@@ -36,7 +36,6 @@ dependencies:
   esys_flutter_share: ^1.0.2
   esys_flutter_share: ^1.0.2
   draggable_scrollbar: ^0.0.4
   draggable_scrollbar: ^0.0.4
   photo_view: ^0.9.2
   photo_view: ^0.9.2
-  flutter_image_compress: ^0.6.5+1
   visibility_detector: ^0.1.4
   visibility_detector: ^0.1.4
   connectivity: ^0.4.8+2
   connectivity: ^0.4.8+2
   event_bus: ^1.1.1
   event_bus: ^1.1.1