merged element-ios 1.10.5 into 4409_basis_update_1_10_5

This commit is contained in:
Arnfried Griesert
2023-03-16 12:19:26 +01:00
168 changed files with 2451 additions and 850 deletions
+70 -7
View File
@@ -188,6 +188,9 @@ static CGSize kThreadListBarButtonItemImageSize;
// Time to display notification content in the timeline
MXTaskProfile *notificationTaskProfile;
// Observe kMXEventTypeStringRoomMember events
__weak id roomMemberEventListener;
}
@property (nonatomic, strong) RemoveJitsiWidgetView *removeJitsiWidgetView;
@@ -236,6 +239,9 @@ static CGSize kThreadListBarButtonItemImageSize;
// scroll state just before the layout change, and restore it after the layout.
@property (nonatomic) BOOL wasScrollAtBottomBeforeLayout;
// Check if we should wait for other participants
@property (nonatomic, readonly) BOOL shouldWaitForOtherParticipants;
@end
@implementation RoomViewController
@@ -332,6 +338,7 @@ static CGSize kThreadListBarButtonItemImageSize;
_showMissedDiscussionsBadge = YES;
_scrollToBottomHidden = YES;
_isWaitingForOtherParticipants = NO;
// Listen to the event sent state changes
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eventDidChangeSentState:) name:kMXEventDidChangeSentStateNotification object:nil];
@@ -381,7 +388,10 @@ static CGSize kThreadListBarButtonItemImageSize;
// Prepare missed dicussion badge (if any)
self.showMissedDiscussionsBadge = _showMissedDiscussionsBadge;
// Refresh the waiting for other participants state
[self refreshWaitForOtherParticipantsState];
// Set up the room title view according to the data source (if any)
[self refreshRoomTitle];
@@ -1214,9 +1224,9 @@ static CGSize kThreadListBarButtonItemImageSize;
BOOL canSend = (userPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsMessage:kMXEventTypeStringRoomMessage]);
BOOL isRoomObsolete = self.roomDataSource.roomState.isObsolete;
BOOL isResourceLimitExceeded = [self.roomDataSource.mxSession.syncError.errcode isEqualToString:kMXErrCodeStringResourceLimitExceeded];
BOOL isResourceLimitExceeded = [self.roomDataSource.mxSession.syncError.errcode isEqualToString:kMXErrCodeStringResourceLimitExceeded];
if (isRoomObsolete || isResourceLimitExceeded)
if (isRoomObsolete || isResourceLimitExceeded || _isWaitingForOtherParticipants)
{
roomInputToolbarViewClass = nil;
shouldDismissContextualMenu = YES;
@@ -1552,6 +1562,8 @@ static CGSize kThreadListBarButtonItemImageSize;
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXEventDidChangeSentStateNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXEventDidChangeIdentifierNotification object:nil];
[self waitForOtherParticipant:NO];
[super destroy];
}
@@ -1658,6 +1670,57 @@ static CGSize kThreadListBarButtonItemImageSize;
return self.customizedRoomDataSource.isCurrentUserSharingActiveLocation;
}
#pragma mark - Wait for 3rd party invitee
- (void)setIsWaitingForOtherParticipants:(BOOL)isWaitingForOtherParticipants
{
if (_isWaitingForOtherParticipants == isWaitingForOtherParticipants)
{
return;
}
_isWaitingForOtherParticipants = isWaitingForOtherParticipants;
[self updateRoomInputToolbarViewClassIfNeeded];
if (_isWaitingForOtherParticipants)
{
if (self->roomMemberEventListener == nil)
{
MXWeakify(self);
self->roomMemberEventListener = [self.roomDataSource.room listenToEventsOfTypes:@[kMXEventTypeStringRoomMember] onEvent:^(MXEvent *event, MXTimelineDirection direction, MXRoomState *roomState) {
MXStrongifyAndReturnIfNil(self);
if (direction != MXTimelineDirectionForwards)
{
return;
}
[self refreshWaitForOtherParticipantsState];
}];
}
}
else
{
if (self->roomMemberEventListener != nil)
{
[self.roomDataSource.room removeListener:self->roomMemberEventListener];
self->roomMemberEventListener = nil;
}
}
}
- (BOOL)shouldWaitForOtherParticipants
{
MXRoomState *roomState = self.roomDataSource.roomState;
BOOL isDirect = self.roomDataSource.room.isDirect;
// Wait for the other participant only if it is a direct encrypted room with only one member waiting for a third party guest.
return (isDirect && roomState.isEncrypted && roomState.membersCount.members == 1 && roomState.thirdPartyInvites.count > 0);
}
- (void)refreshWaitForOtherParticipantsState
{
[self waitForOtherParticipant:self.shouldWaitForOtherParticipants];
}
#pragma mark - Internals
- (UIBarButtonItem *)videoCallBarButtonItem
@@ -1976,7 +2039,7 @@ static CGSize kThreadListBarButtonItemImageSize;
[self refreshMissedDiscussionsCount:YES];
// bwi: check if threads are enabled
if (self.showThreadOption)
if (self.showThreadOption && !_isWaitingForOtherParticipants)
{
if (self.roomDataSource.threadId)
{
@@ -2289,8 +2352,8 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)showRoomInfoWithInitialSection:(RoomInfoSection)roomInfoSection animated:(BOOL)animated
{
RoomInfoCoordinatorParameters *parameters = [[RoomInfoCoordinatorParameters alloc] initWithSession:self.roomDataSource.mxSession room:self.roomDataSource.room parentSpaceId:self.parentSpaceId initialSection:roomInfoSection];
RoomInfoCoordinatorParameters *parameters = [[RoomInfoCoordinatorParameters alloc] initWithSession:self.roomDataSource.mxSession room:self.roomDataSource.room parentSpaceId:self.parentSpaceId initialSection:roomInfoSection canAddParticipants: !self.isWaitingForOtherParticipants];
self.roomInfoCoordinatorBridgePresenter = [[RoomInfoCoordinatorBridgePresenter alloc] initWithParameters:parameters];
self.roomInfoCoordinatorBridgePresenter.delegate = self;
@@ -7509,7 +7572,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (void)updateThreadListBarButtonItem:(UIBarButtonItem *)barButtonItem with:(MXThreadingService *)service
{
if (!service)
if (!service || _isWaitingForOtherParticipants)
{
return;
}