Merge branch 'develop' into gil/SP1_space_creation

# Conflicts:
#	Riot/Modules/People/PeopleViewController.m
#	Riot/Modules/Room/Members/RoomParticipantsViewController.m
#	Riot/Modules/Spaces/SpaceList/SpaceListViewModel.swift
This commit is contained in:
Gil Eluard
2022-02-21 17:20:58 +01:00
685 changed files with 8778 additions and 3678 deletions
+127 -63
View File
@@ -90,7 +90,7 @@ NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNo
NSNotificationName const RoomGroupCallTileTappedNotification = @"RoomGroupCallTileTappedNotification";
const NSTimeInterval kResizeComposerAnimationDuration = .05;
@interface RoomViewController () <UISearchBarDelegate, UIGestureRecognizerDelegate, UIScrollViewAccessibilityDelegate, RoomTitleViewTapGestureDelegate, RoomParticipantsViewControllerDelegate, MXKRoomMemberDetailsViewControllerDelegate, ContactsTableViewControllerDelegate, MXServerNoticesDelegate, RoomContextualMenuViewControllerDelegate,
@interface RoomViewController () <UISearchBarDelegate, UIGestureRecognizerDelegate, UIScrollViewAccessibilityDelegate, RoomTitleViewTapGestureDelegate, MXKRoomMemberDetailsViewControllerDelegate, ContactsTableViewControllerDelegate, MXServerNoticesDelegate, RoomContextualMenuViewControllerDelegate,
ReactionsMenuViewModelCoordinatorDelegate, EditHistoryCoordinatorBridgePresenterDelegate, MXKDocumentPickerPresenterDelegate, EmojiPickerCoordinatorBridgePresenterDelegate,
ReactionHistoryCoordinatorBridgePresenterDelegate, CameraPresenterDelegate, MediaPickerCoordinatorBridgePresenterDelegate,
RoomDataSourceDelegate, RoomCreationModalCoordinatorBridgePresenterDelegate, RoomInfoCoordinatorBridgePresenterDelegate, DialpadViewControllerDelegate, RemoveJitsiWidgetViewDelegate, VoiceMessageControllerDelegate, SpaceDetailPresenterDelegate, UserSuggestionCoordinatorBridgeDelegate, ThreadsCoordinatorBridgePresenterDelegate, MXThreadingServiceDelegate, RoomParticipantsInviteCoordinatorBridgePresenterDelegate>
@@ -443,7 +443,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
if (ThemeService.shared.isCurrentThemeDark)
{
[self.scrollToBottomButton setImage:[UIImage imageNamed:@"scrolldown_dark"] forState:UIControlStateNormal];
[self.scrollToBottomButton setImage:AssetImages.scrolldownDark.image forState:UIControlStateNormal];
self.jumpToLastUnreadBanner.backgroundColor = ThemeService.shared.theme.colors.navigation;
[self.jumpToLastUnreadBanner vc_removeShadow];
@@ -451,7 +451,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
else
{
[self.scrollToBottomButton setImage:[UIImage imageNamed:@"scrolldown"] forState:UIControlStateNormal];
[self.scrollToBottomButton setImage:AssetImages.scrolldown.image forState:UIControlStateNormal];
self.jumpToLastUnreadBanner.backgroundColor = ThemeService.shared.theme.colors.background;
[self.jumpToLastUnreadBanner vc_addShadowWithColor:ThemeService.shared.theme.shadowColor
@@ -1430,7 +1430,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
- (UIBarButtonItem *)videoCallBarButtonItem
{
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"video_call"]
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:AssetImages.videoCall.image
style:UIBarButtonItemStylePlain
target:self
action:@selector(onVideoCallPressed:)];
@@ -1441,7 +1441,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
- (UIBarButtonItem *)threadMoreBarButtonItem
{
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"room_context_menu_more"]
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:AssetImages.roomContextMenuMore.image
style:UIBarButtonItemStylePlain
target:self
action:@selector(onButtonPressed:)];
@@ -1453,7 +1453,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
- (BadgedBarButtonItem *)threadListBarButtonItem
{
UIButton *button = [UIButton new];
UIImage *icon = [[UIImage imageNamed:@"threads_icon"] vc_resizedWith:CGSizeMake(21, 21)];
UIImage *icon = [AssetImages.threadsIcon.image vc_resizedWith:CGSizeMake(21, 21)];
button.contentEdgeInsets = UIEdgeInsetsMake(4, 8, 4, 8);
[button setImage:icon
forState:UIControlStateNormal];
@@ -1610,7 +1610,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
if (self.roomDataSource.room.summary.membersCount.joined == 2 && self.roomDataSource.room.isDirect)
{
// voice call button for Matrix call
UIBarButtonItem *itemVoice = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"voice_call_hangon_icon"]
UIBarButtonItem *itemVoice = [[UIBarButtonItem alloc] initWithImage:AssetImages.voiceCallHangonIcon.image
style:UIBarButtonItemStylePlain
target:self
action:@selector(onVoiceCallPressed:)];
@@ -1639,7 +1639,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
{
// show Join button
CallTileActionButton *button = [CallTileActionButton new];
[button setImage:[UIImage imageNamed:@"call_video_icon"]
[button setImage:AssetImages.callVideoIcon.image
forState:UIControlStateNormal];
[button setTitle:[VectorL10n roomJoinGroupCall]
forState:UIControlStateNormal];
@@ -1661,7 +1661,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
UIBarButtonItem *item = [self videoCallBarButtonItem];
if (!self.canEditJitsiWidget)
{
item.image = [[UIImage imageNamed:@"video_call"] vc_withAlpha:0.3];
item.image = [AssetImages.videoCall.image vc_withAlpha:0.3];
}
[rightBarButtonItems addObject:item];
}
@@ -1670,7 +1670,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
if ([self widgetsCount:NO])
{
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"integrations_icon"]
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:AssetImages.integrationsIcon.image
style:UIBarButtonItemStylePlain
target:self
action:@selector(onIntegrationsPressed:)];
@@ -1989,7 +1989,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
NSMutableArray *actionItems = [NSMutableArray new];
if (RiotSettings.shared.roomScreenAllowMediaLibraryAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_media_library"] andAction:^{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionMediaLibrary.image andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
@@ -1999,7 +1999,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
if (RiotSettings.shared.roomScreenAllowStickerAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_sticker"] andAction:^{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionSticker.image andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
@@ -2009,7 +2009,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
if (RiotSettings.shared.roomScreenAllowFilesAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_file"] andAction:^{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionFile.image andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
@@ -2019,7 +2019,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
if (BuildSettings.pollsEnabled && self.displayConfiguration.sendingPollsEnabled)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_poll"] andAction:^{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionPoll.image andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
@@ -2029,7 +2029,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
if (BuildSettings.locationSharingEnabled)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_location"] andAction:^{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionLocation.image andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
@@ -2039,7 +2039,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
if (RiotSettings.shared.roomScreenAllowCameraAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_camera"] andAction:^{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:AssetImages.actionCamera.image andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
@@ -2556,7 +2556,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
else
{
previewHeader.roomAvatarPlaceholder = [MXKTools paintImage:[UIImage imageNamed:@"placeholder"]
previewHeader.roomAvatarPlaceholder = [MXKTools paintImage:AssetImages.placeholder.image
withColor:ThemeService.shared.theme.tintColor];
}
}
@@ -2588,7 +2588,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
self.bubblesTableViewTopConstraint.constant = self.previewHeaderContainerHeightConstraint.constant - self.bubblesTableView.adjustedContentInset.top;
previewHeader.roomAvatar.alpha = 1;
self->previewHeader.roomAvatar.alpha = 1;
// Force to render the view
[self forceLayoutRefresh];
@@ -2752,17 +2752,35 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
else if (bubbleData.tag == RoomBubbleCellDataTagPoll)
{
if (bubbleData.isPaginationFirstBubble)
if (bubbleData.isIncoming)
{
cellIdentifier = RoomTimelineCellIdentifierPollWithPaginationTitle;
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = RoomTimelineCellIdentifierPollWithoutSenderInfo;
if (bubbleData.isPaginationFirstBubble)
{
cellIdentifier = RoomTimelineCellIdentifierIncomingPollWithPaginationTitle;
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = RoomTimelineCellIdentifierIncomingPollWithoutSenderInfo;
}
else
{
cellIdentifier = RoomTimelineCellIdentifierIncomingPoll;
}
}
else
{
cellIdentifier = RoomTimelineCellIdentifierPoll;
if (bubbleData.isPaginationFirstBubble)
{
cellIdentifier = RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle;
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = RoomTimelineCellIdentifierOutgoingPollWithoutSenderInfo;
}
else
{
cellIdentifier = RoomTimelineCellIdentifierOutgoingPoll;
}
}
}
else if (bubbleData.tag == RoomBubbleCellDataTagLocation)
@@ -2798,6 +2816,61 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
}
}
else if (roomBubbleCellData.getFirstBubbleComponentWithDisplay.event.isEmote)
{
if (bubbleData.isIncoming)
{
if (bubbleData.isPaginationFirstBubble)
{
if (bubbleData.shouldHideSenderName)
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierIncomingEmoteEncryptedWithPaginationTitleWithoutSenderName : RoomTimelineCellIdentifierIncomingEmoteWithPaginationTitleWithoutSenderName;
}
else
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierIncomingEmoteEncryptedWithPaginationTitle : RoomTimelineCellIdentifierIncomingEmoteWithPaginationTitle;
}
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierIncomingEmoteEncryptedWithoutSenderInfo : RoomTimelineCellIdentifierIncomingEmoteWithoutSenderInfo;
}
else if (bubbleData.shouldHideSenderName)
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierIncomingEmoteEncryptedWithoutSenderName : RoomTimelineCellIdentifierIncomingEmoteWithoutSenderName;
}
else
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierIncomingEmoteEncrypted : RoomTimelineCellIdentifierIncomingEmote;
}
}
else
{
if (bubbleData.isPaginationFirstBubble)
{
if (bubbleData.shouldHideSenderName)
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierOutgoingEmoteEncryptedWithPaginationTitleWithoutSenderName : RoomTimelineCellIdentifierOutgoingEmoteWithPaginationTitleWithoutSenderName;
}
else
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierOutgoingEmoteEncryptedWithPaginationTitle : RoomTimelineCellIdentifierOutgoingEmoteWithPaginationTitle;
}
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierOutgoingEmoteEncryptedWithoutSenderInfo : RoomTimelineCellIdentifierOutgoingEmoteWithoutSenderInfo;
}
else if (bubbleData.shouldHideSenderName)
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierOutgoingEmoteEncryptedWithoutSenderName : RoomTimelineCellIdentifierOutgoingEmoteWithoutSenderName;
}
else
{
cellIdentifier = showEncryptionBadge ? RoomTimelineCellIdentifierOutgoingEmoteEncrypted : RoomTimelineCellIdentifierOutgoingEmote;
}
}
}
else if (bubbleData.isIncoming)
{
if (bubbleData.isAttachmentWithThumbnail)
@@ -3647,7 +3720,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
{
MXKPasteboardManager.shared.pasteboard.URL = url;
[self.view vc_toastWithMessage:VectorL10n.roomEventCopyLinkInfo
image:[UIImage imageNamed:@"link_icon"]
image:AssetImages.linkIcon.image
duration:2.0
position:ToastPositionBottom
additionalMargin:self.roomInputToolbarContainerHeightConstraint.constant];
@@ -4213,7 +4286,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self updateTitleViewEncryptionDecoration];
}
- (void)roomDataSource:(RoomDataSource *)roomDataSource didTapThread:(MXThread *)thread
- (void)roomDataSource:(RoomDataSource *)roomDataSource didTapThread:(id<MXThreadProtocol>)thread
{
[self openThreadWithId:thread.id];
}
@@ -4494,6 +4567,15 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self.userSuggestionCoordinator processTextMessage:toolbarView.textMessage];
}
- (void)roomInputToolbarViewDidOpenActionMenu:(MXKRoomInputToolbarView*)toolbarView
{
// Consider opening the action menu as beginning to type and share encryption keys if requested.
if ([MXKAppSettings standardAppSettings].outboundGroupSessionKeyPreSharingStrategy == MXKKeyPreSharingWhenTyping)
{
[self shareEncryptionKeys];
}
}
#pragma mark - MXKRoomMemberDetailsViewControllerDelegate
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController startChatWithMemberId:(NSString *)matrixId completion:(void (^)(void))completion
@@ -5665,6 +5747,8 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
self->encryptionInfoView = encryptionInfoView;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:encryptionInfoView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
@@ -5680,6 +5764,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
attribute:NSLayoutAttributeTop
multiplier:1.0f
constant:-10.0f]];
#pragma clang diagnostic pop
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view
attribute:NSLayoutAttributeLeading
@@ -5739,44 +5824,23 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
- (void)animateReadMarkerView
{
// Check whether the cell with the read marker is known and if the marker is not animated yet.
if (readMarkerTableViewCell && readMarkerTableViewCell.readMarkerView.isHidden)
if (!readMarkerTableViewCell || readMarkerTableViewCell.readMarkerView.isHidden == NO)
{
RoomBubbleCellData *cellData = (RoomBubbleCellData*)readMarkerTableViewCell.bubbleData;
// Do not display the marker if this is the last message.
if (cellData.containsLastMessage && readMarkerTableViewCell.readMarkerView.tag == cellData.mostRecentComponentIndex)
{
readMarkerTableViewCell.readMarkerView.hidden = YES;
readMarkerTableViewCell = nil;
}
else
{
readMarkerTableViewCell.readMarkerView.hidden = NO;
// Animate the layout to hide the read marker
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseIn
animations:^{
readMarkerTableViewCell.readMarkerViewLeadingConstraint.constant = readMarkerTableViewCell.readMarkerViewTrailingConstraint.constant = readMarkerTableViewCell.bubbleOverlayContainer.frame.size.width / 2;
readMarkerTableViewCell.readMarkerView.alpha = 0;
// Force to render the view
[readMarkerTableViewCell.bubbleOverlayContainer layoutIfNeeded];
}
completion:^(BOOL finished){
readMarkerTableViewCell.readMarkerView.hidden = YES;
readMarkerTableViewCell.readMarkerView.alpha = 1;
readMarkerTableViewCell = nil;
}];
});
}
return;
}
RoomBubbleCellData *cellData = (RoomBubbleCellData*)readMarkerTableViewCell.bubbleData;
id<RoomTimelineCellDecorator> cellDecorator = [RoomTimelineConfiguration shared].currentStyle.cellDecorator;
[cellDecorator dissmissReadMarkerViewForCell:readMarkerTableViewCell
cellData:cellData
animated:YES
completion:^{
self->readMarkerTableViewCell = nil;
}];
}
- (void)refreshRemoveJitsiWidgetView