mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Add filter on email addresses in contact list.
This commit is contained in:
parent
027b640476
commit
b30b94d5c7
7 changed files with 26 additions and 1 deletions
|
|
@ -123,6 +123,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[ContactSelection setSelectionMode:ContactSelectionModeMessage];
|
||||
[ContactSelection setAddAddress:nil];
|
||||
[ContactSelection setSipFilter:TRUE];
|
||||
[ContactSelection setEmailFilter:FALSE];
|
||||
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE];
|
||||
} else {
|
||||
[self startChatRoom];
|
||||
|
|
|
|||
|
|
@ -78,8 +78,10 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
NSArray *lContacts = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
|
||||
for (id lPerson in lContacts) {
|
||||
BOOL add = true;
|
||||
if([ContactSelection getSipFilter]) {
|
||||
if([ContactSelection getSipFilter] || [ContactSelection getEmailFilter]) {
|
||||
add = false;
|
||||
}
|
||||
if([ContactSelection getSipFilter]) {
|
||||
ABMultiValueRef lMap = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonInstantMessageProperty);
|
||||
for(int i = 0; i < ABMultiValueGetCount(lMap); ++i) {
|
||||
CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, i);
|
||||
|
|
@ -97,6 +99,12 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
CFRelease(lDict);
|
||||
}
|
||||
}
|
||||
if ((add == false) && [ContactSelection getEmailFilter]) {
|
||||
ABMultiValueRef lMap = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonEmailProperty);
|
||||
if (ABMultiValueGetCount(lMap) > 0) {
|
||||
add = true;
|
||||
}
|
||||
}
|
||||
if(add) {
|
||||
CFStringRef lFirstName = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonFirstNameProperty);
|
||||
CFStringRef lLocalizedFirstName = (lFirstName != nil)? ABAddressBookCopyLocalizedLabel(lFirstName): nil;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ typedef enum _ContactSelectionMode {
|
|||
+ (NSString*)getAddAddress;
|
||||
+ (void)setSipFilter:(BOOL)enable;
|
||||
+ (BOOL)getSipFilter;
|
||||
+ (void)setEmailFilter:(BOOL)enable;
|
||||
+ (BOOL)getEmailFilter;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
static ContactSelectionMode sSelectionMode = ContactSelectionModeNone;
|
||||
static NSString* sAddAddress = nil;
|
||||
static BOOL sSipFilter = FALSE;
|
||||
static BOOL sEmailFilter = FALSE;
|
||||
|
||||
+ (void)setSelectionMode:(ContactSelectionMode)selectionMode {
|
||||
sSelectionMode = selectionMode;
|
||||
|
|
@ -59,6 +60,14 @@ static BOOL sSipFilter = FALSE;
|
|||
return sSipFilter;
|
||||
}
|
||||
|
||||
+ (void)setEmailFilter:(BOOL)enable {
|
||||
sEmailFilter = enable;
|
||||
}
|
||||
|
||||
+ (BOOL)getEmailFilter {
|
||||
return sEmailFilter;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ContactsViewController
|
||||
|
|
@ -189,6 +198,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
- (void)changeView:(HistoryView)view {
|
||||
if(view == History_All) {
|
||||
[ContactSelection setSipFilter:FALSE];
|
||||
[ContactSelection setEmailFilter:FALSE];
|
||||
[tableController loadData];
|
||||
allButton.selected = TRUE;
|
||||
} else {
|
||||
|
|
@ -197,6 +207,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
if(view == History_Linphone) {
|
||||
[ContactSelection setSipFilter:TRUE];
|
||||
[ContactSelection setEmailFilter:FALSE];
|
||||
[tableController loadData];
|
||||
linphoneButton.selected = TRUE;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -318,6 +318,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
[ContactSelection setAddAddress:[addressField text]];
|
||||
[ContactSelection setSipFilter:FALSE];
|
||||
[ContactSelection setEmailFilter:FALSE];
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController);
|
||||
if(controller != nil) {
|
||||
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
|
||||
[ContactSelection setSipFilter:FALSE];
|
||||
[ContactSelection setEmailFilter:FALSE];
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController);
|
||||
if(controller != nil) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,6 +401,7 @@ static NSString * const kDisappearAnimation = @"disappear";
|
|||
[ContactSelection setSelectionMode:ContactSelectionModeNone];
|
||||
[ContactSelection setAddAddress:nil];
|
||||
[ContactSelection setSipFilter:FALSE];
|
||||
[ContactSelection setEmailFilter:FALSE];
|
||||
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue