mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #2342 from vector-im/share_extension_limit_large_size_images
Share extension: Remove image large size resizing choice if output dimension is too high to prevent memory limit exception
This commit is contained in:
commit
b2a9ffe03b
2 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@ Changes in 0.8.4 (2019-03-xx)
|
|||
===============================================
|
||||
|
||||
Improvements:
|
||||
* Share extension: Remove image large size resizing choice if output dimension is too high to prevent memory limit exception (PR #2342).
|
||||
|
||||
Bug fix:
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
NSString *const kShareExtensionManagerDidUpdateAccountDataNotification = @"kShareExtensionManagerDidUpdateAccountDataNotification";
|
||||
|
||||
static const CGFloat kLargeImageSizeMaxDimension = 2048.0;
|
||||
|
||||
typedef NS_ENUM(NSInteger, ImageCompressionMode)
|
||||
{
|
||||
ImageCompressionModeNone,
|
||||
|
@ -560,7 +562,9 @@ typedef NS_ENUM(NSInteger, ImageCompressionMode)
|
|||
}]];
|
||||
}
|
||||
|
||||
if (compressionSizes.large.fileSize)
|
||||
// Do not offer the possibility to resize an image with a dimension above kLargeImageSizeMaxDimension, to prevent the risk of memory limit exception.
|
||||
// TODO: Remove this condition when issue https://github.com/vector-im/riot-ios/issues/2341 will be fixed.
|
||||
if (compressionSizes.large.fileSize && (MAX(compressionSizes.large.imageSize.width, compressionSizes.large.imageSize.height) <= kLargeImageSizeMaxDimension))
|
||||
{
|
||||
NSString *resolution = [NSString stringWithFormat:@"%@ (%d x %d)", [MXTools fileSizeToString:compressionSizes.large.fileSize round:NO], (int)compressionSizes.large.imageSize.width, (int)compressionSizes.large.imageSize.height];
|
||||
|
||||
|
|
Loading…
Reference in a new issue