mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
chat view
This commit is contained in:
parent
10310ac56f
commit
53950de526
9 changed files with 65 additions and 200 deletions
|
|
@ -8,8 +8,9 @@
|
|||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="HistoryDetailsViewController">
|
||||
<connections>
|
||||
<outlet property="addContactButton" destination="50" id="52"/>
|
||||
<outlet property="addressLabel" destination="25" id="42"/>
|
||||
<outlet property="addressLabel" destination="EoB-ux-sD7" id="Ajw-2s-M6X"/>
|
||||
<outlet property="avatarImage" destination="23" id="43"/>
|
||||
<outlet property="contactLabel" destination="25" id="rTL-Ut-42o"/>
|
||||
<outlet property="headerView" destination="33" id="iv2-Rj-j3j"/>
|
||||
<outlet property="tableView" destination="baU-d4-eu3" id="3q4-5X-yCB"/>
|
||||
<outlet property="view" destination="4" id="10"/>
|
||||
|
|
@ -49,11 +50,11 @@
|
|||
</view>
|
||||
<view contentMode="scaleToFill" id="33" userLabel="headerView">
|
||||
<rect key="frame" x="0.0" y="40" width="360" height="146"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="avatar.png" id="23" userLabel="avatarImage" customClass="UIRoundedImageView">
|
||||
<rect key="frame" x="144" y="0.0" width="65" height="65"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact avatar">
|
||||
<accessibilityTraits key="traits" none="YES" image="YES" notEnabled="YES"/>
|
||||
<bool key="isElement" value="YES"/>
|
||||
|
|
@ -61,7 +62,7 @@
|
|||
</imageView>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="25" userLabel="contactLabel">
|
||||
<rect key="frame" x="0.0" y="68" width="352" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact name"/>
|
||||
<attributedString key="attributedText">
|
||||
<fragment content="John ">
|
||||
|
|
@ -83,7 +84,7 @@
|
|||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="johndoe@sip.linphone.org" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="EoB-ux-sD7" userLabel="addressLabel">
|
||||
<rect key="frame" x="4" y="88" width="352" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact name"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="10"/>
|
||||
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
|
|
@ -91,7 +92,7 @@
|
|||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="linphone_user.png" id="mfN-Ai-9RX" userLabel="linphoneImage" customClass="UIRoundedImageView">
|
||||
<rect key="frame" x="217" y="23" width="20" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact avatar">
|
||||
<accessibilityTraits key="traits" none="YES" image="YES" notEnabled="YES"/>
|
||||
<bool key="isElement" value="YES"/>
|
||||
|
|
@ -99,17 +100,23 @@
|
|||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5eX-W0-T4B" userLabel="callButton">
|
||||
<rect key="frame" x="130" y="104" width="42" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Button" image="call_start_body_default.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onCallClick:" destination="-1" eventType="touchUpInside" id="Vlx-14-3CH"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="obZ-W7-q8P" userLabel="chatButton">
|
||||
<rect key="frame" x="180" y="104" width="42" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Button" image="chat_start_body_default.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onChatClick:" destination="-1" eventType="touchUpInside" id="Dd5-7a-ev8"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
LinphoneCallLog *log = [[callLogs objectAtIndex:[indexPath row]] pointerValue];
|
||||
int duration = linphone_call_log_get_duration(log);
|
||||
time_t callTime = linphone_call_log_get_start_date(log);
|
||||
|
||||
cell.textLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[cell.textLabel
|
||||
setText:[NSString stringWithFormat:@"%@ - %d sec",
|
||||
[LinphoneUtils timeToString:callTime withStyle:NSDateFormatterMediumStyle],
|
||||
|
|
|
|||
|
|
@ -29,18 +29,9 @@
|
|||
LinphoneCallLog *callLog;
|
||||
NSDateFormatter *dateFormatter;
|
||||
}
|
||||
@property(weak, nonatomic) IBOutlet UILabel *contactLabel;
|
||||
@property (nonatomic, strong) IBOutlet UIImageView *avatarImage;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *addressLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *dateLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *dateHeaderLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *durationLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *durationHeaderLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *typeLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *typeHeaderLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *plainAddressLabel;
|
||||
@property (nonatomic, strong) IBOutlet UILabel *plainAddressHeaderLabel;
|
||||
@property (nonatomic, strong) IBOutlet UIButton *callButton;
|
||||
@property (nonatomic, strong) IBOutlet UIButton *messageButton;
|
||||
@property (nonatomic, strong) IBOutlet UIButton *addContactButton;
|
||||
@property (nonatomic, copy, setter=setCallLogId:) NSString *callLogId;
|
||||
@property(weak, nonatomic) IBOutlet UIView *headerView;
|
||||
|
|
@ -48,10 +39,9 @@
|
|||
@property(strong, nonatomic) IBOutlet HistoryDetailsTableViewController *tableView;
|
||||
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
- (IBAction)onContactClick:(id)event;
|
||||
- (IBAction)onAddContactClick:(id)event;
|
||||
- (IBAction)onCallClick:(id)event;
|
||||
- (IBAction)onMessageClick:(id)event;
|
||||
- (IBAction)onChatClick:(id)event;
|
||||
- (void)setCallLogId:(NSString *)acallLogId;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -25,21 +25,6 @@
|
|||
@implementation HistoryDetailsViewController {
|
||||
}
|
||||
|
||||
@synthesize callLogId;
|
||||
@synthesize avatarImage;
|
||||
@synthesize addressLabel;
|
||||
@synthesize dateLabel;
|
||||
@synthesize dateHeaderLabel;
|
||||
@synthesize durationLabel;
|
||||
@synthesize durationHeaderLabel;
|
||||
@synthesize typeLabel;
|
||||
@synthesize typeHeaderLabel;
|
||||
@synthesize plainAddressLabel;
|
||||
@synthesize plainAddressHeaderLabel;
|
||||
@synthesize callButton;
|
||||
@synthesize messageButton;
|
||||
@synthesize addContactButton;
|
||||
|
||||
#pragma mark - LifeCycle Functions
|
||||
|
||||
- (id)init {
|
||||
|
|
@ -78,7 +63,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark - Property Functions
|
||||
|
||||
- (void)setCallLogId:(NSString *)acallLogId {
|
||||
self->callLogId = [acallLogId copy];
|
||||
_callLogId = [acallLogId copy];
|
||||
[self update];
|
||||
}
|
||||
|
||||
|
|
@ -90,11 +75,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
UITapGestureRecognizer *headerTapGesture =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onContactClick:)];
|
||||
[_headerView addGestureRecognizer:headerTapGesture];
|
||||
|
||||
[HistoryDetailsViewController adaptSize:dateHeaderLabel field:dateLabel];
|
||||
[HistoryDetailsViewController adaptSize:durationHeaderLabel field:durationLabel];
|
||||
[HistoryDetailsViewController adaptSize:typeHeaderLabel field:typeLabel];
|
||||
[HistoryDetailsViewController adaptSize:plainAddressHeaderLabel field:plainAddressLabel];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
|
@ -102,7 +82,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
BOOL use_system = [[LinphoneManager instance] lpConfigBoolForKey:@"use_system_contacts"];
|
||||
if (use_system) {
|
||||
[addContactButton setHidden:TRUE];
|
||||
_addContactButton.hidden = TRUE;
|
||||
}
|
||||
|
||||
[_tableView loadData];
|
||||
|
|
@ -158,129 +138,41 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[field setFrame:fieldFrame];
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
|
||||
- (void)retrieveCallLog {
|
||||
// Look for the call log
|
||||
callLog = NULL;
|
||||
const MSList *list = linphone_core_get_call_logs([LinphoneManager getLc]);
|
||||
while (list != NULL) {
|
||||
LinphoneCallLog *log = (LinphoneCallLog *)list->data;
|
||||
const char *cid = linphone_call_log_get_call_id(log);
|
||||
if (cid != NULL && [callLogId isEqualToString:[NSString stringWithUTF8String:cid]]) {
|
||||
if (cid != NULL && [_callLogId isEqualToString:[NSString stringWithUTF8String:cid]]) {
|
||||
callLog = log;
|
||||
break;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
// Pop if callLog is null
|
||||
[self retrieveCallLog];
|
||||
if (callLog == NULL) {
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
// this address should NEVER be NULL: if this assert is broken, the bug is elsewhere.
|
||||
assert(addr != NULL);
|
||||
|
||||
UIImage *image = nil;
|
||||
NSString *address = nil;
|
||||
if (addr != NULL) {
|
||||
BOOL useLinphoneAddress = true;
|
||||
// contact name
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress) {
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
|
||||
contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if (contact) {
|
||||
image = [FastAddressBook getContactImage:contact thumbnail:true];
|
||||
address = [FastAddressBook getContactDisplayName:contact];
|
||||
useLinphoneAddress = false;
|
||||
}
|
||||
ms_free(lAddress);
|
||||
}
|
||||
if (useLinphoneAddress) {
|
||||
const char *lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char *lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName)
|
||||
address = [NSString stringWithUTF8String:lDisplayName];
|
||||
else if (lUserName)
|
||||
address = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
[FastAddressBook setDisplayNameLabel:_contactLabel forAddress:addr];
|
||||
_avatarImage.image = [FastAddressBook avatarForAddress:addr];
|
||||
char *addrURI = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:addrURI];
|
||||
ms_free(addrURI);
|
||||
|
||||
// Set Image
|
||||
if (image == nil) {
|
||||
image = [UIImage imageNamed:@"avatar_unknown.png"];
|
||||
}
|
||||
[avatarImage setImage:image];
|
||||
|
||||
// Set Address
|
||||
if (address == nil) {
|
||||
address = NSLocalizedString(@"Unknown", nil);
|
||||
}
|
||||
[addressLabel setText:address];
|
||||
|
||||
// Hide/Show add button
|
||||
BOOL use_system = [[LinphoneManager instance] lpConfigBoolForKey:@"use_system_contacts"];
|
||||
if (contact) {
|
||||
[addContactButton setHidden:TRUE];
|
||||
} else if (!use_system) {
|
||||
[addContactButton setHidden:FALSE];
|
||||
}
|
||||
|
||||
// State
|
||||
NSMutableString *state = [NSMutableString string];
|
||||
if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) {
|
||||
[state setString:NSLocalizedString(@"Incoming call", nil)];
|
||||
} else {
|
||||
[state setString:NSLocalizedString(@"Outgoing call", nil)];
|
||||
}
|
||||
switch (linphone_call_log_get_status(callLog)) {
|
||||
case LinphoneCallSuccess:
|
||||
break;
|
||||
case LinphoneCallAborted:
|
||||
[state appendString:NSLocalizedString(@" (Aborted)", nil)];
|
||||
break;
|
||||
case LinphoneCallMissed:
|
||||
[state appendString:NSLocalizedString(@" (Missed)", nil)];
|
||||
break;
|
||||
case LinphoneCallDeclined:
|
||||
[state appendString:NSLocalizedString(@" (Declined)", nil)];
|
||||
break;
|
||||
}
|
||||
[typeLabel setText:state];
|
||||
|
||||
// Date
|
||||
NSDate *startData = [NSDate dateWithTimeIntervalSince1970:linphone_call_log_get_start_date(callLog)];
|
||||
[dateLabel setText:[dateFormatter stringFromDate:startData]];
|
||||
|
||||
// Duration
|
||||
int duration = linphone_call_log_get_duration(callLog);
|
||||
[durationLabel
|
||||
setText:[NSString stringWithFormat:@"%02i:%02i", (duration / 60), duration - 60 * (duration / 60), nil]];
|
||||
|
||||
// contact name
|
||||
[plainAddressLabel setText:@""];
|
||||
if (addr != NULL) {
|
||||
if ([[LinphoneManager instance] lpConfigBoolForKey:@"contact_display_username_only"]) {
|
||||
[plainAddressLabel setText:[NSString stringWithUTF8String:linphone_address_get_username(addr)
|
||||
? linphone_address_get_username(addr)
|
||||
: ""]];
|
||||
} else {
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress != NULL) {
|
||||
[plainAddressLabel setText:[NSString stringWithUTF8String:lAddress]];
|
||||
ms_free(lAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (addr != NULL) {
|
||||
[callButton setHidden:FALSE];
|
||||
[messageButton setHidden:FALSE];
|
||||
} else {
|
||||
[callButton setHidden:TRUE];
|
||||
[messageButton setHidden:TRUE];
|
||||
}
|
||||
_addContactButton.hidden = contact || use_system;
|
||||
}
|
||||
|
||||
#pragma mark - Action Functions
|
||||
|
|
@ -315,51 +207,31 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[ContactSelection setSipFilter:nil];
|
||||
[ContactSelection enableEmailFilter:FALSE];
|
||||
[ContactSelection setNameOrEmailFilter:nil];
|
||||
ContactsViewController *controller = DYNAMIC_CAST(
|
||||
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]
|
||||
push:TRUE],
|
||||
ContactsViewController);
|
||||
if (controller != nil) {
|
||||
}
|
||||
DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]
|
||||
push:TRUE],
|
||||
ContactsViewController);
|
||||
ms_free(lAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onCallClick:(id)event {
|
||||
LinphoneAddress *addr;
|
||||
addr = linphone_call_log_get_remote_address(callLog);
|
||||
|
||||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress == NULL)
|
||||
return;
|
||||
|
||||
NSString *displayName = nil;
|
||||
if (contact != nil) {
|
||||
displayName = [FastAddressBook getContactDisplayName:contact];
|
||||
} else {
|
||||
const char *lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char *lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName)
|
||||
displayName = [NSString stringWithUTF8String:lDisplayName];
|
||||
else if (lUserName)
|
||||
displayName = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
NSString *displayName = [FastAddressBook displayNameForAddress:addr];
|
||||
|
||||
DialerViewController *controller =
|
||||
DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]],
|
||||
DialerViewController);
|
||||
if (controller != nil) {
|
||||
if (displayName != nil) {
|
||||
[controller call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
|
||||
} else {
|
||||
[controller call:[NSString stringWithUTF8String:lAddress]];
|
||||
}
|
||||
[controller call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
|
||||
}
|
||||
ms_free(lAddress);
|
||||
}
|
||||
|
||||
- (IBAction)onMessageClick:(id)event {
|
||||
- (IBAction)onChatClick:(id)event {
|
||||
LinphoneAddress *addr;
|
||||
addr = linphone_call_log_get_remote_address(callLog);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
_chatLatestTimeLabel.hidden = NO;
|
||||
} else {
|
||||
chatContentLabel.text = nil;
|
||||
_chatLatestTimeLabel.hidden = YES;
|
||||
_chatLatestTimeLabel.text = NSLocalizedString(@"Now", nil);
|
||||
}
|
||||
|
||||
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
|
||||
|
|
|
|||
|
|
@ -46,4 +46,7 @@
|
|||
+ (BOOL)contactHasValidSipDomain:(ABRecordRef)person;
|
||||
+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr;
|
||||
+ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact;
|
||||
+ (NSString *)displayNameForAddress:(const LinphoneAddress *)addr;
|
||||
+ (NSString *)displayNameForContact:(ABRecordRef)contact;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -312,6 +312,14 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
|
|||
}
|
||||
|
||||
+ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact {
|
||||
label.text = [FastAddressBook displayNameForContact:contact];
|
||||
NSString *lLastName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonLastNameProperty));
|
||||
NSString *lLocalizedLastName = [FastAddressBook localizedLabel:lLastName];
|
||||
[label boldSubstring:lLocalizedLastName];
|
||||
}
|
||||
|
||||
+ (NSString *)displayNameForContact:(ABRecordRef)contact {
|
||||
NSString *ret = nil;
|
||||
if (contact != nil) {
|
||||
NSString *lFirstName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonFirstNameProperty));
|
||||
NSString *lLocalizedFirstName = [FastAddressBook localizedLabel:lFirstName];
|
||||
|
|
@ -323,16 +331,16 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
|
|||
NSString *lLocalizedOrganization = [FastAddressBook localizedLabel:lOrganization];
|
||||
|
||||
if (lLocalizedFirstName == nil && lLocalizedLastName == nil) {
|
||||
label.text = (NSString *)lLocalizedOrganization;
|
||||
ret = (NSString *)lLocalizedOrganization;
|
||||
} else {
|
||||
label.text = [NSString stringWithFormat:@"%@ %@", lLocalizedFirstName, lLocalizedLastName];
|
||||
[label boldSubstring:lLocalizedLastName];
|
||||
ret = [NSString stringWithFormat:@"%@ %@", lLocalizedFirstName, lLocalizedLastName];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr {
|
||||
label.text = NSLocalizedString(@"Unknown", nil);
|
||||
+ (NSString *)displayNameForAddress:(const LinphoneAddress *)addr {
|
||||
NSString *ret = NSLocalizedString(@"Unknown", nil);
|
||||
if (addr != NULL) {
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress) {
|
||||
|
|
@ -340,18 +348,22 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
|
|||
ms_free(lAddress);
|
||||
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if (contact) {
|
||||
[FastAddressBook setDisplayNameLabel:label forContact:contact];
|
||||
return;
|
||||
return [FastAddressBook displayNameForContact:contact];
|
||||
}
|
||||
}
|
||||
const char *lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char *lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName) {
|
||||
label.text = [NSString stringWithUTF8String:lDisplayName];
|
||||
ret = [NSString stringWithUTF8String:lDisplayName];
|
||||
} else if (lUserName) {
|
||||
label.text = [NSString stringWithUTF8String:lUserName];
|
||||
ret = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr {
|
||||
label.text = [FastAddressBook displayNameForAddress:addr];
|
||||
}
|
||||
|
||||
+ (UIImage *)avatarForAddress:(const LinphoneAddress *)addr {
|
||||
|
|
|
|||
|
|
@ -244,8 +244,6 @@
|
|||
634CEE161B6630DB00D7A921 /* valid.png in Resources */ = {isa = PBXBuildFile; fileRef = 634CED911B6630DB00D7A921 /* valid.png */; };
|
||||
634CEE171B6630DB00D7A921 /* voicemail.png in Resources */ = {isa = PBXBuildFile; fileRef = 634CED921B6630DB00D7A921 /* voicemail.png */; };
|
||||
635775251B6673EC00C8B704 /* HistoryDetailsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 635775241B6673EC00C8B704 /* HistoryDetailsTableViewController.m */; };
|
||||
6357752E1B6676C200C8B704 /* UIHistoryDetailsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6357752D1B6676C200C8B704 /* UIHistoryDetailsCell.m */; };
|
||||
635775311B66777200C8B704 /* UIHistoryDetailsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6357752F1B66777200C8B704 /* UIHistoryDetailsCell.xib */; };
|
||||
636316D11A1DEBCB0009B839 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D31A1DEBCB0009B839 /* AboutViewController.xib */; };
|
||||
636316D41A1DEC650009B839 /* SettingsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D61A1DEC650009B839 /* SettingsViewController.xib */; };
|
||||
636316D91A1DECC90009B839 /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D71A1DECC90009B839 /* PhoneMainView.xib */; };
|
||||
|
|
@ -803,9 +801,6 @@
|
|||
634CED921B6630DB00D7A921 /* voicemail.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = voicemail.png; sourceTree = "<group>"; };
|
||||
635775231B6673EC00C8B704 /* HistoryDetailsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryDetailsTableViewController.h; sourceTree = "<group>"; };
|
||||
635775241B6673EC00C8B704 /* HistoryDetailsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryDetailsTableViewController.m; sourceTree = "<group>"; };
|
||||
6357752C1B6676C200C8B704 /* UIHistoryDetailsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIHistoryDetailsCell.h; sourceTree = "<group>"; };
|
||||
6357752D1B6676C200C8B704 /* UIHistoryDetailsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIHistoryDetailsCell.m; sourceTree = "<group>"; };
|
||||
635775301B66777200C8B704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/UIHistoryDetailsCell.xib; sourceTree = "<group>"; };
|
||||
636316D21A1DEBCB0009B839 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AboutViewController.xib; sourceTree = "<group>"; };
|
||||
636316D51A1DEC650009B839 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SettingsViewController.xib; sourceTree = "<group>"; };
|
||||
636316D81A1DECC90009B839 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PhoneMainView.xib; sourceTree = "<group>"; };
|
||||
|
|
@ -1448,9 +1443,6 @@
|
|||
340751E6150F38FD00B89C47 /* UIVideoButton.m */,
|
||||
634610041B61330300548952 /* UILabel+Boldify.h */,
|
||||
634610051B61330300548952 /* UILabel+Boldify.m */,
|
||||
6357752C1B6676C200C8B704 /* UIHistoryDetailsCell.h */,
|
||||
6357752D1B6676C200C8B704 /* UIHistoryDetailsCell.m */,
|
||||
6357752F1B66777200C8B704 /* UIHistoryDetailsCell.xib */,
|
||||
);
|
||||
path = LinphoneUI;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -2201,7 +2193,6 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
634CEE161B6630DB00D7A921 /* valid.png in Resources */,
|
||||
635775311B66777200C8B704 /* UIHistoryDetailsCell.xib in Resources */,
|
||||
634CEDC71B6630DB00D7A921 /* delete.png in Resources */,
|
||||
636316D11A1DEBCB0009B839 /* AboutViewController.xib in Resources */,
|
||||
634CEDF31B6630DB00D7A921 /* options_start_conference.png in Resources */,
|
||||
|
|
@ -2569,7 +2560,6 @@
|
|||
D3ED40191602172200BF332B /* HPGrowingTextView.m in Sources */,
|
||||
D3ED401B1602172200BF332B /* HPTextViewInternal.m in Sources */,
|
||||
D37EE162160377D7003608A6 /* DTActionSheet.m in Sources */,
|
||||
6357752E1B6676C200C8B704 /* UIHistoryDetailsCell.m in Sources */,
|
||||
D35E91F4160CA10B0023116B /* UILinphoneTextField.m in Sources */,
|
||||
D35E91F8160CA4FF0023116B /* UILinphoneButton.m in Sources */,
|
||||
D306459E1611EC2A00BB571E /* UILoadingImageView.m in Sources */,
|
||||
|
|
@ -2701,14 +2691,6 @@
|
|||
name = OutgoingCallViewController.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6357752F1B66777200C8B704 /* UIHistoryDetailsCell.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
635775301B66777200C8B704 /* Base */,
|
||||
);
|
||||
name = UIHistoryDetailsCell.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
636316D31A1DEBCB0009B839 /* AboutViewController.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue