Fix: Handle live photo on/off change during upload
This commit is contained in:
parent
67e7bf0220
commit
e75958555a
3 changed files with 13 additions and 2 deletions
|
@ -326,7 +326,7 @@ EXTERNAL SOURCES:
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
background_fetch: bc9b44b0bf8b434e282a2ac9be8662800a0296ed
|
background_fetch: bc9b44b0bf8b434e282a2ac9be8662800a0296ed
|
||||||
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||||
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
|
connectivity_plus: 53efb943fc2882c8512d84c45707bcabc4c36076
|
||||||
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
|
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
|
||||||
Firebase: bd152f0f3d278c4060c5c71359db08ebcfd5a3e2
|
Firebase: bd152f0f3d278c4060c5c71359db08ebcfd5a3e2
|
||||||
firebase_core: ce64b0941c6d87c6ef5022ae9116a158236c8c94
|
firebase_core: ce64b0941c6d87c6ef5022ae9116a158236c8c94
|
||||||
|
|
|
@ -7,6 +7,13 @@ enum InvalidReason {
|
||||||
livePhotoVideoMissing,
|
livePhotoVideoMissing,
|
||||||
thumbnailMissing,
|
thumbnailMissing,
|
||||||
unknown,
|
unknown,
|
||||||
|
|
||||||
|
}
|
||||||
|
extension InvalidReasonExn on InvalidReason {
|
||||||
|
bool get isLivePhotoErr =>
|
||||||
|
this == InvalidReason.livePhotoToImageTypeChanged ||
|
||||||
|
this == InvalidReason.imageToLivePhotoTypeChanged ||
|
||||||
|
this == InvalidReason.livePhotoVideoMissing;
|
||||||
}
|
}
|
||||||
|
|
||||||
class InvalidFileError extends ArgumentError {
|
class InvalidFileError extends ArgumentError {
|
||||||
|
|
|
@ -736,7 +736,11 @@ class FileUploader {
|
||||||
file.deviceFolder != null &&
|
file.deviceFolder != null &&
|
||||||
file.title != null &&
|
file.title != null &&
|
||||||
!file.isSharedMediaToAppSandbox;
|
!file.isSharedMediaToAppSandbox;
|
||||||
final bool deleteEntry = !file.isUploaded && !canIgnoreFile;
|
// If the file is not uploaded yet and either it can not be ignored or the
|
||||||
|
// err is related to live photo media, delete the local entry
|
||||||
|
final bool deleteEntry = !file.isUploaded &&
|
||||||
|
(!canIgnoreFile || e.reason.isLivePhotoErr);
|
||||||
|
|
||||||
if (e.reason != InvalidReason.thumbnailMissing || !canIgnoreFile) {
|
if (e.reason != InvalidReason.thumbnailMissing || !canIgnoreFile) {
|
||||||
_logger.severe(
|
_logger.severe(
|
||||||
"Invalid file, localDelete: $deleteEntry, ignored: $canIgnoreFile",
|
"Invalid file, localDelete: $deleteEntry, ignored: $canIgnoreFile",
|
||||||
|
|
Loading…
Add table
Reference in a new issue