Remove client side conversion of HEIC to JPG

This commit is contained in:
Vishnu Mohandas 2020-05-31 01:40:43 +05:30
parent 9584f2ede7
commit d14015ed30
3 changed files with 5 additions and 26 deletions

View file

@ -60,34 +60,21 @@ class Photo {
}
Future<Uint8List> getBytes({int quality = 100}) {
final asset = getAsset();
Future<Uint8List> 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() {

View file

@ -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:

View file

@ -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