misc: replace [NSNotificationCenter defaultCenter] with NSNotificationCenter.defaultCenter

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-15 16:56:16 +01:00
parent 9d4a76f0c2
commit 6a1e42a562
29 changed files with 277 additions and 296 deletions

View file

@ -84,17 +84,14 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdateEvent:)
name:kLinphoneRegistrationUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(configuringUpdate:)
name:kLinphoneConfiguringStateUpdate
object:nil];
// we will set the new default proxy config in the assistant
previous_default_config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
linphone_core_set_default_proxy_config([LinphoneManager getLc], NULL);
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(registrationUpdateEvent:)
name:kLinphoneRegistrationUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(configuringUpdate:)
name:kLinphoneConfiguringStateUpdate
object:nil];
new_config = NULL;
[self resetTextFields];
@ -103,12 +100,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
// if we quit assistant without creating a new proxy config, just restore the previous one
if (!linphone_core_get_default_proxy_config([LinphoneManager getLc])) {
linphone_core_set_default_proxy_config([LinphoneManager getLc], previous_default_config);
}
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)fitContent {

View file

@ -30,16 +30,16 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCallUpdate object:nil];
}
#pragma mark - UICompositeViewDelegate Functions

View file

@ -48,10 +48,10 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(bluetoothAvailabilityUpdateEvent:)
name:kLinphoneBluetoothAvailabilityUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(bluetoothAvailabilityUpdateEvent:)
name:kLinphoneBluetoothAvailabilityUpdate
object:nil];
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
if (!call) {

View file

@ -123,7 +123,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewDidUnload {
[PhoneMainView.instance.view removeGestureRecognizer:singleFingerTap];
// Remove all observer
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
[super viewDidUnload];
}
@ -150,18 +150,18 @@ static UICompositeViewDescription *compositeDescription = nil;
// Enable tap
[singleFingerTap setEnabled:TRUE];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(messageReceived:)
name:kLinphoneMessageReceived
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(bluetoothAvailabilityUpdateEvent:)
name:kLinphoneBluetoothAvailabilityUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(messageReceived:)
name:kLinphoneMessageReceived
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(bluetoothAvailabilityUpdateEvent:)
name:kLinphoneBluetoothAvailabilityUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[NSTimer scheduledTimerWithTimeInterval:1
target:self
@ -202,7 +202,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
// Remove observer
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)viewDidDisappear:(BOOL)animated {

View file

@ -42,7 +42,7 @@
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - UICompositeViewDelegate Functions
@ -88,34 +88,34 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillEnterForeground:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textReceivedEvent:)
name:kLinphoneMessageReceived
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onMessageChange:)
name:UITextViewTextDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textComposeEvent:)
name:kLinphoneTextComposeEvent
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(applicationWillEnterForeground:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(textReceivedEvent:)
name:kLinphoneMessageReceived
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(onMessageChange:)
name:UITextViewTextDidChangeNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(textComposeEvent:)
name:kLinphoneTextComposeEvent
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[_backToCallButton update];
@ -137,7 +137,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[self setComposingVisible:FALSE withDelay:0]; // will hide the "user is composing.." message
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
@ -331,7 +331,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if (strcasecmp(cr_from_string, fromStr) == 0) {
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
linphone_chat_room_mark_as_read(room);
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
}
[_tableController addChatEntry:chat];
[_tableController scrollToLastUnread:TRUE];

View file

@ -193,7 +193,7 @@ static void chatTable_free_chatrooms(void *data) {
data = ms_list_remove(data, chatRoom);
// will force a call to [self loadData]
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
@ -223,7 +223,7 @@ static void chatTable_free_chatrooms(void *data) {
data = ms_list_remove(data, chatRoom);
// will force a call to [self loadData]
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
}];
}

View file

@ -27,10 +27,10 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textReceivedEvent:)
name:kLinphoneMessageReceived
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(textReceivedEvent:)
name:kLinphoneMessageReceived
object:nil];
[_backToCallButton update];
[self setEditing:NO];
}
@ -38,7 +38,7 @@
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneMessageReceived object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneMessageReceived object:nil];
}
#pragma mark - Event Functions

View file

@ -64,7 +64,7 @@
- (void)dealloc {
// Remove all observers
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - UICompositeViewDelegate Functions
@ -98,15 +98,15 @@ static UICompositeViewDescription *compositeDescription = nil;
!IPAD && UIInterfaceOrientationIsLandscape(PhoneMainView.instance.mainViewController.currentOrientation);
// Set observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(coreUpdateEvent:)
name:kLinphoneCoreUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(coreUpdateEvent:)
name:kLinphoneCoreUpdate
object:nil];
// technically not needed, but older versions of linphone had this button
// disabled by default. In this case, updating by pushing a new version with
@ -146,7 +146,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)viewDidLoad {

View file

@ -51,10 +51,10 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// Set observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdateEvent:)
name:kLinphoneRegistrationUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(registrationUpdateEvent:)
name:kLinphoneRegistrationUpdate
object:nil];
[_usernameField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_username"]];
[_passwordField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_password"]];
@ -97,7 +97,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[super viewWillDisappear:animated];
// Remove observer
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
}
- (void)viewDidLoad {

View file

@ -72,20 +72,20 @@ static UICompositeViewDescription *compositeDescription = nil;
[self update];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(update)
name:kLinphoneAddressBookUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(update)
name:kLinphoneAddressBookUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(coreUpdateEvent:)
name:kLinphoneCoreUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(coreUpdateEvent:)
name:kLinphoneCoreUpdate
object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - Event Functions

View file

@ -53,24 +53,24 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(loadData)
name:kLinphoneAddressBookUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(loadData)
name:kLinphoneAddressBookUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(coreUpdateEvent:)
name:kLinphoneCoreUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(coreUpdateEvent:)
name:kLinphoneCoreUpdate
object:nil];
[self loadData];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneAddressBookUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneAddressBookUpdate object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCoreUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCoreUpdate object:nil];
}
#pragma mark - Event Functions

View file

@ -60,7 +60,7 @@ static UICompositeViewDescription *compositeDescription = nil;
// Reset missed call
linphone_core_reset_missed_calls_count([LinphoneManager getLc]);
// Fake event
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
}
#pragma mark -

View file

@ -374,7 +374,7 @@
- (void)postNotificationforStatus:(IAPPurchaseNotificationStatus)status withDict:(NSDictionary *)dict {
_status = status;
LOGI(@"Triggering notification for status %@", status);
[[NSNotificationCenter defaultCenter] postNotificationName:status object:self userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:status object:self userInfo:dict];
}
- (void)XMLRPCRequest:(XMLRPCRequest *)request didReceiveResponse:(XMLRPCResponse *)response {
@ -479,7 +479,7 @@
#else
- (void)postNotificationforStatus:(IAPPurchaseNotificationStatus)status {
_status = status;
[[NSNotificationCenter defaultCenter] postNotificationName:status object:self userInfo:nil];
[NSNotificationCenter.defaultCenter postNotificationName:status object:self userInfo:nil];
LOGE(@"Not supported, triggering %@", status);
}
- (BOOL)purchaseAccount:(NSString *)phoneNumber

View file

@ -455,7 +455,7 @@
- (void)ConfigurationStateUpdateEvent:(NSNotification *)notif {
LinphoneConfiguringState state = [[notif.userInfo objectForKey:@"state"] intValue];
if (state == LinphoneConfiguringSuccessful) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
UIAlertView *error = [[UIAlertView alloc]
@ -468,7 +468,7 @@
[PhoneMainView.instance startUp];
}
if (state == LinphoneConfiguringFailed) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
UIAlertView *error =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Failure", nil)
@ -507,10 +507,10 @@
- (void)attemptRemoteConfiguration {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(ConfigurationStateUpdateEvent:)
name:kLinphoneConfiguringStateUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(ConfigurationStateUpdateEvent:)
name:kLinphoneConfiguringStateUpdate
object:nil];
linphone_core_set_provisioning_uri([LinphoneManager getLc], [configURL UTF8String]);
[[LinphoneManager instance] destroyLinphoneCore];
[[LinphoneManager instance] startLinphoneCore];

View file

@ -385,7 +385,7 @@
// Post event
NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic];
}
- (void)alertAccountError:(NSString *)error {
@ -835,7 +835,7 @@
// Post event
NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneSettingsUpdate object:self userInfo:eventDic];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneSettingsUpdate object:self userInfo:eventDic];
return YES;
}

View file

