Respond to CR.
This commit is contained in:
parent
b6724ee181
commit
df4cf5c09e
|
@ -159,6 +159,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
.fileSize;
|
.fileSize;
|
||||||
OWSAssertDebug(!error);
|
OWSAssertDebug(!error);
|
||||||
}
|
}
|
||||||
|
// We don't want to show the file size while the attachment is downloading.
|
||||||
|
// To avoid layout jitter when the download completes, we reserve space in
|
||||||
|
// the layout using a whitespace string.
|
||||||
NSString *bottomText = @" ";
|
NSString *bottomText = @" ";
|
||||||
if (fileSize > 0) {
|
if (fileSize > 0) {
|
||||||
bottomText = [OWSFormat formatFileSize:fileSize];
|
bottomText = [OWSFormat formatFileSize:fileSize];
|
||||||
|
|
|
@ -990,6 +990,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
||||||
- (BOOL)canCopyMedia
|
- (BOOL)canCopyMedia
|
||||||
{
|
{
|
||||||
if (self.attachmentPointer != nil) {
|
if (self.attachmentPointer != nil) {
|
||||||
|
// The attachment is still downloading.
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,6 +1019,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
||||||
- (BOOL)canSaveMedia
|
- (BOOL)canSaveMedia
|
||||||
{
|
{
|
||||||
if (self.attachmentPointer != nil) {
|
if (self.attachmentPointer != nil) {
|
||||||
|
// The attachment is still downloading.
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,6 +1145,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
||||||
- (BOOL)hasMediaActionContent
|
- (BOOL)hasMediaActionContent
|
||||||
{
|
{
|
||||||
if (self.attachmentPointer != nil) {
|
if (self.attachmentPointer != nil) {
|
||||||
|
// The attachment is still downloading.
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface TSAttachmentStream (TSAttachmentPointer)
|
@interface TSAttachmentStream (TSAttachmentPointer)
|
||||||
|
|
||||||
- (CGSize)cachedImageSize;
|
- (CGSize)cachedMediaSize;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
_state = TSAttachmentPointerStateEnqueued;
|
_state = TSAttachmentPointerStateEnqueued;
|
||||||
self.attachmentType = attachmentStream.attachmentType;
|
self.attachmentType = attachmentStream.attachmentType;
|
||||||
_pointerType = TSAttachmentPointerTypeRestoring;
|
_pointerType = TSAttachmentPointerTypeRestoring;
|
||||||
_mediaSize = (attachmentStream.shouldHaveImageSize ? attachmentStream.cachedImageSize : CGSizeZero);
|
_mediaSize = (attachmentStream.shouldHaveImageSize ? attachmentStream.cachedMediaSize : CGSizeZero);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
NSString *_Nullable fileName = attachmentProto.fileName;
|
NSString *_Nullable fileName = attachmentProto.fileName;
|
||||||
NSString *_Nullable contentType = attachmentProto.contentType;
|
NSString *_Nullable contentType = attachmentProto.contentType;
|
||||||
if (contentType.length < 1) {
|
if (contentType.length < 1) {
|
||||||
OWSLogError(@"Invalid attachment content type.");
|
// Content type might not set if the sending client can't
|
||||||
|
// infer a MIME type from the file extension.
|
||||||
|
OWSLogWarn(@"Invalid attachment content type.");
|
||||||
NSString *_Nullable fileExtension = [fileName pathExtension].lowercaseString;
|
NSString *_Nullable fileExtension = [fileName pathExtension].lowercaseString;
|
||||||
if (fileExtension.length > 0) {
|
if (fileExtension.length > 0) {
|
||||||
contentType = [MIMETypeUtil mimeTypeForFileExtension:fileExtension];
|
contentType = [MIMETypeUtil mimeTypeForFileExtension:fileExtension];
|
||||||
|
|
|
@ -526,7 +526,7 @@ typedef void (^OWSLoadedThumbnailSuccess)(OWSLoadedThumbnail *loadedThumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)cachedImageSize
|
- (CGSize)cachedMediaSize
|
||||||
{
|
{
|
||||||
OWSAssertDebug(self.shouldHaveImageSize);
|
OWSAssertDebug(self.shouldHaveImageSize);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue