Call: fix conference a bit

This commit is contained in:
Gautier Pelloux-Prayer 2015-10-22 12:03:58 +02:00
parent d95028089b
commit 9e600af7d7
19 changed files with 48 additions and 53 deletions

View file

@ -101,7 +101,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<view hidden="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="9" userLabel="callView">
<rect key="frame" x="0.0" y="0.0" width="375" height="502.9999720837082"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="19" id="KPa-Rm-Qni" userLabel="nameLabel">
@ -127,16 +127,16 @@
</accessibility>
</imageView>
<view hidden="YES" contentMode="scaleToFill" id="126" userLabel="video">
<rect key="frame" x="0.0" y="0.0" width="375" height="502.9999720837082"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" id="173" userLabel="background">
<rect key="frame" x="0.0" y="0.0" width="375" height="502.9999720837082"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" id="132" userLabel="display">
<rect key="frame" x="0.0" y="0.0" width="375" height="502.9999720837082"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<accessibility key="accessibilityConfiguration">
@ -144,7 +144,7 @@
</accessibility>
</view>
<view contentMode="scaleAspectFit" id="127" userLabel="preview">
<rect key="frame" x="253.99998625559141" y="355" width="113" height="139.99999210448345"/>
<rect key="frame" x="254" y="355" width="113" height="140"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
@ -189,7 +189,7 @@
<color key="backgroundColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<button opaque="NO" tag="24" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="7f5-7T-fV3" userLabel="pauseButton" customClass="UIPauseButton">
<rect key="frame" x="310" y="369.9999720837082" width="52" height="52"/>
<rect key="frame" x="310" y="370" width="52" height="52"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<accessibility key="accessibilityConfiguration" label="Pause"/>
<state key="normal" image="pause_big_default.png">
@ -552,7 +552,7 @@
</subviews>
</view>
<view contentMode="scaleToFill" id="8q9-3P-Fz0" userLabel="lowerBar">
<rect key="frame" x="0.0" y="66" width="375" height="66"/>
<rect key="frame" x="0.0" y="64" width="375" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" tag="27" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="SRu-dB-r3e" userLabel="numpadButton" customClass="UIToggleButton">

View file

@ -98,14 +98,12 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)update {
// [self view]; // Force view load
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *uri = linphone_address_as_string_uri_only(addr);
addressLabel.text = [NSString stringWithUTF8String:uri];
ms_free(uri);
avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:NO];
avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
}
#pragma mark - Property Functions

View file

@ -55,8 +55,7 @@ static UICompositeViewDescription *compositeDescription = nil;
char *uri = linphone_address_as_string_uri_only(addr);
_addressLabel.text = [NSString stringWithUTF8String:uri];
ms_free(uri);
_avatarImage.image =
[FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
}
}

View file

@ -447,23 +447,19 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
- (void)onCurrentCallChange {
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
if (!call) {
_noActiveCallView.hidden = NO;
return;
}
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneCall *call = linphone_core_get_current_call(lc);
_callView.hidden = linphone_call_is_in_conference(call);
_conferenceView.hidden = !_callView.hidden;
_noActiveCallView.hidden = YES;
_noActiveCallView.hidden = (call || linphone_core_is_in_conference(lc));
_callView.hidden = !call;
_conferenceView.hidden = !linphone_core_is_in_conference(lc);
if (call && !linphone_call_is_in_conference(call)) {
if (!_callView.hidden) {
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *uri = linphone_address_as_string_uri_only(addr);
ms_free(uri);
_avatarImage.image =
[FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
}
}

View file

@ -189,8 +189,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:linphoneAddress];
_addressLabel.accessibilityValue = _addressLabel.text;
_avatarImage.image =
[FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:linphoneAddress] thumbnail:YES];
_avatarImage.image = [FastAddressBook imageForAddress:linphoneAddress thumbnail:YES];
}
static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *ud) {
@ -439,7 +438,7 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
}
- (IBAction)onCallClick:(id)sender {
NSString *displayName = [FastAddressBook getContactDisplayName:linphone_chat_room_get_peer_address(chatRoom)];
NSString *displayName = [FastAddressBook displayNameForAddress:linphone_chat_room_get_peer_address(chatRoom)];
// Go to dialer view
DialerView *view = VIEW(DialerView);
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];

View file

@ -649,12 +649,13 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
} else if (contactSections[section] == ContactSections_Last_Name && self.tableView.isEditing) {
text = NSLocalizedString(@"Last name", nil);
canAddEntry = NO;
} else if ([self getSectionData:section].count > 0) {
} else if ([self getSectionData:section].count > 0 || self.tableView.isEditing) {
if (contactSections[section] == ContactSections_Number) {
text = NSLocalizedString(@"Phone numbers", nil);
} else if (contactSections[section] == ContactSections_Sip) {
text = NSLocalizedString(@"SIP addresses", nil);
} else if (contactSections[section] == ContactSections_Email) {
} else if (contactSections[section] == ContactSections_Email &&
[LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"]) {
text = NSLocalizedString(@"Email addresses", nil);
}
}

View file

@ -60,7 +60,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
[PhoneMainView.instance popCurrentView];
return;
}
_avatarImage.image = [FastAddressBook getContactImage:_contact thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForContact:_contact thumbnail:NO];
[_tableController setContact:_contact];
}
@ -114,7 +114,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
_contact = NULL;
[self resetData];
_contact = acontact;
_avatarImage.image = [FastAddressBook getContactImage:_contact thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForContact:_contact thumbnail:NO];
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:acontact];
[_tableController setContact:_contact];
@ -304,6 +304,6 @@ static UICompositeViewDescription *compositeDescription = nil;
CFRelease(cfdata);
_avatarImage.image = [FastAddressBook getContactImage:_contact thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForContact:_contact thumbnail:NO];
}
@end

View file

@ -199,7 +199,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
// Cached avatar
UIImage *image = [avatarMap objectForKey:[NSNumber numberWithInt:ABRecordGetRecordID(contact)]];
if (image == nil) {
image = [FastAddressBook getContactImage:contact thumbnail:true];
image = [FastAddressBook imageForContact:contact thumbnail:true];
[avatarMap setObject:image forKey:[NSNumber numberWithInt:ABRecordGetRecordID(contact)]];
}
[cell.avatarImage setImage:image];

View file

@ -359,7 +359,8 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)call:(NSString *)address {
NSString *displayName = [FastAddressBook getContactDisplayName:[FastAddressBook getContact:address]];
ABRecordRef contact = [FastAddressBook getContact:address];
NSString *displayName = contact ? [FastAddressBook displayNameForContact:contact] : nil;
[self call:address displayName:displayName];
}

View file

@ -162,7 +162,7 @@ static UICompositeViewDescription *compositeDescription = nil;
ABRecordRef contact = [FastAddressBook getContactWithAddress:addr];
_addContactButton.hidden = (contact != nil);
[ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr];
_avatarImage.image = [FastAddressBook getContactImage:contact thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForContact:contact thumbnail:NO];
char *addrURI = linphone_address_as_string_uri_only(addr);
_addressLabel.text = [NSString stringWithUTF8String:addrURI];
ms_free(addrURI);

View file

@ -87,8 +87,9 @@
}
if ([address length] > 0) {
NSString *displayName = [FastAddressBook getContactDisplayName:[FastAddressBook getContact:address]];
[[LinphoneManager instance] call:address displayName:displayName transfer:FALSE];
ABRecordRef contact = [FastAddressBook getContact:address];
NSString *displayName = contact ? [FastAddressBook displayNameForContact:contact] : nil;
[LinphoneManager.instance call:address displayName:displayName transfer:FALSE];
}
}

View file

@ -37,7 +37,7 @@
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
_avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:YES];
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:YES];
int duration = linphone_call_get_duration(call);
[_durationLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration / 60), (duration % 60), nil]];

View file

