parent
e4f31b5e40
commit
db07ea8a8e
|
@ -155,7 +155,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
imageView.layer.cornerRadius = MIN(imageView.bounds.size.width, imageView.bounds.size.height) * 0.5f;
|
||||
[_cachedMediaView addSubview:imageView];
|
||||
|
||||
NSString *fileExtension = self.attachment.filePath.pathExtension;
|
||||
NSString *filename = self.attachment.sourceFilename;
|
||||
if (!filename) {
|
||||
filename = [self.attachment localFilePathWithoutTransaction];
|
||||
}
|
||||
NSString *fileExtension = filename.pathExtension;
|
||||
if (fileExtension.length < 1) {
|
||||
[MIMETypeUtil fileExtensionForMIMEType:self.attachment.contentType];
|
||||
}
|
||||
|
@ -186,7 +190,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
const CGFloat kLabelHSpacing = self.iconHSpacing;
|
||||
const CGFloat kLabelVSpacing = 2;
|
||||
NSString *topText =
|
||||
[self.attachment.filename stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
[self.attachment.sourceFilename stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
if (topText.length < 1) {
|
||||
topText = [MIMETypeUtil fileExtensionForMIMEType:self.attachment.contentType].uppercaseString;
|
||||
}
|
||||
|
@ -203,7 +207,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
NSError *error;
|
||||
unsigned long long fileSize =
|
||||
[[NSFileManager defaultManager] attributesOfItemAtPath:self.attachment.filePath error:&error].fileSize;
|
||||
[[NSFileManager defaultManager] attributesOfItemAtPath:[self.attachment localFilePathWithoutTransaction]
|
||||
error:&error]
|
||||
.fileSize;
|
||||
OWSAssert(!error);
|
||||
NSString *bottomText = [ViewControllerUtils formatFileSize:fileSize];
|
||||
UILabel *bottomLabel = [UILabel new];
|
||||
|
|
|
@ -254,7 +254,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
// they have no file name.
|
||||
//
|
||||
// TODO: Remove this after the flag has been in production for a few months.
|
||||
return (self.attachment.isVoiceMessage || self.attachment.filename.length < 1);
|
||||
return (self.attachment.isVoiceMessage || self.attachment.sourceFilename.length < 1);
|
||||
}
|
||||
|
||||
- (UIView *)createAudioMediaView
|
||||
|
@ -287,7 +287,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
const CGFloat kLabelHSpacing = self.audioIconHSpacing;
|
||||
const CGFloat kLabelVSpacing = 2;
|
||||
NSString *topText = [[self.attachment.filename stringByDeletingPathExtension]
|
||||
NSString *filename = self.attachment.sourceFilename;
|
||||
if (!filename) {
|
||||
filename = [self.attachment localFilePathWithoutTransaction];
|
||||
}
|
||||
NSString *topText = [[filename stringByDeletingPathExtension]
|
||||
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
if (topText.length < 1) {
|
||||
topText = [MIMETypeUtil fileExtensionForMIMEType:self.attachment.contentType].uppercaseString;
|
||||
|
|
|
@ -3414,7 +3414,7 @@ typedef enum : NSUInteger {
|
|||
if (newGroupModel.groupImage) {
|
||||
[self.messageSender sendAttachmentData:UIImagePNGRepresentation(newGroupModel.groupImage)
|
||||
contentType:OWSMimeTypeImagePng
|
||||
filename:nil
|
||||
sourceFilename:nil
|
||||
inMessage:message
|
||||
success:^{
|
||||
DDLogDebug(@"%@ Successfully sent group update with avatar", self.tag);
|
||||
|
|
|
@ -454,7 +454,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
if (model.groupImage) {
|
||||
[self.messageSender sendAttachmentData:UIImagePNGRepresentation(model.groupImage)
|
||||
contentType:OWSMimeTypeImagePng
|
||||
filename:nil
|
||||
sourceFilename:nil
|
||||
inMessage:message
|
||||
success:popToThread
|
||||
failure:removeThreadWithError];
|
||||
|
|
|
@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
expiresInSeconds:(configuration.isEnabled ? configuration.durationSeconds : 0)];
|
||||
[messageSender sendAttachmentData:attachment.data
|
||||
contentType:attachment.mimeType
|
||||
filename:attachment.filenameOrDefault
|
||||
sourceFilename:attachment.filenameOrDefault
|
||||
inMessage:message
|
||||
success:^{
|
||||
DDLogDebug(@"%@ Successfully sent message attachment.", self.tag);
|
||||
|
|
Loading…
Reference in New Issue