@ -251,10 +251,10 @@ struct codec_name_pref_table codec_pref_table[] = {{"speex", 8000, "speex_8k_pre
- (id)init {
if ((self = [super init])) {
AudioSessionInitialize(NULL, NULL, NULL, NULL);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(audioRouteChangeListenerCallback2:)
name:AVAudioSessionRouteChangeNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(audioRouteChangeListenerCallback2:)
name:AVAudioSessionRouteChangeNotification
object:nil];
NSString *path = [[NSBundle mainBundle] pathForResource:@"msg" ofType:@"wav"];
self.messagePlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:path] error:nil];
@ -292,7 +292,7 @@ struct codec_name_pref_table codec_pref_table[] = {{"speex", 8000, "speex_8k_pre
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)silentPushFailed:(NSTimer *)timer {
@ -585,11 +585,11 @@ static void linphone_iphone_log_user_warning(struct _LinphoneCore *lc, const cha
- (void)displayStatus:(NSString *)message {
// Post event
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneDisplayStatusUpdate
object:self
userInfo:@{
@"message" : message
}];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneDisplayStatusUpdate
object:self
userInfo:@{
@"message" : message
}];
}
static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char *message) {
@ -773,8 +773,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char
@"state" : [NSNumber numberWithInt:state],
@"message" : [NSString stringWithUTF8String:message]
};
LOGI(@"Call %p changed to state %s: %s", call, linphone_call_state_to_string(state), message);
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self userInfo:dict];
}
static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState state,
@ -802,7 +801,7 @@ static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGloba
// dispatch the notification asynchronously
dispatch_async(dispatch_get_main_queue(), ^(void) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneGlobalStateUpdate object:self userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneGlobalStateUpdate object:self userInfo:dict];
});
}
@ -829,9 +828,9 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon
// dispatch the notification asynchronously
dispatch_async(dispatch_get_main_queue(), ^(void) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneConfiguringStateUpdate
object:self
userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneConfiguringStateUpdate
object:self
userInfo:dict];
});
}
@ -856,7 +855,7 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon
NSDictionary *dict = [NSDictionary
dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:state], @"state", [NSValue valueWithPointer:cfg], @"cfg",
[NSString stringWithUTF8String:message], @"message", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneRegistrationUpdate object:self userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneRegistrationUpdate object:self userInfo:dict];
}
static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyConfig *cfg,
@ -966,7 +965,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
@"call-id" : callID
};
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self userInfo:dict];
}
static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message) {
@ -984,7 +983,7 @@ static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom
if (body != NULL) {
[dict setObject:[NSValue valueWithPointer:body] forKey:@"content"];
}
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneNotifyReceived object:self userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneNotifyReceived object:self userInfo:dict];
}
static void linphone_iphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event,
@ -1012,19 +1011,17 @@ static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCa
[dict setObject:[NSValue valueWithPointer:call] forKey:@"call"];
[dict setObject:[NSNumber numberWithBool:on] forKey:@"on"];
[dict setObject:[NSString stringWithUTF8String:authentication_token] forKey:@"token"];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallEncryptionChanged
object:self
userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallEncryptionChanged object:self userInfo:dict];
}
#pragma mark - Message composition start
- (void)onMessageComposeReceived:(LinphoneCore *)core forRoom:(LinphoneChatRoom *)room {
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextComposeEvent
object:self
userInfo:@{
@"room" : [NSValue valueWithPointer:room]
}];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneTextComposeEvent
object:self
userInfo:@{
@"room" : [NSValue valueWithPointer:room]
}];
}
static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
@ -1388,9 +1385,9 @@ static LinphoneCoreVTable linphonec_vtable = {
// Post event
NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCoreUpdate
object:[LinphoneManager instance]
userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCoreUpdate
object:[LinphoneManager instance]
userInfo:dict];
}
static BOOL libStarted = FALSE;
@ -1493,19 +1490,19 @@ static BOOL libStarted = FALSE;
(or skipped).
Wait for this to finish the code configuration */
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(audioSessionInterrupted:)
name:AVAudioSessionInterruptionNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(globalStateChangedNotificationHandler:)
name:kLinphoneGlobalStateUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(configuringStateChangedNotificationHandler:)
name:kLinphoneConfiguringStateUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(inappReady:) name:kIAPReady object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(audioSessionInterrupted:)
name:AVAudioSessionInterruptionNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(globalStateChangedNotificationHandler:)
name:kLinphoneGlobalStateUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(configuringStateChangedNotificationHandler:)
name:kLinphoneConfiguringStateUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(inappReady:) name:kIAPReady object:nil];
/*call iterate once immediately in order to initiate background connections with sip server or remote provisioning
* grab, if any */
@ -1520,7 +1517,7 @@ static BOOL libStarted = FALSE;
// just in case
[self removeCTCallCenterCb];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
if (theLinphoneCore != nil) { // just in case application terminate before linphone core initialization
@ -1537,9 +1534,9 @@ static BOOL libStarted = FALSE;
// Post event
NSDictionary *dict =
[NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCoreUpdate
object:[LinphoneManager instance]
userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCoreUpdate
object:[LinphoneManager instance]
userInfo:dict];
SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
if (proxyReachability)
@ -1841,9 +1838,9 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
NSDictionary *dict =
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:bluetoothAvailable], @"available", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneBluetoothAvailabilityUpdate
object:self
userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneBluetoothAvailabilityUpdate
object:self
userInfo:dict];
CFRelease(newRoute);
}
}

