mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore: bump dart sdk to 3.8 (#20355)
* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
9b3718120b
commit
e52b9d15b5
643 changed files with 32561 additions and 35292 deletions
|
|
@ -55,8 +55,10 @@ class BackgroundService {
|
|||
String _lastPrintedDetailContent = "";
|
||||
String? _lastPrintedDetailTitle;
|
||||
late final ThrottleProgressUpdate _throttledNotifiy = ThrottleProgressUpdate(_updateProgress, notifyInterval);
|
||||
late final ThrottleProgressUpdate _throttledDetailNotify =
|
||||
ThrottleProgressUpdate(_updateDetailProgress, notifyInterval);
|
||||
late final ThrottleProgressUpdate _throttledDetailNotify = ThrottleProgressUpdate(
|
||||
_updateDetailProgress,
|
||||
notifyInterval,
|
||||
);
|
||||
|
||||
bool get isBackgroundInitialized {
|
||||
return _isBackgroundInitialized;
|
||||
|
|
@ -87,15 +89,12 @@ class BackgroundService {
|
|||
int triggerMaxDelay = 50000,
|
||||
}) async {
|
||||
try {
|
||||
final bool ok = await _foregroundChannel.invokeMethod(
|
||||
'configure',
|
||||
[
|
||||
requireUnmetered,
|
||||
requireCharging,
|
||||
triggerUpdateDelay,
|
||||
triggerMaxDelay,
|
||||
],
|
||||
);
|
||||
final bool ok = await _foregroundChannel.invokeMethod('configure', [
|
||||
requireUnmetered,
|
||||
requireCharging,
|
||||
triggerUpdateDelay,
|
||||
triggerMaxDelay,
|
||||
]);
|
||||
return ok;
|
||||
} catch (error) {
|
||||
return false;
|
||||
|
|
@ -140,10 +139,7 @@ class BackgroundService {
|
|||
}
|
||||
|
||||
Future<List<Uint8List?>?> digestFiles(List<String> paths) {
|
||||
return _foregroundChannel.invokeListMethod<Uint8List?>(
|
||||
"digestFiles",
|
||||
paths,
|
||||
);
|
||||
return _foregroundChannel.invokeListMethod<Uint8List?>("digestFiles", paths);
|
||||
}
|
||||
|
||||
/// Updates the notification shown by the background service
|
||||
|
|
@ -158,10 +154,15 @@ class BackgroundService {
|
|||
}) async {
|
||||
try {
|
||||
if (_isBackgroundInitialized) {
|
||||
return _backgroundChannel.invokeMethod<bool>(
|
||||
'updateNotification',
|
||||
[title, content, progress, max, indeterminate, isDetail, onlyIfFG],
|
||||
);
|
||||
return _backgroundChannel.invokeMethod<bool>('updateNotification', [
|
||||
title,
|
||||
content,
|
||||
progress,
|
||||
max,
|
||||
indeterminate,
|
||||
isDetail,
|
||||
onlyIfFG,
|
||||
]);
|
||||
}
|
||||
} catch (error) {
|
||||
debugPrint("[_updateNotification] failed to communicate with plugin");
|
||||
|
|
@ -170,11 +171,7 @@ class BackgroundService {
|
|||
}
|
||||
|
||||
/// Shows a new priority notification
|
||||
Future<bool> _showErrorNotification({
|
||||
required String title,
|
||||
String? content,
|
||||
String? individualTag,
|
||||
}) async {
|
||||
Future<bool> _showErrorNotification({required String title, String? content, String? individualTag}) async {
|
||||
try {
|
||||
if (_isBackgroundInitialized && _errorGracePeriodExceeded) {
|
||||
return await _backgroundChannel.invokeMethod('showError', [title, content, individualTag]);
|
||||
|
|
@ -191,9 +188,7 @@ class BackgroundService {
|
|||
return await _backgroundChannel.invokeMethod('clearErrorNotifications');
|
||||
}
|
||||
} catch (error) {
|
||||
debugPrint(
|
||||
"[_clearErrorNotifications] failed to communicate with plugin",
|
||||
);
|
||||
debugPrint("[_clearErrorNotifications] failed to communicate with plugin");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -302,10 +297,7 @@ class BackgroundService {
|
|||
// indefinitely and can run later
|
||||
// Android is fine to wait here until the lock releases
|
||||
final waitForLock = Platform.isIOS
|
||||
? acquireLock().timeout(
|
||||
const Duration(seconds: 5),
|
||||
onTimeout: () => false,
|
||||
)
|
||||
? acquireLock().timeout(const Duration(seconds: 5), onTimeout: () => false)
|
||||
: acquireLock();
|
||||
|
||||
final bool hasAccess = await waitForLock;
|
||||
|
|
@ -341,20 +333,13 @@ class BackgroundService {
|
|||
final db = await Bootstrap.initIsar();
|
||||
await Bootstrap.initDomain(db);
|
||||
|
||||
final ref = ProviderContainer(
|
||||
overrides: [
|
||||
dbProvider.overrideWithValue(db),
|
||||
isarProvider.overrideWithValue(db),
|
||||
],
|
||||
);
|
||||
final ref = ProviderContainer(overrides: [dbProvider.overrideWithValue(db), isarProvider.overrideWithValue(db)]);
|
||||
|
||||
HttpSSLOptions.apply();
|
||||
ref.read(apiServiceProvider).setAccessToken(Store.get(StoreKey.accessToken));
|
||||
await ref.read(authServiceProvider).setOpenApiServiceEndpoint();
|
||||
if (kDebugMode) {
|
||||
debugPrint(
|
||||
"[BG UPLOAD] Using endpoint: ${ref.read(apiServiceProvider).apiClient.basePath}",
|
||||
);
|
||||
debugPrint("[BG UPLOAD] Using endpoint: ${ref.read(apiServiceProvider).apiClient.basePath}");
|
||||
}
|
||||
|
||||
final selectedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.select);
|
||||
|
|
@ -418,10 +403,7 @@ class BackgroundService {
|
|||
return false;
|
||||
}
|
||||
|
||||
Set<BackupCandidate> toUpload = await backupService.buildUploadCandidates(
|
||||
selectedAlbums,
|
||||
excludedAlbums,
|
||||
);
|
||||
Set<BackupCandidate> toUpload = await backupService.buildUploadCandidates(selectedAlbums, excludedAlbums);
|
||||
|
||||
try {
|
||||
toUpload = await backupService.removeAlreadyUploadedAssets(toUpload);
|
||||
|
|
@ -444,12 +426,7 @@ class BackgroundService {
|
|||
_uploadedAssetsCount = 0;
|
||||
_updateNotification(
|
||||
title: "backup_background_service_in_progress_notification".tr(),
|
||||
content: notifyTotalProgress
|
||||
? formatAssetBackupProgress(
|
||||
_uploadedAssetsCount,
|
||||
_assetsToUploadCount,
|
||||
)
|
||||
: null,
|
||||
content: notifyTotalProgress ? formatAssetBackupProgress(_uploadedAssetsCount, _assetsToUploadCount) : null,
|
||||
progress: 0,
|
||||
max: notifyTotalProgress ? _assetsToUploadCount : 0,
|
||||
indeterminate: !notifyTotalProgress,
|
||||
|
|
@ -463,9 +440,7 @@ class BackgroundService {
|
|||
toUpload,
|
||||
_cancellationToken!,
|
||||
pmProgressHandler: pmProgressHandler,
|
||||
onSuccess: (result) => _onAssetUploaded(
|
||||
shouldNotify: notifyTotalProgress,
|
||||
),
|
||||
onSuccess: (result) => _onAssetUploaded(shouldNotify: notifyTotalProgress),
|
||||
onProgress: (bytes, totalBytes) => _onProgress(bytes, totalBytes, shouldNotify: notifySingleProgress),
|
||||
onCurrentAsset: (asset) => _onSetCurrentBackupAsset(asset, shouldNotify: notifySingleProgress),
|
||||
onError: _onBackupError,
|
||||
|
|
@ -482,9 +457,7 @@ class BackgroundService {
|
|||
return ok;
|
||||
}
|
||||
|
||||
void _onAssetUploaded({
|
||||
bool shouldNotify = false,
|
||||
}) async {
|
||||
void _onAssetUploaded({bool shouldNotify = false}) async {
|
||||
if (!shouldNotify) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -522,31 +495,27 @@ class BackgroundService {
|
|||
progress: _uploadedAssetsCount,
|
||||
max: _assetsToUploadCount,
|
||||
title: title,
|
||||
content: formatAssetBackupProgress(
|
||||
_uploadedAssetsCount,
|
||||
_assetsToUploadCount,
|
||||
),
|
||||
content: formatAssetBackupProgress(_uploadedAssetsCount, _assetsToUploadCount),
|
||||
);
|
||||
}
|
||||
|
||||
void _onBackupError(ErrorUploadAsset errorAssetInfo) {
|
||||
_showErrorNotification(
|
||||
title:
|
||||
"backup_background_service_upload_failure_notification".tr(namedArgs: {'filename': errorAssetInfo.fileName}),
|
||||
title: "backup_background_service_upload_failure_notification".tr(
|
||||
namedArgs: {'filename': errorAssetInfo.fileName},
|
||||
),
|
||||
individualTag: errorAssetInfo.id,
|
||||
);
|
||||
}
|
||||
|
||||
void _onSetCurrentBackupAsset(
|
||||
CurrentUploadAsset currentUploadAsset, {
|
||||
bool shouldNotify = false,
|
||||
}) {
|
||||
void _onSetCurrentBackupAsset(CurrentUploadAsset currentUploadAsset, {bool shouldNotify = false}) {
|
||||
if (!shouldNotify) {
|
||||
return;
|
||||
}
|
||||
|
||||
_throttledDetailNotify.title = "backup_background_service_current_upload_notification"
|
||||
.tr(namedArgs: {'filename': currentUploadAsset.fileName});
|
||||
_throttledDetailNotify.title = "backup_background_service_current_upload_notification".tr(
|
||||
namedArgs: {'filename': currentUploadAsset.fileName},
|
||||
);
|
||||
_throttledDetailNotify.progress = 0;
|
||||
_throttledDetailNotify.total = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue