|
|
|
|
@ -4,10 +4,10 @@ import 'dart:io';
|
|
|
|
|
import 'package:background_downloader/background_downloader.dart';
|
|
|
|
|
import 'package:collection/collection.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/models/download/livephotos_medatada.model.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';
|
|
|
|
|
|
|
|
|
|
final downloadRepositoryProvider = Provider((ref) => DownloadRepository());
|
|
|
|
|
@ -33,19 +33,19 @@ class DownloadRepository {
|
|
|
|
|
|
|
|
|
|
DownloadRepository() {
|
|
|
|
|
_downloader.registerCallbacks(
|
|
|
|
|
group: downloadGroupImage,
|
|
|
|
|
group: kDownloadGroupImage,
|
|
|
|
|
taskStatusCallback: (update) => onImageDownloadStatus?.call(update),
|
|
|
|
|
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_downloader.registerCallbacks(
|
|
|
|
|
group: downloadGroupVideo,
|
|
|
|
|
group: kDownloadGroupVideo,
|
|
|
|
|
taskStatusCallback: (update) => onVideoDownloadStatus?.call(update),
|
|
|
|
|
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_downloader.registerCallbacks(
|
|
|
|
|
group: downloadGroupLivePhoto,
|
|
|
|
|
group: kDownloadGroupLivePhoto,
|
|
|
|
|
taskStatusCallback: (update) => onLivePhotoDownloadStatus?.call(update),
|
|
|
|
|
taskProgressCallback: (update) => onTaskProgress?.call(update),
|
|
|
|
|
);
|
|
|
|
|
@ -66,7 +66,7 @@ class DownloadRepository {
|
|
|
|
|
Future<List<TaskRecord>> getLiveVideoTasks() {
|
|
|
|
|
return _downloader.database.allRecordsWithStatus(
|
|
|
|
|
TaskStatus.complete,
|
|
|
|
|
group: downloadGroupLivePhoto,
|
|
|
|
|
group: kDownloadGroupLivePhoto,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -100,7 +100,7 @@ class DownloadRepository {
|
|
|
|
|
headers: headers,
|
|
|
|
|
filename: asset.name,
|
|
|
|
|
updates: Updates.statusAndProgress,
|
|
|
|
|
group: isVideo ? downloadGroupVideo : downloadGroupImage,
|
|
|
|
|
group: isVideo ? kDownloadGroupVideo : kDownloadGroupImage,
|
|
|
|
|
);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
@ -113,7 +113,7 @@ class DownloadRepository {
|
|
|
|
|
headers: headers,
|
|
|
|
|
filename: asset.name,
|
|
|
|
|
updates: Updates.statusAndProgress,
|
|
|
|
|
group: downloadGroupLivePhoto,
|
|
|
|
|
group: kDownloadGroupLivePhoto,
|
|
|
|
|
metaData: json.encode(_dummyMetadata),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@ -126,7 +126,7 @@ class DownloadRepository {
|
|
|
|
|
.toUpperCase()
|
|
|
|
|
.replaceAll(RegExp(r"\.(JPG|HEIC)$"), '.MOV'),
|
|
|
|
|
updates: Updates.statusAndProgress,
|
|
|
|
|
group: downloadGroupLivePhoto,
|
|
|
|
|
group: kDownloadGroupLivePhoto,
|
|
|
|
|
metaData: json.encode(_dummyMetadata),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|