|
|
@ -328,11 +328,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
self.bodyMediaView = bodyMediaView;
|
|
|
|
self.bodyMediaView = bodyMediaView;
|
|
|
|
bodyMediaView.userInteractionEnabled = NO;
|
|
|
|
bodyMediaView.userInteractionEnabled = NO;
|
|
|
|
if (self.isMediaBeingSent) {
|
|
|
|
|
|
|
|
// TODO:
|
|
|
|
|
|
|
|
bodyMediaView.layer.opacity = 0.75f;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self.hasFullWidthMediaView) {
|
|
|
|
if (self.hasFullWidthMediaView) {
|
|
|
|
// Flush any pending "text" subviews.
|
|
|
|
// Flush any pending "text" subviews.
|
|
|
|
[self insertAnyTextViewsIntoStackView:textViews];
|
|
|
|
[self insertAnyTextViewsIntoStackView:textViews];
|
|
|
@ -478,12 +473,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
[self insertAnyTextViewsIntoStackView:textViews];
|
|
|
|
[self insertAnyTextViewsIntoStackView:textViews];
|
|
|
|
|
|
|
|
|
|
|
|
CGSize bubbleSize = [self measureSize];
|
|
|
|
CGSize bubbleSize = [self measureSize];
|
|
|
|
[NSLayoutConstraint autoSetPriority:UILayoutPriorityRequired
|
|
|
|
[self.viewConstraints addObjectsFromArray:@[
|
|
|
|
forConstraints:^{
|
|
|
|
[self autoSetDimension:ALDimensionWidth toSize:bubbleSize.width],
|
|
|
|
[self.viewConstraints addObjectsFromArray:@[
|
|
|
|
]];
|
|
|
|
[self autoSetDimension:ALDimensionWidth toSize:bubbleSize.width],
|
|
|
|
|
|
|
|
]];
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (bodyMediaView) {
|
|
|
|
if (bodyMediaView) {
|
|
|
|
OWSAssert(bodyMediaSize);
|
|
|
|
OWSAssert(bodyMediaSize);
|
|
|
|
[self.viewConstraints
|
|
|
|
[self.viewConstraints
|
|
|
@ -855,7 +847,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
stillImageView.layer.minificationFilter = kCAFilterTrilinear;
|
|
|
|
stillImageView.layer.minificationFilter = kCAFilterTrilinear;
|
|
|
|
stillImageView.layer.magnificationFilter = kCAFilterTrilinear;
|
|
|
|
stillImageView.layer.magnificationFilter = kCAFilterTrilinear;
|
|
|
|
stillImageView.backgroundColor = [UIColor whiteColor];
|
|
|
|
stillImageView.backgroundColor = [UIColor whiteColor];
|
|
|
|
[self addAttachmentUploadViewIfNecessary:stillImageView];
|
|
|
|
[self addAttachmentUploadViewIfNecessary];
|
|
|
|
|
|
|
|
|
|
|
|
__weak OWSMessageBubbleView *weakSelf = self;
|
|
|
|
__weak OWSMessageBubbleView *weakSelf = self;
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
@ -903,7 +895,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
// might not match the aspect ratio of the view.
|
|
|
|
// might not match the aspect ratio of the view.
|
|
|
|
animatedImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
animatedImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
animatedImageView.backgroundColor = [UIColor whiteColor];
|
|
|
|
animatedImageView.backgroundColor = [UIColor whiteColor];
|
|
|
|
[self addAttachmentUploadViewIfNecessary:animatedImageView];
|
|
|
|
[self addAttachmentUploadViewIfNecessary];
|
|
|
|
|
|
|
|
|
|
|
|
__weak OWSMessageBubbleView *weakSelf = self;
|
|
|
|
__weak OWSMessageBubbleView *weakSelf = self;
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
@ -952,7 +944,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
conversationStyle:self.conversationStyle];
|
|
|
|
conversationStyle:self.conversationStyle];
|
|
|
|
self.viewItem.lastAudioMessageView = audioMessageView;
|
|
|
|
self.viewItem.lastAudioMessageView = audioMessageView;
|
|
|
|
[audioMessageView createContents];
|
|
|
|
[audioMessageView createContents];
|
|
|
|
[self addAttachmentUploadViewIfNecessary:audioMessageView];
|
|
|
|
[self addAttachmentUploadViewIfNecessary];
|
|
|
|
|
|
|
|
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
// Do nothing.
|
|
|
|
// Do nothing.
|
|
|
@ -982,10 +974,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
UIImageView *videoPlayButton = [[UIImageView alloc] initWithImage:videoPlayIcon];
|
|
|
|
UIImageView *videoPlayButton = [[UIImageView alloc] initWithImage:videoPlayIcon];
|
|
|
|
[stillImageView addSubview:videoPlayButton];
|
|
|
|
[stillImageView addSubview:videoPlayButton];
|
|
|
|
[videoPlayButton autoCenterInSuperview];
|
|
|
|
[videoPlayButton autoCenterInSuperview];
|
|
|
|
[self addAttachmentUploadViewIfNecessary:stillImageView
|
|
|
|
[self addAttachmentUploadViewIfNecessaryWithAttachmentStateCallback:^(BOOL isAttachmentReady) {
|
|
|
|
attachmentStateCallback:^(BOOL isAttachmentReady) {
|
|
|
|
videoPlayButton.hidden = !isAttachmentReady;
|
|
|
|
videoPlayButton.hidden = !isAttachmentReady;
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__weak OWSMessageBubbleView *weakSelf = self;
|
|
|
|
__weak OWSMessageBubbleView *weakSelf = self;
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
@ -1024,7 +1015,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
OWSGenericAttachmentView *attachmentView =
|
|
|
|
OWSGenericAttachmentView *attachmentView =
|
|
|
|
[[OWSGenericAttachmentView alloc] initWithAttachment:self.attachmentStream isIncoming:self.isIncoming];
|
|
|
|
[[OWSGenericAttachmentView alloc] initWithAttachment:self.attachmentStream isIncoming:self.isIncoming];
|
|
|
|
[attachmentView createContentsWithConversationStyle:self.conversationStyle];
|
|
|
|
[attachmentView createContentsWithConversationStyle:self.conversationStyle];
|
|
|
|
[self addAttachmentUploadViewIfNecessary:attachmentView];
|
|
|
|
[self addAttachmentUploadViewIfNecessary];
|
|
|
|
|
|
|
|
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
self.loadCellContentBlock = ^{
|
|
|
|
// Do nothing.
|
|
|
|
// Do nothing.
|
|
|
@ -1082,26 +1073,27 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
return contactShareView;
|
|
|
|
return contactShareView;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)addAttachmentUploadViewIfNecessary:(UIView *)attachmentView
|
|
|
|
- (void)addAttachmentUploadViewIfNecessary
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[self addAttachmentUploadViewIfNecessary:attachmentView
|
|
|
|
[self addAttachmentUploadViewIfNecessaryWithAttachmentStateCallback:nil];
|
|
|
|
attachmentStateCallback:^(BOOL isAttachmentReady){
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)addAttachmentUploadViewIfNecessary:(UIView *)attachmentView
|
|
|
|
- (void)addAttachmentUploadViewIfNecessaryWithAttachmentStateCallback:
|
|
|
|
attachmentStateCallback:(AttachmentStateBlock)attachmentStateCallback
|
|
|
|
(nullable AttachmentStateBlock)attachmentStateCallback
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OWSAssert(attachmentView);
|
|
|
|
|
|
|
|
OWSAssert(attachmentStateCallback);
|
|
|
|
|
|
|
|
OWSAssert(self.attachmentStream);
|
|
|
|
OWSAssert(self.attachmentStream);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!attachmentStateCallback) {
|
|
|
|
|
|
|
|
attachmentStateCallback = ^(BOOL isAttachmentReady) {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (self.isOutgoing) {
|
|
|
|
if (self.isOutgoing) {
|
|
|
|
if (!self.attachmentStream.isUploaded) {
|
|
|
|
if (!self.attachmentStream.isUploaded) {
|
|
|
|
AttachmentUploadView *attachmentUploadView =
|
|
|
|
AttachmentUploadView *attachmentUploadView =
|
|
|
|
[[AttachmentUploadView alloc] initWithAttachment:self.attachmentStream
|
|
|
|
[[AttachmentUploadView alloc] initWithAttachment:self.attachmentStream
|
|
|
|
attachmentStateCallback:attachmentStateCallback];
|
|
|
|
attachmentStateCallback:attachmentStateCallback];
|
|
|
|
[attachmentView addSubview:attachmentUploadView];
|
|
|
|
[self.bubbleView addSubview:attachmentUploadView];
|
|
|
|
[attachmentUploadView autoPinToSuperviewEdges];
|
|
|
|
[attachmentUploadView autoPinToSuperviewEdges];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|