diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index 75fd29cce..3e8da2008 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#import "LinphoneManager.h" #import "ChatRoomTableViewController.h" #import "UIChatRoomCell.h" #import "Utils.h" @@ -108,7 +109,7 @@ self->remoteAddress = [aremoteAddress copy]; [self loadData]; [ChatModel readConversation:remoteAddress]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextReceived object:self]; } diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 7e3744458..ba620059b 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -106,7 +106,7 @@ static UICompositeViewDescription *compositeDescription = nil; object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textReceivedEvent:) - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; if([tableController isEditing]) [tableController setEditing:FALSE animated:FALSE]; @@ -130,7 +130,7 @@ static UICompositeViewDescription *compositeDescription = nil; name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; } @@ -223,7 +223,7 @@ static UICompositeViewDescription *compositeDescription = nil; caseInsensitiveCompare:remoteAddress] == NSOrderedSame) { [chat setRead:[NSNumber numberWithInt:1]]; [chat update]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextReceived object:self]; [tableController addChatEntry:chat]; } ms_free(fromStr); diff --git a/Classes/ChatTableViewController.m b/Classes/ChatTableViewController.m index 91b6287bc..47e240fb6 100644 --- a/Classes/ChatTableViewController.m +++ b/Classes/ChatTableViewController.m @@ -105,7 +105,7 @@ [data removeObjectAtIndex:[indexPath row]]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; [tableView endUpdates]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextReceived object:self]; } } diff --git a/Classes/ChatViewController.m b/Classes/ChatViewController.m index ac91c6d5b..51c636024 100644 --- a/Classes/ChatViewController.m +++ b/Classes/ChatViewController.m @@ -56,7 +56,7 @@ [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textReceivedEvent:) - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; if([tableController isEditing]) [tableController setEditing:FALSE animated:FALSE]; @@ -68,7 +68,7 @@ [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; } diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 66e5b439d..580772ff8 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -204,7 +204,7 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_None, C CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, i); BOOL add = false; if(CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { - if(CFStringCompare((CFStringRef)CONTACT_SIP_FIELD, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { + if(CFStringCompare((CFStringRef)kContactSipField, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { add = true; } } else { @@ -272,7 +272,7 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_None, C lMap = ABMultiValueCreateMutable(kABDictionaryPropertyType); } CFStringRef keys[] = { kABPersonInstantMessageUsernameKey, kABPersonInstantMessageServiceKey }; - CFTypeRef values[] = { [value copy], CONTACT_SIP_FIELD }; + CFTypeRef values[] = { [value copy], kContactSipField }; CFDictionaryRef lDict = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 1, NULL, NULL); CFStringRef label = (CFStringRef)[labelArray objectAtIndex:0]; if(!ABMultiValueAddValueAndLabel(lMap, lDict, label, &identifier)) { @@ -712,7 +712,7 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_None, C CFRelease(lcMap); int index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); CFStringRef keys[] = { kABPersonInstantMessageUsernameKey, kABPersonInstantMessageServiceKey}; - CFTypeRef values[] = { [value copy], CONTACT_SIP_FIELD }; + CFTypeRef values[] = { [value copy], kContactSipField }; CFDictionaryRef lDict = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, NULL, NULL); ABMultiValueReplaceValueAtIndex(lMap, lDict, index); CFRelease(lDict); diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index 225be3f20..21b20f6bc 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -122,7 +122,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Set observer [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdateEvent:) - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; // Update on show if([LinphoneManager isLcReady]) { @@ -137,7 +137,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Remove observer [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; } diff --git a/Classes/FirstLoginViewController.m b/Classes/FirstLoginViewController.m index 38f93cf6a..9d447b0d5 100644 --- a/Classes/FirstLoginViewController.m +++ b/Classes/FirstLoginViewController.m @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#import "LinphoneManager.h" #import "FirstLoginViewController.h" #import "LinphoneManager.h" #import "PhoneMainView.h" @@ -76,7 +76,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Set observer [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(registrationUpdateEvent:) - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; [usernameField setText:[[LinphoneManager instance].settingsStore objectForKey:@"username_preference"]]; @@ -97,7 +97,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Remove observer [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; } diff --git a/Classes/HistoryDetailsViewController.m b/Classes/HistoryDetailsViewController.m index 56941f55a..f0af8e22e 100644 --- a/Classes/HistoryDetailsViewController.m +++ b/Classes/HistoryDetailsViewController.m @@ -99,7 +99,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) - name:@"LinphoneAddressBookUpdate" + name:kLinphoneAddressBookUpdate object:nil]; [self update]; } @@ -108,7 +108,7 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneAddressBookUpdate" + name:kLinphoneAddressBookUpdate object:nil]; } diff --git a/Classes/HistoryViewController.m b/Classes/HistoryViewController.m index 30ec0ffc6..11f4f951a 100644 --- a/Classes/HistoryViewController.m +++ b/Classes/HistoryViewController.m @@ -85,7 +85,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Reset missed call linphone_core_reset_missed_calls_count([LinphoneManager getLc]); // Fake event - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneCallUpdate" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self]; } - (void)viewDidLoad { diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index 18aaf67ea..4004855ae 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -125,7 +125,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Remove observer [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; } @@ -138,7 +138,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Set observer [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdateEvent:) - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; // Update on show diff --git a/Classes/IncomingCallViewController.m b/Classes/IncomingCallViewController.m index 19207b5fc..2a738cb0c 100644 --- a/Classes/IncomingCallViewController.m +++ b/Classes/IncomingCallViewController.m @@ -52,7 +52,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdateEvent:) - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; } @@ -60,7 +60,7 @@ [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; } diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 1075712d8..cd7f89a06 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -186,6 +186,19 @@ int __aeabi_idiv(int a, int b) { - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [LinphoneLogger log:LinphoneLoggerDebug format:@"PushNotification: Receive %@", userInfo]; + NSDictionary *aps = [userInfo objectForKey:@"aps"]; + if(aps != nil) { + NSDictionary *alert = [aps objectForKey:@"alert"]; + if(alert != nil) { + NSString *loc_key = [alert objectForKey:@"loc-key"]; + if(loc_key != nil) { + if([loc_key isEqualToString:@"IM_MSG"]) { + [[LinphoneManager instance] addInhibitedEvent:kLinphoneTextReceivedSound]; + [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; + } + } + } + } } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 104e45f55..d1e847b60 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -32,7 +32,14 @@ #include "linphonecore.h" -extern const NSString *CONTACT_SIP_FIELD; +extern NSString *const kLinphoneTextReceived; +extern NSString *const kLinphoneTextReceivedSound; +extern NSString *const kLinphoneCallUpdate; +extern NSString *const kLinphoneRegistrationUpdate; +extern NSString *const kLinphoneMainViewChange; +extern NSString *const kLinphoneAddressBookUpdate; + +extern NSString *const kContactSipField; typedef enum _Connectivity { wifi, @@ -56,6 +63,11 @@ typedef struct _LinphoneCallAppData { UILocalNotification *notification; } LinphoneCallAppData; +typedef struct _LinphoneManagerSounds { + SystemSoundID call; + SystemSoundID message; +} LinphoneManagerSounds; + @interface LinphoneManager : NSObject { @protected SCNetworkReachabilityRef proxyReachability; @@ -70,15 +82,14 @@ typedef struct _LinphoneCallAppData { FastAddressBook* fastAddressBook; + LinphoneManagerSounds sounds; + NSMutableArray *inhibitedEvent; id settingsStore; sqlite3 *database; + @public CallContext currentCallContextBeforeGoingBackground; - struct _Sounds { - SystemSoundID callSound; - SystemSoundID messageSound; - } sounds; } + (LinphoneManager*)instance; #ifdef DEBUG @@ -105,6 +116,9 @@ typedef struct _LinphoneCallAppData { - (void)enableSpeaker:(BOOL)enable; - (BOOL)isSpeakerEnabled; +- (void)addInhibitedEvent:(NSString*)event; +- (BOOL)removeInhibitedEvent:(NSString*)event; + - (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer; @property (nonatomic, retain) id settingsStore; @@ -115,6 +129,7 @@ typedef struct _LinphoneCallAppData { @property (readonly) const char* backCamId; @property (readonly) sqlite3* database; @property (nonatomic, retain) NSData *pushNotificationToken; +@property (readonly) LinphoneManagerSounds sounds; @end diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 0eb13f9fc..eb7884f15 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -35,9 +35,16 @@ #include "lpconfig.h" #include "private.h" -static LinphoneCore* theLinphoneCore=nil; -static LinphoneManager* theLinphoneManager=nil; -const NSString *CONTACT_SIP_FIELD = @"SIP"; +static LinphoneCore* theLinphoneCore = nil; +static LinphoneManager* theLinphoneManager = nil; + +NSString *const kLinphoneTextReceived = @"LinphoneTextReceived"; +NSString *const kLinphoneTextReceivedSound = @"LinphoneTextReceivedSound"; +NSString *const kLinphoneCallUpdate = @"LinphoneCallUpdate"; +NSString *const kLinphoneRegistrationUpdate = @"LinphoneRegistrationUpdate"; +NSString *const kLinphoneAddressBookUpdate = @"LinphoneAddressBookUpdate"; +NSString *const kLinphoneMainViewChange = @"LinphoneMainViewChange"; +NSString *const kContactSipField = @"SIP"; extern void libmsilbc_init(); #ifdef HAVE_AMR @@ -68,6 +75,7 @@ extern void libmsbcg729_init(); @synthesize database; @synthesize fastAddressBook; @synthesize pushNotificationToken; +@synthesize sounds; struct codec_name_pref_table{ const char *name; @@ -172,19 +180,21 @@ struct codec_name_pref_table codec_pref_table[]={ { NSString *path = [[NSBundle mainBundle] pathForResource:@"ring" ofType:@"wav"]; - OSStatus status = AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &sounds.callSound); + sounds.call = 0; + OSStatus status = AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &sounds.call); if(status != 0){ [LinphoneLogger log:LinphoneLoggerWarning format:@"Can't set \"call\" system sound"]; } } { NSString *path = [[NSBundle mainBundle] pathForResource:@"msg" ofType:@"wav"]; - OSStatus status = AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &sounds.messageSound); + sounds.message = 0; + OSStatus status = AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &sounds.message); if(status != 0){ [LinphoneLogger log:LinphoneLoggerWarning format:@"Can't set \"message\" system sound"]; } } - + inhibitedEvent = [[NSMutableArray alloc] init]; database = NULL; settingsStore = nil; self.defaultExpires = 600; @@ -194,9 +204,14 @@ struct codec_name_pref_table codec_pref_table[]={ } - (void)dealloc { - AudioServicesDisposeSystemSoundID(sounds.callSound); - AudioServicesDisposeSystemSoundID(sounds.messageSound); + if(sounds.call) { + AudioServicesDisposeSystemSoundID(sounds.call); + } + if(sounds.message) { + AudioServicesDisposeSystemSoundID(sounds.message); + } + [inhibitedEvent release]; [fastAddressBook release]; [self closeDatabase]; [settingsStore release]; @@ -905,4 +920,17 @@ static LinphoneCoreVTable linphonec_vtable = { } } +- (void)addInhibitedEvent:(NSString*)event { + [inhibitedEvent addObject:event]; +} + +- (BOOL)removeInhibitedEvent:(NSString*)event { + NSUInteger index = [inhibitedEvent indexOfObject:kLinphoneTextReceivedSound]; + if(index != NSNotFound) { + [inhibitedEvent removeObjectAtIndex:index]; + return TRUE; + } + return FALSE; +} + @end diff --git a/Classes/LinphoneUI/UICallBar.m b/Classes/LinphoneUI/UICallBar.m index f71969973..07f346df1 100644 --- a/Classes/LinphoneUI/UICallBar.m +++ b/Classes/LinphoneUI/UICallBar.m @@ -205,7 +205,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdateEvent:) - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; // Update on show LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); @@ -219,7 +219,7 @@ [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; } diff --git a/Classes/LinphoneUI/UIMainBar.m b/Classes/LinphoneUI/UIMainBar.m index e513babd5..7e868a9f3 100644 --- a/Classes/LinphoneUI/UIMainBar.m +++ b/Classes/LinphoneUI/UIMainBar.m @@ -63,15 +63,15 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeViewEvent:) - name:@"LinphoneMainViewChange" + name:kLinphoneMainViewChange object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdate:) - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textReceived:) - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; [self update:FALSE]; } @@ -80,13 +80,13 @@ [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneMainViewChange" + name:kLinphoneMainViewChange object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; } diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index 235ff282d..d7d747961 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -118,7 +118,7 @@ linphone_core_leave_conference([LinphoneManager getLc]); // Fake event - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneCallUpdate" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self]; break; } case UIPauseButtonType_CurrentCall: @@ -153,7 +153,7 @@ { linphone_core_enter_conference([LinphoneManager getLc]); // Fake event - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneCallUpdate" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self]; break; } case UIPauseButtonType_CurrentCall: diff --git a/Classes/LinphoneUI/UIStateBar.m b/Classes/LinphoneUI/UIStateBar.m index af07b4f2e..aa686e2ea 100644 --- a/Classes/LinphoneUI/UIStateBar.m +++ b/Classes/LinphoneUI/UIStateBar.m @@ -74,7 +74,7 @@ NSTimer *callSecurityTimer; // Set observer [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(registrationUpdate:) - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; @@ -93,7 +93,7 @@ NSTimer *callSecurityTimer; // Remove observer [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; if(callQualityTimer != nil) { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index db5a33ed4..657ac740a 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -102,15 +102,15 @@ static PhoneMainView* phoneMainViewInstance=nil; // Set observers [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdate:) - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(registrationUpdate:) - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textReceived:) - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryLevelChanged:) @@ -128,13 +128,13 @@ static PhoneMainView* phoneMainViewInstance=nil; // Remove observers [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneCallUpdate" + name:kLinphoneCallUpdate object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneTextReceived" + name:kLinphoneTextReceived object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceBatteryLevelDidChangeNotification @@ -494,7 +494,7 @@ static PhoneMainView* phoneMainViewInstance=nil; } NSDictionary* mdict = [NSMutableDictionary dictionaryWithObject:currentView forKey:@"view"]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneMainViewChange" object:self userInfo:mdict]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMainViewChange object:self userInfo:mdict]; return [mainViewController getCurrentViewController]; } @@ -595,7 +595,9 @@ static PhoneMainView* phoneMainViewInstance=nil; [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; } } else { - AudioServicesPlaySystemSound([LinphoneManager instance]->sounds.messageSound); + if(![[LinphoneManager instance] removeInhibitedEvent:kLinphoneTextReceivedSound]) { + AudioServicesPlaySystemSound([LinphoneManager instance].sounds.message); + } } } diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 7065ebd2d..e09152d7a 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -142,7 +142,7 @@ CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, i); BOOL add = false; if(CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { - if(CFStringCompare((CFStringRef)CONTACT_SIP_FIELD, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { + if(CFStringCompare((CFStringRef)kContactSipField, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { add = true; } } else { @@ -161,7 +161,7 @@ } CFRelease(lContacts); } - [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneAddressBookUpdate" object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneAddressBookUpdate object:self]; } void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef info, void *context) { diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m index 3049e127f..746bae50a 100644 --- a/Classes/WizardViewController.m +++ b/Classes/WizardViewController.m @@ -125,7 +125,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(registrationUpdateEvent:) - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -141,7 +141,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:@"LinphoneRegistrationUpdate" + name:kLinphoneRegistrationUpdate object:nil];