Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show name of screenshare participant #1687

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NextcloudTalk/CallViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 21 additions & 4 deletions NextcloudTalk/CallViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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];
}];
Expand Down Expand Up @@ -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;}
Expand Down
33 changes: 29 additions & 4 deletions NextcloudTalk/CallViewController.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="ipad12_9rounded" orientation="portrait" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -24,6 +24,8 @@
<outlet property="lowerHandButton" destination="RpQ-sH-1qf" id="g5K-YY-Va1"/>
<outlet property="moreMenuButton" destination="Gjp-FF-fc2" id="qXV-GI-Uuu"/>
<outlet property="recordingButton" destination="aQX-QQ-eLT" id="Jh5-wa-IyR"/>
<outlet property="screenshareLabel" destination="jS8-GI-SJT" id="l5i-yo-wU9"/>
<outlet property="screenshareLabelContainer" destination="o1l-BI-9Qm" id="w1I-1t-qFm"/>
<outlet property="screenshareViewRightContraint" destination="IS9-3G-cQz" id="QGY-es-LX7"/>
<outlet property="screensharingView" destination="Zzc-Pq-hMC" id="kaT-G4-IxS"/>
<outlet property="sideBarView" destination="fSY-ZT-xIC" id="4UK-JE-3Md"/>
Expand Down Expand Up @@ -262,12 +264,35 @@
<action selector="closeScreensharingButtonPressed:" destination="-1" eventType="touchUpInside" id="Pio-Dr-GaB"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="o1l-BI-9Qm" userLabel="ScreenshareLabelContainer">
<rect key="frame" x="463.5" y="1224" width="97" height="26"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="sdfsdfsdf" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jS8-GI-SJT" userLabel="ScreenshareLabel">
<rect key="frame" x="16" y="4" width="65" height="18"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" id="fl4-VY-OBo"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.1175515647" green="0.1187154416" blue="0.1187154416" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstItem="jS8-GI-SJT" firstAttribute="leading" secondItem="o1l-BI-9Qm" secondAttribute="leading" constant="16" id="L7w-HG-xVj"/>
<constraint firstAttribute="bottom" secondItem="jS8-GI-SJT" secondAttribute="bottom" constant="4" id="TMQ-6H-QNh"/>
<constraint firstAttribute="trailing" secondItem="jS8-GI-SJT" secondAttribute="trailing" constant="16" id="dnd-lP-phb"/>
<constraint firstItem="jS8-GI-SJT" firstAttribute="top" secondItem="o1l-BI-9Qm" secondAttribute="top" constant="4" id="jNW-9o-AJP"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="j53-tu-e0T"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="j53-tu-e0T" firstAttribute="trailing" secondItem="N0N-Ny-Aeg" secondAttribute="trailing" constant="12" id="Pxi-mX-3dC"/>
<constraint firstItem="j53-tu-e0T" firstAttribute="bottom" secondItem="o1l-BI-9Qm" secondAttribute="bottom" constant="8" id="bNY-pf-A4h"/>
<constraint firstItem="N0N-Ny-Aeg" firstAttribute="top" secondItem="j53-tu-e0T" secondAttribute="top" constant="12" id="pDR-Pt-2K8"/>
<constraint firstItem="o1l-BI-9Qm" firstAttribute="centerX" secondItem="Zzc-Pq-hMC" secondAttribute="centerX" id="yHO-ZB-x8k"/>
</constraints>
</view>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TXj-7E-NAa" userLabel="LocalVideo" customClass="MTKView">
Expand Down Expand Up @@ -342,9 +367,9 @@
<image name="mic.fill" catalog="system" width="110" height="128"/>
<image name="phone.down.fill" catalog="system" width="128" height="55"/>
<image name="record.circle.fill" catalog="system" width="128" height="123"/>
<image name="speaker.slash.fill" catalog="system" width="118" height="128"/>
<image name="speaker.slash.fill" catalog="system" width="115" height="128"/>
<image name="video.fill" catalog="system" width="128" height="81"/>
<image name="video.slash.fill" catalog="system" width="128" height="103"/>
<image name="video.slash.fill" catalog="system" width="128" height="114"/>
<image name="xmark" catalog="system" width="128" height="113"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand Down
Loading