Add the ability to present room chat while in a call.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2020-05-22 09:55:34 +02:00
Родитель cf4a44936b
Коммит 88df7ffa9f
6 изменённых файлов: 65 добавлений и 0 удалений

Просмотреть файл

@ -41,6 +41,7 @@ typedef NS_ENUM(NSInteger, CallState) {
NSMutableDictionary *_videoRenderersDict;
NSMutableDictionary *_screenRenderersDict;
NCCallController *_callController;
NCChatViewController *_chatViewController;
ARDCaptureController *_captureController;
UIView <RTCVideoRenderer> *_screenView;
CGSize _screensharingSize;
@ -60,6 +61,7 @@ typedef NS_ENUM(NSInteger, CallState) {
@property (nonatomic, strong) IBOutlet UIButton *switchCameraButton;
@property (nonatomic, strong) IBOutlet UIButton *hangUpButton;
@property (nonatomic, strong) IBOutlet UIButton *videoCallButton;
@property (nonatomic, strong) IBOutlet UIButton *chatButton;
@property (nonatomic, strong) IBOutlet UICollectionView *collectionView;
@property (nonatomic, strong) IBOutlet UICollectionViewFlowLayout *flowLayout;
@ -119,6 +121,7 @@ typedef NS_ENUM(NSInteger, CallState) {
[self.videoDisableButton.layer setCornerRadius:30.0f];
[self.hangUpButton.layer setCornerRadius:30.0f];
[self.videoCallButton.layer setCornerRadius:30.0f];
[self.chatButton.layer setCornerRadius:30.0f];
[self.closeScreensharingButton.layer setCornerRadius:16.0f];
self.audioMuteButton.accessibilityLabel = @"Microphone";
@ -134,6 +137,8 @@ typedef NS_ENUM(NSInteger, CallState) {
self.hangUpButton.accessibilityHint = @"Doble tap to hang up the call";
self.videoCallButton.accessibilityLabel = @"Camera";
self.videoCallButton.accessibilityHint = @"Doble tap to upgrade this voice call to a video call";
self.chatButton.accessibilityLabel = @"Chat";
self.chatButton.accessibilityHint = @"Doble tap to show call's chat";
[self adjustButtonsConainer];
@ -715,6 +720,32 @@ typedef NS_ENUM(NSInteger, CallState) {
[self hangup];
}
- (IBAction)chatButtonPressed:(id)sender
{
[self toggleChatView];
}
- (void)toggleChatView
{
if (!_chatViewController) {
_chatViewController = [[NCChatViewController alloc] initForRoom:_room];
[self addChildViewController:_chatViewController];
[self.view addSubview:_chatViewController.view];
_chatViewController.view.frame = self.view.bounds;
_chatViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[_chatViewController didMoveToParentViewController:self];
[self.view bringSubviewToFront:_chatButton];
} else {
[_chatViewController willMoveToParentViewController:nil];
[_chatViewController.view removeFromSuperview];
[_chatViewController removeFromParentViewController];
_chatViewController = nil;
}
}
- (void)finishCall
{
_callController = nil;

Просмотреть файл

@ -15,6 +15,7 @@
<outlet property="audioMuteButton" destination="kDR-Ds-I7B" id="9NJ-iO-JMY"/>
<outlet property="avatarBackgroundImageView" destination="H1v-6g-V21" id="ASI-wy-zPa"/>
<outlet property="buttonsContainerView" destination="ybF-7q-HlR" id="8Mk-fB-QML"/>
<outlet property="chatButton" destination="iRE-oh-vZ4" id="EfP-bT-Oeo"/>
<outlet property="closeScreensharingButton" destination="N0N-Ny-Aeg" id="NrD-JV-Hec"/>
<outlet property="collectionView" destination="aUh-Z0-hO6" id="jmc-BV-dTa"/>
<outlet property="hangUpButton" destination="Rl8-bS-FJ5" id="jNg-Ly-6wz"/>
@ -80,6 +81,15 @@
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="j53-tu-e0T"/>
</view>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iRE-oh-vZ4">
<rect key="frame" x="307" y="68" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.60784313729999995" green="0.60784313729999995" blue="0.60784313729999995" alpha="0.74973244859999999" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" image="chat"/>
<connections>
<action selector="chatButtonPressed:" destination="-1" eventType="touchUpInside" id="KhR-dg-Tez"/>
</connections>
</button>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ybF-7q-HlR">
<rect key="frame" x="37" y="477" width="300" height="170"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
@ -159,6 +169,7 @@
</objects>
<resources>
<image name="audio" width="24" height="24"/>
<image name="chat" width="24" height="24"/>
<image name="close" width="24" height="24"/>
<image name="hang-up" width="24" height="24"/>
<image name="speaker-off" width="24" height="24"/>

23
VideoCalls/Images.xcassets/chat.imageset/Contents.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "chat.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "chat@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "chat@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Двоичные данные
VideoCalls/Images.xcassets/chat.imageset/chat.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 419 B

Двоичные данные
VideoCalls/Images.xcassets/chat.imageset/chat@2x.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 710 B

Двоичные данные
VideoCalls/Images.xcassets/chat.imageset/chat@3x.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.0 KiB