copy not working in > iOS 15

This commit is contained in:
Shunmugaraj
2022-03-22 10:49:32 +03:00
committed by Stefan Ceriu
parent b510e66e00
commit 8ce6a1c1c6
+9 -5
View File
@@ -3519,6 +3519,8 @@ static CGSize kThreadListBarButtonItemImageSize;
BOOL showThreadOption = [self showThreadOptionForEvent:selectedEvent];
if (showThreadOption && [self canCopyEvent:selectedEvent andCell:cell])
{
MXKRoomBubbleTableViewCell *roomBubbleTableViewCell = (MXKRoomBubbleTableViewCell *)cell;
MXKRoomBubbleCellData *cellData = roomBubbleTableViewCell.bubbleData;
[self.eventMenuBuilder addItemWithType:EventMenuItemTypeCopy
action:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionCopy]
style:UIAlertActionStyleDefault
@@ -3527,7 +3529,7 @@ static CGSize kThreadListBarButtonItemImageSize;
[self cancelEventSelection];
[self copyEvent:selectedEvent inCell:cell];
[self copyEvent:selectedEvent inCell:cell withCellData:cellData];
}]];
}
@@ -6678,10 +6680,12 @@ static CGSize kThreadListBarButtonItemImageSize;
RoomContextualMenuItem *copyMenuItem = [[RoomContextualMenuItem alloc] initWithMenuAction:RoomContextualMenuActionCopy];
copyMenuItem.isEnabled = [self canCopyEvent:event andCell:cell];
MXKRoomBubbleTableViewCell *roomBubbleTableViewCell = (MXKRoomBubbleTableViewCell *)cell;
MXKRoomBubbleCellData *cellData = roomBubbleTableViewCell.bubbleData;
copyMenuItem.action = ^{
MXStrongifyAndReturnIfNil(self);
[self copyEvent:event inCell:cell];
[self copyEvent:event inCell:cell withCellData:cellData];
};
return copyMenuItem;
@@ -6739,14 +6743,14 @@ static CGSize kThreadListBarButtonItemImageSize;
return result;
}
- (void)copyEvent:(MXEvent*)event inCell:(id<MXKCellRendering>)cell
- (void)copyEvent:(MXEvent*)event inCell:(id<MXKCellRendering>)cell withCellData:(MXKRoomBubbleCellData *)cellData
{
MXKRoomBubbleTableViewCell *roomBubbleTableViewCell = (MXKRoomBubbleTableViewCell *)cell;
MXKAttachment *attachment = roomBubbleTableViewCell.bubbleData.attachment;
MXKAttachment *attachment = cellData.attachment;
if (!attachment)
{
NSArray *components = roomBubbleTableViewCell.bubbleData.bubbleComponents;
NSArray *components = cellData.bubbleComponents;
MXKRoomBubbleComponent *selectedComponent;
for (selectedComponent in components)
{