Apply attachment type assets.
23
Signal/Images.xcassets/attachment_audio.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_audio@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_audio@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_audio@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Signal/Images.xcassets/attachment_audio.imageset/attachment_audio@1x.png
vendored
Normal file
After Width: | Height: | Size: 318 B |
BIN
Signal/Images.xcassets/attachment_audio.imageset/attachment_audio@2x.png
vendored
Normal file
After Width: | Height: | Size: 573 B |
BIN
Signal/Images.xcassets/attachment_audio.imageset/attachment_audio@3x.png
vendored
Normal file
After Width: | Height: | Size: 959 B |
23
Signal/Images.xcassets/attachment_file.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_file@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_file@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_file@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Signal/Images.xcassets/attachment_file.imageset/attachment_file@1x.png
vendored
Normal file
After Width: | Height: | Size: 198 B |
BIN
Signal/Images.xcassets/attachment_file.imageset/attachment_file@2x.png
vendored
Normal file
After Width: | Height: | Size: 312 B |
BIN
Signal/Images.xcassets/attachment_file.imageset/attachment_file@3x.png
vendored
Normal file
After Width: | Height: | Size: 436 B |
23
Signal/Images.xcassets/attachment_play_button.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_play_button@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_play_button@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "attachment_play_button@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Signal/Images.xcassets/attachment_play_button.imageset/attachment_play_button@1x.png
vendored
Normal file
After Width: | Height: | Size: 203 B |
BIN
Signal/Images.xcassets/attachment_play_button.imageset/attachment_play_button@2x.png
vendored
Normal file
After Width: | Height: | Size: 365 B |
BIN
Signal/Images.xcassets/attachment_play_button.imageset/attachment_play_button@3x.png
vendored
Normal file
After Width: | Height: | Size: 547 B |
|
@ -104,8 +104,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (UIColor *)highlightColor
|
||||
{
|
||||
BOOL isQuotingSelf = [NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber];
|
||||
return (isQuotingSelf ? OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent
|
||||
: OWSMessagesBubbleImageFactory.bubbleColorIncoming);
|
||||
return (isQuotingSelf ? OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent : [UIColor colorWithRGBHex:0xB5B5B5]);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
@ -140,6 +139,17 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
quotedAttachmentView.layer.cornerRadius = 2.f;
|
||||
quotedAttachmentView.clipsToBounds = YES;
|
||||
quotedAttachmentView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
if (self.isVideoAttachment) {
|
||||
UIImage *contentIcon = [UIImage imageNamed:@"attachment_play_button"];
|
||||
contentIcon = [contentIcon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
UIImageView *contentImageView = [self imageViewForImage:contentIcon];
|
||||
contentImageView.tintColor = [UIColor whiteColor];
|
||||
[quotedAttachmentView addSubview:contentImageView];
|
||||
[contentImageView autoCenterInSuperview];
|
||||
[contentImageView setContentHuggingHigh];
|
||||
[contentImageView setCompressionResistanceHigh];
|
||||
}
|
||||
} else if (self.quotedMessage.thumbnailDownloadFailed) {
|
||||
// TODO design review icon and color
|
||||
UIImage *contentIcon =
|
||||
|
@ -162,17 +172,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapFailedThumbnailDownload:)];
|
||||
[quotedAttachmentView addGestureRecognizer:tapGesture];
|
||||
} else {
|
||||
// TODO: This asset is wrong.
|
||||
// TODO: There's a special asset for audio files.
|
||||
UIImage *contentIcon = [UIImage imageNamed:@"file-thin-black-filled-large"];
|
||||
UIImageView *contentImageView = [self imageViewForImage:contentIcon];
|
||||
quotedAttachmentView = [UIView containerView];
|
||||
[quotedAttachmentView addSubview:contentImageView];
|
||||
quotedAttachmentView.backgroundColor = self.highlightColor;
|
||||
quotedAttachmentView.layer.cornerRadius = self.quotedAttachmentSize * 0.5f;
|
||||
|
||||
UIImage *contentIcon =
|
||||
[UIImage imageNamed:(self.isAudioAttachment ? @"attachment_audio" : @"attachment_file")];
|
||||
contentIcon = [contentIcon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
UIImageView *contentImageView = [self imageViewForImage:contentIcon];
|
||||
contentImageView.tintColor = [UIColor whiteColor];
|
||||
[quotedAttachmentView addSubview:contentImageView];
|
||||
[contentImageView autoCenterInSuperview];
|
||||
[contentImageView
|
||||
autoSetDimensionsToSize:CGSizeMake(self.quotedAttachmentSize * 0.5f, self.quotedAttachmentSize * 0.5f)];
|
||||
[contentImageView setContentHuggingHigh];
|
||||
[contentImageView setCompressionResistanceHigh];
|
||||
}
|
||||
|
||||
quotedAttachmentView.userInteractionEnabled = YES;
|
||||
|
@ -354,6 +366,28 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)isAudioAttachment
|
||||
{
|
||||
// TODO: Are we going to use the filename? For all mimetypes?
|
||||
NSString *_Nullable contentType = self.quotedMessage.contentType;
|
||||
if (contentType.length < 1) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [MIMETypeUtil isAudio:contentType];
|
||||
}
|
||||
|
||||
- (BOOL)isVideoAttachment
|
||||
{
|
||||
// TODO: Are we going to use the filename? For all mimetypes?
|
||||
NSString *_Nullable contentType = self.quotedMessage.contentType;
|
||||
if (contentType.length < 1) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [MIMETypeUtil isVideo:contentType];
|
||||
}
|
||||
|
||||
- (UILabel *)configureQuotedAuthorLabel
|
||||
{
|
||||
OWSAssert(self.quotedAuthorLabel);
|
||||
|
|