mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
fix: network criteria for upload LivePhotos (#21386)
This commit is contained in:
parent
d6b8c0926f
commit
aacb27ea5f
1 changed files with 16 additions and 7 deletions
|
|
@ -278,13 +278,7 @@ class UploadService {
|
||||||
livePhotoVideoId: '',
|
livePhotoVideoId: '',
|
||||||
).toJson();
|
).toJson();
|
||||||
|
|
||||||
bool requiresWiFi = true;
|
final requiresWiFi = _shouldRequireWiFi(asset);
|
||||||
|
|
||||||
if (asset.isVideo && _appSettingsService.getSetting(AppSettingsEnum.useCellularForUploadVideos)) {
|
|
||||||
requiresWiFi = false;
|
|
||||||
} else if (!asset.isVideo && _appSettingsService.getSetting(AppSettingsEnum.useCellularForUploadPhotos)) {
|
|
||||||
requiresWiFi = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return buildUploadTask(
|
return buildUploadTask(
|
||||||
file,
|
file,
|
||||||
|
|
@ -311,6 +305,8 @@ class UploadService {
|
||||||
|
|
||||||
final fields = {'livePhotoVideoId': livePhotoVideoId};
|
final fields = {'livePhotoVideoId': livePhotoVideoId};
|
||||||
|
|
||||||
|
final requiresWiFi = _shouldRequireWiFi(asset);
|
||||||
|
|
||||||
return buildUploadTask(
|
return buildUploadTask(
|
||||||
file,
|
file,
|
||||||
originalFileName: asset.name,
|
originalFileName: asset.name,
|
||||||
|
|
@ -319,9 +315,22 @@ class UploadService {
|
||||||
group: kBackupLivePhotoGroup,
|
group: kBackupLivePhotoGroup,
|
||||||
priority: 0, // Highest priority to get upload immediately
|
priority: 0, // Highest priority to get upload immediately
|
||||||
isFavorite: asset.isFavorite,
|
isFavorite: asset.isFavorite,
|
||||||
|
requiresWiFi: requiresWiFi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _shouldRequireWiFi(LocalAsset asset) {
|
||||||
|
bool requiresWiFi = true;
|
||||||
|
|
||||||
|
if (asset.isVideo && _appSettingsService.getSetting(AppSettingsEnum.useCellularForUploadVideos)) {
|
||||||
|
requiresWiFi = false;
|
||||||
|
} else if (!asset.isVideo && _appSettingsService.getSetting(AppSettingsEnum.useCellularForUploadPhotos)) {
|
||||||
|
requiresWiFi = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return requiresWiFi;
|
||||||
|
}
|
||||||
|
|
||||||
Future<UploadTask> buildUploadTask(
|
Future<UploadTask> buildUploadTask(
|
||||||
File file, {
|
File file, {
|
||||||
required String group,
|
required String group,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue