diff --git a/NextcloudTalk/CallViewController.h b/NextcloudTalk/CallViewController.h index 8cfc8a93c..ab4f0404a 100644 --- a/NextcloudTalk/CallViewController.h +++ b/NextcloudTalk/CallViewController.h @@ -59,6 +59,8 @@ @property (nonatomic, strong) IBOutlet UILabel *waitingLabel; @property (nonatomic, strong) IBOutlet NCChatTitleView *titleView; @property (nonatomic, strong) IBOutlet UILabel *callTimeLabel; +@property (nonatomic, strong) IBOutlet UIView *screenshareLabelContainer; +@property (nonatomic, strong) IBOutlet UILabel *screenshareLabel; - (instancetype)initCallInRoom:(NCRoom *)room asUser:(NSString*)displayName audioOnly:(BOOL)audioOnly; - (void)toggleChatView; diff --git a/NextcloudTalk/CallViewController.m b/NextcloudTalk/CallViewController.m index 552add3d1..66b42342f 100644 --- a/NextcloudTalk/CallViewController.m +++ b/NextcloudTalk/CallViewController.m @@ -300,6 +300,13 @@ - (void)viewDidLoad } } +- (void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + + [self.screenshareLabelContainer.layer setCornerRadius:self.screenshareLabelContainer.frame.size.height / 2]; +} + - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; @@ -1871,7 +1878,7 @@ - (void)showReaction:(CallReactionView *)callReactionView - (void)cellWantsToPresentScreenSharing:(CallParticipantViewCell *)participantCell { NCPeerConnection *peerConnection = [self peerConnectionForPeerIdentifier:participantCell.peerIdentifier]; - [self showScreenOfPeerId:peerConnection.peerId]; + [self showScreenOfPeer:peerConnection]; } - (void)cellWantsToChangeZoom:(CallParticipantViewCell *)participantCell showOriginalSize:(BOOL)showOriginalSize @@ -2063,7 +2070,7 @@ - (void)callController:(NCCallController *)callController didAddStream:(RTCMedia } else if ([remotePeer.roomType isEqualToString:kRoomTypeScreen]) { [self->_screenRenderersDict setObject:renderView forKey:remotePeer.peerId]; [self->_screenPeersInCall addObject:remotePeer]; - [self showScreenOfPeerId:remotePeer.peerId]; + [self showScreenOfPeer:remotePeer]; [self updatePeer:remotePeer block:^(CallParticipantViewCell *cell) { [cell setScreenShared:YES]; }]; @@ -2230,14 +2237,24 @@ - (void)callController:(NCCallController *)callController isSwitchingToCall:(NSS #pragma mark - Screensharing -- (void)showScreenOfPeerId:(NSString *)peerId +- (void)showScreenOfPeer:(NCPeerConnection *)peer { dispatch_async(dispatch_get_main_queue(), ^{ - RTCMTLVideoView *renderView = [self->_screenRenderersDict objectForKey:peerId]; + RTCMTLVideoView *renderView = [self->_screenRenderersDict objectForKey:peer.peerId]; [self->_screensharingView replaceContentView:renderView]; [self->_screensharingView bringSubviewToFront:self->_closeScreensharingButton]; + // The screenPeer does not have a name associated to it, try to get the nonScreenPeer + NCPeerConnection *nonScreenPeer = [self peerConnectionForPeerId:peer.peerId]; + NSString *peerDisplayName = nonScreenPeer.peerName; + if (!peerDisplayName || [peerDisplayName isKindOfClass:[NSNull class]] || [peerDisplayName isEqualToString:@""]) { + peerDisplayName = NSLocalizedString(@"Guest", nil); + } + + [self->_screenshareLabel setText:peerDisplayName]; + [self->_screensharingView bringSubviewToFront:self->_screenshareLabelContainer]; + [UIView transitionWithView:self->_screensharingView duration:0.4 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{self->_screensharingView.hidden = NO;} diff --git a/NextcloudTalk/CallViewController.xib b/NextcloudTalk/CallViewController.xib index 448f8a45d..7169e4fe0 100644 --- a/NextcloudTalk/CallViewController.xib +++ b/NextcloudTalk/CallViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -24,6 +24,8 @@ + + @@ -262,12 +264,35 @@ + + + + + + + + + + + + + + + @@ -342,9 +367,9 @@ - + - +