send initial invite to create a chatroom

This commit is contained in:
Benjamin Reis 2017-10-06 15:19:20 +02:00
parent e77ad93331
commit b454580caa
11 changed files with 125 additions and 14 deletions

View file

@ -18,5 +18,6 @@
@property(strong, nonatomic) IBOutlet ChatConversationCreateConfirmCollectionViewController *collectionController;
- (IBAction)onBackClick:(id)sender;
- (IBAction)onValidateClick:(id)sender;
- (void)deleteContact:(NSString *)uri;
@end

View file

@ -50,9 +50,9 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void) viewWillAppear:(BOOL)animated {
for(id uri in _contacts.allKeys) {
[_collectionController.collectionView registerClass:UIChatCreateConfirmCollectionViewCell.class forCellWithReuseIdentifier:uri];
if(![_contactsGroup containsObject:_contacts[uri]])
[_contactsGroup addObject:_contacts[uri]];
[_collectionView registerClass:UIChatCreateConfirmCollectionViewCell.class forCellWithReuseIdentifier:uri];
if(![_contactsGroup containsObject:uri])
[_contactsGroup addObject:uri];
}
[_collectionView reloadData];
}
@ -73,6 +73,21 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (IBAction)onValidateClick:(id)sender {
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, _nameField.text.UTF8String);
bctbx_list_t *addresses = NULL;
for (id object in _contactsGroup) {
LinphoneAddress *addr = linphone_address_new(((NSString *)object).UTF8String);
if(addresses)
bctbx_list_append(addresses, addr);
else
addresses = bctbx_list_new(addr);
}
linphone_chat_room_add_participants(room, addresses);
}
- (void)deleteContact:(NSString *)uri {
[_contacts removeObjectForKey:uri];
[_contactsGroup removeObject:uri];
[_collectionView reloadData];
}
@ -97,6 +112,7 @@ static UICompositeViewDescription *compositeDescription = nil;
NSString *uri = _contactsGroup[indexPath.item];
UIChatCreateConfirmCollectionViewCell *cell = (UIChatCreateConfirmCollectionViewCell *)[_collectionView dequeueReusableCellWithReuseIdentifier:uri forIndexPath:indexPath];
cell.uri = uri;
cell.confirmController = self;
cell = [cell initWithName:_contacts[uri]];
return cell;
}

View file

@ -26,6 +26,17 @@
<rect key="frame" x="0.0" y="42" width="375" height="559"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vxZ-Pk-gLv" userLabel="addedContacts" customClass="UICollectionView">
<rect key="frame" x="8" y="112" width="359" height="439"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<accessibility key="accessibilityConfiguration" label="addedContacts"/>
</view>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fb4-Ne-SMe">
<rect key="frame" x="0.0" y="56" width="375" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2Kg-fP-a78" userLabel="topBar">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
@ -75,12 +86,6 @@
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next" enablesReturnKeyAutomatically="YES"/>
</textField>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vxZ-Pk-gLv" userLabel="addedContacts" customClass="UICollectionView">
<rect key="frame" x="8" y="112" width="359" height="439"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<accessibility key="accessibilityConfiguration" label="addedContacts"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>

View file

@ -63,9 +63,15 @@
LOGW(@"Cannot update chat cell: null chat");
return;
}
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
if(linphone_chat_room_get_nb_participants(chatRoom) > 1) {
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom)];
[_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES];
} else {
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
}
LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom);
if (last_message) {

View file

@ -7,6 +7,11 @@
#import <UIKit/UIKit.h>
#import "UIChatCreateCollectionViewCell.h"
#import "ChatConversationCreateConfirmView.h"
@interface UIChatCreateConfirmCollectionViewCell : UIChatCreateCollectionViewCell
@interface UIChatCreateConfirmCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *displayNameLabel;
@property (strong, nonatomic) ChatConversationCreateConfirmView *confirmController;
@property (strong, nonatomic) NSString *uri;
- (id)initWithName:(NSString *)identifier;
@end

View file

@ -9,8 +9,25 @@
@implementation UIChatCreateConfirmCollectionViewCell
- (void)onDelete {
- (id)initWithName:(NSString *)identifier {
if (self != nil) {
NSArray *arrayOfViews =
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil];
if ([arrayOfViews count] >= 1) {
UIChatCreateCollectionViewCell *sub = ((UIChatCreateCollectionViewCell *)[arrayOfViews objectAtIndex:0]);
[self addSubview:sub];
_displayNameLabel = sub.nameLabel;
}
}
[_displayNameLabel setText:identifier];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDelete)];
tap.numberOfTouchesRequired = 1;
[self addGestureRecognizer:tap];
return self;
}
- (void)onDelete {
[_confirmController deleteContact:_uri];
}
@end

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIChatCreateConfirmCollectionViewCell">
<connections>
<outlet property="displayNameLabel" destination="Wm0-Lb-XxP" id="TAE-Sa-n0a"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="blP-I3-gjJ" customClass="UIChatCreateCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="100" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="100" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="John Doe" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wm0-Lb-XxP" userLabel="displayNameLabel">
<rect key="frame" x="14" y="18" width="92" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" fixedFrame="YES" image="conference_delete.png" translatesAutoresizingMaskIntoConstraints="NO" id="uyA-OW-PoB" userLabel="selectedImage">
<rect key="frame" x="1" y="23" width="10" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
</view>
<size key="customSize" width="170" height="45"/>
<connections>
<outlet property="nameLabel" destination="Wm0-Lb-XxP" id="MAU-k0-kts"/>
</connections>
<point key="canvasLocation" x="2" y="86"/>
</collectionViewCell>
</objects>
<resources>
<image name="conference_delete.png" width="11" height="11"/>
</resources>
</document>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -30,6 +30,7 @@ deliver_imdn=1
[misc]
#by default it is set to 30 by liblinphone
history_max_size=-1
conference_factory_uri=sips:conference-factory@sip.linphone.org
[sound]
dtmf_player_amp=0.007

View file

