mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
feat(mobile): beta sync stats page (#19950)
* show beta sync stats * show status next to jobs * use drift devtools reset database impl * dcm fixes * fix: hash count * styling --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
97daf42fd5
commit
2efca67217
20 changed files with 742 additions and 44 deletions
|
|
@ -12,6 +12,14 @@ class BackgroundSyncManager {
|
|||
final SyncCallback? onRemoteSyncComplete;
|
||||
final SyncErrorCallback? onRemoteSyncError;
|
||||
|
||||
final SyncCallback? onLocalSyncStart;
|
||||
final SyncCallback? onLocalSyncComplete;
|
||||
final SyncErrorCallback? onLocalSyncError;
|
||||
|
||||
final SyncCallback? onHashingStart;
|
||||
final SyncCallback? onHashingComplete;
|
||||
final SyncErrorCallback? onHashingError;
|
||||
|
||||
Cancelable<void>? _syncTask;
|
||||
Cancelable<void>? _syncWebsocketTask;
|
||||
Cancelable<void>? _deviceAlbumSyncTask;
|
||||
|
|
@ -21,6 +29,12 @@ class BackgroundSyncManager {
|
|||
this.onRemoteSyncStart,
|
||||
this.onRemoteSyncComplete,
|
||||
this.onRemoteSyncError,
|
||||
this.onLocalSyncStart,
|
||||
this.onLocalSyncComplete,
|
||||
this.onLocalSyncError,
|
||||
this.onHashingStart,
|
||||
this.onHashingComplete,
|
||||
this.onHashingError,
|
||||
});
|
||||
|
||||
Future<void> cancel() {
|
||||
|
|
@ -47,6 +61,8 @@ class BackgroundSyncManager {
|
|||
return _deviceAlbumSyncTask!.future;
|
||||
}
|
||||
|
||||
onLocalSyncStart?.call();
|
||||
|
||||
// We use a ternary operator to avoid [_deviceAlbumSyncTask] from being
|
||||
// captured by the closure passed to [runInIsolateGentle].
|
||||
_deviceAlbumSyncTask = full
|
||||
|
|
@ -61,6 +77,10 @@ class BackgroundSyncManager {
|
|||
|
||||
return _deviceAlbumSyncTask!.whenComplete(() {
|
||||
_deviceAlbumSyncTask = null;
|
||||
onLocalSyncComplete?.call();
|
||||
}).catchError((error) {
|
||||
onLocalSyncError?.call(error.toString());
|
||||
_deviceAlbumSyncTask = null;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -70,10 +90,17 @@ class BackgroundSyncManager {
|
|||
return _hashTask!.future;
|
||||
}
|
||||
|
||||
onHashingStart?.call();
|
||||
|
||||
_hashTask = runInIsolateGentle(
|
||||
computation: (ref) => ref.read(hashServiceProvider).hashAssets(),
|
||||
);
|
||||
|
||||
return _hashTask!.whenComplete(() {
|
||||
onHashingComplete?.call();
|
||||
_hashTask = null;
|
||||
}).catchError((error) {
|
||||
onHashingError?.call(error.toString());
|
||||
_hashTask = null;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue