mirror of
https://github.com/immich-app/immich.git
synced 2025-11-20 21:02:34 +09:00
chore: refactor download group (#20099)
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker / pre-job (push) Waiting to run
Docker / Re-Tag ML () (push) Blocked by required conditions
Docker / Re-Tag ML (-armnn) (push) Blocked by required conditions
Docker / Re-Tag ML (-cuda) (push) Blocked by required conditions
Docker / Re-Tag ML (-openvino) (push) Blocked by required conditions
Docker / Re-Tag ML (-rknn) (push) Blocked by required conditions
Docker / Re-Tag ML (-rocm) (push) Blocked by required conditions
Docker / Re-Tag Server () (push) Blocked by required conditions
Docker / Build and Push ML (armnn, linux/arm64, -armnn) (push) Blocked by required conditions
Docker / Build and Push ML (cpu, ) (push) Blocked by required conditions
Docker / Build and Push ML (cuda, linux/amd64, -cuda) (push) Blocked by required conditions
Docker / Build and Push ML (openvino, linux/amd64, -openvino) (push) Blocked by required conditions
Docker / Build and Push ML (rknn, linux/arm64, -rknn) (push) Blocked by required conditions
Docker / Build and Push ML (rocm, linux/amd64, {"linux/amd64": "mich"}, -rocm) (push) Blocked by required conditions
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Static Code Analysis / zizmor (push) Waiting to run
Test / pre-job (push) Waiting to run
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker / pre-job (push) Waiting to run
Docker / Re-Tag ML () (push) Blocked by required conditions
Docker / Re-Tag ML (-armnn) (push) Blocked by required conditions
Docker / Re-Tag ML (-cuda) (push) Blocked by required conditions
Docker / Re-Tag ML (-openvino) (push) Blocked by required conditions
Docker / Re-Tag ML (-rknn) (push) Blocked by required conditions
Docker / Re-Tag ML (-rocm) (push) Blocked by required conditions
Docker / Re-Tag Server () (push) Blocked by required conditions
Docker / Build and Push ML (armnn, linux/arm64, -armnn) (push) Blocked by required conditions
Docker / Build and Push ML (cpu, ) (push) Blocked by required conditions
Docker / Build and Push ML (cuda, linux/amd64, -cuda) (push) Blocked by required conditions
Docker / Build and Push ML (openvino, linux/amd64, -openvino) (push) Blocked by required conditions
Docker / Build and Push ML (rknn, linux/arm64, -rknn) (push) Blocked by required conditions
Docker / Build and Push ML (rocm, linux/amd64, {"linux/amd64": "mich"}, -rocm) (push) Blocked by required conditions
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Static Code Analysis / zizmor (push) Waiting to run
Test / pre-job (push) Waiting to run
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
This commit is contained in:
@@ -20,6 +20,9 @@ const String kSecuredPinCode = "secured_pin_code";
|
|||||||
const String kManualUploadGroup = 'manual_upload_group';
|
const String kManualUploadGroup = 'manual_upload_group';
|
||||||
const String kBackupGroup = 'backup_group';
|
const String kBackupGroup = 'backup_group';
|
||||||
const String kBackupLivePhotoGroup = 'backup_live_photo_group';
|
const String kBackupLivePhotoGroup = 'backup_live_photo_group';
|
||||||
|
const String kDownloadGroupImage = 'group_image';
|
||||||
|
const String kDownloadGroupVideo = 'group_video';
|
||||||
|
const String kDownloadGroupLivePhoto = 'group_livephoto';
|
||||||
|
|
||||||
// Timeline constants
|
// Timeline constants
|
||||||
const int kTimelineNoneSegmentSize = 120;
|
const int kTimelineNoneSegmentSize = 120;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/constants/locales.dart';
|
import 'package:immich_mobile/constants/locales.dart';
|
||||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||||
import 'package:immich_mobile/generated/codegen_loader.g.dart';
|
import 'package:immich_mobile/generated/codegen_loader.g.dart';
|
||||||
@@ -29,7 +30,6 @@ import 'package:immich_mobile/theme/dynamic_theme.dart';
|
|||||||
import 'package:immich_mobile/theme/theme_data.dart';
|
import 'package:immich_mobile/theme/theme_data.dart';
|
||||||
import 'package:immich_mobile/utils/bootstrap.dart';
|
import 'package:immich_mobile/utils/bootstrap.dart';
|
||||||
import 'package:immich_mobile/utils/cache/widgets_binding.dart';
|
import 'package:immich_mobile/utils/cache/widgets_binding.dart';
|
||||||
import 'package:immich_mobile/utils/download.dart';
|
|
||||||
import 'package:immich_mobile/utils/http_ssl_options.dart';
|
import 'package:immich_mobile/utils/http_ssl_options.dart';
|
||||||
import 'package:immich_mobile/utils/licenses.dart';
|
import 'package:immich_mobile/utils/licenses.dart';
|
||||||
import 'package:immich_mobile/utils/migration.dart';
|
import 'package:immich_mobile/utils/migration.dart';
|
||||||
@@ -101,7 +101,7 @@ Future<void> initApp() async {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await FileDownloader().trackTasksInGroup(
|
await FileDownloader().trackTasksInGroup(
|
||||||
downloadGroupLivePhoto,
|
kDownloadGroupLivePhoto,
|
||||||
markDownloadedComplete: false,
|
markDownloadedComplete: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
|
|
||||||
void _configureFileDownloaderNotifications() {
|
void _configureFileDownloaderNotifications() {
|
||||||
FileDownloader().configureNotificationForGroup(
|
FileDownloader().configureNotificationForGroup(
|
||||||
downloadGroupImage,
|
kDownloadGroupImage,
|
||||||
running: TaskNotification(
|
running: TaskNotification(
|
||||||
'downloading_media'.tr(),
|
'downloading_media'.tr(),
|
||||||
'${'file_name'.tr()}: {filename}',
|
'${'file_name'.tr()}: {filename}',
|
||||||
@@ -192,7 +192,7 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
);
|
);
|
||||||
|
|
||||||
FileDownloader().configureNotificationForGroup(
|
FileDownloader().configureNotificationForGroup(
|
||||||
downloadGroupVideo,
|
kDownloadGroupVideo,
|
||||||
running: TaskNotification(
|
running: TaskNotification(
|
||||||
'downloading_media'.tr(),
|
'downloading_media'.tr(),
|
||||||
'${'file_name'.tr()}: {filename}',
|
'${'file_name'.tr()}: {filename}',
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import 'dart:io';
|
|||||||
import 'package:background_downloader/background_downloader.dart';
|
import 'package:background_downloader/background_downloader.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||||
import 'package:immich_mobile/models/download/livephotos_medatada.model.dart';
|
import 'package:immich_mobile/models/download/livephotos_medatada.model.dart';
|
||||||
import 'package:immich_mobile/services/api.service.dart';
|
import 'package:immich_mobile/services/api.service.dart';
|
||||||
import 'package:immich_mobile/utils/download.dart';
|
|
||||||
import 'package:immich_mobile/utils/image_url_builder.dart';
|
import 'package:immich_mobile/utils/image_url_builder.dart';
|
||||||
|
|
||||||
final downloadRepositoryProvider = Provider((ref) => DownloadRepository());
|
final downloadRepositoryProvider = Provider((ref) => DownloadRepository());
|
||||||
@@ -33,19 +33,19 @@ class DownloadRepository {
|
|||||||
|
|
||||||
DownloadRepository() {
|
DownloadRepository() {
|
||||||
_downloader.registerCallbacks(
|
_downloader.registerCallbacks(
|
||||||
group: downloadGroupImage,
|
group: kDownloadGroupImage,
|
||||||
taskStatusCallback: (update) => onImageDownloadStatus?.call(update),
|
taskStatusCallback: (update) => onImageDownloadStatus?.call(update),
|
||||||
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
||||||
);
|
);
|
||||||
|
|
||||||
_downloader.registerCallbacks(
|
_downloader.registerCallbacks(
|
||||||
group: downloadGroupVideo,
|
group: kDownloadGroupVideo,
|
||||||
taskStatusCallback: (update) => onVideoDownloadStatus?.call(update),
|
taskStatusCallback: (update) => onVideoDownloadStatus?.call(update),
|
||||||
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
||||||
);
|
);
|
||||||
|
|
||||||
_downloader.registerCallbacks(
|
_downloader.registerCallbacks(
|
||||||
group: downloadGroupLivePhoto,
|
group: kDownloadGroupLivePhoto,
|
||||||
taskStatusCallback: (update) => onLivePhotoDownloadStatus?.call(update),
|
taskStatusCallback: (update) => onLivePhotoDownloadStatus?.call(update),
|
||||||
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
||||||
);
|
);
|
||||||
@@ -66,7 +66,7 @@ class DownloadRepository {
|
|||||||
Future<List<TaskRecord>> getLiveVideoTasks() {
|
Future<List<TaskRecord>> getLiveVideoTasks() {
|
||||||
return _downloader.database.allRecordsWithStatus(
|
return _downloader.database.allRecordsWithStatus(
|
||||||
TaskStatus.complete,
|
TaskStatus.complete,
|
||||||
group: downloadGroupLivePhoto,
|
group: kDownloadGroupLivePhoto,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ class DownloadRepository {
|
|||||||
headers: headers,
|
headers: headers,
|
||||||
filename: asset.name,
|
filename: asset.name,
|
||||||
updates: Updates.statusAndProgress,
|
updates: Updates.statusAndProgress,
|
||||||
group: isVideo ? downloadGroupVideo : downloadGroupImage,
|
group: isVideo ? kDownloadGroupVideo : kDownloadGroupImage,
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ class DownloadRepository {
|
|||||||
headers: headers,
|
headers: headers,
|
||||||
filename: asset.name,
|
filename: asset.name,
|
||||||
updates: Updates.statusAndProgress,
|
updates: Updates.statusAndProgress,
|
||||||
group: downloadGroupLivePhoto,
|
group: kDownloadGroupLivePhoto,
|
||||||
metaData: json.encode(_dummyMetadata),
|
metaData: json.encode(_dummyMetadata),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ class DownloadRepository {
|
|||||||
.toUpperCase()
|
.toUpperCase()
|
||||||
.replaceAll(RegExp(r"\.(JPG|HEIC)$"), '.MOV'),
|
.replaceAll(RegExp(r"\.(JPG|HEIC)$"), '.MOV'),
|
||||||
updates: Updates.statusAndProgress,
|
updates: Updates.statusAndProgress,
|
||||||
group: downloadGroupLivePhoto,
|
group: kDownloadGroupLivePhoto,
|
||||||
metaData: json.encode(_dummyMetadata),
|
metaData: json.encode(_dummyMetadata),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'package:background_downloader/background_downloader.dart';
|
import 'package:background_downloader/background_downloader.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/asset.entity.dart';
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
||||||
import 'package:immich_mobile/entities/store.entity.dart';
|
import 'package:immich_mobile/entities/store.entity.dart';
|
||||||
@@ -10,7 +11,6 @@ import 'package:immich_mobile/models/download/livephotos_medatada.model.dart';
|
|||||||
import 'package:immich_mobile/repositories/download.repository.dart';
|
import 'package:immich_mobile/repositories/download.repository.dart';
|
||||||
import 'package:immich_mobile/repositories/file_media.repository.dart';
|
import 'package:immich_mobile/repositories/file_media.repository.dart';
|
||||||
import 'package:immich_mobile/services/api.service.dart';
|
import 'package:immich_mobile/services/api.service.dart';
|
||||||
import 'package:immich_mobile/utils/download.dart';
|
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
final downloadServiceProvider = Provider(
|
final downloadServiceProvider = Provider(
|
||||||
@@ -173,7 +173,7 @@ class DownloadService {
|
|||||||
_buildDownloadTask(
|
_buildDownloadTask(
|
||||||
asset.remoteId!,
|
asset.remoteId!,
|
||||||
asset.fileName,
|
asset.fileName,
|
||||||
group: downloadGroupLivePhoto,
|
group: kDownloadGroupLivePhoto,
|
||||||
metadata: LivePhotosMetadata(
|
metadata: LivePhotosMetadata(
|
||||||
part: LivePhotosPart.image,
|
part: LivePhotosPart.image,
|
||||||
id: asset.remoteId!,
|
id: asset.remoteId!,
|
||||||
@@ -184,7 +184,7 @@ class DownloadService {
|
|||||||
asset.fileName
|
asset.fileName
|
||||||
.toUpperCase()
|
.toUpperCase()
|
||||||
.replaceAll(RegExp(r"\.(JPG|HEIC)$"), '.MOV'),
|
.replaceAll(RegExp(r"\.(JPG|HEIC)$"), '.MOV'),
|
||||||
group: downloadGroupLivePhoto,
|
group: kDownloadGroupLivePhoto,
|
||||||
metadata: LivePhotosMetadata(
|
metadata: LivePhotosMetadata(
|
||||||
part: LivePhotosPart.video,
|
part: LivePhotosPart.video,
|
||||||
id: asset.remoteId!,
|
id: asset.remoteId!,
|
||||||
@@ -201,7 +201,7 @@ class DownloadService {
|
|||||||
_buildDownloadTask(
|
_buildDownloadTask(
|
||||||
asset.remoteId!,
|
asset.remoteId!,
|
||||||
asset.fileName,
|
asset.fileName,
|
||||||
group: asset.isImage ? downloadGroupImage : downloadGroupVideo,
|
group: asset.isImage ? kDownloadGroupImage : kDownloadGroupVideo,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
const downloadGroupImage = 'group_image';
|
|
||||||
const downloadGroupVideo = 'group_video';
|
|
||||||
const downloadGroupLivePhoto = 'group_livephoto';
|
|
||||||
Reference in New Issue
Block a user