@ -626,6 +626,9 @@
8C2595DD1DEDC92D007A6424 /* ProviderDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2595DC1DEDC92D007A6424 /* ProviderDelegate.m */; };
8C2595DF1DEDCC8E007A6424 /* CallKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C2595DE1DEDCC8E007A6424 /* CallKit.framework */; };
8C2595E11DEDDC67007A6424 /* callkit_logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2595E01DEDDC67007A6424 /* callkit_logo.png */; };
8C2A81921F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81911F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib */; };
8C2A81951F87B8000012A66B /* chat_group_avatar@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81931F87B7FF0012A66B /* chat_group_avatar@2x.png */; };
8C2A81961F87B8000012A66B /* chat_group_avatar.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81941F87B8000012A66B /* chat_group_avatar.png */; };
8C300D9A1E40E0CC00728EF3 /* lime_ko.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C300D981E40E0CC00728EF3 /* lime_ko.png */; };
8C300D9B1E40E0CC00728EF3 /* lime_ko@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C300D991E40E0CC00728EF3 /* lime_ko@2x.png */; };
8C3EA9E31EB892D600B732B6 /* msamr.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C3EA9E01EB892D600B732B6 /* msamr.framework */; };
@ -1672,6 +1675,9 @@
8C2595DC1DEDC92D007A6424 /* ProviderDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProviderDelegate.m; sourceTree = "<group>"; };
8C2595DE1DEDCC8E007A6424 /* CallKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CallKit.framework; path = System/Library/Frameworks/CallKit.framework; sourceTree = SDKROOT; };
8C2595E01DEDDC67007A6424 /* callkit_logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = callkit_logo.png; sourceTree = "<group>"; };
8C2A81911F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UIChatCreateConfirmCollectionViewCell.xib; sourceTree = "<group>"; };
8C2A81931F87B7FF0012A66B /* chat_group_avatar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "chat_group_avatar@2x.png"; sourceTree = "<group>"; };
8C2A81941F87B8000012A66B /* chat_group_avatar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_group_avatar.png; sourceTree = "<group>"; };
8C300D981E40E0CC00728EF3 /* lime_ko.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lime_ko.png; sourceTree = "<group>"; };
8C300D991E40E0CC00728EF3 /* lime_ko@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lime_ko@2x.png"; sourceTree = "<group>"; };
8C3EA9E01EB892D600B732B6 /* msamr.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = msamr.framework; path = "liblinphone-sdk/apple-darwin/Frameworks/msamr.framework"; sourceTree = "<group>"; };
@ -2184,6 +2190,7 @@
8C9C5E101F83BD97006987FA /* UIChatCreateCollectionViewCell.xib */,
8CD3F5AA1F86632100680C98 /* UIChatCreateConfirmCollectionViewCell.h */,
8CD3F5AB1F86632100680C98 /* UIChatCreateConfirmCollectionViewCell.m */,
8C2A81911F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib */,
63B8D69F1BCBF43100C12B09 /* UIChatCreateCell.h */,
63B8D6A01BCBF43100C12B09 /* UIChatCreateCell.m */,
639E9CA81C0DB7F200019A75 /* UIChatCreateCell.xib */,
@ -2436,6 +2443,8 @@
633FEBE11D3CD5570014B822 /* images */ = {
isa = PBXGroup;
children = (
8C2A81941F87B8000012A66B /* chat_group_avatar.png */,
8C2A81931F87B7FF0012A66B /* chat_group_avatar@2x.png */,
8CB2B8F61F86229B0015CEE2 /* chat_secure.png */,
8CB2B8F71F86229C0015CEE2 /* next_disabled.png */,
8CB2B8F81F86229D0015CEE2 /* next_disabled@2x.png */,
@ -3534,6 +3543,7 @@
633FEDA51D3CD5590014B822 /* back_default@2x.png in Resources */,
633FEF311D3CD55A0014B822 /* route_speaker_disabled@2x.png in Resources */,
633FEEE41D3CD55A0014B822 /* numpad_9_default@2x.png in Resources */,
8C2A81961F87B8000012A66B /* chat_group_avatar.png in Resources */,
633FEDA31D3CD5590014B822 /* avatar~ipad@2x.png in Resources */,
633FEF461D3CD55A0014B822 /* speaker_disabled.png in Resources */,
638F1A911C21993D004B8E02 /* UICompositeView~ipad.xib in Resources */,
@ -3632,6 +3642,7 @@
633FEDE11D3CD5590014B822 /* call_start_body_over~ipad@2x.png in Resources */,
633FEF4F1D3CD55A0014B822 /* valid_default@2x.png in Resources */,
633FEE241D3CD5590014B822 /* chat_start_body_over~ipad.png in Resources */,
8C2A81951F87B8000012A66B /* chat_group_avatar@2x.png in Resources */,
633FEE091D3CD5590014B822 /* chat_add_disabled@2x.png in Resources */,
633FEE191D3CD5590014B822 /* chat_send_over@2x.png in Resources */,
633FEF181D3CD55A0014B822 /* pause_small_over_selected.png in Resources */,
@ -3682,6 +3693,7 @@
633FEE291D3CD5590014B822 /* checkbox_unchecked@2x.png in Resources */,
63AADC001B6A0FF200AA16FD /* assistant_linphone_create.rc in Resources */,
633FEF1C1D3CD55A0014B822 /* presence_offline.png in Resources */,
8C2A81921F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib in Resources */,
633FEE901D3CD55A0014B822 /* list_details_over.png in Resources */,
633FEDE31D3CD5590014B822 /* call_status_incoming@2x.png in Resources */,
633FEE821D3CD5590014B822 /* led_disconnected.png in Resources */,