mirror of
https://github.com/immich-app/immich.git
synced 2026-01-12 13:15:14 -08:00
handle LivePhotos progress
This commit is contained in:
@@ -430,13 +430,17 @@ class DriftBackupNotifier extends StateNotifier<DriftBackupState> {
|
||||
}
|
||||
|
||||
void _handleForegroundBackupProgress(String localAssetId, String filename, int bytes, int totalBytes) {
|
||||
if (state.cancelToken == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final progress = totalBytes > 0 ? bytes / totalBytes : 0.0;
|
||||
final currentItem = state.uploadItems[localAssetId];
|
||||
if (currentItem != null) {
|
||||
state = state.copyWith(
|
||||
uploadItems: {
|
||||
...state.uploadItems,
|
||||
localAssetId: currentItem.copyWith(progress: progress, fileSize: totalBytes),
|
||||
localAssetId: currentItem.copyWith(filename: filename, progress: progress, fileSize: totalBytes),
|
||||
},
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -194,7 +194,7 @@ class UploadService {
|
||||
asset,
|
||||
httpClient,
|
||||
cancelToken,
|
||||
(bytes, totalBytes) => onProgress(asset.localId!, asset.name, bytes, totalBytes),
|
||||
onProgress,
|
||||
onSuccess,
|
||||
onError,
|
||||
onICloudProgress: onICloudProgress,
|
||||
@@ -221,7 +221,7 @@ class UploadService {
|
||||
LocalAsset asset,
|
||||
Client httpClient,
|
||||
CancellationToken cancelToken,
|
||||
void Function(int bytes, int totalBytes) onProgress,
|
||||
void Function(String id, String filename, int bytes, int totalBytes) onProgress,
|
||||
void Function(String localAssetId, String remoteAssetId) onSuccess,
|
||||
void Function(String errorMessage) onError, {
|
||||
void Function(String localAssetId, double progress)? onICloudProgress,
|
||||
@@ -307,7 +307,7 @@ class UploadService {
|
||||
fields: fields,
|
||||
httpClient: httpClient,
|
||||
cancelToken: cancelToken,
|
||||
onProgress: onProgress,
|
||||
onProgress: (bytes, totalBytes) => onProgress(asset.localId!, livePhotoTitle, bytes, totalBytes),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ class UploadService {
|
||||
fields: fields,
|
||||
httpClient: httpClient,
|
||||
cancelToken: cancelToken,
|
||||
onProgress: onProgress,
|
||||
onProgress: (bytes, totalBytes) => onProgress(asset.localId!, originalFileName, bytes, totalBytes),
|
||||
);
|
||||
|
||||
if (result.isSuccess && result.remoteAssetId != null) {
|
||||
|
||||
Reference in New Issue
Block a user