View file

@ -31,7 +31,7 @@
#pragma mark - Lifecycle Functions
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
[callQualityTimer invalidate];
}
@ -41,29 +41,29 @@
[super viewWillAppear:animated];
// Set observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdate:)
name:kLinphoneRegistrationUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(registrationUpdate:)
name:kLinphoneRegistrationUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(globalStateUpdate:)
name:kLinphoneGlobalStateUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(globalStateUpdate:)
name:kLinphoneGlobalStateUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(notifyReceived:)
name:kLinphoneNotifyReceived
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(notifyReceived:)
name:kLinphoneNotifyReceived
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onCallEncryptionChanged:)
name:kLinphoneCallEncryptionChanged
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(onCallEncryptionChanged:)
name:kLinphoneCallEncryptionChanged
object:nil];
// Update to default state
LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
@ -79,10 +79,10 @@
[super viewWillDisappear:animated];
// Remove observer
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneGlobalStateUpdate object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneNotifyReceived object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneGlobalStateUpdate object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneNotifyReceived object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCallUpdate object:nil];
if (callQualityTimer != nil) {
[callQualityTimer invalidate];

View file

@ -27,24 +27,24 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changeViewEvent:)
name:kLinphoneMainViewChange
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(messageReceived:)
name:kLinphoneMessageReceived
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(changeViewEvent:)
name:kLinphoneMainViewChange
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(messageReceived:)
name:kLinphoneMessageReceived
object:nil];
[self update:FALSE];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {

View file

@ -14,16 +14,16 @@
- (instancetype)init {
if (self = [super init]) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdateEvent:)
name:kLinphoneCallUpdate
object:nil];
}
return self;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)callUpdateEvent:(NSNotification *)notif {

View file

@ -18,19 +18,19 @@ static NSString *const kDisappearAnimation = @"disappear";
@implementation UIBouncingView
INIT_WITH_COMMON_CF {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(settingsUpdate:)
name:kLinphoneSettingsUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillEnterForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(settingsUpdate:)
name:kLinphoneSettingsUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(applicationWillEnterForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
return self;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)settingsUpdate:(NSNotification *)notif {

View file

@ -210,19 +210,19 @@
_ftd = aftd;
_fileTransferProgress.progress = 0;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onFileTransferSendUpdate:)
name:kLinphoneFileTransferSendUpdate
object:_ftd];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onFileTransferRecvUpdate:)
name:kLinphoneFileTransferRecvUpdate
object:_ftd];
[NSNotificationCenter.defaultCenter removeObserver:self];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(onFileTransferSendUpdate:)
name:kLinphoneFileTransferSendUpdate
object:_ftd];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(onFileTransferRecvUpdate:)
name:kLinphoneFileTransferRecvUpdate
object:_ftd];
}
- (void)disconnectFromFileDelegate {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
_ftd = nil;
}

View file

@ -116,7 +116,7 @@
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - ViewController Functions
@ -158,10 +158,10 @@
[self.tabBarViewController viewWillAppear:animated];
[self.statusBarViewController viewWillAppear:animated];
[self.sideMenuViewController viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationDidChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(orientationDidChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
}
@ -184,7 +184,7 @@
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated {

View file

@ -106,7 +106,7 @@
linphone_core_leave_conference([LinphoneManager getLc]);
// Fake event
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
break;
}
case UIPauseButtonType_CurrentCall: {
@ -134,7 +134,7 @@
case UIPauseButtonType_Conference: {
linphone_core_enter_conference([LinphoneManager getLc]);
// Fake event
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
break;
}
case UIPauseButtonType_CurrentCall: {

View file

@ -23,15 +23,15 @@ INIT_WITH_COMMON_CF {
[self setBordered:NO];
[self setRoundRadius];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationDidChange:)
name:@"UIDeviceOrientationDidChangeNotification"
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(orientationDidChange:)
name:@"UIDeviceOrientationDidChangeNotification"
object:nil];
return self;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)orientationDidChange:(NSNotification *)k {

View file

@ -154,7 +154,7 @@ static RootViewManager *rootViewManagerInstance = nil;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - ViewController Functions
@ -173,39 +173,32 @@ static RootViewManager *rootViewManagerInstance = nil;
[super viewWillAppear:animated];
// Set observers
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdate:)
name:kLinphoneRegistrationUpdate
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textReceived:)
name:kLinphoneMessageReceived
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onGlobalStateChanged:)
name:kLinphoneGlobalStateUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(registrationUpdate:)
name:kLinphoneRegistrationUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(textReceived:)
name:kLinphoneMessageReceived
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(onGlobalStateChanged:)
name:kLinphoneGlobalStateUpdate
object:nil];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(batteryLevelChanged:)
name:UIDeviceBatteryLevelDidChangeNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(batteryLevelChanged:)
name:UIDeviceBatteryLevelDidChangeNotification
object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// Remove observers
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneMessageReceived object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIDeviceBatteryLevelDidChangeNotification
object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:NO];
}
@ -591,7 +584,7 @@ static RootViewManager *rootViewManagerInstance = nil;
//[[RootViewManager instance] setViewControllerForDescription:view];
NSDictionary *mdict = [NSMutableDictionary dictionaryWithObject:vc->currentView forKey:@"view"];
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMainViewChange object:self userInfo:mdict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMainViewChange object:self userInfo:mdict];
return [vc->mainViewController getCurrentViewController];
}

View file

@ -161,7 +161,7 @@
}
// Start notification after animation of DCRoundSwitch
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter]
[NSNotificationCenter.defaultCenter
postNotificationName:kIASKAppSettingChanged
object:[toggle key]
userInfo:[NSDictionary dictionaryWithObject:[self.settingsStore objectForKey:[toggle key]]
@ -368,7 +368,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[super viewWillDisappear:animated];
[_settingsController dismiss:self];
// Set observer
[[NSNotificationCenter defaultCenter] removeObserver:self name:kIASKAppSettingChanged object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:kIASKAppSettingChanged object:nil];
if (linphone_ringtoneplayer_is_started(linphone_core_get_ringtoneplayer([LinphoneManager getLc]))) {
linphone_core_stop_ringing([LinphoneManager getLc]);
@ -383,10 +383,10 @@ static UICompositeViewDescription *compositeDescription = nil;
[self recomputeAccountLabelsAndSync];
// Set observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appSettingChanged:)
name:kIASKAppSettingChanged
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(appSettingChanged:)
name:kIASKAppSettingChanged
object:nil];
}
#pragma mark - Event Functions
@ -669,8 +669,7 @@ static UICompositeViewDescription *compositeDescription = nil;
} else if ([key isEqual:@"battery_alert_button"]) {
[[UIDevice currentDevice] _setBatteryState:UIDeviceBatteryStateUnplugged];
[[UIDevice currentDevice] _setBatteryLevel:0.01f];
[[NSNotificationCenter defaultCenter] postNotificationName:UIDeviceBatteryLevelDidChangeNotification
object:self];
[NSNotificationCenter.defaultCenter postNotificationName:UIDeviceBatteryLevelDidChangeNotification object:self];
} else if ([key isEqual:@"flush_images_button"]) {
const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]);
while (rooms) {

View file

@ -26,10 +26,10 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdateEvent:)
name:kLinphoneRegistrationUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(registrationUpdateEvent:)
name:kLinphoneRegistrationUpdate
object:nil];
[self updateHeader];
[_sideMenuTableViewController.tableView reloadData];

View file

@ -237,7 +237,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
}
CFRelease(lContacts);
}
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneAddressBookUpdate object:self];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneAddressBookUpdate object:self];
}
void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void *context) {

View file

@ -75,7 +75,7 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
inMessage:message];
}
thiz.message = NULL;
[[NSNotificationCenter defaultCenter]
[NSNotificationCenter.defaultCenter
postNotificationName:kLinphoneFileTransferRecvUpdate
object:thiz
userInfo:@{
@ -93,7 +93,7 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
LOGD(@"Transfer of %s (%d bytes): already %ld sent, adding %ld", linphone_content_get_name(content),
linphone_content_get_size(content), [thiz.data length], size);
[thiz.data appendBytes:linphone_buffer_get_string_content(buffer) length:size];
[[NSNotificationCenter defaultCenter]
[NSNotificationCenter.defaultCenter
postNotificationName:kLinphoneFileTransferRecvUpdate
object:thiz
userInfo:@{
@ -116,9 +116,9 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
}];
LOGD(@"Transfer of %s (%d bytes): already sent %ld (%f%%), remaining %ld", linphone_content_get_name(content),
total, offset, offset * 100.f / total, remaining);
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneFileTransferSendUpdate
object:thiz
userInfo:dict];
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneFileTransferSendUpdate
object:thiz
userInfo:dict];
LinphoneBuffer *buffer = NULL;
@try {