@ -39,7 +39,7 @@
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
_avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:NO];
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
int duration = linphone_call_get_duration(call);
[_durationLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration / 60), (duration % 60), nil]];

View file

@ -110,7 +110,7 @@
[LinphoneUtils setSelfAvatar:_avatarImage];
} else {
ABRecordRef contact = [FastAddressBook getContactWithAddress:linphone_chat_message_get_peer_address(_message)];
_avatarImage.image = [FastAddressBook getContactImage:contact thumbnail:YES];
_avatarImage.image = [FastAddressBook imageForContact:contact thumbnail:YES];
}
_backgroundColorImage.image = _bottomBarColor.image = [UIImage imageNamed:(outgoing ? @"color_A" : @"color_D")];

View file

@ -71,7 +71,7 @@
}
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
[ContactDisplay setDisplayNameLabel:addressLabel forAddress:addr];
avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:NO];
avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom);
if (last_message) {

View file

@ -96,7 +96,7 @@
[ContactDisplay setDisplayNameLabel:displayNameLabel forAddress:addr];
ABRecordRef contact = [FastAddressBook getContactWithAddress:addr];
_avatarImage.image = [FastAddressBook getContactImage:contact thumbnail:TRUE];
_avatarImage.image = [FastAddressBook imageForContact:contact thumbnail:TRUE];
}
- (void)setEditing:(BOOL)editing {

View file

@ -39,8 +39,9 @@
+ (ABRecordRef)getContact:(NSString *)address;
+ (ABRecordRef)getContactWithAddress:(const LinphoneAddress *)address;
+ (NSString *)getContactDisplayName:(ABRecordRef)contact;
+ (UIImage *)getContactImage:(ABRecordRef)contact thumbnail:(BOOL)thumbnail;
+ (UIImage *)imageForContact:(ABRecordRef)contact thumbnail:(BOOL)thumbnail;
+ (UIImage *)imageForAddress:(const LinphoneAddress *)addr thumbnail:(BOOL)thumbnail;
+ (BOOL)contactHasValidSipDomain:(ABRecordRef)person;
+ (NSString *)displayNameForContact:(ABRecordRef)person;

View file

@ -26,15 +26,7 @@
static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void *context);
+ (NSString *)getContactDisplayName:(ABRecordRef)contact {
NSString *retString = nil;
if (contact) {
retString = CFBridgingRelease(ABRecordCopyCompositeName(contact));
}
return retString;
}
+ (UIImage *)getContactImage:(ABRecordRef)contact thumbnail:(BOOL)thumbnail {
+ (UIImage *)imageForContact:(ABRecordRef)contact thumbnail:(BOOL)thumbnail {
UIImage *retImage = nil;
if (contact && ABPersonHasImageData(contact)) {
NSData *imgData = CFBridgingRelease(ABPersonCopyImageDataWithFormat(
@ -51,6 +43,10 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
return retImage;
}
+ (UIImage *)imageForAddress:(const LinphoneAddress *)addr thumbnail:(BOOL)thumbnail {
return [FastAddressBook imageForContact:[FastAddressBook getContactWithAddress:addr] thumbnail:thumbnail];
}
+ (ABRecordRef)getContact:(NSString *)address {
if (LinphoneManager.instance.fastAddressBook != nil) {
@synchronized(LinphoneManager.instance.fastAddressBook.addressBookMap) {
@ -307,6 +303,9 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
NSString *lFirstName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonFirstNameProperty));
NSString *lLocalizedFirstName = [FastAddressBook localizedLabel:lFirstName];
// TODO: we may use the following so that first name / last name is properly displayed?
// retString = CFBridgingRelease(ABRecordCopyCompositeName(contact));
NSString *lLastName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonLastNameProperty));
NSString *lLocalizedLastName = [FastAddressBook localizedLabel:lLastName];

@ -1 +1 @@
Subproject commit af28361f22aef16e3b317696017463972b00acfc
Subproject commit e9c787b7990a06d7cbd715f9dce2322488661950