mirror of
https://github.com/immich-app/immich.git
synced 2026-01-21 11:26:08 -05:00
* feat: bring back manual backup * expose iCloud retrieval progress * wip * unify http upload method, check for connectivity on iOS * handle LivePhotos progress * feat: speed calculation * wip * better upload detail page * handle error * handle error * pr feedback * feat: share intent upload * feat: manual upload * feat: manual upload progress * chore: styling * refactor * refactor * remove unused logs * fix: background android backup * feat: add error section * remove complete section * remove empty state and prevent slot jumps * more refactor * fix: background test * chore: add metadata to foreground upload * fix: email and name get reset in auth provider * pr feedback * remove version check for metadata field in upload payload * chore: fix unit test --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
34 lines
960 B
Dart
34 lines
960 B
Dart
import 'package:cancellation_token_http/http.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
/// Tracks per-asset upload progress.
|
|
/// Key: local asset ID, Value: upload progress 0.0 to 1.0, or -1.0 for error
|
|
class AssetUploadProgressNotifier extends Notifier<Map<String, double>> {
|
|
static const double errorValue = -1.0;
|
|
|
|
@override
|
|
Map<String, double> build() => {};
|
|
|
|
void setProgress(String localAssetId, double progress) {
|
|
state = {...state, localAssetId: progress};
|
|
}
|
|
|
|
void setError(String localAssetId) {
|
|
state = {...state, localAssetId: errorValue};
|
|
}
|
|
|
|
void remove(String localAssetId) {
|
|
state = Map.from(state)..remove(localAssetId);
|
|
}
|
|
|
|
void clear() {
|
|
state = {};
|
|
}
|
|
}
|
|
|
|
final assetUploadProgressProvider = NotifierProvider<AssetUploadProgressNotifier, Map<String, double>>(
|
|
AssetUploadProgressNotifier.new,
|
|
);
|
|
|
|
final manualUploadCancelTokenProvider = StateProvider<CancellationToken?>((ref) => null);
|