Merge branch 'master' of https://github.com/vector-im/element-ios into feature/3269_merge_element_1_8_18

# Conflicts:
#	Config/AppIdentifiers.xcconfig
#	Config/AppVersion.xcconfig
#	Podfile
#	Podfile.lock
#	Riot/Assets/de.lproj/Vector.strings
#	Riot/Generated/Images.swift
#	Riot/Modules/Analytics/DecryptionFailureTracker.m
#	Riot/Modules/Application/LegacyAppDelegate.h
#	Riot/Modules/Onboarding/OnboardingCoordinator.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift
#	Riot/Modules/Room/RoomViewController.m
#	Riot/SupportingFiles/Info.plist
#	Riot/Utils/EventFormatter.m
#	Riot/Utils/Tools.h
#	Riot/Utils/Tools.m
#	Riot/target.yml
#	RiotSwiftUI/Modules/Common/Mock/MockAppScreens.swift
#	fastlane/Fastfile
#	project.yml
This commit is contained in:
Frank Rotermund
2022-06-12 19:49:46 +02:00
533 changed files with 25776 additions and 3058 deletions
+171 -101
View File
@@ -106,9 +106,6 @@ static CGSize kThreadListBarButtonItemImageSize;
// The preview header
__weak PreviewRoomTitleView *previewHeader;
// The customized room data source for Vector
RoomDataSource *customizedRoomDataSource;
// The user taps on a user id contained in a message
MXKContact *selectedContact;
@@ -200,7 +197,7 @@ static CGSize kThreadListBarButtonItemImageSize;
@property (nonatomic, strong) RoomContextualMenuViewController *roomContextualMenuViewController;
@property (nonatomic, strong) RoomContextualMenuPresenter *roomContextualMenuPresenter;
@property (nonatomic, strong) MXKErrorAlertPresentation *errorPresenter;
@property (nonatomic, strong) NSString *textMessageBeforeEditing;
@property (nonatomic, strong) NSAttributedString *textMessageBeforeEditing;
@property (nonatomic, strong) EditHistoryCoordinatorBridgePresenter *editHistoryPresenter;
@property (nonatomic, strong) MXKDocumentPickerPresenter *documentPickerPresenter;
@property (nonatomic, strong) EmojiPickerCoordinatorBridgePresenter *emojiPickerCoordinatorBridgePresenter;
@@ -319,7 +316,8 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)finalizeInit
{
[super finalizeInit];
[self registerPillAttachmentViewProviderIfNeeded];
self.resizeComposerAnimationDuration = kResizeComposerAnimationDuration;
// Setup `MXKViewControllerHandling` properties
@@ -572,10 +570,10 @@ static CGSize kThreadListBarButtonItemImageSize;
[self removeTypingNotificationsListener];
if (customizedRoomDataSource)
if (self.customizedRoomDataSource)
{
// Cancel potential selected event (to leave edition mode)
if (customizedRoomDataSource.selectedEventId)
if (self.customizedRoomDataSource.selectedEventId)
{
[self cancelEventSelection];
}
@@ -673,6 +671,15 @@ static CGSize kThreadListBarButtonItemImageSize;
{
[self showThreadsNotice];
}
if (self.saveProgressTextInput && self.roomDataSource)
{
// Retrieve the potential message partially typed during last room display.
// Note: We have to wait for viewDidAppear before updating growingTextView (viewWillAppear is too early)
RoomInputToolbarView *inputToolbar = (RoomInputToolbarView *)self.inputToolbarView;
inputToolbar.attributedTextMessage = self.roomDataSource.partialAttributedTextMessage;
}
}
- (void)viewDidDisappear:(BOOL)animated
@@ -1031,7 +1038,7 @@ static CGSize kThreadListBarButtonItemImageSize;
[super displayRoom:dataSource];
customizedRoomDataSource = nil;
self.customizedRoomDataSource = nil;
if (self.roomDataSource)
{
@@ -1042,7 +1049,7 @@ static CGSize kThreadListBarButtonItemImageSize;
// Store ref on customized room data source
if ([dataSource isKindOfClass:RoomDataSource.class])
{
customizedRoomDataSource = (RoomDataSource*)dataSource;
self.customizedRoomDataSource = (RoomDataSource*)dataSource;
}
// Set room title view
@@ -1369,7 +1376,7 @@ static CGSize kThreadListBarButtonItemImageSize;
*/
// The event modified is always fetch from the actual data source
MXEvent *eventModified = [self.roomDataSource eventWithEventId:customizedRoomDataSource.selectedEventId];
MXEvent *eventModified = [self.roomDataSource eventWithEventId:self.customizedRoomDataSource.selectedEventId];
// In the case the event is a reply or and edit, and it's done on a non-live timeline
// we have to fetch live timeline in order to display the event properly
@@ -1398,7 +1405,7 @@ static CGSize kThreadListBarButtonItemImageSize;
}];
}
if (self->customizedRoomDataSource.selectedEventId)
if (self.customizedRoomDataSource.selectedEventId)
{
[self cancelEventSelection];
}
@@ -1470,10 +1477,10 @@ static CGSize kThreadListBarButtonItemImageSize;
currentAlert = nil;
}
if (customizedRoomDataSource)
if (self.customizedRoomDataSource)
{
customizedRoomDataSource.selectedEventId = nil;
customizedRoomDataSource = nil;
self.customizedRoomDataSource.selectedEventId = nil;
self.customizedRoomDataSource = nil;
}
[self removeTypingNotificationsListener];
@@ -1581,7 +1588,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (BOOL)shouldShowLiveLocationSharingBannerView
{
return customizedRoomDataSource.isCurrentUserSharingIsLocation;
return self.customizedRoomDataSource.isCurrentUserSharingActiveLocation;
}
#pragma mark - Internals
@@ -1692,7 +1699,7 @@ static CGSize kThreadListBarButtonItemImageSize;
MXCall *callInRoom = [self.roomDataSource.mxSession.callManager callInRoom:self.roomDataSource.roomId];
return (callInRoom && callInRoom.state != MXCallStateEnded)
|| customizedRoomDataSource.jitsiWidget;
|| self.customizedRoomDataSource.jitsiWidget;
}
/**
@@ -2030,7 +2037,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)handleLongPressFromCell:(id<MXKCellRendering>)cell withTappedEvent:(MXEvent*)event
{
if (event && !customizedRoomDataSource.selectedEventId)
if (event && !self.customizedRoomDataSource.selectedEventId)
{
[self showContextualMenuForEvent:event fromSingleTapGesture:NO cell:cell animated:YES];
}
@@ -2806,7 +2813,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (Class<MXKCellRendering>)cellViewClassForCellData:(MXKCellData*)cellData
{
RoomTimelineCellIdentifier cellIdentifier = [self cellIdentifierForCellData:cellData andRoomDataSource:customizedRoomDataSource];
RoomTimelineCellIdentifier cellIdentifier = [self cellIdentifierForCellData:cellData andRoomDataSource:self.customizedRoomDataSource];
RoomTimelineConfiguration *timelineConfiguration = [RoomTimelineConfiguration shared];
@@ -2973,7 +2980,7 @@ static CGSize kThreadListBarButtonItemImageSize;
}
}
#ifdef LOCATION
else if (bubbleData.tag == RoomBubbleCellDataTagLocation)
else if (bubbleData.tag == RoomBubbleCellDataTagLocation || bubbleData.tag == RoomBubbleCellDataTagLiveLocation)
{
if (bubbleData.isIncoming)
{
@@ -3200,7 +3207,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)actionIdentifier inCell:(id<MXKCellRendering>)cell userInfo:(NSDictionary *)userInfo
{
// Handle here user actions on bubbles for Vector app
if (customizedRoomDataSource)
if (self.customizedRoomDataSource)
{
id<MXKRoomBubbleCellDataStoring> bubbleData;
@@ -3225,16 +3232,40 @@ static CGSize kThreadListBarButtonItemImageSize;
[self mention:roomMember];
}
}
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellStopShareButtonPressed])
{
NSString *beaconInfoEventId;
if ([bubbleData isKindOfClass:[RoomBubbleCellData class]])
{
RoomBubbleCellData *roomBubbleCellData = (RoomBubbleCellData*)bubbleData;
beaconInfoEventId = roomBubbleCellData.beaconInfoSummary.id;
}
[self.delegate roomViewControllerDidStopLiveLocationSharing:self beaconInfoEventId:beaconInfoEventId];
}
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellRetryShareButtonPressed])
{
MXEvent *selectedEvent = userInfo[kMXKRoomBubbleCellEventKey];
if (selectedEvent)
{
// TODO: - Implement retry live location action
}
}
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnMessageTextView] || [actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnContentView])
{
// Retrieve the tapped event
MXEvent *tappedEvent = userInfo[kMXKRoomBubbleCellEventKey];
// Check whether a selection already exist or not
if (customizedRoomDataSource.selectedEventId)
if (self.customizedRoomDataSource.selectedEventId)
{
[self cancelEventSelection];
}
else if (bubbleData.tag == RoomBubbleCellDataTagLiveLocation)
{
[self.delegate roomViewController:self didRequestLiveLocationPresentationForBubbleData:bubbleData];
}
else if (tappedEvent)
{
if (tappedEvent.eventType == MXEventTypeRoomCreate)
@@ -3365,7 +3396,7 @@ static CGSize kThreadListBarButtonItemImageSize;
// We consider this tap like a selection.
// Check whether a selection already exist or not
if (customizedRoomDataSource.selectedEventId)
if (self.customizedRoomDataSource.selectedEventId)
{
[self cancelEventSelection];
}
@@ -3399,7 +3430,7 @@ static CGSize kThreadListBarButtonItemImageSize;
else if ([actionIdentifier isEqualToString:kRoomMembershipExpandedBubbleCellTapOnCollapseButton])
{
// Reset the selection before collapsing
customizedRoomDataSource.selectedEventId = nil;
self.customizedRoomDataSource.selectedEventId = nil;
[self.roomDataSource collapseRoomBubble:((MXKRoomBubbleTableViewCell*)cell).bubbleData collapsed:YES];
}
@@ -3466,7 +3497,7 @@ static CGSize kThreadListBarButtonItemImageSize;
if (granted)
{
// Present the Jitsi view controller
Widget *jitsiWidget = [self->customizedRoomDataSource jitsiWidget];
Widget *jitsiWidget = [self.customizedRoomDataSource jitsiWidget];
if (jitsiWidget)
{
[self showJitsiCallWithWidget:jitsiWidget];
@@ -3480,7 +3511,7 @@ static CGSize kThreadListBarButtonItemImageSize;
MXEvent *widgetEvent = userInfo[kMXKRoomBubbleCellEventKey];
Widget *widget = [[Widget alloc] initWithWidgetEvent:widgetEvent
inMatrixSession:customizedRoomDataSource.mxSession];
inMatrixSession:self.customizedRoomDataSource.mxSession];
[[JitsiService shared] resetDeclineForWidgetWithId:widget.widgetId];
}
else if ([actionIdentifier isEqualToString:RoomGroupCallStatusCell.leaveAction])
@@ -3492,7 +3523,7 @@ static CGSize kThreadListBarButtonItemImageSize;
{
MXEvent *widgetEvent = userInfo[kMXKRoomBubbleCellEventKey];
Widget *widget = [[Widget alloc] initWithWidgetEvent:widgetEvent
inMatrixSession:customizedRoomDataSource.mxSession];
inMatrixSession:self.customizedRoomDataSource.mxSession];
[[JitsiService shared] declineWidgetWithId:widget.widgetId];
[self reloadBubblesTable:YES];
}
@@ -3557,6 +3588,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
@@ -3565,7 +3598,7 @@ static CGSize kThreadListBarButtonItemImageSize;
[self cancelEventSelection];
[self copyEvent:selectedEvent inCell:cell];
[self copyEvent:selectedEvent inCell:cell withCellData:cellData];
}]];
}
@@ -4313,36 +4346,12 @@ static CGSize kThreadListBarButtonItemImageSize;
default:
{
MXEvent *tappedEvent = userInfo[kMXKRoomBubbleCellEventKey];
NSString *format = tappedEvent.content[@"format"];
NSString *formattedBody = tappedEvent.content[@"formatted_body"];
// if an html formatted body exists
if ([format isEqualToString:kMXRoomMessageFormatHTML] && formattedBody)
URLValidationResult *result = [URLValidator validateTappedURL:url in:tappedEvent];
if (result.shouldShowConfirmationAlert)
{
NSURL *visibleURL = [formattedBodyParser getVisibleURLForURL:url inFormattedBody:formattedBody];
if (visibleURL && ![url isEqual:visibleURL])
{
// urls are different, show confirmation alert
UIAlertController *alert = [UIAlertController alertControllerWithTitle:[VectorL10n externalLinkConfirmationTitle] message:[VectorL10n externalLinkConfirmationMessage:visibleURL.absoluteString :url.absoluteString] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *continueAction = [UIAlertAction actionWithTitle:[VectorL10n continue] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
// Try to open the link
[[UIApplication sharedApplication] vc_open:url completionHandler:^(BOOL success) {
if (!success)
{
[self showUnableToOpenLinkErrorAlert];
}
}];
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:[VectorL10n cancel] style:UIAlertActionStyleCancel handler:nil];
[alert addAction:continueAction];
[alert addAction:cancelAction];
[self presentViewController:alert animated:YES completion:nil];
return NO;
}
[self showDifferentURLsAlertFor:url
visibleURLString:result.visibleURLString];
return NO;
}
// Try to open the link
[[UIApplication sharedApplication] vc_open:url completionHandler:^(BOOL success) {
@@ -4396,8 +4405,8 @@ static CGSize kThreadListBarButtonItemImageSize;
{
[self setInputToolBarSendMode:inputToolBarSendMode forEventWithId:eventId];
customizedRoomDataSource.showBubbleDateTimeOnSelection = showTimestamp;
customizedRoomDataSource.selectedEventId = eventId;
self.customizedRoomDataSource.showBubbleDateTimeOnSelection = showTimestamp;
self.customizedRoomDataSource.selectedEventId = eventId;
// Force table refresh
[self dataSource:self.roomDataSource didCellChange:nil];
@@ -4413,9 +4422,9 @@ static CGSize kThreadListBarButtonItemImageSize;
currentAlert = nil;
}
customizedRoomDataSource.showBubbleDateTimeOnSelection = YES;
customizedRoomDataSource.selectedEventId = nil;
customizedRoomDataSource.highlightedEventId = nil;
self.customizedRoomDataSource.showBubbleDateTimeOnSelection = YES;
self.customizedRoomDataSource.selectedEventId = nil;
self.customizedRoomDataSource.highlightedEventId = nil;
[self restoreTextMessageBeforeEditing];
@@ -4437,8 +4446,8 @@ static CGSize kThreadListBarButtonItemImageSize;
if (roomInputToolbarView)
{
self.textMessageBeforeEditing = roomInputToolbarView.textMessage;
roomInputToolbarView.textMessage = [self.roomDataSource editableTextMessageForEvent:event];
self.textMessageBeforeEditing = roomInputToolbarView.attributedTextMessage;
roomInputToolbarView.attributedTextMessage = [self.customizedRoomDataSource editableAttributedTextMessageFor:event];
}
[self selectEventWithId:eventId inputToolBarSendMode:RoomInputToolbarViewSendModeEdit showTimestamp:YES];
@@ -4450,7 +4459,7 @@ static CGSize kThreadListBarButtonItemImageSize;
if (self.textMessageBeforeEditing)
{
roomInputToolbarView.textMessage = self.textMessageBeforeEditing;
roomInputToolbarView.attributedTextMessage = self.textMessageBeforeEditing;
}
self.textMessageBeforeEditing = nil;
@@ -4468,6 +4477,29 @@ static CGSize kThreadListBarButtonItemImageSize;
return roomInputToolbarView;
}
- (void)showDifferentURLsAlertFor:(NSURL *)url visibleURLString:(NSString *)visibleURLString
{
// urls are different, show confirmation alert
UIAlertController *alert = [UIAlertController alertControllerWithTitle:[VectorL10n externalLinkConfirmationTitle] message:[VectorL10n externalLinkConfirmationMessage:visibleURLString :url.absoluteString] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *continueAction = [UIAlertAction actionWithTitle:[VectorL10n continue] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
// Try to open the link
[[UIApplication sharedApplication] vc_open:url completionHandler:^(BOOL success) {
if (!success)
{
[self showUnableToOpenLinkErrorAlert];
}
}];
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:[VectorL10n cancel] style:UIAlertActionStyleCancel handler:nil];
[alert addAction:continueAction];
[alert addAction:cancelAction];
[self presentViewController:alert animated:YES completion:nil];
}
#pragma mark - RoomDataSourceDelegate
- (void)roomDataSourceDidUpdateEncryptionTrustLevel:(RoomDataSource *)roomDataSource
@@ -4627,7 +4659,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)placeCallWithVideo2:(BOOL)video
{
Widget *jitsiWidget = [customizedRoomDataSource jitsiWidget];
Widget *jitsiWidget = [self.customizedRoomDataSource jitsiWidget];
if (jitsiWidget)
{
// If there is already a Jitsi call, join it
@@ -4716,9 +4748,18 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView isTyping:(BOOL)typing
{
[super roomInputToolbarView:toolbarView isTyping:typing];
// TODO: Improve so we don't save partial message twice.
RoomInputToolbarView *inputToolbar = (RoomInputToolbarView *)toolbarView;
if (self.saveProgressTextInput && self.roomDataSource && inputToolbar)
{
// Store the potential message partially typed in text input
self.roomDataSource.partialAttributedTextMessage = inputToolbar.attributedTextMessage;
}
// Cancel potential selected event (to leave edition mode)
NSString *selectedEventId = customizedRoomDataSource.selectedEventId;
NSString *selectedEventId = self.customizedRoomDataSource.selectedEventId;
if (typing && selectedEventId && ![self.roomDataSource canReplyToEventWithId:selectedEventId])
{
[self cancelEventSelection];
@@ -4754,17 +4795,17 @@ static CGSize kThreadListBarButtonItemImageSize;
}
}
- (void)roomInputToolbarViewDidTapCancel:(MXKRoomInputToolbarView*)toolbarView
- (void)roomInputToolbarViewDidTapCancel:(RoomInputToolbarView*)toolbarView
{
[self cancelEventSelection];
}
- (void)roomInputToolbarViewDidChangeTextMessage:(MXKRoomInputToolbarView *)toolbarView
- (void)roomInputToolbarViewDidChangeTextMessage:(RoomInputToolbarView *)toolbarView
{
[self.userSuggestionCoordinator processTextMessage:toolbarView.textMessage];
}
- (void)roomInputToolbarViewDidOpenActionMenu:(MXKRoomInputToolbarView*)toolbarView
- (void)roomInputToolbarViewDidOpenActionMenu:(RoomInputToolbarView*)toolbarView
{
// Consider opening the action menu as beginning to type and share encryption keys if requested.
if ([MXKAppSettings standardAppSettings].outboundGroupSessionKeyPreSharingStrategy == MXKKeyPreSharingWhenTyping)
@@ -4773,6 +4814,11 @@ static CGSize kThreadListBarButtonItemImageSize;
}
}
- (void)roomInputToolbarView:(RoomInputToolbarView *)toolbarView sendAttributedTextMessage:(NSAttributedString *)attributedTextMessage
{
[self sendAttributedTextMessage:attributedTextMessage];
}
#pragma mark - MXKRoomMemberDetailsViewControllerDelegate
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController startChatWithMemberId:(NSString *)matrixId completion:(void (^)(void))completion
@@ -5328,7 +5374,7 @@ static CGSize kThreadListBarButtonItemImageSize;
MXStrongifyAndReturnIfNil(self);
MXCall *call = notif.object;
if ([call.room.roomId isEqualToString:self->customizedRoomDataSource.roomId])
if ([call.room.roomId isEqualToString:self.customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
@@ -5339,7 +5385,7 @@ static CGSize kThreadListBarButtonItemImageSize;
MXStrongifyAndReturnIfNil(self);
NSString *roomId = notif.object;
if ([roomId isEqualToString:self->customizedRoomDataSource.roomId])
if ([roomId isEqualToString:self.customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
}
@@ -5349,7 +5395,7 @@ static CGSize kThreadListBarButtonItemImageSize;
MXStrongifyAndReturnIfNil(self);
NSString *roomId = notif.object;
if ([roomId isEqualToString:self->customizedRoomDataSource.roomId])
if ([roomId isEqualToString:self.customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
@@ -5409,7 +5455,7 @@ static CGSize kThreadListBarButtonItemImageSize;
Widget *widget = notif.object;
if (widget.mxSession == self.roomDataSource.mxSession
&& [widget.roomId isEqualToString:self->customizedRoomDataSource.roomId])
&& [widget.roomId isEqualToString:self.customizedRoomDataSource.roomId])
{
// Call button update
[self refreshRoomTitle];
@@ -5484,16 +5530,16 @@ static CGSize kThreadListBarButtonItemImageSize;
self.activitiesViewExpanded = YES;
[roomActivitiesView displayNetworkErrorNotification:[VectorL10n roomOfflineNotification]];
}
else if (customizedRoomDataSource.roomState.isObsolete)
else if (self.customizedRoomDataSource.roomState.isObsolete)
{
self.activitiesViewExpanded = YES;
MXWeakify(self);
[roomActivitiesView displayRoomReplacementWithRoomLinkTappedHandler:^{
MXStrongifyAndReturnIfNil(self);
MXEvent *stoneTombEvent = [self->customizedRoomDataSource.roomState stateEventsWithType:kMXEventTypeStringRoomTombStone].lastObject;
MXEvent *stoneTombEvent = [self.customizedRoomDataSource.roomState stateEventsWithType:kMXEventTypeStringRoomTombStone].lastObject;
NSString *replacementRoomId = self->customizedRoomDataSource.roomState.tombStoneContent.replacementRoomId;
NSString *replacementRoomId = self.customizedRoomDataSource.roomState.tombStoneContent.replacementRoomId;
if ([self.roomDataSource.mxSession roomWithRoomId:replacementRoomId])
{
// Open the room if it is already joined
@@ -5502,7 +5548,7 @@ static CGSize kThreadListBarButtonItemImageSize;
else
{
// Else auto join it via the server that sent the event
MXLogDebug(@"[RoomVC] Auto join an upgraded room: %@ -> %@. Sender: %@", self->customizedRoomDataSource.roomState.roomId,
MXLogDebug(@"[RoomVC] Auto join an upgraded room: %@ -> %@. Sender: %@", self.customizedRoomDataSource.roomState.roomId,
replacementRoomId, stoneTombEvent.sender);
NSString *viaSenderServer = [MXTools serverNameInMatrixIdentifier:stoneTombEvent.sender];
@@ -5891,10 +5937,10 @@ static CGSize kThreadListBarButtonItemImageSize;
MXEvent *event = notif.object;
NSString *previousId = notif.userInfo[kMXEventIdentifierKey];
if ([customizedRoomDataSource.selectedEventId isEqualToString:previousId])
if ([self.customizedRoomDataSource.selectedEventId isEqualToString:previousId])
{
MXLogDebug(@"[RoomVC] eventDidChangeIdentifier: Update selectedEventId");
customizedRoomDataSource.selectedEventId = event.eventId;
self.customizedRoomDataSource.selectedEventId = event.eventId;
}
}
@@ -6104,7 +6150,7 @@ static CGSize kThreadListBarButtonItemImageSize;
if (self.roomDataSource.isLive && !self.roomDataSource.isPeeking)
{
Widget *jitsiWidget = [customizedRoomDataSource jitsiWidget];
Widget *jitsiWidget = [self.customizedRoomDataSource jitsiWidget];
if (jitsiWidget && self.canEditJitsiWidget)
{
@@ -6702,10 +6748,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;
@@ -6764,14 +6812,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)
{
@@ -6781,11 +6829,19 @@ static CGSize kThreadListBarButtonItemImageSize;
}
selectedComponent = nil;
}
NSString *textMessage = selectedComponent.textMessage;
NSAttributedString *attributedTextMessage = selectedComponent.attributedTextMessage;
if (textMessage)
if (attributedTextMessage)
{
MXKPasteboardManager.shared.pasteboard.string = textMessage;
if (@available(iOS 15.0, *))
{
MXKPasteboardManager.shared.pasteboard.string = [PillsFormatter stringByReplacingPillsIn:attributedTextMessage asMarkdown:YES];
}
else
{
MXKPasteboardManager.shared.pasteboard.string = attributedTextMessage.string;
}
}
else
{
@@ -6970,7 +7026,7 @@ static CGSize kThreadListBarButtonItemImageSize;
return;
}
self->customizedRoomDataSource.highlightedEventId = eventId;
self.customizedRoomDataSource.highlightedEventId = eventId;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
if ([[self.bubblesTableView indexPathsForVisibleRows] containsObject:indexPath])
@@ -6996,19 +7052,19 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)cancelEventHighlight
{
// if data source is highlighting an event, dismiss the highlight when user dragges the table view
if (customizedRoomDataSource.highlightedEventId)
if (self.customizedRoomDataSource.highlightedEventId)
{
NSInteger row = [self.roomDataSource indexOfCellDataWithEventId:customizedRoomDataSource.highlightedEventId];
NSInteger row = [self.roomDataSource indexOfCellDataWithEventId:self.customizedRoomDataSource.highlightedEventId];
if (row == NSNotFound)
{
customizedRoomDataSource.highlightedEventId = nil;
self.customizedRoomDataSource.highlightedEventId = nil;
return;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
if ([[self.bubblesTableView indexPathsForVisibleRows] containsObject:indexPath])
{
customizedRoomDataSource.highlightedEventId = nil;
self.customizedRoomDataSource.highlightedEventId = nil;
[self.bubblesTableView reloadRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
@@ -7413,7 +7469,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)removeJitsiWidgetViewDidCompleteSliding:(RemoveJitsiWidgetView *)view
{
view.delegate = nil;
Widget *jitsiWidget = [customizedRoomDataSource jitsiWidget];
Widget *jitsiWidget = [self.customizedRoomDataSource jitsiWidget];
[self startActivityIndicator];
@@ -7519,13 +7575,14 @@ static CGSize kThreadListBarButtonItemImageSize;
didRequestMentionForMember:(MXRoomMember *)member
textTrigger:(NSString *)textTrigger
{
if (textTrigger.length) {
NSString *textMessage = [self.inputToolbarView textMessage];
textMessage = [textMessage stringByReplacingOccurrencesOfString:textTrigger
withString:@""
options:NSBackwardsSearch | NSAnchoredSearch
range:NSMakeRange(0, textMessage.length)];
[self.inputToolbarView setTextMessage:textMessage];
RoomInputToolbarView *toolbar = (RoomInputToolbarView *)self.inputToolbarView;
if (toolbar && textTrigger.length) {
NSMutableAttributedString *attributedTextMessage = [[NSMutableAttributedString alloc] initWithAttributedString:toolbar.attributedTextMessage];
[[attributedTextMessage mutableString] replaceOccurrencesOfString:textTrigger
withString:@""
options:NSBackwardsSearch | NSAnchoredSearch
range:NSMakeRange(0, attributedTextMessage.length)];
[toolbar setAttributedTextMessage:attributedTextMessage];
}
[self mention:member];
@@ -7602,4 +7659,17 @@ static CGSize kThreadListBarButtonItemImageSize;
[self stopActivityIndicator];
}
#pragma mark - Pills
/// Register provider for Pills.
- (void)registerPillAttachmentViewProviderIfNeeded
{
if (@available(iOS 15.0, *))
{
if (![NSTextAttachment textAttachmentViewProviderClassForFileType:PillsFormatter.pillUTType])
{
[NSTextAttachment registerTextAttachmentViewProviderClass:PillAttachmentViewProvider.class forFileType:PillsFormatter.pillUTType];
}
}
}
@end