mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 08:12:40 +00:00
Merge pull request #791 from vector-im/fix_encryption_icon_offset
Bug Fix - Chat screen: the vertical offset on encryption icon due to …
This commit is contained in:
commit
016f1b3467
23 changed files with 118 additions and 251 deletions
|
@ -100,6 +100,28 @@ NSString *const kMXKRoomBubbleCellVectorEditButtonPressed = @"kMXKRoomBubbleCell
|
||||||
|
|
||||||
// Available on iOS 8 and later
|
// Available on iOS 8 and later
|
||||||
[NSLayoutConstraint activateConstraints:@[rightConstraint, topConstraint, widthConstraint, heightConstraint]];
|
[NSLayoutConstraint activateConstraints:@[rightConstraint, topConstraint, widthConstraint, heightConstraint]];
|
||||||
|
|
||||||
|
// Check whether a vertical whitespace was applied to display correctly the timestamp.
|
||||||
|
if (componentIndex || bubbleData.shouldHideSenderInformation || bubbleData.shouldHideSenderName)
|
||||||
|
{
|
||||||
|
// Adjust the position of the potential encryption icon in this case.
|
||||||
|
if (self.encryptionStatusContainerView)
|
||||||
|
{
|
||||||
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
for (UIView *view in subviews)
|
||||||
|
{
|
||||||
|
// Note: The encryption icon has been tagged with the component index.
|
||||||
|
if (view.tag == componentIndex)
|
||||||
|
{
|
||||||
|
CGRect frame = view.frame;
|
||||||
|
frame.origin.y += 15;
|
||||||
|
view.frame = frame;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,14 @@ extern NSString *const kRoomEncryptedDataBubbleCellTapOnEncryptionIcon;
|
||||||
*/
|
*/
|
||||||
+ (UIImage*)encryptionIconForEvent:(MXEvent*)event andSession:(MXSession*)session;
|
+ (UIImage*)encryptionIconForEvent:(MXEvent*)event andSession:(MXSession*)session;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the encryption status icon in front of each bubble component.
|
||||||
|
|
||||||
|
@param bubbleData the bubble cell data
|
||||||
|
@param containerView the container view in which the icons will be added.
|
||||||
|
*/
|
||||||
|
+ (void)addEncryptionStatusFromBubbleData:(MXKRoomBubbleCellData *)bubbleData inContainerView:(UIView *)containerView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,4 +77,39 @@ NSString *const kRoomEncryptedDataBubbleCellTapOnEncryptionIcon = @"kRoomEncrypt
|
||||||
return [UIImage imageNamed:encryptionIcon];
|
return [UIImage imageNamed:encryptionIcon];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void)addEncryptionStatusFromBubbleData:(MXKRoomBubbleCellData *)bubbleData inContainerView:(UIView *)containerView
|
||||||
|
{
|
||||||
|
// Ensure that older subviews are removed
|
||||||
|
// They should be (they are removed when the cell is not anymore used).
|
||||||
|
// But, it seems that is not always true.
|
||||||
|
NSArray* views = [containerView subviews];
|
||||||
|
for (UIView* view in views)
|
||||||
|
{
|
||||||
|
[view removeFromSuperview];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSArray *bubbleComponents = bubbleData.bubbleComponents;
|
||||||
|
MXKRoomBubbleComponent *component;
|
||||||
|
|
||||||
|
for (NSUInteger componentIndex; componentIndex < bubbleComponents.count; componentIndex++)
|
||||||
|
{
|
||||||
|
component = bubbleComponents[componentIndex];
|
||||||
|
|
||||||
|
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
||||||
|
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
||||||
|
|
||||||
|
CGRect frame = encryptStatusImageView.frame;
|
||||||
|
frame.origin.y = component.position.y + 3;
|
||||||
|
encryptStatusImageView.frame = frame;
|
||||||
|
|
||||||
|
CGPoint center = encryptStatusImageView.center;
|
||||||
|
center.x = containerView.frame.size.width / 2;
|
||||||
|
encryptStatusImageView.center = center;
|
||||||
|
|
||||||
|
encryptStatusImageView.tag = componentIndex;
|
||||||
|
|
||||||
|
[containerView addSubview:encryptStatusImageView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomIncomingEncryptedTextMsgBubbleCell : RoomIncomingTextMsgBubbleCell
|
@interface RoomIncomingEncryptedTextMsgBubbleCell : RoomIncomingTextMsgBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,38 +40,13 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
// Ensure that older subviews are removed
|
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
|
||||||
// But, it seems that is not always true.
|
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
|
||||||
[view removeFromSuperview];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didEndDisplay
|
- (void)didEndDisplay
|
||||||
{
|
{
|
||||||
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
|
||||||
for (UIView *view in subviews)
|
for (UIView *view in subviews)
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomIncomingEncryptedTextMsgWithPaginationTitleBubbleCell : RoomIncomingTextMsgWithPaginationTitleBubbleCell
|
@interface RoomIncomingEncryptedTextMsgWithPaginationTitleBubbleCell : RoomIncomingTextMsgWithPaginationTitleBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,32 +40,19 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that older subviews are removed
|
- (void)didEndDisplay
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
{
|
||||||
// But, it seems that is not always true.
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
for (UIView *view in subviews)
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
[super didEndDisplay];
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - User actions
|
#pragma mark - User actions
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomIncomingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell : RoomIncomingTextMsgWithPaginationTitleWithoutSenderNameBubbleCell
|
@interface RoomIncomingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell : RoomIncomingTextMsgWithPaginationTitleWithoutSenderNameBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,32 +40,19 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that older subviews are removed
|
- (void)didEndDisplay
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
{
|
||||||
// But, it seems that is not always true.
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
for (UIView *view in subviews)
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
[super didEndDisplay];
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - User actions
|
#pragma mark - User actions
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomIncomingEncryptedTextMsgWithoutSenderInfoBubbleCell : RoomIncomingTextMsgWithoutSenderInfoBubbleCell
|
@interface RoomIncomingEncryptedTextMsgWithoutSenderInfoBubbleCell : RoomIncomingTextMsgWithoutSenderInfoBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,32 +40,19 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that older subviews are removed
|
- (void)didEndDisplay
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
{
|
||||||
// But, it seems that is not always true.
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
for (UIView *view in subviews)
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
[super didEndDisplay];
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - User actions
|
#pragma mark - User actions
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomIncomingEncryptedTextMsgWithoutSenderNameBubbleCell : RoomIncomingTextMsgWithoutSenderNameBubbleCell
|
@interface RoomIncomingEncryptedTextMsgWithoutSenderNameBubbleCell : RoomIncomingTextMsgWithoutSenderNameBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,32 +40,19 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that older subviews are removed
|
- (void)didEndDisplay
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
{
|
||||||
// But, it seems that is not always true.
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
for (UIView *view in subviews)
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
[super didEndDisplay];
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - User actions
|
#pragma mark - User actions
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomOutgoingEncryptedTextMsgBubbleCell : RoomOutgoingTextMsgBubbleCell
|
@interface RoomOutgoingEncryptedTextMsgBubbleCell : RoomOutgoingTextMsgBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,38 +40,13 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
// Ensure that older subviews are removed
|
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
|
||||||
// But, it seems that is not always true.
|
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
|
||||||
[view removeFromSuperview];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didEndDisplay
|
- (void)didEndDisplay
|
||||||
{
|
{
|
||||||
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
|
||||||
for (UIView *view in subviews)
|
for (UIView *view in subviews)
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomOutgoingEncryptedTextMsgWithPaginationTitleBubbleCell : RoomOutgoingTextMsgWithPaginationTitleBubbleCell
|
@interface RoomOutgoingEncryptedTextMsgWithPaginationTitleBubbleCell : RoomOutgoingTextMsgWithPaginationTitleBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -71,7 +71,6 @@
|
||||||
- (void)didEndDisplay
|
- (void)didEndDisplay
|
||||||
{
|
{
|
||||||
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
|
||||||
for (UIView *view in subviews)
|
for (UIView *view in subviews)
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomOutgoingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell : RoomOutgoingTextMsgWithPaginationTitleWithoutSenderNameBubbleCell
|
@interface RoomOutgoingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell : RoomOutgoingTextMsgWithPaginationTitleWithoutSenderNameBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,38 +40,13 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
// Ensure that older subviews are removed
|
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
|
||||||
// But, it seems that is not always true.
|
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
|
||||||
[view removeFromSuperview];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didEndDisplay
|
- (void)didEndDisplay
|
||||||
{
|
{
|
||||||
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
|
||||||
for (UIView *view in subviews)
|
for (UIView *view in subviews)
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomOutgoingEncryptedTextMsgWithoutSenderInfoBubbleCell : RoomOutgoingTextMsgWithoutSenderInfoBubbleCell
|
@interface RoomOutgoingEncryptedTextMsgWithoutSenderInfoBubbleCell : RoomOutgoingTextMsgWithoutSenderInfoBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,38 +40,13 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
// Ensure that older subviews are removed
|
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
|
||||||
// But, it seems that is not always true.
|
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
|
||||||
[view removeFromSuperview];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didEndDisplay
|
- (void)didEndDisplay
|
||||||
{
|
{
|
||||||
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
|
||||||
for (UIView *view in subviews)
|
for (UIView *view in subviews)
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
|
|
|
@ -21,6 +21,4 @@
|
||||||
*/
|
*/
|
||||||
@interface RoomOutgoingEncryptedTextMsgWithoutSenderNameBubbleCell : RoomOutgoingTextMsgWithoutSenderNameBubbleCell
|
@interface RoomOutgoingEncryptedTextMsgWithoutSenderNameBubbleCell : RoomOutgoingTextMsgWithoutSenderNameBubbleCell
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIView *encryptionStatusContainerView;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,38 +40,13 @@
|
||||||
if (bubbleData)
|
if (bubbleData)
|
||||||
{
|
{
|
||||||
// Set the right device info icon in front of each event
|
// Set the right device info icon in front of each event
|
||||||
|
[RoomEncryptedDataBubbleCell addEncryptionStatusFromBubbleData:bubbleData inContainerView:self.encryptionStatusContainerView];
|
||||||
// Ensure that older subviews are removed
|
|
||||||
// They should be (they are removed when the cell is not anymore used).
|
|
||||||
// But, it seems that is not always true.
|
|
||||||
NSArray* views = [self.encryptionStatusContainerView subviews];
|
|
||||||
for(UIView* view in views)
|
|
||||||
{
|
|
||||||
[view removeFromSuperview];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MXKRoomBubbleComponent *component in bubbleData.bubbleComponents)
|
|
||||||
{
|
|
||||||
UIImage *icon = [RoomEncryptedDataBubbleCell encryptionIconForEvent:component.event andSession:bubbleData.mxSession];
|
|
||||||
UIImageView *encryptStatusImageView = [[UIImageView alloc] initWithImage:icon];
|
|
||||||
|
|
||||||
CGRect frame = encryptStatusImageView.frame;
|
|
||||||
frame.origin.y = component.position.y + 3;
|
|
||||||
encryptStatusImageView.frame = frame;
|
|
||||||
|
|
||||||
CGPoint center = encryptStatusImageView.center;
|
|
||||||
center.x = self.encryptionStatusContainerView.frame.size.width / 2;
|
|
||||||
encryptStatusImageView.center = center;
|
|
||||||
|
|
||||||
[self.encryptionStatusContainerView addSubview:encryptStatusImageView];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didEndDisplay
|
- (void)didEndDisplay
|
||||||
{
|
{
|
||||||
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
NSArray* subviews = self.encryptionStatusContainerView.subviews;
|
||||||
|
|
||||||
for (UIView *view in subviews)
|
for (UIView *view in subviews)
|
||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
|
|
Loading…
Reference in a new issue