Browse Source

Download progress

Alex 1 year ago
parent
commit
1174b6d445

+ 4 - 3
mobile/lib/modules/backup/models/backup_state.model.dart

@@ -1,5 +1,4 @@
 // ignore_for_file: public_member_api_docs, sort_constructors_first
-import 'dart:convert';
 
 import 'package:cancellation_token_http/http.dart';
 import 'package:collection/collection.dart';
@@ -133,8 +132,10 @@ class BackUpState {
         collectionEquals(other.selectedBackupAlbums, selectedBackupAlbums) &&
         collectionEquals(other.excludedBackupAlbums, excludedBackupAlbums) &&
         collectionEquals(other.allUniqueAssets, allUniqueAssets) &&
-        collectionEquals(other.selectedAlbumsBackupAssetsIds,
-            selectedAlbumsBackupAssetsIds) &&
+        collectionEquals(
+          other.selectedAlbumsBackupAssetsIds,
+          selectedAlbumsBackupAssetsIds,
+        ) &&
         other.currentUploadAsset == currentUploadAsset;
   }
 

+ 67 - 19
mobile/lib/modules/backup/ui/current_backup_asset_info_box.dart

@@ -23,6 +23,8 @@ class CurrentUploadingAssetInfoBox extends HookConsumerWidget {
     var uploadProgress = !isManualUpload
         ? ref.watch(backupProvider).progressInPercentage
         : ref.watch(manualUploadProvider).progressInPercentage;
+    var iCloudDownloadProgress =
+        ref.watch(backupProvider).iCloudDownloadProgress;
     final isShowThumbnail = useState(false);
 
     String getAssetCreationDate() {
@@ -143,6 +145,69 @@ class CurrentUploadingAssetInfoBox extends HookConsumerWidget {
       }
     }
 
+    buildiCloudDownloadProgerssBar() {
+      if (asset.iCloudAsset != null && asset.iCloudAsset!) {
+        return Padding(
+          padding: const EdgeInsets.only(top: 8.0),
+          child: Row(
+            children: [
+              SizedBox(
+                width: 110,
+                child: Text(
+                  "iCloud Download",
+                  style: context.textTheme.labelSmall,
+                ),
+              ),
+              Expanded(
+                child: LinearProgressIndicator(
+                  minHeight: 10.0,
+                  value: uploadProgress / 100.0,
+                  backgroundColor: Colors.grey,
+                  color: context.primaryColor,
+                ),
+              ),
+              Text(
+                " ${iCloudDownloadProgress.toStringAsFixed(0)}%",
+                style: const TextStyle(fontSize: 12),
+              ),
+            ],
+          ),
+        );
+      }
+
+      return const SizedBox();
+    }
+
+    buildUploadProgressBar() {
+      return Padding(
+        padding: const EdgeInsets.only(top: 8.0),
+        child: Row(
+          children: [
+            if (asset.iCloudAsset != null && asset.iCloudAsset!)
+              SizedBox(
+                width: 110,
+                child: Text(
+                  "Immich Upload",
+                  style: context.textTheme.labelSmall,
+                ),
+              ),
+            Expanded(
+              child: LinearProgressIndicator(
+                minHeight: 10.0,
+                value: uploadProgress / 100.0,
+                backgroundColor: Colors.grey,
+                color: context.primaryColor,
+              ),
+            ),
+            Text(
+              " ${uploadProgress.toStringAsFixed(0)}%",
+              style: const TextStyle(fontSize: 12),
+            ),
+          ],
+        ),
+      );
+    }
+
     return FutureBuilder<Uint8List?>(
       future: buildAssetThumbnail(),
       builder: (context, thumbnail) => ListTile(
@@ -197,25 +262,8 @@ class CurrentUploadingAssetInfoBox extends HookConsumerWidget {
         ),
         subtitle: Column(
           children: [
-            Padding(
-              padding: const EdgeInsets.only(top: 8.0),
-              child: Row(
-                children: [
-                  Expanded(
-                    child: LinearProgressIndicator(
-                      minHeight: 10.0,
-                      value: uploadProgress / 100.0,
-                      backgroundColor: Colors.grey,
-                      color: context.primaryColor,
-                    ),
-                  ),
-                  Text(
-                    " ${uploadProgress.toStringAsFixed(0)}%",
-                    style: const TextStyle(fontSize: 12),
-                  ),
-                ],
-              ),
-            ),
+            buildiCloudDownloadProgerssBar(),
+            buildUploadProgressBar(),
             Padding(
               padding: const EdgeInsets.only(top: 8.0),
               child: buildAssetInfoTable(),