Browse Source

feat(mobile) reused HTTP client for uploading assets (#1487)

* feat(mobile) reused HTTP client for uploading assets

* remove unused comments
Alex 2 years ago
parent
commit
830fec0c29
1 changed files with 3 additions and 2 deletions
  1. 3 2
      mobile/lib/modules/backup/services/backup.service.dart

+ 3 - 2
mobile/lib/modules/backup/services/backup.service.dart

@@ -29,6 +29,7 @@ final backupServiceProvider = Provider(
 );
 );
 
 
 class BackupService {
 class BackupService {
+  final httpClient = http.Client();
   final ApiService _apiService;
   final ApiService _apiService;
 
 
   BackupService(this._apiService);
   BackupService(this._apiService);
@@ -282,7 +283,8 @@ class BackupService {
             ),
             ),
           );
           );
 
 
-          var response = await req.send(cancellationToken: cancelToken);
+          var response =
+              await httpClient.send(req, cancellationToken: cancelToken);
 
 
           if (response.statusCode == 200) {
           if (response.statusCode == 200) {
             // asset is a duplicate (already exists on the server)
             // asset is a duplicate (already exists on the server)
@@ -334,7 +336,6 @@ class BackupService {
 
 
   Future<MultipartFile?> _getLivePhotoFile(AssetEntity entity) async {
   Future<MultipartFile?> _getLivePhotoFile(AssetEntity entity) async {
     var motionFilePath = await entity.getMediaUrl();
     var motionFilePath = await entity.getMediaUrl();
-    // var motionFilePath = '/var/mobile/Media/DCIM/103APPLE/IMG_3371.MOV'
 
 
     if (motionFilePath != null) {
     if (motionFilePath != null) {
       var validPath = motionFilePath.replaceAll('file://', '');
       var validPath = motionFilePath.replaceAll('file://', '');