diff --git a/Classes/CallDelegate.m b/Classes/CallDelegate.m index b7b6ed366..982a99ff1 100644 --- a/Classes/CallDelegate.m +++ b/Classes/CallDelegate.m @@ -18,6 +18,7 @@ */ #import "CallDelegate.h" +#import "Utils.h" @implementation CallDelegate @@ -32,7 +33,7 @@ timeout = nil; } if (eventType == CD_UNDEFINED) { - ms_error("Incorrect usage of CallDelegate/ActionSheet: eventType must be set"); + [LinphoneLogger logc:LinphoneLoggerError format:"Incorrect usage of CallDelegate/ActionSheet: eventType must be set"]; } [delegate actionSheet:actionSheet ofType:eventType clickedButtonAtIndex:buttonIndex withUserDatas:call]; } @@ -47,7 +48,7 @@ if (buttonIndex != actionSheet.cancelButtonIndex) return; if (eventType == CD_UNDEFINED) { - ms_error("Incorrect usage of CallDelegate/ActionSheet: eventType must be set"); + [LinphoneLogger logc:LinphoneLoggerError format:"Incorrect usage of CallDelegate/ActionSheet: eventType must be set"]; } [delegate actionSheet:actionSheet ofType:eventType clickedButtonAtIndex:buttonIndex withUserDatas:call]; @@ -59,7 +60,7 @@ timeout = nil; } if (eventType == CD_UNDEFINED) { - ms_error("Incorrect usage of CallDelegate/ActionSheet: eventType must be set"); + [LinphoneLogger logc:LinphoneLoggerError format:"Incorrect usage of CallDelegate/ActionSheet: eventType must be set"]; } [delegate actionSheet:actionSheet ofType:eventType clickedButtonAtIndex:actionSheet.cancelButtonIndex withUserDatas:call]; } diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 4d9701168..65282e6e9 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -164,7 +164,7 @@ if(contact == NULL) return; - NSLog(@"Load data from contact %p", contact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Load data from contact %p", contact]; // Phone numbers { ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonPhoneProperty); @@ -242,7 +242,7 @@ [entry release]; } else { added = false; - NSLog(@"Can't add entry: %@", [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; } CFRelease(lMap); } else if(section == 1) { @@ -270,7 +270,7 @@ [entry release]; } else { added = false; - NSLog(@"Can't add entry: %@", [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Can't add entry: %@", [error localizedDescription]]; } CFRelease(lMap); } @@ -670,7 +670,7 @@ } [cell.detailTextLabel setText:value]; } else { - NSLog(@"Not valid UIEditableTableViewCell"); + [LinphoneLogger logc:LinphoneLoggerError format:"Not valid UIEditableTableViewCell"]; } return TRUE; } diff --git a/Classes/ContactDetailsViewController.m b/Classes/ContactDetailsViewController.m index 3e376fdfd..43b5aa030 100644 --- a/Classes/ContactDetailsViewController.m +++ b/Classes/ContactDetailsViewController.m @@ -62,7 +62,7 @@ return; } - NSLog(@"Reset data to contact %p", contact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Reset data to contact %p", contact]; ABRecordID recordID = ABRecordGetRecordID(contact); ABAddressBookRevert(addressBook); contact = ABAddressBookGetPersonWithRecordID(addressBook, recordID); @@ -91,9 +91,9 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf NSError* error = NULL; ABAddressBookRemoveRecord(addressBook, contact, (CFErrorRef*)&error); if (error != NULL) { - NSLog(@"Remove contact %p: Fail(%@)", contact, [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Remove contact %p: Fail(%@)", contact, [error localizedDescription]]; } else { - NSLog(@"Remove contact %p: Success!", contact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Remove contact %p: Success!", contact]; } contact = NULL; @@ -103,9 +103,9 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf ABAddressBookSave(addressBook, (CFErrorRef*)&error); inhibUpdate = FALSE; if (error != NULL) { - NSLog(@"Save AddressBook: Fail(%@)", [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Save AddressBook: Fail(%@)", [error localizedDescription]]; } else { - NSLog(@"Save AddressBook: Success!"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Save AddressBook: Success!"]; } } } @@ -121,9 +121,9 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf if(ABRecordGetRecordID(contact) == kABRecordInvalidID) { ABAddressBookAddRecord(addressBook, contact, (CFErrorRef*)&error); if (error != NULL) { - NSLog(@"Add contact %p: Fail(%@)", contact, [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Add contact %p: Fail(%@)", contact, [error localizedDescription]]; } else { - NSLog(@"Add contact %p: Success!", contact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Add contact %p: Success!", contact]; } } @@ -133,14 +133,14 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf ABAddressBookSave(addressBook, (CFErrorRef*)&error); inhibUpdate = FALSE; if (error != NULL) { - NSLog(@"Save AddressBook: Fail(%@)", [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Save AddressBook: Fail(%@)", [error localizedDescription]]; } else { - NSLog(@"Save AddressBook: Success!"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Save AddressBook: Success!"]; } } - (void)newContact { - NSLog(@"New contact"); + [LinphoneLogger logc:LinphoneLoggerLog format:"New contact"]; self->contact = ABPersonCreate(); [tableController setContact:self->contact]; [self enableEdit:FALSE]; @@ -148,7 +148,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf } - (void)newContact:(NSString*)address { - NSLog(@"New contact"); + [LinphoneLogger logc:LinphoneLoggerLog format:"New contact"]; self->contact = ABPersonCreate(); [tableController setContact:self->contact]; [tableController addSipField:address]; @@ -157,7 +157,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf } - (void)editContact:(ABRecordRef)acontact { - NSLog(@"Edit contact %p", acontact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Edit contact %p", acontact]; self->contact = ABAddressBookGetPersonWithRecordID(addressBook, ABRecordGetRecordID(acontact)); [tableController setContact:self->contact]; [self enableEdit:FALSE]; @@ -165,7 +165,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf } - (void)editContact:(ABRecordRef)acontact address:(NSString*)address { - NSLog(@"Edit contact %p", acontact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Edit contact %p", acontact]; self->contact = ABAddressBookGetPersonWithRecordID(addressBook, ABRecordGetRecordID(acontact)); [tableController setContact:self->contact]; [tableController addSipField:address]; @@ -177,7 +177,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf #pragma mark - Property Functions - (void)setContact:(ABRecordRef)acontact { - NSLog(@"set contact %p", acontact); + [LinphoneLogger logc:LinphoneLoggerLog format:"Set contact %p", acontact]; self->contact = ABAddressBookGetPersonWithRecordID(addressBook, ABRecordGetRecordID(acontact)); [tableController setContact:self->contact]; [self disableEdit:FALSE]; diff --git a/Classes/ContactsTableViewController.m b/Classes/ContactsTableViewController.m index fd8bea406..76b9b9c4c 100644 --- a/Classes/ContactsTableViewController.m +++ b/Classes/ContactsTableViewController.m @@ -76,7 +76,7 @@ #pragma mark - - (void)reloadData { - NSLog(@"Load contact list"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Load contact list"]; @synchronized (addressBookMap) { // Reset Address book diff --git a/Classes/ContactsViewController.m b/Classes/ContactsViewController.m index 7aa950af7..cefb5d147 100644 --- a/Classes/ContactsViewController.m +++ b/Classes/ContactsViewController.m @@ -103,7 +103,6 @@ typedef enum _HistoryView { - (void)viewDidLoad { [super viewDidLoad]; - [self changeView: History_All]; // Set selected+over background: IB lack ! [linphoneButton setImage:[UIImage imageNamed:@"contacts_linphone_selected.png"] diff --git a/Classes/InCallTableViewController.m b/Classes/InCallTableViewController.m index 533dec6fe..155fbc632 100644 --- a/Classes/InCallTableViewController.m +++ b/Classes/InCallTableViewController.m @@ -121,7 +121,7 @@ enum TableSection { } if (calls == 0) { - ms_error("Cannot find call with index %d (in conf: %d)", index, conf); + [LinphoneLogger logc:LinphoneLoggerError format:"Cannot find call with index %d (in conf: %d)", index, conf]; return nil; } else { return (LinphoneCall*)calls->data; diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index d880c617a..bf72436ca 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -469,7 +469,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy); } else { // decline video - ms_message("User declined video proposal"); + [LinphoneLogger logc:LinphoneLoggerLog format:"User declined video proposal"]; linphone_core_accept_call_update([LinphoneManager getLc], call, NULL); } linphone_call_params_destroy(paramsCopy); @@ -477,7 +477,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { break; } default: - ms_error("Unhandled CallDelegate event of type: %d received - ignoring", type); + [LinphoneLogger logc:LinphoneLoggerError format:"Unhandled CallDelegate event of type: %d received - ignoring", type]; } } diff --git a/Classes/InCallViewController.xib b/Classes/InCallViewController.xib index 4d3193769..8f79f3993 100644 --- a/Classes/InCallViewController.xib +++ b/Classes/InCallViewController.xib @@ -264,6 +264,14 @@ 169 + + + preview + + + + 172 + view @@ -413,7 +421,7 @@ - 171 + 172 diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 6f9234573..3233247dd 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -47,14 +47,14 @@ int __aeabi_idiv(int a, int b) { int callCount = [ct.currentCalls count]; if (!callCount) { - NSLog(@"No GSM call -> enabling SIP calls"); + [LinphoneLogger logc:LinphoneLoggerLog format:"No GSM call -> enabling SIP calls"]; linphone_core_set_max_calls([LinphoneManager getLc], 3); } else { - NSLog(@"%d GSM call(s) -> disabling SIP calls", callCount); + [LinphoneLogger logc:LinphoneLoggerLog format:"%d GSM call(s) -> disabling SIP calls", callCount]; /* pause current call, if any */ LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); if (call) { - NSLog(@"Pausing SIP call"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Pausing SIP call"]; linphone_core_pause_call([LinphoneManager getLc], call); } linphone_core_set_max_calls([LinphoneManager getLc], 0); @@ -134,7 +134,7 @@ int __aeabi_idiv(int a, int b) { - (void)loadDefaultSettings:(NSDictionary *) appDefaults { for(NSString* key in appDefaults){ - NSLog(@"Overload %@ to in app settings.", key); + [LinphoneLogger log:LinphoneLoggerLog format:@"Overload %@ to in app settings.", key]; [[[LinphoneManager instance] settingsStore] setObject:[appDefaults objectForKey:key] forKey:key]; } [[[LinphoneManager instance] settingsStore] synchronize]; @@ -212,7 +212,7 @@ int __aeabi_idiv(int a, int b) { LinphoneCall* call; [(NSData*)([notification.userInfo objectForKey:@"call"]) getBytes:&call]; if (!call) { - ms_warning("Local notification received with nil call"); + [LinphoneLogger logc:LinphoneLoggerWarning format:"Local notification received with nil call"]; return; } linphone_core_accept_call([LinphoneManager getLc], call); diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index ec00af1cf..7a57b6f42 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -29,11 +29,11 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); NSUserDefaults *oldconfig=[NSUserDefaults standardUserDefaults]; NSArray *allkeys=[[oldconfig dictionaryRepresentation] allKeys]; for(NSString* key in allkeys){ - NSLog(@"Migrating old config item %@ to in app settings.",key); + [LinphoneLogger log:LinphoneLoggerLog format:@"Migrating old config item %@ to in app settings.",key]; [self setObject:[oldconfig objectForKey:key] forKey:key]; } [self synchronize]; - NSLog(@"Migration done"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Migration done"]; } - (id)init { @@ -82,8 +82,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); bool_t value = linphone_core_payload_type_enabled(lc,pt); [self setBool:value forKey: pref]; }else{ - ms_warning("Codec %s/%i supported by core is not shown in iOS app config view.", - pt->mime_type,pt->clock_rate); + [LinphoneLogger logc:LinphoneLoggerWarning format:"Codec %s/%i supported by core is not shown in iOS app config view.", + pt->mime_type,pt->clock_rate]; } } } @@ -230,7 +230,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); LCSipTransports transportValue={0}; if (transport!=nil) { if (linphone_core_get_sip_transports(lc, &transportValue)) { - ms_error("cannot get current transport"); + [LinphoneLogger logc:LinphoneLoggerError format:"cannot get current transport"]; } // Only one port can be set at one time, the others's value is 0 if ([transport isEqualToString:@"tcp"]) { @@ -246,10 +246,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); transportValue.tcp_port=0; transportValue.udp_port=0; } else { - ms_error("unexpected transport [%s]",[transport cStringUsingEncoding:[NSString defaultCStringEncoding]]); + [LinphoneLogger logc:LinphoneLoggerError format:"unexpected transport [%s]",[transport cStringUsingEncoding:[NSString defaultCStringEncoding]]]; } if (linphone_core_set_sip_transports(lc, &transportValue)) { - ms_error("cannot set transport"); + [LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"]; } } diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index f26854c1d..3fec4a53f 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -27,6 +27,7 @@ #import "IASKSettingsStore.h" #import "IASKAppSettingsViewController.h" #import "FastAddressBook.h" +#import "Utils.h" #include "linphonecore.h" @@ -38,8 +39,6 @@ typedef enum _Connectivity { ,none } Connectivity; -@class FastAddressBook; - /* Application specific call context */ typedef struct _CallContext { LinphoneCall* call; @@ -63,7 +62,6 @@ typedef struct _LinphoneCallAppData { @private NSTimer* mIterateTimer; - id mLogView; bool isbackgroundModeEnabled; Connectivity connectivity; @@ -82,28 +80,25 @@ typedef struct _LinphoneCallAppData { + (LinphoneCore*) getLc; + (BOOL)isLcReady; + (BOOL)runningOnIpad; -- (void)registerLogView:(id) view; - ++ (BOOL)isNotIphone3G; + (NSString *)getPreferenceForCodec: (const char*) name withRate: (int) rate; + (BOOL)codecIsSupported:(NSString *) prefName; - - -- (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer; - (void)startLibLinphone; -- (BOOL)isNotIphone3G; - (void)destroyLibLinphone; - - (BOOL)enterBackgroundMode; - (void)becomeActive; -- (void)kickOffNetworkConnection; +- (void)kickOffNetworkConnection; - (void)setupNetworkReachabilityCallback; + - (void)refreshRegisters; - (void)enableSpeaker:(BOOL)enable; - (BOOL)isSpeakerEnabled; +- (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer; + @property (nonatomic, retain) id settingsStore; @property (readonly) FastAddressBook* fastAddressBook; @property Connectivity connectivity; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index fed5147d7..021416385 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -110,6 +110,41 @@ struct codec_name_pref_table codec_pref_table[]={ return TRUE; } ++ (BOOL)runningOnIpad { +#ifdef UI_USER_INTERFACE_IDIOM + return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); +#else + return NO; +#endif +} + ++ (BOOL)isNotIphone3G +{ + static BOOL done=FALSE; + static BOOL result; + if (!done){ + size_t size; + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char *machine = malloc(size); + sysctlbyname("hw.machine", machine, &size, NULL, 0); + NSString *platform = [[NSString alloc ] initWithUTF8String:machine]; + free(machine); + + result = ![platform isEqualToString:@"iPhone1,2"]; + + [platform release]; + done=TRUE; + } + return result; +} + ++ (LinphoneManager*)instance { + return theLinphoneManager; +} + + +#pragma mark - Lifecycle Functions + - (id)init { assert (!theLinphoneManager); if ((self = [super init])) { @@ -129,6 +164,9 @@ struct codec_name_pref_table codec_pref_table[]={ [super dealloc]; } + +#pragma mark - Database Functions + - (void)openDatabase { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath = [paths objectAtIndex:0]; @@ -139,32 +177,82 @@ struct codec_name_pref_table codec_pref_table[]={ NSError *error = nil; //[fileManager removeItemAtPath:databaseDocumentPath error:&error]; //TODO REMOVE if ([fileManager fileExistsAtPath:databaseDocumentPath] == NO) { - NSLog(@"Create sqlite 3 database"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Create sqlite3 database"]; NSString *resourceDocumentPath = [[NSBundle mainBundle] pathForResource:@"database" ofType:@"sqlite"]; [fileManager copyItemAtPath:resourceDocumentPath toPath:databaseDocumentPath error:&error]; if(error != nil) { - NSLog(@"Can't copy database: %@", [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Can't copy database: %@", [error localizedDescription]]; return; } } if(sqlite3_open([databaseDocumentPath UTF8String], &database) != SQLITE_OK) { - NSLog(@"Can't open \"%@\" sqlite3 database.", databaseDocumentPath); + [LinphoneLogger log:LinphoneLoggerError format:@"Can't open \"%@\" sqlite3 database.", databaseDocumentPath]; } } - (void)closeDatabase { if(database != NULL) { if(sqlite3_close(database) != SQLITE_OK) { - NSLog(@"Can't close sqlite3 database."); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't close sqlite3 database."]; } } } -+ (LinphoneManager*)instance { - return theLinphoneManager; + +#pragma mark - Linphone Core Functions + ++ (LinphoneCore*)getLc { + if (theLinphoneCore==nil) { + @throw([NSException exceptionWithName:@"LinphoneCoreException" reason:@"Linphone core not initialized yet" userInfo:nil]); + } + return theLinphoneCore; } ++ (BOOL)isLcReady { + return theLinphoneCore != nil; +} + + +#pragma mark - Logs Functions + +//generic log handler for debug version +void linphone_iphone_log_handler(int lev, const char *fmt, va_list args){ + NSString* format = [NSString stringWithUTF8String:fmt]; + NSLogv(format, args); + NSString* formatedString = [[NSString alloc] initWithFormat:format arguments:args]; + //[[LinphoneManager instance] addLog:formatedString]; + [formatedString release]; +} + +//Error/warning log handler +static void linphone_iphone_log(struct _LinphoneCore * lc, const char * message) { + NSString* log = [NSString stringWithCString:message encoding:[NSString defaultCStringEncoding]]; + NSLog(log, NULL); + //[[LinphoneManager instance] addLog:log]; +} + + +#pragma mark - Display Status Functions + +- (void)displayStatus:(NSString*) message { + // Post event + NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: + message, @"message", + nil] autorelease]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneDisplayStatus" object:self userInfo:dict]; +} + + +static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char * message) { + NSString* status = [[NSString alloc] initWithCString:message encoding:[NSString defaultCStringEncoding]]; + [(LinphoneManager*)linphone_core_get_user_data(lc) displayStatus:status]; + [status release]; +} + + +#pragma mark - Call State Functions + - (void)onCall:(LinphoneCall*)call StateChanged:(LinphoneCallState)state withMessage:(const char *)message { // Handling wrapper if(state == LinphoneCallReleased) { @@ -187,88 +275,27 @@ struct codec_name_pref_table codec_pref_table[]={ // Post event NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: - [NSValue valueWithPointer:call], @"call", - [NSNumber numberWithInt:state], @"state", - [NSString stringWithUTF8String:message], @"message", nil] autorelease]; + [NSValue valueWithPointer:call], @"call", + [NSNumber numberWithInt:state], @"state", + [NSString stringWithUTF8String:message], @"message", nil] autorelease]; [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneCallUpdate" object:self userInfo:dict]; } -+ (LinphoneCore*)getLc { - if (theLinphoneCore==nil) { - @throw([NSException exceptionWithName:@"LinphoneCoreException" reason:@"Linphone core not initialized yet" userInfo:nil]); - } - return theLinphoneCore; -} - -+ (BOOL)isLcReady { - return theLinphoneCore != nil; -} - -- (void)addLog:(NSString*) log { - [mLogView addLog:log]; -} - -- (void)displayStatus:(NSString*) message { - // Post event - NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: - message, @"message", - nil] autorelease]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneDisplayStatus" object:self userInfo:dict]; -} - -//generic log handler for debug version -void linphone_iphone_log_handler(int lev, const char *fmt, va_list args){ - NSString* format = [[NSString alloc] initWithCString:fmt encoding:[NSString defaultCStringEncoding]]; - NSLogv(format,args); - NSString* formatedString = [[NSString alloc] initWithFormat:format arguments:args]; - [[LinphoneManager instance] addLog:formatedString]; - [format release]; - [formatedString release]; -} - -//Error/warning log handler -static void linphone_iphone_log(struct _LinphoneCore * lc, const char * message) { - NSString* log = [NSString stringWithCString:message encoding:[NSString defaultCStringEncoding]]; - NSLog(log,NULL); - [[LinphoneManager instance]addLog:log]; -} -//status -static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char * message) { - NSString* status = [[NSString alloc] initWithCString:message encoding:[NSString defaultCStringEncoding]]; - [(LinphoneManager*)linphone_core_get_user_data(lc) displayStatus:status]; - [status release]; -} - static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, LinphoneCallState state,const char* message) { - /*LinphoneCallIdle, - LinphoneCallIncomingReceived, - LinphoneCallOutgoingInit, - LinphoneCallOutgoingProgress, - LinphoneCallOutgoingRinging, - LinphoneCallOutgoingEarlyMedia, - LinphoneCallConnected, - LinphoneCallStreamsRunning, - LinphoneCallPausing, - LinphoneCallPaused, - LinphoneCallResuming, - LinphoneCallRefered, - LinphoneCallError, - LinphoneCallEnd, - LinphoneCallPausedByRemote - */ [(LinphoneManager*)linphone_core_get_user_data(lc) onCall:call StateChanged: state withMessage: message]; } + +#pragma mark - Transfert State Functions + static void linphone_iphone_transfer_state_changed(LinphoneCore* lc, LinphoneCall* call, LinphoneCallState state) { - /* - LinhoneCallOutgoingProgress -> SalReferTrying - LinphoneCallConnected -> SalReferSuccess - LinphoneCallError -> SalReferFailed | * - */ } + +#pragma mark - Registration State Functions + -(void) onRegister:(LinphoneCore *)lc cfg:(LinphoneProxyConfig*) cfg state:(LinphoneRegistrationState) state message:(const char*) message { - ms_warning("NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message); + [LinphoneLogger logc:LinphoneLoggerLog format:"NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message]; // Post event NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: @@ -283,6 +310,9 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo [(LinphoneManager*)linphone_core_get_user_data(lc) onRegister:lc cfg:cfg state:state message:message]; } + +#pragma mark - Text Received Functions + - (void)onTextReceived:(LinphoneCore *)lc room:(LinphoneChatRoom *)room from:(const LinphoneAddress *)from message:(const char *)message { // Save message in database @@ -307,21 +337,8 @@ static void linphone_iphone_text_received(LinphoneCore *lc, LinphoneChatRoom *ro [(LinphoneManager*)linphone_core_get_user_data(lc) onTextReceived:lc room:room from:from message:message]; } -static LinphoneCoreVTable linphonec_vtable = { - .show =NULL, - .call_state_changed =(LinphoneCallStateCb)linphone_iphone_call_state, - .registration_state_changed = linphone_iphone_registration_state, - .notify_recv = NULL, - .new_subscription_request = NULL, - .auth_info_requested = NULL, - .display_status = linphone_iphone_display_status, - .display_message=linphone_iphone_log, - .display_warning=linphone_iphone_log, - .display_url=NULL, - .text_received=linphone_iphone_text_received, - .dtmf_received=NULL, - .transfer_state_changed=linphone_iphone_transfer_state_changed -}; + +#pragma mark - Network Functions - (void)kickOffNetworkConnection { /*start a new thread to avoid blocking the main ui in case of peer host failure*/ @@ -338,24 +355,24 @@ static LinphoneCoreVTable linphonec_vtable = { } static void showNetworkFlags(SCNetworkReachabilityFlags flags){ - ms_message("Network connection flags:"); - if (flags==0) ms_message("no flags."); + [LinphoneLogger logc:LinphoneLoggerLog format:"Network connection flags:"]; + if (flags==0) [LinphoneLogger logc:LinphoneLoggerLog format:"no flags."]; if (flags & kSCNetworkReachabilityFlagsTransientConnection) - ms_message("kSCNetworkReachabilityFlagsTransientConnection"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsTransientConnection"]; if (flags & kSCNetworkReachabilityFlagsReachable) - ms_message("kSCNetworkReachabilityFlagsReachable"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsReachable"]; if (flags & kSCNetworkReachabilityFlagsConnectionRequired) - ms_message("kSCNetworkReachabilityFlagsConnectionRequired"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsConnectionRequired"]; if (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) - ms_message("kSCNetworkReachabilityFlagsConnectionOnTraffic"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsConnectionOnTraffic"]; if (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) - ms_message("kSCNetworkReachabilityFlagsConnectionOnDemand"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsConnectionOnDemand"]; if (flags & kSCNetworkReachabilityFlagsIsLocalAddress) - ms_message("kSCNetworkReachabilityFlagsIsLocalAddress"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsIsLocalAddress"]; if (flags & kSCNetworkReachabilityFlagsIsDirect) - ms_message("kSCNetworkReachabilityFlagsIsDirect"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsIsDirect"]; if (flags & kSCNetworkReachabilityFlagsIsWWAN) - ms_message("kSCNetworkReachabilityFlagsIsWWAN"); + [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsIsWWAN"]; } void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* nilCtx){ @@ -399,7 +416,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_proxy_config_expires(proxy, 0); } linphone_core_set_network_reachable([LinphoneManager getLc],true); - ms_message("Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")); + [LinphoneLogger logc:LinphoneLoggerLog format:"Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")]; } lLinphoneMgr.connectivity=newConnectivity; } @@ -409,111 +426,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } } -- (BOOL)isNotIphone3G -{ - static BOOL done=FALSE; - static BOOL result; - if (!done){ - size_t size; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *machine = malloc(size); - sysctlbyname("hw.machine", machine, &size, NULL, 0); - NSString *platform = [[NSString alloc ] initWithUTF8String:machine]; - free(machine); - - result = ![platform isEqualToString:@"iPhone1,2"]; - - [platform release]; - done=TRUE; - } - return result; -} - -// no proxy configured alert -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - if (buttonIndex == 1) { - [[[LinphoneManager instance] settingsStore] setBool:true forKey:@"check_config_disable_preference"]; - } -} - -- (void)destroyLibLinphone { - [mIterateTimer invalidate]; - AVAudioSession *audioSession = [AVAudioSession sharedInstance]; - [audioSession setDelegate:nil]; - if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization - NSLog(@"Destroy linphonecore"); - linphone_core_destroy(theLinphoneCore); - theLinphoneCore = nil; - SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - if (proxyReachability) - CFRelease(proxyReachability); - proxyReachability=nil; - - } - -} - -//**********************BG mode management*************************/////////// -- (BOOL)enterBackgroundMode { - LinphoneProxyConfig* proxyCfg; - linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg); - linphone_core_stop_dtmf_stream(theLinphoneCore); - - if (proxyCfg && [settingsStore boolForKey:@"backgroundmode_preference"]) { - //For registration register - linphone_core_refresh_registers(theLinphoneCore); - - - //wait for registration answer - int i=0; - while (!linphone_proxy_config_is_registered(proxyCfg) && i++<40 ) { - linphone_core_iterate(theLinphoneCore); - usleep(100000); - } - //register keepalive - if ([[UIApplication sharedApplication] setKeepAliveTimeout:600/*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/ - handler:^{ - ms_warning("keepalive handler"); - if (theLinphoneCore == nil) { - ms_warning("It seems that Linphone BG mode was deactivated, just skipping"); - return; - } - //kick up network cnx, just in case - [self kickOffNetworkConnection]; - [self refreshRegisters]; - linphone_core_iterate(theLinphoneCore); - } - ]) { - - - ms_message("keepalive handler succesfully registered"); - } else { - ms_warning("keepalive handler cannot be registered"); - } - LCSipTransports transportValue; - if (linphone_core_get_sip_transports(theLinphoneCore, &transportValue)) { - ms_error("cannot get current transport"); - } - return YES; - } - else { - ms_message("Entering lite bg mode"); - [self destroyLibLinphone]; - return NO; - } -} - -//scheduling loop -- (void)iterate { - linphone_core_iterate(theLinphoneCore); -} - - (void)setupNetworkReachabilityCallback { SCNetworkReachabilityContext *ctx=NULL; const char *nodeName="linphone.org"; if (proxyReachability) { - ms_message("Cancelling old network reachability"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Cancelling old network reachability"]; SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); CFRelease(proxyReachability); proxyReachability = nil; @@ -524,25 +442,45 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach //initial state is network off should be done as soon as possible SCNetworkReachabilityFlags flags; if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { - ms_error("Cannot get reachability flags: %s", SCErrorString(SCError())); + [LinphoneLogger logc:LinphoneLoggerError format:"Cannot get reachability flags: %s", SCErrorString(SCError())]; return; } networkReachabilityCallBack(proxyReachability, flags, ctx ? ctx->info : 0); if (!SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack, ctx)){ - ms_error("Cannot register reachability cb: %s", SCErrorString(SCError())); + [LinphoneLogger logc:LinphoneLoggerError format:"Cannot register reachability cb: %s", SCErrorString(SCError())]; return; } if(!SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)){ - ms_error("Cannot register schedule reachability cb: %s", SCErrorString(SCError())); + [LinphoneLogger logc:LinphoneLoggerError format:"Cannot register schedule reachability cb: %s", SCErrorString(SCError())]; return; } } -/************* - *lib linphone init method - */ +#pragma mark - + +static LinphoneCoreVTable linphonec_vtable = { + .show =NULL, + .call_state_changed =(LinphoneCallStateCb)linphone_iphone_call_state, + .registration_state_changed = linphone_iphone_registration_state, + .notify_recv = NULL, + .new_subscription_request = NULL, + .auth_info_requested = NULL, + .display_status = linphone_iphone_display_status, + .display_message=linphone_iphone_log, + .display_warning=linphone_iphone_log, + .display_url=NULL, + .text_received=linphone_iphone_text_received, + .dtmf_received=NULL, + .transfer_state_changed=linphone_iphone_transfer_state_changed +}; + +//scheduling loop +- (void)iterate { + linphone_core_iterate(theLinphoneCore); +} + - (void)startLibLinphone { //get default config from bundle @@ -572,7 +510,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach #endif /* Initialize linphone core*/ - NSLog(@"Create linphonecore"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"]; theLinphoneCore = linphone_core_new (&linphonec_vtable , [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]] @@ -617,7 +555,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach NSString* path = [myBundle pathForResource:@"nowebcamCIF" ofType:@"jpg"]; if (path) { const char* imagePath = [path cStringUsingEncoding:[NSString defaultCStringEncoding]]; - ms_message("Using '%s' as source image for no webcam", imagePath); + [LinphoneLogger logc:LinphoneLoggerLog format:"Using '%s' as source image for no webcam", imagePath]; linphone_core_set_static_picture(theLinphoneCore, imagePath); } @@ -639,11 +577,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach NSUInteger cpucount = [[NSProcessInfo processInfo] processorCount]; ms_set_cpu_count(cpucount); - if (![self isNotIphone3G]){ + if (![LinphoneManager isNotIphone3G]){ PayloadType *pt=linphone_core_find_payload_type(theLinphoneCore,"SILK",24000); if (pt) { linphone_core_enable_payload_type(theLinphoneCore,pt,FALSE); - ms_warning("SILK/24000 and video disabled on old iPhone 3G"); + [LinphoneLogger logc:LinphoneLoggerWarning format:"SILK/24000 and video disabled on old iPhone 3G"]; } linphone_core_enable_video(theLinphoneCore, FALSE, FALSE); } @@ -655,9 +593,9 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach settingsStore = [[LinphoneCoreSettingsStore alloc] init]; - ms_warning("Linphone [%s] started on [%s]" + [LinphoneLogger logc:LinphoneLoggerWarning format:"Linphone [%s] started on [%s]" ,linphone_core_get_version() - ,[[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]] ); + ,[[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]]]; if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { @@ -666,23 +604,71 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } } -- (void)refreshRegisters{ - /*first check if network is available*/ - if (proxyReachability){ - SCNetworkReachabilityFlags flags=0; - if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { - ms_error("Cannot get reachability flags, re-creating reachability context."); - [self setupNetworkReachabilityCallback]; - }else{ - networkReachabilityCallBack(proxyReachability, flags, 0); - if (flags==0){ - /*workaround iOS bug: reachability API cease to work after some time.*/ - /*when flags==0, either we have no network, or the reachability object lies. To workaround, create a new one*/ - [self setupNetworkReachabilityCallback]; - } + +- (void)destroyLibLinphone { + [mIterateTimer invalidate]; + AVAudioSession *audioSession = [AVAudioSession sharedInstance]; + [audioSession setDelegate:nil]; + if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization + [LinphoneLogger logc:LinphoneLoggerLog format:"Destroy linphonecore"]; + linphone_core_destroy(theLinphoneCore); + theLinphoneCore = nil; + SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + if (proxyReachability) + CFRelease(proxyReachability); + proxyReachability=nil; + + } + +} + +- (BOOL)enterBackgroundMode { + LinphoneProxyConfig* proxyCfg; + linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg); + linphone_core_stop_dtmf_stream(theLinphoneCore); + + if (proxyCfg && [settingsStore boolForKey:@"backgroundmode_preference"]) { + //For registration register + linphone_core_refresh_registers(theLinphoneCore); + + + //wait for registration answer + int i=0; + while (!linphone_proxy_config_is_registered(proxyCfg) && i++<40 ) { + linphone_core_iterate(theLinphoneCore); + usleep(100000); } - }else ms_error("No proxy reachability context created !"); - linphone_core_refresh_registers(theLinphoneCore);//just to make sure REGISTRATION is up to date + //register keepalive + if ([[UIApplication sharedApplication] setKeepAliveTimeout:600/*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/ + handler:^{ + [LinphoneLogger logc:LinphoneLoggerWarning format:"keepalive handler"]; + if (theLinphoneCore == nil) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"It seems that Linphone BG mode was deactivated, just skipping"]; + return; + } + //kick up network cnx, just in case + [self kickOffNetworkConnection]; + [self refreshRegisters]; + linphone_core_iterate(theLinphoneCore); + } + ]) { + + + [LinphoneLogger logc:LinphoneLoggerLog format:"keepalive handler succesfully registered"]; + } else { + [LinphoneLogger logc:LinphoneLoggerLog format:"keepalive handler cannot be registered"]; + } + LCSipTransports transportValue; + if (linphone_core_get_sip_transports(theLinphoneCore, &transportValue)) { + [LinphoneLogger logc:LinphoneLoggerError format:"cannot get current transport"]; + } + return YES; + } + else { + [LinphoneLogger logc:LinphoneLoggerLog format:"Entering lite bg mode"]; + [self destroyLibLinphone]; + return NO; + } } - (void)becomeActive { @@ -697,23 +683,40 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } -- (void)registerLogView:(id) view { - mLogView = view; -} - - (void)beginInterruption { LinphoneCall* c = linphone_core_get_current_call(theLinphoneCore); - ms_message("Sound interruption detected!"); + [LinphoneLogger logc:LinphoneLoggerLog format:"Sound interruption detected!"]; if (c) { linphone_core_pause_call(theLinphoneCore, c); } } - (void)endInterruption { - ms_message("Sound interruption ended!"); - //let the user resume the call manually. + [LinphoneLogger logc:LinphoneLoggerLog format:"Sound interruption ended!"]; } +- (void)refreshRegisters{ + /*first check if network is available*/ + if (proxyReachability){ + SCNetworkReachabilityFlags flags=0; + if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { + [LinphoneLogger logc:LinphoneLoggerError format:"Cannot get reachability flags, re-creating reachability context."]; + [self setupNetworkReachabilityCallback]; + }else{ + networkReachabilityCallBack(proxyReachability, flags, 0); + if (flags==0){ + /*workaround iOS bug: reachability API cease to work after some time.*/ + /*when flags==0, either we have no network, or the reachability object lies. To workaround, create a new one*/ + [self setupNetworkReachabilityCallback]; + } + } + }else [LinphoneLogger logc:LinphoneLoggerError format:"No proxy reachability context created !"]; + linphone_core_refresh_registers(theLinphoneCore);//just to make sure REGISTRATION is up to date +} + + +#pragma mark - Speaker Functions + - (void)enableSpeaker:(BOOL)enable { //redirect audio to speaker if(enable) { @@ -735,20 +738,15 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach OSStatus lStatus = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &lNewRouteSize, &lNewRoute); if (!lStatus && lNewRouteSize > 0) { NSString *route = (NSString *) lNewRoute; - ms_message("Current audio route is [%s]", [route cStringUsingEncoding:[NSString defaultCStringEncoding]]); + [LinphoneLogger logc:LinphoneLoggerLog format:"Current audio route is [%s]", [route cStringUsingEncoding:[NSString defaultCStringEncoding]]]; return [route isEqualToString: @"Speaker"] || [route isEqualToString: @"SpeakerAndMicrophone"]; } else { return false; } } -+ (BOOL)runningOnIpad { -#ifdef UI_USER_INTERFACE_IDIOM - return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); -#endif - return NO; -} +#pragma mark - Call Functions - (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer { if (!linphone_core_is_network_reachabled(theLinphoneCore)) { @@ -764,7 +762,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach CTCallCenter* ct = [[CTCallCenter alloc] init]; if ([ct.currentCalls count] > 0) { - ms_error("GSM call in progress, cancelling outgoing SIP call request"); + [LinphoneLogger logc:LinphoneLoggerError format:"GSM call in progress, cancelling outgoing SIP call request"]; UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot make call",nil) message:NSLocalizedString(@"Please terminate GSM call",nil) delegate:nil diff --git a/Classes/LinphoneUI/UIBluetoothButton.m b/Classes/LinphoneUI/UIBluetoothButton.m index c565779be..634fb4206 100644 --- a/Classes/LinphoneUI/UIBluetoothButton.m +++ b/Classes/LinphoneUI/UIBluetoothButton.m @@ -19,13 +19,15 @@ #import "UIBluetoothButton.h" #import +#import "Utils.h" + #include "linphonecore.h" @implementation UIBluetoothButton #define check_auresult(au,method) \ -if (au!=0) ms_error("UIBluetoothButton error for %s: ret=%ld",method,au) +if (au!=0) [LinphoneLogger logc:LinphoneLoggerError format:"UIBluetoothButton error for %s: ret=%ld",method,au] --(void) onOn { +- (void)onOn { //redirect audio to bluetooth UInt32 size = sizeof(CFStringRef); @@ -42,7 +44,8 @@ if (au!=0) ms_error("UIBluetoothButton error for %s: ret=%ld",method,au) check_auresult(result,"set kAudioSessionProperty_OverrideCategoryEnableBluetoothInput 1"); } --(void) onOff { + +- (void)onOff { //redirect audio to bluetooth int allowBluetoothInput = 0; OSStatus result = AudioSessionSetProperty ( @@ -58,22 +61,13 @@ if (au!=0) ms_error("UIBluetoothButton error for %s: ret=%ld",method,au) } --(bool) isInitialStateOn { + +- (bool)onUpdate { return false; } - -/* - // Only override drawRect: if you perform custom drawing. - // An empty implementation adversely affects performance during animation. - - (void)drawRect:(CGRect)rect { - // Drawing code. - } - */ - - (void)dealloc { [super dealloc]; } - @end diff --git a/Classes/LinphoneUI/UICallBar.m b/Classes/LinphoneUI/UICallBar.m index abfa85b21..5ced60b3d 100644 --- a/Classes/LinphoneUI/UICallBar.m +++ b/Classes/LinphoneUI/UICallBar.m @@ -198,6 +198,10 @@ #pragma mark - - (void)callUpdate:(LinphoneCall*)call state:(LinphoneCallState)state { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call bar: Linphone core not ready"]; + return; + } LinphoneCore* lc = [LinphoneManager getLc]; [speakerButton update]; diff --git a/Classes/LinphoneUI/UICallBar.xib b/Classes/LinphoneUI/UICallBar.xib index 71d94f926..b49a45a22 100644 --- a/Classes/LinphoneUI/UICallBar.xib +++ b/Classes/LinphoneUI/UICallBar.xib @@ -1278,7 +1278,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIPassView + UITransparentView com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -1378,7 +1378,7 @@ UIButton - UIButton + UIToggleButton UIButton UIButton UIButton @@ -1387,7 +1387,7 @@ UIButton UIButton UIButton - UIButton + UIToggleButton UIButton UIView UIView @@ -1409,7 +1409,7 @@ dialerButton - UIButton + UIToggleButton eightButton @@ -1445,7 +1445,7 @@ optionsButton - UIButton + UIToggleButton optionsTransferButton @@ -1548,14 +1548,6 @@ ./Classes/UIMicroButton.h - - UIPassView - UIView - - IBProjectSource - ./Classes/UIPassView.h - - UIPauseButton UIToggleButton diff --git a/Classes/LinphoneUI/UICallCell.m b/Classes/LinphoneUI/UICallCell.m index ef3ea1747..cd4fbe250 100644 --- a/Classes/LinphoneUI/UICallCell.m +++ b/Classes/LinphoneUI/UICallCell.m @@ -147,101 +147,99 @@ } - (void)update { - LinphoneCall *call = NULL; - if(data != nil && data->call != NULL) { - call = data->call; - const LinphoneAddress* addr = linphone_call_get_remote_address(call); - - UIImage *image = nil; - NSString* address = nil; - if(addr != NULL) { - BOOL useLinphoneAddress = true; - // contact name - const char* lAddress = linphone_address_as_string_uri_only(addr); - if(lAddress) { - NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]]; - ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress]; - if(contact) { - image = [FastAddressBook getContactImage:contact thumbnail:false]; - address = [FastAddressBook getContactDisplayName:contact]; - useLinphoneAddress = false; - } - } - 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]; - } - } - - // Set Image - if(image == nil) { - image = [UIImage imageNamed:@"avatar_unknown.png"]; - } - [avatarImage setImage:image]; - - // Set Address - if(address == nil) { - address = @"Unknown"; - } - [addressLabel setText:address]; + if(data == nil || data->call) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"]; + return; + } + LinphoneCall *call = data->call; + const LinphoneAddress* addr = linphone_call_get_remote_address(call); - LinphoneCallState state = linphone_call_get_state(call); - if(!conferenceCell) { - if(state == LinphoneCallOutgoingRinging) { - [stateImage setImage:[UIImage imageNamed:@"call_state_ringing_default.png"]]; - [stateImage setHidden:false]; - [pauseButton setHidden:true]; - } else if(state == LinphoneCallOutgoingInit || state == LinphoneCallOutgoingProgress){ - [stateImage setImage:[UIImage imageNamed:@"call_state_outgoing_default.png"]]; - [stateImage setHidden:false]; - [pauseButton setHidden:true]; - } else { - [stateImage setHidden:true]; - [pauseButton setHidden:false]; - [pauseButton update]; - } - [removeButton setHidden:true]; - if(firstCell) { - [headerBackgroundImage setImage:[UIImage imageNamed:@"cell_call_first.png"]]; - [headerBackgroundHighlightImage setImage:[UIImage imageNamed:@"cell_call_first_highlight.png"]]; - } else { - [headerBackgroundImage setImage:[UIImage imageNamed:@"cell_call.png"]]; - [headerBackgroundHighlightImage setImage:[UIImage imageNamed:@"cell_call_highlight.png"]]; + UIImage *image = nil; + NSString* address = nil; + if(addr != NULL) { + BOOL useLinphoneAddress = true; + // contact name + const char* lAddress = linphone_address_as_string_uri_only(addr); + if(lAddress) { + NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]]; + ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress]; + if(contact) { + image = [FastAddressBook getContactImage:contact thumbnail:false]; + address = [FastAddressBook getContactDisplayName:contact]; + useLinphoneAddress = false; } + } + 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]; + } + } + + // Set Image + if(image == nil) { + image = [UIImage imageNamed:@"avatar_unknown.png"]; + } + [avatarImage setImage:image]; + + // Set Address + if(address == nil) { + address = @"Unknown"; + } + [addressLabel setText:address]; + + LinphoneCallState state = linphone_call_get_state(call); + if(!conferenceCell) { + if(state == LinphoneCallOutgoingRinging) { + [stateImage setImage:[UIImage imageNamed:@"call_state_ringing_default.png"]]; + [stateImage setHidden:false]; + [pauseButton setHidden:true]; + } else if(state == LinphoneCallOutgoingInit || state == LinphoneCallOutgoingProgress){ + [stateImage setImage:[UIImage imageNamed:@"call_state_outgoing_default.png"]]; + [stateImage setHidden:false]; + [pauseButton setHidden:true]; } else { [stateImage setHidden:true]; - [pauseButton setHidden:true]; - [removeButton setHidden:false]; - [headerBackgroundImage setImage:[UIImage imageNamed:@"cell_conference.png"]]; + [pauseButton setHidden:false]; + [pauseButton update]; } - - int duration = linphone_call_get_duration(call); - [stateLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration/60), duration - 60 * (duration / 60), nil]]; - - if(!data->minimize) { - CGRect frame = [self frame]; - frame.size.height = [avatarView frame].size.height; - [self setFrame:frame]; - [avatarView setHidden:false]; + [removeButton setHidden:true]; + if(firstCell) { + [headerBackgroundImage setImage:[UIImage imageNamed:@"cell_call_first.png"]]; + [headerBackgroundHighlightImage setImage:[UIImage imageNamed:@"cell_call_first_highlight.png"]]; } else { - CGRect frame = [self frame]; - frame.size.height = [headerView frame].size.height; - [self setFrame:frame]; - [avatarView setHidden:true]; + [headerBackgroundImage setImage:[UIImage imageNamed:@"cell_call.png"]]; + [headerBackgroundHighlightImage setImage:[UIImage imageNamed:@"cell_call_highlight.png"]]; } + } else { + [stateImage setHidden:true]; + [pauseButton setHidden:true]; + [removeButton setHidden:false]; + [headerBackgroundImage setImage:[UIImage imageNamed:@"cell_conference.png"]]; + } + + int duration = linphone_call_get_duration(call); + [stateLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration/60), duration - 60 * (duration / 60), nil]]; + + if(!data->minimize) { + CGRect frame = [self frame]; + frame.size.height = [avatarView frame].size.height; + [self setFrame:frame]; + [avatarView setHidden:false]; + } else { + CGRect frame = [self frame]; + frame.size.height = [headerView frame].size.height; + [self setFrame:frame]; + [avatarView setHidden:true]; } [pauseButton setType:UIPauseButtonType_Call call:call]; } - (void)selfUpdate { UITableView *parentTable = (UITableView *)self.superview; - /*[parentTable beginUpdates]; - [parentTable reloadData]; - [parentTable endUpdates];*/ if(parentTable) { NSIndexPath *index= [parentTable indexPathForCell:self]; if(index != nil) { diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m index aa0f5e51d..bc4a621c3 100644 --- a/Classes/LinphoneUI/UICamSwitch.m +++ b/Classes/LinphoneUI/UICamSwitch.m @@ -20,24 +20,13 @@ #import "UICamSwitch.h" #include "LinphoneManager.h" - @implementation UICamSwitch @synthesize preview; --(void) touchUp:(id) sender { - if (nextCamId!=currentCamId) { - ms_message("Switching from [%s] to [%s]",currentCamId,nextCamId); - linphone_core_set_video_device([LinphoneManager getLc], nextCamId); - nextCamId=currentCamId; - currentCamId = linphone_core_get_video_device([LinphoneManager getLc]); - linphone_core_update_call([LinphoneManager getLc] - , linphone_core_get_current_call([LinphoneManager getLc]) - ,NULL); - linphone_core_set_native_preview_window_id([LinphoneManager getLc], - (unsigned long)preview); - } -} -- (id) init { + +#pragma mark - Lifecycle Functions + +- (id)initUICamSwitch { [self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside]; currentCamId = (char*)linphone_core_get_video_device([LinphoneManager getLc]); if ([LinphoneManager instance].frontCamId !=nil ) { @@ -52,18 +41,28 @@ } return self; } + +- (id)init { + self = [super init]; + if (self) { + [self initUICamSwitch]; + } + return self; +} + - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { - [self init]; + [self initUICamSwitch]; } return self; } + - (id)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (self) { - [self init]; + [self initUICamSwitch]; } return self; } @@ -75,7 +74,24 @@ } +#pragma mark - - +-(void) touchUp:(id) sender { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot tigger camswitch button: Linphone core not ready"]; + return; + } + if (nextCamId != currentCamId) { + [LinphoneLogger logc:LinphoneLoggerLog format:"Switching from [%s] to [%s]",currentCamId,nextCamId]; + linphone_core_set_video_device([LinphoneManager getLc], nextCamId); + nextCamId=currentCamId; + currentCamId = linphone_core_get_video_device([LinphoneManager getLc]); + linphone_core_update_call([LinphoneManager getLc] + , linphone_core_get_current_call([LinphoneManager getLc]) + , NULL); + /*linphone_core_set_native_preview_window_id([LinphoneManager getLc], + (unsigned long)preview);*/ + } +} @end diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 2b913ee9c..dc98f86b6 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -70,13 +70,15 @@ #pragma mark - - (void)update { - - if (chat != nil) { - [avatarImage setImage:[UIImage imageNamed:@"avatar_unknown_small.png"]]; - [displayNameLabel setText:[chat remoteContact]]; - [chatContentLabel setText:[chat message]]; + if(chat == nil) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat cell: null chat"]; + return; } + [avatarImage setImage:[UIImage imageNamed:@"avatar_unknown_small.png"]]; + [displayNameLabel setText:[chat remoteContact]]; + [chatContentLabel setText:[chat message]]; + // // Adapt size // diff --git a/Classes/LinphoneUI/UIChatRoomCell.m b/Classes/LinphoneUI/UIChatRoomCell.m index 4327acb6d..a18150915 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.m +++ b/Classes/LinphoneUI/UIChatRoomCell.m @@ -18,6 +18,7 @@ */ #import "UIChatRoomCell.h" +#import "Utils.h" #import @@ -72,9 +73,11 @@ static UIFont *CELL_FONT = nil; #pragma mark - - (void)update { - if(chat != nil) { - [messageLabel setText:[chat message]]; + if(chat == nil) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room cell: null chat"]; + return; } + [messageLabel setText:[chat message]]; } - (void)setEditing:(BOOL)editing { diff --git a/Classes/LinphoneUI/UIChatRoomHeader.m b/Classes/LinphoneUI/UIChatRoomHeader.m index 25c4de26e..6b862c155 100644 --- a/Classes/LinphoneUI/UIChatRoomHeader.m +++ b/Classes/LinphoneUI/UIChatRoomHeader.m @@ -18,6 +18,7 @@ */ #import "UIChatRoomHeader.h" +#import "Utils.h" @implementation UIChatRoomHeader @@ -54,10 +55,13 @@ #pragma mark - - (void)update { - if(contact != nil) { - [avatarImage setImage:[UIImage imageNamed:@"avatar_unknown_small.png"]]; - [addressLabel setText:contact]; + if(contact == NULL) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room header: null contact"]; + return; } + + [avatarImage setImage:[UIImage imageNamed:@"avatar_unknown_small.png"]]; + [addressLabel setText:contact]; } + (CGFloat)height { diff --git a/Classes/LinphoneUI/UICompositeViewController.xib b/Classes/LinphoneUI/UICompositeViewController.xib index 841ed0dfd..4fa0262ba 100644 --- a/Classes/LinphoneUI/UICompositeViewController.xib +++ b/Classes/LinphoneUI/UICompositeViewController.xib @@ -70,6 +70,7 @@ {{0, 400}, {320, 60}} + _NS:9 YES @@ -175,10 +176,10 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIPassView + UITransparentView com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIPassView + UITransparentView com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -216,14 +217,6 @@ ./Classes/UICompositeViewController.h - - UIPassView - UIView - - IBProjectSource - ./Classes/UIPassView.h - - 0 diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m index 624db9c53..aa203fc6e 100644 --- a/Classes/LinphoneUI/UIContactCell.m +++ b/Classes/LinphoneUI/UIContactCell.m @@ -18,7 +18,7 @@ */ #import "UIContactCell.h" - +#import "Utils.h" #import "FastAddressBook.h" @implementation UIContactCell @@ -71,6 +71,11 @@ } - (void)update { + if(contact == NULL) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update contact cell: null contact"]; + return; + } + CFStringRef lFirstName = ABRecordCopyValue(contact, kABPersonFirstNameProperty); CFStringRef lLocalizedFirstName = (lFirstName != nil)?ABAddressBookCopyLocalizedLabel(lFirstName):nil; CFStringRef lLastName = ABRecordCopyValue(contact, kABPersonLastNameProperty); diff --git a/Classes/LinphoneUI/UIContactDetailsHeader.m b/Classes/LinphoneUI/UIContactDetailsHeader.m index 99009ef95..03bb83259 100644 --- a/Classes/LinphoneUI/UIContactDetailsHeader.m +++ b/Classes/LinphoneUI/UIContactDetailsHeader.m @@ -18,7 +18,7 @@ */ #import "UIContactDetailsHeader.h" - +#import "Utils.h" #import "UIEditableTableViewCell.h" #import "FastAddressBook.h" @@ -69,28 +69,32 @@ - (void)setContact:(ABRecordRef)acontact { contact = acontact; [self update]; - [tableView reloadData]; } #pragma mark - - (void)update { - if(contact) { - // Avatar image - { - UIImage *image = [FastAddressBook getContactImage:contact thumbnail:true]; - if(image == nil) { - image = [UIImage imageNamed:@"avatar_unknown_small.png"]; - } - [avatarImage setImage:image]; - } - - // Contact label - { - [addressLabel setText:[FastAddressBook getContactDisplayName:contact]]; - } + if(contact == NULL) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update contact details header: null contact"]; + return; } + + // Avatar image + { + UIImage *image = [FastAddressBook getContactImage:contact thumbnail:true]; + if(image == nil) { + image = [UIImage imageNamed:@"avatar_unknown_small.png"]; + } + [avatarImage setImage:image]; + } + + // Contact label + { + [addressLabel setText:[FastAddressBook getContactDisplayName:contact]]; + } + + [tableView reloadData]; } + (CGFloat)height:(BOOL)editing { @@ -217,10 +221,10 @@ NSError* error = NULL; ABRecordSetValue(contact, property, [textField text], (CFErrorRef*)&error); if (error != NULL) { - NSLog(@"Error when saving property %i in contact %p: Fail(%@)", property, contact, [error localizedDescription]); + [LinphoneLogger log:LinphoneLoggerError format:@"Error when saving property %i in contact %p: Fail(%@)", property, contact, [error localizedDescription]]; } } else { - NSLog(@"Not valid UIEditableTableViewCell"); + [LinphoneLogger logc:LinphoneLoggerWarning format:"Not valid UIEditableTableViewCell"]; } return TRUE; } diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m index a93fc5080..7dcd33429 100644 --- a/Classes/LinphoneUI/UIDigitButton.m +++ b/Classes/LinphoneUI/UIDigitButton.m @@ -69,6 +69,10 @@ #pragma mark - Actions Functions - (void)touchDown:(id) sender { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot trigger digit button: Linphone core not ready"]; + return; + } if (addressField && (!dtmf || !linphone_core_in_call([LinphoneManager getLc]))) { NSString* newAddress = [NSString stringWithFormat:@"%@%c",addressField.text, digit]; [addressField setText:newAddress]; @@ -80,6 +84,10 @@ } - (void)touchUp:(id) sender { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot trigger digit button: Linphone core not ready"]; + return; + } linphone_core_stop_dtmf([LinphoneManager getLc]); } diff --git a/Classes/LinphoneUI/UIEraseButton.m b/Classes/LinphoneUI/UIEraseButton.m index 9b4e96eb4..d271a2727 100644 --- a/Classes/LinphoneUI/UIEraseButton.m +++ b/Classes/LinphoneUI/UIEraseButton.m @@ -60,6 +60,7 @@ [addressField release]; } + #pragma mark - Action Functions -(void) touchDown:(id) sender { diff --git a/Classes/LinphoneUI/UIHangUpButton.m b/Classes/LinphoneUI/UIHangUpButton.m index ec71460d1..61e4f38a1 100644 --- a/Classes/LinphoneUI/UIHangUpButton.m +++ b/Classes/LinphoneUI/UIHangUpButton.m @@ -95,10 +95,13 @@ [self setEnabled:true]; return; } - } + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update hangup button: Linphone core not ready"]; + } [self setEnabled:false]; } + #pragma mark - Action Functions -(void) touchUp:(id) sender { @@ -117,6 +120,8 @@ linphone_core_terminate_call(lc,(LinphoneCall*)(calls->data)); } } + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot trigger hangup button: Linphone core not ready"]; } } diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m index efdfd0277..5b6cefe12 100644 --- a/Classes/LinphoneUI/UIHistoryCell.m +++ b/Classes/LinphoneUI/UIHistoryCell.m @@ -94,6 +94,10 @@ #pragma mark - - (void)update { + if(callLog == NULL) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update history cell: null callLog"]; + return; + } // Set up the cell... LinphoneAddress* addr; diff --git a/Classes/LinphoneUI/UILongTouchButton.m b/Classes/LinphoneUI/UILongTouchButton.m index 03088ce79..012b2ef0e 100644 --- a/Classes/LinphoneUI/UILongTouchButton.m +++ b/Classes/LinphoneUI/UILongTouchButton.m @@ -75,13 +75,9 @@ } - (void)onRepeatTouch { - [NSException raise:NSInternalInconsistencyException - format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]; } - (void)onLongTouch { - [NSException raise:NSInternalInconsistencyException - format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]; } @end diff --git a/Classes/LinphoneUI/UIMicroButton.m b/Classes/LinphoneUI/UIMicroButton.m index d3b506951..5c321134d 100644 --- a/Classes/LinphoneUI/UIMicroButton.m +++ b/Classes/LinphoneUI/UIMicroButton.m @@ -24,10 +24,18 @@ @implementation UIMicroButton - (void)onOn { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle mic button: Linphone core not ready"]; + return; + } linphone_core_mute_mic([LinphoneManager getLc], false); } - (void)onOff { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle mic button: Linphone core not ready"]; + return; + } linphone_core_mute_mic([LinphoneManager getLc], true); } @@ -35,7 +43,7 @@ if([LinphoneManager isLcReady]) { return linphone_core_is_mic_muted([LinphoneManager getLc]) == false; } else { - //not ready yet + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update mic button: Linphone core not ready"]; return true; } } diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index fc53aa47e..235ff282d 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -99,11 +99,17 @@ #pragma mark - UIToggleButtonDelegate Functions - (void)onOn { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause button: Linphone core not ready"]; + return; + } switch (type) { case UIPauseButtonType_Call: { if (call != nil) { linphone_core_pause_call([LinphoneManager getLc], call); + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; } break; } @@ -120,6 +126,8 @@ LinphoneCall* currentCall = [UIPauseButton getCall]; if (currentCall != nil) { linphone_core_pause_call([LinphoneManager getLc], currentCall); + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; } break; } @@ -127,11 +135,17 @@ } - (void)onOff { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause button: Linphone core not ready"]; + return; + } switch (type) { case UIPauseButtonType_Call: { if (call != nil) { linphone_core_resume_call([LinphoneManager getLc], call); + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; } break; } @@ -147,6 +161,8 @@ LinphoneCall* currentCall = [UIPauseButton getCall]; if (currentCall != nil) { linphone_core_resume_call([LinphoneManager getLc], currentCall); + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; } break; } @@ -199,7 +215,9 @@ break; } } - } + } else { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update pause button: Linphone core not ready"]; + } return ret; } diff --git a/Classes/LinphoneUI/UISpeakerButton.m b/Classes/LinphoneUI/UISpeakerButton.m index cae8f76b0..9151ddbd7 100644 --- a/Classes/LinphoneUI/UISpeakerButton.m +++ b/Classes/LinphoneUI/UISpeakerButton.m @@ -19,7 +19,7 @@ #import #import "UISpeakerButton.h" - +#import "Utils.h" #import "LinphoneManager.h" #include "linphonecore.h" @@ -46,7 +46,7 @@ static void audioRouteChangeListenerCallback ( AudioSessionInitialize(NULL, NULL, NULL, NULL); OSStatus lStatus = AudioSessionAddPropertyListener(routeChangeID, audioRouteChangeListenerCallback, self); if (lStatus) { - ms_error ("cannot register route change handler [%ld]",lStatus); + [LinphoneLogger logc:LinphoneLoggerError format:"cannot register route change handler [%ld]",lStatus]; } } @@ -77,7 +77,7 @@ static void audioRouteChangeListenerCallback ( - (void)dealloc { OSStatus lStatus = AudioSessionRemovePropertyListenerWithUserData(routeChangeID, audioRouteChangeListenerCallback, self); if (lStatus) { - ms_error ("cannot un register route change handler [%ld]",lStatus); + [LinphoneLogger logc:LinphoneLoggerError format:"cannot un register route change handler [%ld]",lStatus]; } [super dealloc]; } diff --git a/Classes/LinphoneUI/UIStateBar.m b/Classes/LinphoneUI/UIStateBar.m index 507d9b1fe..1b14f74e5 100644 --- a/Classes/LinphoneUI/UIStateBar.m +++ b/Classes/LinphoneUI/UIStateBar.m @@ -112,14 +112,14 @@ NSTimer *callQualityTimer; switch (state) { case LinphoneRegistrationOk: - message = @"Registered"; break; + message = NSLocalizedString(@"Registered", nil); break; case LinphoneRegistrationNone: case LinphoneRegistrationCleared: - message = @"Not registered"; break; + message = NSLocalizedString(@"Not registered", nil); break; case LinphoneRegistrationFailed: - message = @"Registration failed"; break; + message = NSLocalizedString(@"Registration failed", nil); break; case LinphoneRegistrationProgress: - message = @"Registration in progress"; break; + message = NSLocalizedString(@"Registration in progress", nil); break; //case LinphoneRegistrationCleared: m= @"No SIP account"; break; default: break; } diff --git a/Classes/LinphoneUI/UIPassView.h b/Classes/LinphoneUI/UITransparentView.h similarity index 94% rename from Classes/LinphoneUI/UIPassView.h rename to Classes/LinphoneUI/UITransparentView.h index 839832347..8d12e22b6 100644 --- a/Classes/LinphoneUI/UIPassView.h +++ b/Classes/LinphoneUI/UITransparentView.h @@ -1,4 +1,4 @@ -/* UIPassView.h +/* UITransparentView.h * * Copyright (C) 2012 Belledonne Comunications, Grenoble, France * @@ -19,6 +19,6 @@ #import -@interface UIPassView : UIView +@interface UITransparentView : UIView @end diff --git a/Classes/LinphoneUI/UIPassView.m b/Classes/LinphoneUI/UITransparentView.m similarity index 94% rename from Classes/LinphoneUI/UIPassView.m rename to Classes/LinphoneUI/UITransparentView.m index 201f0fa2d..40326e77b 100644 --- a/Classes/LinphoneUI/UIPassView.m +++ b/Classes/LinphoneUI/UITransparentView.m @@ -1,4 +1,4 @@ -/* UIPassView.m +/* UITransparentView.m * * Copyright (C) 2012 Belledonne Comunications, Grenoble, France * @@ -17,9 +17,9 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#import "UIPassView.h" +#import "UITransparentView.h" -@implementation UIPassView +@implementation UITransparentView - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { BOOL pointInside = NO; diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index f5b0b9055..6de7c2842 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -56,6 +56,11 @@ } - (void)onOn { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle video button: Linphone core not ready"]; + return; + } + LinphoneCore* lc = [LinphoneManager getLc]; if (!linphone_core_video_enabled(lc)) @@ -73,11 +78,16 @@ linphone_core_update_call(lc, call, call_params); linphone_call_params_destroy(call_params); } else { - ms_warning("Cannot toggle video, because no current call"); + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle video button, because no current call"]; } } - (void)onOff { + if(![LinphoneManager isLcReady]) { + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle video button: Linphone core not ready"]; + return; + } + LinphoneCore* lc = [LinphoneManager getLc]; if (!linphone_core_video_enabled(lc)) @@ -95,7 +105,7 @@ linphone_core_update_call(lc, call, call_params); linphone_call_params_destroy(call_params); } else { - ms_warning("Cannot toggle video, because no current call"); + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle video button, because no current call"]; } } @@ -139,7 +149,7 @@ } return val; } else { - //not ready yet + [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update video button: Linphone core not ready"]; return false; } } diff --git a/Classes/Model/ChatModel.m b/Classes/Model/ChatModel.m index fbd949149..575442316 100644 --- a/Classes/Model/ChatModel.m +++ b/Classes/Model/ChatModel.m @@ -65,19 +65,19 @@ - (void)create { sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return; } const char *sql = [[NSString stringWithFormat:@"INSERT INTO chat (localContact, remoteContact, direction, message, time, read) VALUES (\"%@\", \"%@\", %i, \"%@\", %f, %i)", localContact, remoteContact, [direction intValue], message, [time timeIntervalSince1970], [read intValue]] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return; } if (sqlite3_step(sqlStatement) != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); } } @@ -85,7 +85,7 @@ + (ChatModel*)read:(NSNumber*)chatId { sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return nil; } @@ -93,7 +93,7 @@ chatId] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return nil; } @@ -102,7 +102,7 @@ if (err == SQLITE_ROW) { line = [[ChatModel alloc] initWithData:sqlStatement]; } else if (err != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); return nil; } @@ -114,7 +114,7 @@ - (void)update { sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return; } @@ -122,12 +122,12 @@ localContact, remoteContact, [direction intValue], message, [time timeIntervalSince1970], read, [chatId intValue]] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return; } if (sqlite3_step(sqlStatement) != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); return; } @@ -138,7 +138,7 @@ - (void)delete { sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return; } @@ -146,12 +146,12 @@ chatId] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return; } if (sqlite3_step(sqlStatement) != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); return; } @@ -166,14 +166,14 @@ NSMutableArray *array = [NSMutableArray array]; sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return array; } const char *sql = "SELECT id, localContact, remoteContact, direction, message, time, read FROM chat GROUP BY remoteContact ORDER BY time DESC"; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't execute the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't execute the query: %s (%s)", sql, sqlite3_errmsg(database)]; return array; } @@ -184,7 +184,7 @@ } if (err != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; return array; } @@ -197,7 +197,7 @@ NSMutableArray *array = [NSMutableArray array]; sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return array; } @@ -205,7 +205,7 @@ contact] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't execute the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't execute the query: %s (%s)", sql, sqlite3_errmsg(database)]; return array; } @@ -216,7 +216,7 @@ } if (err != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; return array; } @@ -228,7 +228,7 @@ + (void)removeConversation:(NSString *)contact { sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return; } @@ -236,12 +236,12 @@ contact] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return; } if (sqlite3_step(sqlStatement) != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); return; } @@ -253,19 +253,19 @@ int count = -1; sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return count; } const char *sql = [[NSString stringWithFormat:@"SELECT count(*) FROM chat WHERE read=0"] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return count; } if (sqlite3_step(sqlStatement) != SQLITE_ROW) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); return count; } @@ -279,7 +279,7 @@ + (void)readConversation:(NSString *)contact { sqlite3* database = [[LinphoneManager instance] database]; if(database == NULL) { - NSLog(@"Database not ready"); + [LinphoneLogger logc:LinphoneLoggerError format:"Database not ready"]; return; } @@ -287,12 +287,12 @@ contact] UTF8String]; sqlite3_stmt *sqlStatement; if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { - NSLog(@"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)]; return; } if (sqlite3_step(sqlStatement) != SQLITE_DONE) { - NSLog(@"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)); + [LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)]; sqlite3_finalize(sqlStatement); return; } diff --git a/Classes/MoreViewController.m b/Classes/MoreViewController.m index 6963f31ab..4e5d97e2f 100644 --- a/Classes/MoreViewController.m +++ b/Classes/MoreViewController.m @@ -37,7 +37,7 @@ [super viewDidLoad]; [creditText setText: [NSString stringWithFormat:creditText.text,[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]]; consoleViewController = [[ConsoleViewController alloc] initWithNibName:@"ConsoleViewController" bundle:[NSBundle mainBundle]]; - [[LinphoneManager instance] registerLogView:consoleViewController]; + //[[LinphoneManager instance] registerLogView:consoleViewController]; isDebug = lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]),"app","debugenable_preference",0); } diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index e5eb6acd8..e2077c354 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -324,7 +324,7 @@ static PhoneMainView* phoneMainViewInstance=nil; } - (UIViewController*)_changeView:(PhoneView)view transition:(CATransition*)transition { - NSLog(@"PhoneMainView: change view %d", view); + [LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: change view %d", view]; UICompositeViewDescription* description = [viewDescriptions objectForKey:[NSNumber numberWithInt: view]]; if(description == nil) return nil; @@ -348,7 +348,7 @@ static PhoneMainView* phoneMainViewInstance=nil; } - (UIViewController*)popView:(NSArray *)calls { - NSLog(@"PhoneMainView: Pop!"); + [LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Pop view"]; if([viewStack count] > 0) { PhoneView view = [[viewStack lastObject] intValue]; [viewStack removeLastObject]; @@ -446,7 +446,7 @@ static PhoneMainView* phoneMainViewInstance=nil; LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call); if ([UIDevice currentDevice].batteryState == UIDeviceBatteryStateUnplugged) { float level = [UIDevice currentDevice].batteryLevel; - ms_message("Video call is running. Battery level: %.2f", level); + [LinphoneLogger logc:LinphoneLoggerLog format:"Video call is running. Battery level: %.2f", level]; if (level < 0.1 && !appData->batteryWarningShown) { // notify user CallDelegate* cd = [[CallDelegate alloc] init]; diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index 7480c0708..f79eb785e 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -124,7 +124,7 @@ } // NSLog(@"Specifier received: %@", identifier); if ([identifier isEqualToString:@"silk_24k_preference"]) { - if (![[LinphoneManager instance] isNotIphone3G]) + if (![LinphoneManager isNotIphone3G]) return nil; } if ([identifier isEqualToString:@"backgroundmode_preference"]) { diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index 26764f459..8568aca78 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -26,4 +26,21 @@ [inst_ isKindOfClass:[cls class]]? inst_ : nil; \ }) +typedef enum _LinphoneLoggerSeverity { + LinphoneLoggerLog = 0, + LinphoneLoggerDebug, + LinphoneLoggerWarning, + LinphoneLoggerError, + LinphoneLoggerFatal +} LinphoneLoggerSeverity; + + +@interface LinphoneLogger : NSObject { + +} ++ (void)log:(LinphoneLoggerSeverity) severity format:(NSString *)format,...; ++ (void)logc:(LinphoneLoggerSeverity) severity format:(const char *)format,...; + +@end + #endif diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m new file mode 100644 index 000000000..1ae8a0230 --- /dev/null +++ b/Classes/Utils/Utils.m @@ -0,0 +1,62 @@ +/* Utils.m + * + * Copyright (C) 2012 Belledonne Comunications, Grenoble, France + * + * 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 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#import "Utils.h" +#include "linphonecore.h" + +@implementation LinphoneLogger + ++ (void)log:(LinphoneLoggerSeverity) severity format:(NSString *)format,... { + va_list args; + va_start (args, format); + NSString *str = [[NSString alloc] initWithFormat: format arguments:args]; + if(severity <= LinphoneLoggerLog) { + ms_message("%s", [str UTF8String]); + } else if(severity <= LinphoneLoggerDebug) { + ms_debug("%s", [str UTF8String]); + } else if(severity <= LinphoneLoggerWarning) { + ms_warning("%s", [str UTF8String]); + } else if(severity <= LinphoneLoggerError) { + ms_error("%s", [str UTF8String]); + } else if(severity <= LinphoneLoggerFatal) { + ms_fatal("%s", [str UTF8String]); + } + [str release]; + va_end (args); +} + ++ (void)logc:(LinphoneLoggerSeverity) severity format:(const char *)format,... { + va_list args; + va_start (args, format); + if(severity <= LinphoneLoggerLog) { + ortp_logv(ORTP_MESSAGE, format, args); + } else if(severity <= LinphoneLoggerDebug) { + ortp_logv(ORTP_DEBUG, format, args); + } else if(severity <= LinphoneLoggerWarning) { + ortp_logv(ORTP_WARNING, format, args); + } else if(severity <= LinphoneLoggerError) { + ortp_logv(ORTP_ERROR, format, args); + } else if(severity <= LinphoneLoggerFatal) { + ortp_logv(ORTP_FATAL, format, args); + } + va_end (args); +} + +@end diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index da2906f04..cac80fa0c 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -241,8 +241,8 @@ D3211BC3159CBFD70098460B /* back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3211BBD159CBFD60098460B /* back_over.png */; }; D32409C3158B49A600C8C119 /* UILongTouchButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D32409C2158B49A600C8C119 /* UILongTouchButton.m */; }; D32409C4158B49A600C8C119 /* UILongTouchButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D32409C2158B49A600C8C119 /* UILongTouchButton.m */; }; - D32460E6159D9AAD00BA7F3A /* UIPassView.m in Sources */ = {isa = PBXBuildFile; fileRef = D32460E5159D9AAD00BA7F3A /* UIPassView.m */; }; - D32460E7159D9AAD00BA7F3A /* UIPassView.m in Sources */ = {isa = PBXBuildFile; fileRef = D32460E5159D9AAD00BA7F3A /* UIPassView.m */; }; + D32460E6159D9AAD00BA7F3A /* UITransparentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D32460E5159D9AAD00BA7F3A /* UITransparentView.m */; }; + D32460E7159D9AAD00BA7F3A /* UITransparentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D32460E5159D9AAD00BA7F3A /* UITransparentView.m */; }; D326483815887D5200930C67 /* OrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = D326483715887D5200930C67 /* OrderedDictionary.m */; }; D326483915887D5200930C67 /* OrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = D326483715887D5200930C67 /* OrderedDictionary.m */; }; D326483E1588950F00930C67 /* UICallBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D326483C1588950F00930C67 /* UICallBar.m */; }; @@ -341,6 +341,8 @@ D35498221587716B000081D8 /* UIStateBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D354981F1587716B000081D8 /* UIStateBar.m */; }; D35498231587716B000081D8 /* UIStateBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = D35498201587716B000081D8 /* UIStateBar.xib */; }; D35498241587716B000081D8 /* UIStateBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = D35498201587716B000081D8 /* UIStateBar.xib */; }; + D35860D615B549B500513429 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = D35860D515B549B500513429 /* Utils.m */; }; + D35860D715B549B500513429 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = D35860D515B549B500513429 /* Utils.m */; }; D35E757815931E5D0066B1C1 /* switch_camera_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D35E757515931E5D0066B1C1 /* switch_camera_default.png */; }; D35E757915931E5D0066B1C1 /* switch_camera_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D35E757515931E5D0066B1C1 /* switch_camera_default.png */; }; D35E757A15931E5D0066B1C1 /* switch_camera_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D35E757615931E5D0066B1C1 /* switch_camera_over.png */; }; @@ -1136,8 +1138,8 @@ D3211BBD159CBFD60098460B /* back_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = back_over.png; path = Resources/back_over.png; sourceTree = ""; }; D32409C1158B49A600C8C119 /* UILongTouchButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILongTouchButton.h; sourceTree = ""; }; D32409C2158B49A600C8C119 /* UILongTouchButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UILongTouchButton.m; sourceTree = ""; }; - D32460E4159D9AAD00BA7F3A /* UIPassView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPassView.h; sourceTree = ""; }; - D32460E5159D9AAD00BA7F3A /* UIPassView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPassView.m; sourceTree = ""; }; + D32460E4159D9AAD00BA7F3A /* UITransparentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITransparentView.h; sourceTree = ""; }; + D32460E5159D9AAD00BA7F3A /* UITransparentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITransparentView.m; sourceTree = ""; }; D326483615887D5200930C67 /* OrderedDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OrderedDictionary.h; path = Utils/OrderedDictionary.h; sourceTree = ""; }; D326483715887D5200930C67 /* OrderedDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OrderedDictionary.m; path = Utils/OrderedDictionary.m; sourceTree = ""; }; D326483B1588950F00930C67 /* UICallBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICallBar.h; sourceTree = ""; }; @@ -1199,6 +1201,7 @@ D354981E1587716B000081D8 /* UIStateBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIStateBar.h; sourceTree = ""; }; D354981F1587716B000081D8 /* UIStateBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIStateBar.m; sourceTree = ""; }; D35498201587716B000081D8 /* UIStateBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIStateBar.xib; sourceTree = ""; }; + D35860D515B549B500513429 /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Utils.m; path = Utils/Utils.m; sourceTree = ""; }; D35E757515931E5D0066B1C1 /* switch_camera_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = switch_camera_default.png; path = Resources/switch_camera_default.png; sourceTree = ""; }; D35E757615931E5D0066B1C1 /* switch_camera_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = switch_camera_over.png; path = Resources/switch_camera_over.png; sourceTree = ""; }; D35E757F159328EA0066B1C1 /* UIAddressTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAddressTextField.h; sourceTree = ""; }; @@ -1917,8 +1920,6 @@ 2214EBF212F86360002A5394 /* UIMicroButton.m */, D3F34F331599C354005BE94F /* UIModalViewController.h */, D3F34F341599C354005BE94F /* UIModalViewController.m */, - D32460E4159D9AAD00BA7F3A /* UIPassView.h */, - D32460E5159D9AAD00BA7F3A /* UIPassView.m */, D36FB2D31589EF7C0036F6F2 /* UIPauseButton.h */, D36FB2D41589EF7C0036F6F2 /* UIPauseButton.m */, 22968A5D12F875C600588287 /* UISpeakerButton.h */, @@ -1930,6 +1931,8 @@ D32648431588F6FB00930C67 /* UIToggleButton.m */, D3196D3C15A32BD7007FEEBA /* UITransferButton.h */, D3196D3D15A32BD8007FEEBA /* UITransferButton.m */, + D32460E4159D9AAD00BA7F3A /* UITransparentView.h */, + D32460E5159D9AAD00BA7F3A /* UITransparentView.m */, 340751E5150F38FC00B89C47 /* UIVideoButton.h */, 340751E6150F38FD00B89C47 /* UIVideoButton.m */, D378907715AC44A300BD776C /* UIView+ModalStack.h */, @@ -2340,6 +2343,7 @@ D3F9A9DD15AF0FFE0045320F /* TPKeyboardAvoiding */, D3F9A9EB15AF27620045320F /* UACellBackgroundView */, C9B3A6FD15B485DB006F52EE /* Utils.h */, + D35860D515B549B500513429 /* Utils.m */, ); name = Utils; sourceTree = ""; @@ -3151,7 +3155,7 @@ D3F34F351599C354005BE94F /* UIModalViewController.m in Sources */, D31AAF5E159B3919002C6B02 /* InCallTableViewController.m in Sources */, D3211BB0159C4EF10098460B /* UIConferenceHeader.m in Sources */, - D32460E6159D9AAD00BA7F3A /* UIPassView.m in Sources */, + D32460E6159D9AAD00BA7F3A /* UITransparentView.m in Sources */, D32B9DFC15A2F131000B6DEC /* FastAddressBook.m in Sources */, D3196D3E15A32BD8007FEEBA /* UITransferButton.m in Sources */, D350F20E15A43BB100149E54 /* WizardViewController.m in Sources */, @@ -3173,6 +3177,7 @@ D3F9A9E215AF100D0045320F /* TPKeyboardAvoidingScrollView.m in Sources */, D3F9A9E415AF100D0045320F /* TPKeyboardAvoidingTableView.m in Sources */, D3F9A9EE15AF277E0045320F /* UACellBackgroundView.m in Sources */, + D35860D615B549B500513429 /* Utils.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3240,7 +3245,7 @@ D3F34F361599C354005BE94F /* UIModalViewController.m in Sources */, D31AAF5F159B3919002C6B02 /* InCallTableViewController.m in Sources */, D3211BB1159C4EF10098460B /* UIConferenceHeader.m in Sources */, - D32460E7159D9AAD00BA7F3A /* UIPassView.m in Sources */, + D32460E7159D9AAD00BA7F3A /* UITransparentView.m in Sources */, D32B9DFD15A2F131000B6DEC /* FastAddressBook.m in Sources */, D3196D3F15A32BD8007FEEBA /* UITransferButton.m in Sources */, D350F20F15A43BB100149E54 /* WizardViewController.m in Sources */, @@ -3262,6 +3267,7 @@ D3F9A9E315AF100D0045320F /* TPKeyboardAvoidingScrollView.m in Sources */, D3F9A9E515AF100D0045320F /* TPKeyboardAvoidingTableView.m in Sources */, D3F9A9EF15AF277E0045320F /* UACellBackgroundView.m in Sources */, + D35860D715B549B500513429 /* Utils.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };