From ad4feff82f9dcbb1092b1dbb621a3c119f9dbb1d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 8 Sep 2015 13:13:32 +0200 Subject: [PATCH] clean up headers --- Classes/AboutViewController.m | 2 +- Classes/ChatRoomTableViewController.m | 1 - Classes/ChatRoomViewController.m | 5 +- Classes/ChatTableViewController.m | 1 - Classes/ContactDetailsTableViewController.m | 1 - Classes/ContactsTableViewController.m | 1 - Classes/ContactsViewController.m | 3 -- Classes/DialerViewController.m | 6 --- Classes/HistoryDetailsTableViewController.m | 1 + Classes/HistoryDetailsViewController.m | 3 +- Classes/HistoryTableViewController.m | 1 - Classes/ImagePickerViewController.m | 1 - Classes/InAppProductsManager.m | 1 - Classes/InCallTableViewController.m | 1 + Classes/InCallViewController.m | 1 - Classes/IncomingCallViewController.h | 2 +- Classes/IncomingCallViewController.m | 2 +- Classes/LinphoneCoreSettingsStore.m | 2 +- Classes/LinphoneManager.h | 1 - Classes/LinphoneManager.m | 1 + Classes/LinphoneUI/UICallCell.m | 1 + Classes/LinphoneUI/UICamSwitch.m | 1 + Classes/LinphoneUI/UIChatCell.m | 2 +- .../LinphoneUI/UICompositeViewController.m | 1 + Classes/LinphoneUI/UIContactCell.m | 2 +- Classes/LinphoneUI/UIHistoryCell.m | 2 +- Classes/LinphoneUI/UIPauseButton.m | 3 +- Classes/LinphoneUI/UIStateBar.h | 3 +- Classes/LinphoneUI/UIVideoButton.m | 1 + Classes/OutgoingCallViewController.m | 2 +- Classes/PhoneMainView.h | 49 +++++++++---------- Classes/PhoneMainView.m | 2 - Classes/SettingsViewController.m | 2 - Classes/SideMenuViewController.m | 2 +- Classes/Utils/FastAddressBook.h | 3 +- Classes/Utils/FastAddressBook.m | 15 +----- Classes/Utils/FileTransferDelegate.m | 2 + Classes/Utils/Utils.h | 12 ++--- Classes/Utils/Utils.m | 19 +++++++ Classes/WizardViewController.m | 2 - 40 files changed, 73 insertions(+), 90 deletions(-) diff --git a/Classes/AboutViewController.m b/Classes/AboutViewController.m index 26f43573f..0b7733d60 100644 --- a/Classes/AboutViewController.m +++ b/Classes/AboutViewController.m @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#import "AboutViewController.h" +#import "PhoneMainView.h" #import "LinphoneManager.h" #include "linphone/lpconfig.h" #include "LinphoneIOSVersion.h" diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index d526fc5b6..27efe2171 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -20,7 +20,6 @@ #import "LinphoneManager.h" #import "ChatRoomTableViewController.h" #import "UIChatRoomCell.h" -#import "Utils.h" #import "PhoneMainView.h" @implementation ChatRoomTableViewController diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index acfd7ed91..197cf8da5 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -19,12 +19,9 @@ #import "ChatRoomViewController.h" #import "PhoneMainView.h" -#import "DTActionSheet.h" #import "UILinphone.h" -#import "DTAlertView.h" #import "Utils/FileTransferDelegate.h" #import -#import "Utils.h" #import "UIChatRoomCell.h" @implementation ChatRoomViewController @@ -200,7 +197,7 @@ static UICompositeViewDescription *compositeDescription = nil; [error show]; return; } - [FastAddressBook setDisplayNameLabel:addressLabel forAddress:linphoneAddress]; + [ContactDisplay setDisplayNameLabel:addressLabel forAddress:linphoneAddress]; addressLabel.accessibilityValue = addressLabel.text; avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithLinphoneAddress:linphoneAddress] thumbnail:YES]; diff --git a/Classes/ChatTableViewController.m b/Classes/ChatTableViewController.m index 5aa56bf61..4f2070bac 100644 --- a/Classes/ChatTableViewController.m +++ b/Classes/ChatTableViewController.m @@ -26,7 +26,6 @@ #import "PhoneMainView.h" #import "UACellBackgroundView.h" #import "UILinphone.h" -#import "Utils.h" @implementation ChatTableViewController { MSList *data; diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 93db73d09..03869d127 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -24,7 +24,6 @@ #import "UILinphone.h" #import "OrderedDictionary.h" #import "FastAddressBook.h" -#import "Utils.h" @interface Entry : NSObject diff --git a/Classes/ContactsTableViewController.m b/Classes/ContactsTableViewController.m index 2766dce68..ef0f4166c 100644 --- a/Classes/ContactsTableViewController.m +++ b/Classes/ContactsTableViewController.m @@ -23,7 +23,6 @@ #import "PhoneMainView.h" #import "UACellBackgroundView.h" #import "UILinphone.h" -#import "Utils.h" @implementation ContactsTableViewController diff --git a/Classes/ContactsViewController.m b/Classes/ContactsViewController.m index e72bdffa8..72332c618 100644 --- a/Classes/ContactsViewController.m +++ b/Classes/ContactsViewController.m @@ -17,10 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#import "ContactsViewController.h" #import "PhoneMainView.h" -#import "Utils.h" - #import @implementation ContactSelection diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index 926f5ccb7..01edfd875 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -20,14 +20,8 @@ #import #import -#import "DialerViewController.h" -#import "IncallViewController.h" -#import "DTAlertView.h" #import "LinphoneManager.h" #import "PhoneMainView.h" -#import "Utils.h" - -#include "linphone/linphonecore.h" @implementation DialerViewController diff --git a/Classes/HistoryDetailsTableViewController.m b/Classes/HistoryDetailsTableViewController.m index e0b7e7543..707273493 100644 --- a/Classes/HistoryDetailsTableViewController.m +++ b/Classes/HistoryDetailsTableViewController.m @@ -8,6 +8,7 @@ #import "HistoryDetailsTableViewController.h" #import "LinphoneManager.h" +#import "Utils.h" @implementation HistoryDetailsTableViewController diff --git a/Classes/HistoryDetailsViewController.m b/Classes/HistoryDetailsViewController.m index a283fb850..4b74f74e5 100644 --- a/Classes/HistoryDetailsViewController.m +++ b/Classes/HistoryDetailsViewController.m @@ -20,7 +20,6 @@ #import "HistoryDetailsViewController.h" #import "PhoneMainView.h" #import "FastAddressBook.h" -#import "Utils.h" @implementation HistoryDetailsViewController { } @@ -165,7 +164,7 @@ static UICompositeViewDescription *compositeDescription = nil; // this address should NEVER be NULL: if this assert is broken, the bug is elsewhere. assert(addr != NULL); - [FastAddressBook setDisplayNameLabel:_contactLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr]; _avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithLinphoneAddress:addr] thumbnail:NO]; char *addrURI = linphone_address_as_string_uri_only(addr); diff --git a/Classes/HistoryTableViewController.m b/Classes/HistoryTableViewController.m index eee487911..12648a69b 100644 --- a/Classes/HistoryTableViewController.m +++ b/Classes/HistoryTableViewController.m @@ -23,7 +23,6 @@ #import "PhoneMainView.h" #import "UACellBackgroundView.h" #import "UILinphone.h" -#import "Utils.h" @implementation HistoryTableViewController diff --git a/Classes/ImagePickerViewController.m b/Classes/ImagePickerViewController.m index 4bf2b64ae..6ebea0adb 100644 --- a/Classes/ImagePickerViewController.m +++ b/Classes/ImagePickerViewController.m @@ -19,7 +19,6 @@ #import "ImagePickerViewController.h" #import "PhoneMainView.h" -#import "DTActionSheet.h" @implementation ImagePickerViewController diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m index 9ce1f73c9..e2fa9a3bf 100644 --- a/Classes/InAppProductsManager.m +++ b/Classes/InAppProductsManager.m @@ -25,7 +25,6 @@ #import #import -#import "Utils.h" #import "LinphoneManager.h" #import "PhoneMainView.h" diff --git a/Classes/InCallTableViewController.m b/Classes/InCallTableViewController.m index 56972b294..7ce1a7c37 100644 --- a/Classes/InCallTableViewController.m +++ b/Classes/InCallTableViewController.m @@ -21,6 +21,7 @@ #import "UICallCell.h" #import "UIConferenceHeader.h" #import "LinphoneManager.h" +#import "Utils.h" @implementation InCallTableViewController diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index 9de7e4f21..903e609be 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -29,7 +29,6 @@ #import "LinphoneManager.h" #import "PhoneMainView.h" #import "UILinphone.h" -#import "DTActionSheet.h" #include "linphone/linphonecore.h" diff --git a/Classes/IncomingCallViewController.h b/Classes/IncomingCallViewController.h index 34142cd19..38290f34c 100644 --- a/Classes/IncomingCallViewController.h +++ b/Classes/IncomingCallViewController.h @@ -21,7 +21,7 @@ #import "UICompositeViewController.h" #import "TPMultiLayoutViewController.h" -#include "linphone/linphonecore.h" +#include "LinphoneManager.h" @protocol IncomingCallViewDelegate diff --git a/Classes/IncomingCallViewController.m b/Classes/IncomingCallViewController.m index bd09e3631..85db20a7e 100644 --- a/Classes/IncomingCallViewController.m +++ b/Classes/IncomingCallViewController.m @@ -102,7 +102,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self view]; // Force view load const LinphoneAddress *addr = linphone_call_get_remote_address(call); - [FastAddressBook setDisplayNameLabel:_nameLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr]; char *uri = linphone_address_as_string_uri_only(addr); addressLabel.text = [NSString stringWithUTF8String:uri]; ms_free(uri); diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index d983e88d3..29c84341d 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -18,7 +18,7 @@ */ #import "LinphoneCoreSettingsStore.h" -#import "DTAlertView.h" +#import "Utils.h" #include "linphone/lpconfig.h" diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index c4a9d221b..a3ce8ce06 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -30,7 +30,6 @@ #import "IASKSettingsStore.h" #import "IASKAppSettingsViewController.h" #import "FastAddressBook.h" -#import "Utils.h" #import "InAppProductsManager.h" #include "linphone/linphonecore.h" diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 03ee20a38..f6ab6a2b1 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -41,6 +41,7 @@ #import "LinphoneIOSVersion.h" #import +#import "Utils.h" #define LINPHONE_LOGS_MAX_ENTRY 5000 diff --git a/Classes/LinphoneUI/UICallCell.m b/Classes/LinphoneUI/UICallCell.m index b02023199..41cc1fde9 100644 --- a/Classes/LinphoneUI/UICallCell.m +++ b/Classes/LinphoneUI/UICallCell.m @@ -23,6 +23,7 @@ #import "UILinphone.h" #import "LinphoneManager.h" #import "FastAddressBook.h" +#import "Utils.h" @implementation UICallCellData diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m index 0f5d5cba7..eb2d64a50 100644 --- a/Classes/LinphoneUI/UICamSwitch.m +++ b/Classes/LinphoneUI/UICamSwitch.m @@ -19,6 +19,7 @@ #import "UICamSwitch.h" #include "LinphoneManager.h" +#import "Utils.h" @implementation UICamSwitch @synthesize preview; diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 7c614bd01..7ad0ef3c4 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -69,7 +69,7 @@ return; } const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom); - [FastAddressBook setDisplayNameLabel:addressLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:addressLabel forAddress:addr]; avatarImage.image = [FastAddressBook getContactImage:[FastAddressBook getContactWithLinphoneAddress:addr] thumbnail:NO]; diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m index a88ea14ea..d9a98bd7b 100644 --- a/Classes/LinphoneUI/UICompositeViewController.m +++ b/Classes/LinphoneUI/UICompositeViewController.m @@ -20,6 +20,7 @@ #import "UICompositeViewController.h" #import "LinphoneAppDelegate.h" +#import "Utils.h" @implementation UICompositeViewDescription diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m index f98d2e73d..4f967e983 100644 --- a/Classes/LinphoneUI/UIContactCell.m +++ b/Classes/LinphoneUI/UIContactCell.m @@ -45,7 +45,7 @@ - (void)setContact:(ABRecordRef)acontact { contact = acontact; - [FastAddressBook setDisplayNameLabel:nameLabel forContact:contact]; + [ContactDisplay setDisplayNameLabel:nameLabel forContact:contact]; _linphoneImage.hidden = !([FastAddressBook contactHasValidSipDomain:contact]); } diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m index e7a273b71..d0e1910a2 100644 --- a/Classes/LinphoneUI/UIHistoryCell.m +++ b/Classes/LinphoneUI/UIHistoryCell.m @@ -117,7 +117,7 @@ } _stateImage.image = image; - [FastAddressBook setDisplayNameLabel:displayNameLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:displayNameLabel forAddress:addr]; ABRecordRef contact = [FastAddressBook getContactWithLinphoneAddress:addr]; _avatarImage.image = [FastAddressBook getContactImage:contact thumbnail:TRUE]; } diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index 894cd0e67..6f828271f 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -19,8 +19,7 @@ #import "UIPauseButton.h" #import "LinphoneManager.h" - -#include "linphone/linphonecore.h" +#import "Utils.h" @implementation UIPauseButton diff --git a/Classes/LinphoneUI/UIStateBar.h b/Classes/LinphoneUI/UIStateBar.h index cfbfe0d8a..b47fd87e3 100644 --- a/Classes/LinphoneUI/UIStateBar.h +++ b/Classes/LinphoneUI/UIStateBar.h @@ -19,8 +19,7 @@ #import #import "TPMultiLayoutViewController.h" -#import "DTActionSheet.h" -#import "SideMenuTableViewController.h" +#import "PhoneMainView.h" @interface UIStateBar : TPMultiLayoutViewController { DTActionSheet *securitySheet; diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index d6651a8aa..c5a9ae6b1 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -19,6 +19,7 @@ #import "UIVideoButton.h" #include "LinphoneManager.h" +#import "Utils.h" @implementation UIVideoButton { BOOL last_update_state; diff --git a/Classes/OutgoingCallViewController.m b/Classes/OutgoingCallViewController.m index 8b2ec5fdb..a8077639e 100644 --- a/Classes/OutgoingCallViewController.m +++ b/Classes/OutgoingCallViewController.m @@ -48,7 +48,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[PhoneMainView instance] popCurrentView]; } else { const LinphoneAddress *addr = linphone_call_get_remote_address(call); - [FastAddressBook setDisplayNameLabel:_nameLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr]; char *uri = linphone_address_as_string_uri_only(addr); _addressLabel.text = [NSString stringWithUTF8String:uri]; ms_free(uri); diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index 545f1bd30..6e64a4dd9 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -4,43 +4,42 @@ * * 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 2 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, write to the Free Software + * the Free Software Foundation; either version 2 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ -#import #import -#import "LinphoneManager.h" -#import "UICompositeViewController.h" - /* These imports are here so that we can import PhoneMainView.h without bothering to import all the rest of the view headers */ #import "AboutViewController.h" -#import "IncomingCallViewController.h" #import "ChatRoomViewController.h" #import "ChatViewController.h" -#import "DialerViewController.h" -#import "ContactsViewController.h" -#import "ContactDetailsViewController.h" #import "ContactDetailsLabelViewController.h" -#import "ImagePickerViewController.h" -#import "HistoryViewController.h" +#import "ContactDetailsViewController.h" +#import "ContactsViewController.h" +#import "DialerViewController.h" #import "HistoryDetailsViewController.h" -#import "InCallViewController.h" -#import "SettingsViewController.h" -#import "WizardViewController.h" -#import "IncomingCallViewController.h" +#import "HistoryViewController.h" #import "ImageViewController.h" +#import "InCallViewController.h" +#import "IncomingCallViewController.h" #import "OutgoingCallViewController.h" +#import "SettingsViewController.h" +#import "SideMenuViewController.h" +#import "WizardViewController.h" + +#import "DTAlertView.h" +#import "DTActionSheet.h" +#import "Utils.h" @class PhoneMainView; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 67da5f67f..8f6ca3d85 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -22,8 +22,6 @@ #import "LinphoneAppDelegate.h" #import "PhoneMainView.h" -#import "Utils.h" -#import "DTActionSheet.h" static RootViewManager *rootViewManagerInstance = nil; diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index 6fb714d55..71a02e0c3 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -32,8 +32,6 @@ #import "IASKTextField.h" #include "linphone/lpconfig.h" -#import "DTAlertView.h" - #ifdef DEBUG @interface UIDevice (debug) diff --git a/Classes/SideMenuViewController.m b/Classes/SideMenuViewController.m index b22ab4bdd..7523f989b 100644 --- a/Classes/SideMenuViewController.m +++ b/Classes/SideMenuViewController.m @@ -22,7 +22,7 @@ LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config([LinphoneManager getLc]); if (default_proxy != NULL) { const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy); - [FastAddressBook setDisplayNameLabel:_nameLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr]; char *as_string = linphone_address_as_string(addr); _addressLabel.text = [NSString stringWithUTF8String:as_string]; ms_free(as_string); diff --git a/Classes/Utils/FastAddressBook.h b/Classes/Utils/FastAddressBook.h index 5f34ca9e5..89771ba06 100644 --- a/Classes/Utils/FastAddressBook.h +++ b/Classes/Utils/FastAddressBook.h @@ -40,10 +40,9 @@ + (NSString *)getContactDisplayName:(ABRecordRef)contact; + (UIImage *)getContactImage:(ABRecordRef)contact thumbnail:(BOOL)thumbnail; + (BOOL)contactHasValidSipDomain:(ABRecordRef)person; -+ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact; ++ (NSString *)displayNameForContact:(ABRecordRef)person; + (NSString *)displayNameForAddress:(const LinphoneAddress *)addr; -+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr; + (BOOL)isSipURI:(NSString *)address; // should be removed + (NSString *)appendCountryCodeIfPossible:(NSString *)number; // should be removed diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 423457e9b..3c0d17155 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -20,7 +20,7 @@ #import "FastAddressBook.h" #import "LinphoneManager.h" #import "ContactsViewController.h" -#import "UILabel+Boldify.h" +#import "Utils.h" @implementation FastAddressBook @@ -327,15 +327,6 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void return match; } -+ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact { - label.text = [FastAddressBook displayNameForContact:contact]; - NSString *lLastName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonLastNameProperty)); - NSString *lLocalizedLastName = [FastAddressBook localizedLabel:lLastName]; - if (lLocalizedLastName) { - [label boldSubstring:lLocalizedLastName]; - } -} - + (NSString *)displayNameForContact:(ABRecordRef)contact { NSString *ret = NSLocalizedString(@"Unknown", nil); if (contact != nil) { @@ -374,8 +365,4 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void return ret; } -+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr { - label.text = [FastAddressBook displayNameForAddress:addr]; -} - @end diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index 28b74008d..b48c9ef26 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -7,6 +7,8 @@ // #import "FileTransferDelegate.h" +#import "Utils.h" + @interface FileTransferDelegate () @property(strong) NSMutableData *data; @end diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index 19904c07a..b047b2bf0 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -17,16 +17,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef LINPHONE_UTILS_H -#define LINPHONE_UTILS_H - #define DYNAMIC_CAST(x, cls) \ ({ \ cls *inst_ = (cls *)(x); \ [inst_ isKindOfClass:[cls class]]? inst_ : nil; \ }) -#import +#import "LinphoneManager.h" @interface LinphoneLogger : NSObject { @@ -63,10 +60,13 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); #define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__) #define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__) -#endif - @interface NSString(md5) - (NSString *)md5; @end + +@interface ContactDisplay : NSObject ++ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact; ++ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr; +@end diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index 46e962d5b..438788f64 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -20,6 +20,8 @@ #import "Utils.h" #include "linphone/linphonecore.h" #import +#import "UILabel+Boldify.h" +#import "FastAddressBook.h" @implementation LinphoneLogger @@ -335,3 +337,20 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) { } @end + +@implementation ContactDisplay + ++ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact { + label.text = [FastAddressBook displayNameForContact:contact]; + NSString *lLastName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonLastNameProperty)); + NSString *lLocalizedLastName = [FastAddressBook localizedLabel:lLastName]; + if (lLocalizedLastName) { + [label boldSubstring:lLocalizedLastName]; + } +} + ++ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr { + label.text = [FastAddressBook displayNameForAddress:addr]; +} + +@end \ No newline at end of file diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m index 1a62c2d6f..eb0eae884 100644 --- a/Classes/WizardViewController.m +++ b/Classes/WizardViewController.m @@ -28,8 +28,6 @@ #import #import -#import "DTAlertView.h" - typedef enum _ViewElement { ViewElement_Username = 100, ViewElement_Password = 101,