-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[image_picker]fix load error when the image is BMP/HEIF/HEIC format #4665
Changes from all commits
04e2e82
fefbe88
4063085
a23135e
c201bcd
5dc0b50
29ce9b1
0d4d2b7
e2a8fd6
36da2b6
d130454
e584c96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
|
||
## 0.8.4+12 | ||
|
||
* iOS:support images with heic,heif,raw,tiff formats. | ||
|
||
## 0.8.4+11 | ||
|
||
* Fixes Activity leak. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
|
||
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h> | ||
|
||
#import <UniformTypeIdentifiers/UTCoreTypes.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a blank line after it; they are different import sections. |
||
#import "FLTPHPickerSaveImageToPathOperation.h" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please undo this change. |
||
API_AVAILABLE(ios(14)) | ||
@interface FLTPHPickerSaveImageToPathOperation () | ||
|
||
|
@@ -84,16 +84,28 @@ - (void)start { | |
} | ||
if (@available(iOS 14, *)) { | ||
[self setExecuting:YES]; | ||
|
||
if ([self.result.itemProvider hasItemConformingToTypeIdentifier:UTTypeWebP.identifier]) { | ||
[self.result.itemProvider | ||
loadDataRepresentationForTypeIdentifier:UTTypeWebP.identifier | ||
completionHandler:^(NSData *_Nullable data, | ||
NSError *_Nullable error) { | ||
UIImage *image = [[UIImage alloc] initWithData:data]; | ||
[self processImage:image]; | ||
}]; | ||
return; | ||
NSArray *supportedRepresentations = @[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Supported" seems misleading here; this isn't an exhaustive list since there's the other codepath as well. What is distinct about these vs other types that makes them need to use a different code path (so that we can name the list accordingly)? |
||
UTTypeRAWImage.identifier, | ||
UTTypeTIFF.identifier, | ||
UTTypeBMP.identifier, | ||
UTTypePNG.identifier, | ||
UTTypeHEIF.identifier, | ||
UTTypeHEIC.identifier, | ||
UTTypeJPEG.identifier, | ||
UTTypeWebP.identifier, | ||
UTTypeGIF.identifier, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we changing the codepath for types that already worked? Is this a preferred API? |
||
]; | ||
for (NSString *identifier in supportedRepresentations) { | ||
if ([self.result.itemProvider hasItemConformingToTypeIdentifier:identifier]) { | ||
[self.result.itemProvider | ||
loadDataRepresentationForTypeIdentifier:identifier | ||
completionHandler:^(NSData *_Nullable data, | ||
NSError *_Nullable error) { | ||
UIImage *image = [[UIImage alloc] initWithData:data]; | ||
[self processImage:image]; | ||
}]; | ||
return; | ||
} | ||
} | ||
|
||
[self.result.itemProvider | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.