Commit 4216ecdc authored by DanmeiChen's avatar DanmeiChen
Browse files

fix devices list can not do call

parent 79362149
Pipeline #31095 passed with stage
in 3 minutes and 32 seconds
......@@ -23,9 +23,15 @@
@interface DevicesMenuEntry : NSObject {
@public
LinphoneParticipant *participant;
NSInteger numberOfDevices;
BOOL myself;
LinphoneParticipantDevice *device;
BOOL isFirst;
BOOL isUnique;
BOOL isMyself;
NSInteger index;
BOOL isListOpen;
NSString *displayName;
};
@end
@interface DevicesListView : UIViewController <UICompositeViewDelegate, UITableViewDelegate, UITableViewDataSource>
......@@ -34,7 +40,6 @@
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic) LinphoneChatRoom *room;
@property bctbx_list_t *devices;
@property NSMutableArray *devicesMenuEntries;
- (IBAction)onBackClick:(id)sender;
......
......@@ -19,18 +19,19 @@
#import "DevicesListView.h"
#import "PhoneMainView.h"
#import "UIDevicesDetails.h"
#import "UIDeviceCell.h"
@implementation DevicesMenuEntry
- (id)initWithTitle:(LinphoneParticipant *)par number:(NSInteger)num isMe:(BOOL)isMe{
if ((self = [super init])) {
participant = par;
numberOfDevices = num;
myself = isMe;
}
return self;
- (id)init:(LinphoneParticipantDevice *)dev isMe:(BOOL)isMe isFirst:(BOOL)first isUnique:(BOOL)unique index:(NSInteger)idx{
if ((self = [super init])) {
device = dev;
isMyself = isMe;
isFirst = first;
isUnique = unique;
index = idx;
isListOpen = FALSE;
}
return self;
}
@end
......@@ -64,29 +65,36 @@ static UICompositeViewDescription *compositeDescription = nil;
_tableView.delegate = self;
bctbx_list_t *participants = linphone_chat_room_get_participants(_room);
_devicesMenuEntries = [NSMutableArray array];
if (linphone_chat_room_get_capabilities(_room) & LinphoneChatRoomCapabilitiesOneToOne) {
LinphoneParticipant *firstParticipant = participants ? (LinphoneParticipant *)participants->data : NULL;
const LinphoneAddress *addr = firstParticipant ? linphone_participant_get_address(firstParticipant) : linphone_chat_room_get_peer_address(_room);
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
_devices = linphone_participant_get_devices(firstParticipant);
_addressLabel.text = [NSString stringWithFormat:NSLocalizedString(@"devices", nil)];
[_devicesMenuEntries
addObject:[[DevicesMenuEntry alloc] initWithTitle:firstParticipant number:0 isMe:FALSE]];
} else {
LinphoneParticipant *participant;
for (int i=0; i<bctbx_list_size(participants); i++) {
participant = (LinphoneParticipant *)bctbx_list_nth_data(participants,i);
[_devicesMenuEntries
addObject:[[DevicesMenuEntry alloc] initWithTitle:participant number:0 isMe:FALSE]];
}
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(_room) ?: LINPHONE_DUMMY_SUBJECT];
if (linphone_chat_room_get_capabilities(_room) & LinphoneChatRoomCapabilitiesOneToOne) {
LinphoneParticipant *firstParticipant = participants ? (LinphoneParticipant *)participants->data : NULL;
const LinphoneAddress *addr = firstParticipant ? linphone_participant_get_address(firstParticipant) : linphone_chat_room_get_peer_address(_room);
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
} else {
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(_room) ?: LINPHONE_DUMMY_SUBJECT];
_addressLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@'s devices", nil), _addressLabel.text];
}
}
LinphoneParticipant *participant;
for (int i=0; i<bctbx_list_size(participants); i++) {
participant = (LinphoneParticipant *)bctbx_list_nth_data(participants,i);
bctbx_list_t *devices = linphone_participant_get_devices(participant);
DevicesMenuEntry *entry = [[DevicesMenuEntry alloc] init:(LinphoneParticipantDevice *)bctbx_list_nth_data(devices, 0) isMe:FALSE isFirst:TRUE isUnique:(bctbx_list_size(devices)<2) index:i];
UILabel *lab = [[UILabel alloc] init];
[ContactDisplay setDisplayNameLabel:lab forAddress:linphone_participant_get_address(participant)];
entry->displayName = lab.text;
entry->participant = participant;
[_devicesMenuEntries addObject:entry];
bctbx_list_free(devices);
}
LinphoneParticipant *me = linphone_chat_room_get_me(_room);
[_devicesMenuEntries addObject:[[DevicesMenuEntry alloc] initWithTitle:me number:0 isMe:TRUE]];
bctbx_list_t *devices = linphone_participant_get_devices(me);
DevicesMenuEntry *entry = [[DevicesMenuEntry alloc] init:(LinphoneParticipantDevice *)bctbx_list_nth_data(devices, 0) isMe:TRUE isFirst:TRUE isUnique:(bctbx_list_size(devices)<2) index:bctbx_list_size(participants)];
entry->participant = me;
[_devicesMenuEntries addObject:entry];
bctbx_list_free(devices);
bctbx_list_free(participants);
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[_tableView reloadData];
......@@ -105,42 +113,65 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [_devicesMenuEntries count];
return [_devicesMenuEntries count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{
DevicesMenuEntry *entry = [_devicesMenuEntries objectAtIndex:indexPath.row];
return entry->numberOfDevices > 1 ? (entry->numberOfDevices + 1) * 56.0 : 56.0;
return 56.0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *kCellId = NSStringFromClass(UIDevicesDetails.class);
UIDevicesDetails *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
if (cell == nil) {
cell = [[UIDevicesDetails alloc] initWithIdentifier:kCellId];
}
DevicesMenuEntry *entry = [_devicesMenuEntries objectAtIndex:indexPath.row];
entry->myself ? cell.addressLabel.text = NSLocalizedString(@"Me", nil) : [ContactDisplay setDisplayNameLabel:cell.addressLabel forAddress:linphone_participant_get_address(entry->participant)];
cell.participant = entry->participant;
[cell update:(entry->numberOfDevices != 0)];
NSString *kCellId = NSStringFromClass(UIDeviceCell.class);
UIDeviceCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
if (cell == nil) {
cell = [[UIDeviceCell alloc] initWithIdentifier:kCellId];
}
DevicesMenuEntry *entry = [_devicesMenuEntries objectAtIndex:indexPath.row];
if (entry->isFirst) {
entry->isMyself ? cell.deviceLabel.text = NSLocalizedString(@"Me", nil) : [ContactDisplay setDisplayNameLabel:cell.deviceLabel forAddress:linphone_participant_get_address(entry->participant)];
}
cell.device = entry->device;
cell.isFirst = entry->isFirst;
cell.isUnique = entry->isUnique;
cell.isListOpen = entry->isListOpen;
[cell update];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
DevicesMenuEntry *entry = [_devicesMenuEntries objectAtIndex:indexPath.row];
NSInteger num = 0;
if (entry->numberOfDevices == 0) {
num = bctbx_list_size(linphone_participant_get_devices(entry->participant));
if (entry->isUnique || !entry->isFirst) {
if (!entry->device) {
LOGE(@"Can not call, because the device is null.");
[_tableView reloadData];
} else {
const LinphoneAddress *addr = linphone_participant_device_get_address(entry->device);
[CallManager.instance startCallWithAddr:(LinphoneAddress *)addr isSas:TRUE];
}
} else {
bctbx_list_t *devices = linphone_participant_get_devices(entry->participant);
if (entry->isListOpen) {
entry->isListOpen = FALSE;
[_devicesMenuEntries replaceObjectAtIndex:indexPath.row withObject:entry];
for (int i=0; i< bctbx_list_size(devices); i++) {
[_devicesMenuEntries removeObjectAtIndex:indexPath.row+1];
}
} else {
entry->isListOpen = TRUE;
[_devicesMenuEntries replaceObjectAtIndex:indexPath.row withObject:entry];
LinphoneParticipantDevice *device;
for (int i=0; i<bctbx_list_size(devices); i++) {
device = (LinphoneParticipantDevice *)bctbx_list_nth_data(devices,i);
DevicesMenuEntry *tempEntry = [[DevicesMenuEntry alloc] init:device isMe:entry->isMyself isFirst:FALSE isUnique:FALSE index:entry->index];
[_devicesMenuEntries insertObject:tempEntry atIndex:indexPath.row+i+1];
}
}
bctbx_list_free(devices);
[_tableView reloadData];
}
[_devicesMenuEntries replaceObjectAtIndex:indexPath.row withObject:[[DevicesMenuEntry alloc] initWithTitle:entry->participant number:num isMe:entry->myself]];
[_tableView reloadData];
}
@end
......@@ -19,7 +19,6 @@
#import "EphemeralSettingsView.h"
#import "PhoneMainView.h"
#import "UIDevicesDetails.h"
#import "UIDeviceCell.h"
......
......@@ -19,14 +19,20 @@
#import <UIKit/UIKit.h>
@interface UIDeviceCell : UITableViewCell <UIGestureRecognizerDelegate>
@interface UIDeviceCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIRoundedImageView *avatarImage;
@property (weak, nonatomic) IBOutlet UIImageView *securityImage;
@property (weak, nonatomic) IBOutlet UILabel *deviceLabel;
@property (weak, nonatomic) IBOutlet UIButton *securityButton;
@property (weak, nonatomic) IBOutlet UIButton *dropMenuButton;
@property LinphoneParticipantDevice *device;
@property BOOL isOneToOne;
@property BOOL isFirst;
@property BOOL isUnique;
@property BOOL isListOpen;
- (IBAction)onSecurityCallClick:(id)sender;
- (id)initWithIdentifier:(NSString *)identifier;
- (void)update;
@end
......@@ -38,30 +38,30 @@
- (void)update {
if (!_device) {
LOGE(@"Can not update, because the device is null.");
_securityButton.hidden = FALSE;
_dropMenuButton.hidden = TRUE;
return;
}
[_securityButton setImage:[FastAddressBook imageForSecurityLevel:linphone_participant_device_get_security_level(_device)] forState:UIControlStateNormal];
char *uri = linphone_address_as_string_uri_only(linphone_participant_device_get_address(_device));
_deviceLabel.text = [NSString stringWithUTF8String:linphone_participant_device_get_name(_device) ? :
uri];
ms_free(uri);
if (_isOneToOne) {
CGRect frame =_deviceLabel.frame;
frame.origin.x = 30;
_deviceLabel.frame = frame;
}
self.selectionStyle =UITableViewCellSelectionStyleNone;
UITapGestureRecognizer *particpantsBarTap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(onSecurityCallClick:)];
particpantsBarTap.delegate = self;
[self addGestureRecognizer:particpantsBarTap];
}
- (IBAction)onSecurityCallClick:(id)sender {
const LinphoneAddress *addr = linphone_participant_device_get_address(_device);
[CallManager.instance startCallWithAddr:(LinphoneAddress *)addr isSas:TRUE];
if (_isFirst) {
_securityImage.hidden = _avatarImage.hidden = FALSE;
} else {
_securityImage.hidden = _avatarImage.hidden = TRUE;
char *uri = linphone_address_as_string_uri_only(linphone_participant_device_get_address(_device));
_deviceLabel.text = [NSString stringWithUTF8String:linphone_participant_device_get_name(_device) ? :
uri];
ms_free(uri);
}
if (_isUnique || !_isFirst) {
[_securityButton setImage:[FastAddressBook imageForSecurityLevel:linphone_participant_device_get_security_level(_device)] forState:UIControlStateNormal];
_securityButton.hidden = FALSE;
_dropMenuButton.hidden = TRUE;
} else {
UIImage *image = _isListOpen ? [UIImage imageNamed:@"chevron_list_open"] : [UIImage imageNamed:@"chevron_list_close"];
[_dropMenuButton setImage:image forState:UIControlStateNormal];
_securityButton.hidden = TRUE;
_dropMenuButton.hidden = FALSE;
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIDeviceCell">
<connections>
<outlet property="deviceLabel" destination="7tu-QT-9B2" id="HXh-Cw-5Lo"/>
<outlet property="securityButton" destination="I16-aS-Ah2" id="rmi-B5-zMM"/>
<outlet property="avatarImage" destination="LRW-22-s3K" id="03I-de-Kds"/>
<outlet property="deviceLabel" destination="23h-W1-6ay" id="biw-2i-FVP"/>
<outlet property="dropMenuButton" destination="9vI-pO-DaH" id="hgj-hj-vhH"/>
<outlet property="securityButton" destination="g2C-kT-DQO" id="Q1F-Kb-WlP"/>
<outlet property="securityImage" destination="MUx-ml-Ysi" id="GXv-wg-rSU"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="Sro-AN-vkC">
<rect key="frame" x="0.0" y="0.0" width="375" height="56"/>
<view contentMode="scaleToFill" id="yLn-MV-9lL">
<rect key="frame" x="0.0" y="0.0" width="375" height="60"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="color_F.png" translatesAutoresizingMaskIntoConstraints="NO" id="GKq-qB-nT7" userLabel="selectedButtonImage">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="color_F.png" translatesAutoresizingMaskIntoConstraints="NO" id="1Md-b2-l0n" userLabel="selectedButtonImage">
<rect key="frame" x="0.0" y="55" width="375" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" fixedFrame="YES" text="John Doe" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7tu-QT-9B2" userLabel="deviceLabel">
<rect key="frame" x="69" y="16" width="220" height="24"/>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="avatar.png" translatesAutoresizingMaskIntoConstraints="NO" id="LRW-22-s3K" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="14" y="8" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="security_1_indicator.png" translatesAutoresizingMaskIntoConstraints="NO" id="MUx-ml-Ysi" userLabel="securityImage">
<rect key="frame" x="41" y="8" width="18" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" fixedFrame="YES" text="John Doe" lineBreakMode="tailTruncation" minimumFontSize="1" translatesAutoresizingMaskIntoConstraints="NO" id="23h-W1-6ay" userLabel="addressLabel">
<rect key="frame" x="69" y="16" width="237" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" name=".SFNSDisplay" family=".SF NS Display" pointSize="21"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I16-aS-Ah2" userLabel="securityButton">
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9vI-pO-DaH" userLabel="dropMenuButton">
<rect key="frame" x="336" y="24" width="18" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<state key="normal" image="chevron_list_close.png"/>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="g2C-kT-DQO" userLabel="securityButton">
<rect key="frame" x="336" y="17" width="18" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<state key="normal" image="security_1_indicator.png"/>
<connections>
<action selector="onSecurityCallClick:" destination="-1" eventType="touchUpInside" id="yLI-cZ-jfY"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="efL-ge-nWd"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="Yad-Bp-jOq"/>
<point key="canvasLocation" x="250.40000000000001" y="215.8920539730135"/>
<point key="canvasLocation" x="250.40000000000001" y="172.71364317841082"/>
</view>
</objects>
<resources>
<image name="avatar.png" width="414.39999389648438" height="414.39999389648438"/>
<image name="chevron_list_close.png" width="28" height="16"/>
<image name="color_F.png" width="2" height="2"/>
<image name="security_1_indicator.png" width="27.5" height="32.5"/>
</resources>
......
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
*
* This file is part of linphone-iphone
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import <UIKit/UIKit.h>
@interface UIDevicesDetails : UITableViewCell <UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate>
@property (weak, nonatomic) IBOutlet UIButton *dropMenuButton;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UIRoundedImageView *avatarImage;
@property (weak, nonatomic) IBOutlet UIImageView *securityImage;
@property (weak, nonatomic) IBOutlet UIButton *securityButton;
@property (weak, nonatomic) IBOutlet UITableView *devicesTable;
@property bctbx_list_t *devices;
@property LinphoneParticipant *participant;
- (IBAction)onSecurityCallClick:(id)sender;
- (id)initWithIdentifier:(NSString *)identifier;
- (void)update:(BOOL)listOpen;
@end
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
*
* This file is part of linphone-iphone
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import "UIDevicesDetails.h"
#import "UIDeviceCell.h"
@implementation UIDevicesDetails
#pragma mark - Lifecycle Functions
- (id)initWithIdentifier:(NSString *)identifier {
if ((self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]) != nil) {
NSArray *arrayOfViews =
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil];
// resize cell to match .nib size. It is needed when resized the cell to
// correctly adapt its height too
UIView *sub = ((UIView *)[arrayOfViews objectAtIndex:0]);
[self setFrame:CGRectMake(0, 0, sub.frame.size.width, sub.frame.size.height)];
[self addSubview:sub];
_devicesTable.dataSource = self;
_devicesTable.delegate = self;
}
return self;
}
- (void)update:(BOOL)listOpen {
_devices = linphone_participant_get_devices(_participant);
UIImage *image = [FastAddressBook imageForSecurityLevel:linphone_participant_get_security_level(_participant)];
if (bctbx_list_size(_devices) == 1) {
[_securityButton setImage:image forState:UIControlStateNormal];
_securityButton.hidden = FALSE;
_dropMenuButton.hidden = TRUE;
UITapGestureRecognizer *particpantsBarTap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(onSecurityCallClick:)];
particpantsBarTap.delegate = self;
[self addGestureRecognizer:particpantsBarTap];
} else {
UIImage *image = listOpen ? [UIImage imageNamed:@"chevron_list_open"] : [UIImage imageNamed:@"chevron_list_close"];
[_dropMenuButton setImage:image forState:UIControlStateNormal];
}
[_securityImage setImage:image];
}
- (IBAction)onSecurityCallClick:(id)sender {
LinphoneParticipantDevice *device = (LinphoneParticipantDevice *)bctbx_list_nth_data(_devices, 0);
const LinphoneAddress *addr = linphone_participant_device_get_address(device);
[CallManager.instance startCallWithAddr:(LinphoneAddress *)addr isSas:TRUE];
}
#pragma mark - TableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return bctbx_list_size(_devices);
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
return 56.0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *kCellId = NSStringFromClass(UIDeviceCell.class);
UIDeviceCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
if (cell == nil) {
cell = [[UIDeviceCell alloc] initWithIdentifier:kCellId];
}
LinphoneParticipantDevice *device = (LinphoneParticipantDevice *)bctbx_list_nth_data(_devices, (int)[indexPath row]);
cell.device = device;
cell.isOneToOne = FALSE;
[cell update];
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = [UIColor colorWithRed:(245 / 255.0) green:(245 / 255.0) blue:(245 / 255.0) alpha:1.0];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIDevicesDetails">
<connections>
<outlet property="addressLabel" destination="X0O-yd-2qT" id="QJ7-lu-E5n"/>
<outlet property="avatarImage" destination="gUM-dT-1wZ" id="WPF-6b-5Hv"/>
<outlet property="devicesTable" destination="Bhw-SW-cbz" id="Fc6-BV-RrV"/>
<outlet property="dropMenuButton" destination="fqu-53-vFp" id="qwN-sh-50p"/>
<outlet property="securityButton" destination="exm-bi-aEL" id="Ht8-LX-ag7"/>
<outlet property="securityImage" destination="kEm-qC-OwR" id="SYs-Vr-JdZ"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="wsb-SF-TOc">
<rect key="frame" x="0.0" y="0.0" width="375" height="156"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="color_F.png" translatesAutoresizingMaskIntoConstraints="NO" id="Uvg-tA-8Jm" userLabel="selectedButtonImage">
<rect key="frame" x="0.0" y="55" width="375" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="avatar.png" translatesAutoresizingMaskIntoConstraints="NO" id="gUM-dT-1wZ" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="14" y="8" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="security_1_indicator.png" translatesAutoresizingMaskIntoConstraints="NO" id="kEm-qC-OwR" userLabel="securityImage">
<rect key="frame" x="41" y="8" width="18" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" fixedFrame="YES" text="John Doe" lineBreakMode="tailTruncation" minimumFontSize="1" translatesAutoresizingMaskIntoConstraints="NO" id="X0O-yd-2qT" userLabel="addressLabel">
<rect key="frame" x="69" y="16" width="237" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" name=".SFNSDisplay" family=".SF NS Display" pointSize="21"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fqu-53-vFp" userLabel="dropMenuButton">
<rect key="frame" x="336" y="24" width="18" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<state key="normal" image="chevron_list_close.png"/>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="exm-bi-aEL" userLabel="securityButton">
<rect key="frame" x="336" y="17" width="18" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<state key="normal" image="security_1_indicator.png"/>
<connections>
<action selector="onSecurityCallClick:" destination="-1" eventType="touchUpInside" id="D1A-3d-K60"/>
</connections>
</button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Bhw-SW-cbz">
<rect key="frame" x="0.0" y="56" width="375" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="sectionIndexBackgroundColor" red="0.95892507685714279" green="0.95990397074285716" blue="0.96240171367142868" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</tableView>
</subviews>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="TKU-h3-Vmo"/>