From 2b44a4e5456998abf42a02130273ab82af09248a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 10:29:53 +0100 Subject: [PATCH 01/22] submodules: update cmake-builder to fix openh264 compilation --- submodules/cmake-builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/cmake-builder b/submodules/cmake-builder index a63fb5009..bfccbef96 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit a63fb50096ee56f82fa7611c44b07f40915dd3fb +Subproject commit bfccbef964288347884757e93cd06d9821daf42e From d63ddbc7f0dc44520cdeba558e46184649bf8c4d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 10:44:05 +0100 Subject: [PATCH 02/22] LinphoneManager: provide factory parameter to plugins init since they expect it --- Classes/LinphoneManager.m | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index f6348ed4c..4c29ad7b9 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -72,13 +72,13 @@ NSString *const kLinphoneFileTransferRecvUpdate = @"LinphoneFileTransferRecvUpda const int kLinphoneAudioVbrCodecDefaultBitrate = 36; /*you can override this from linphonerc or linphonerc-factory*/ -extern void libmsilbc_init(void); -extern void libmsamr_init(void); -extern void libmsx264_init(void); -extern void libmsopenh264_init(void); -extern void libmssilk_init(void); -extern void libmsbcg729_init(void); -extern void libmswebrtc_init(void); +extern void libmsilbc_init(MSFactory *factory); +extern void libmsamr_init(MSFactory *factory); +extern void libmsx264_init(MSFactory *factory); +extern void libmsopenh264_init(MSFactory *factory); +extern void libmssilk_init(MSFactory *factory); +extern void libmsbcg729_init(MSFactory *factory); +extern void libmswebrtc_init(MSFactory *factory); #define FRONT_CAM_NAME \ "AV Capture: com.apple.avfoundation.avcapturedevice.built-in_video:1" /*"AV Capture: Front Camera"*/ @@ -1453,13 +1453,13 @@ static BOOL libStarted = FALSE; ms_init(); // Need to initialize mediastreamer2 before loading the plugins // Load plugins if available in the linphone SDK - otherwise these calls will do nothing - libmsilbc_init(); - libmssilk_init(); - libmsamr_init(); - libmsx264_init(); - libmsopenh264_init(); - libmsbcg729_init(); - libmswebrtc_init(); + libmsilbc_init(ms_factory_get_fallback()); + libmssilk_init(ms_factory_get_fallback()); + libmsamr_init(ms_factory_get_fallback()); + libmsx264_init(ms_factory_get_fallback()); + libmsopenh264_init(ms_factory_get_fallback()); + libmsbcg729_init(ms_factory_get_fallback()); + libmswebrtc_init(ms_factory_get_fallback()); theLinphoneCore = linphone_core_new_with_config(&linphonec_vtable, configDb, (__bridge void *)(self)); LOGI(@"Create linphonecore %p", theLinphoneCore); From 94e1d2212df78c9735a3f023c4dc2d2b190e1f50 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 14:31:26 +0100 Subject: [PATCH 03/22] chat: improve notification text --- Classes/ChatConversationTableView.m | 14 -------------- Classes/LinphoneManager.m | 13 +++++-------- Classes/LinphoneUI/UIChatBubbleTextCell.m | 13 ++++++++++--- Classes/LinphoneUI/UIChatCell.m | 20 +++++--------------- Classes/LinphoneUI/UIRoundedImageView.m | 3 ++- linphone_Prefix.pch | 2 ++ 6 files changed, 24 insertions(+), 41 deletions(-) diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index b6b78a726..b494b8379 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -103,20 +103,6 @@ } } -- (void)debugMessages { - if (!messageList) { - LOGE(@"No data to debug"); - return; - } - MSList *item = messageList; - int count = 0; - while (item) { - LinphoneChatMessage *msg = (LinphoneChatMessage *)item->data; - LOGI(@"Message %d: %s", count++, linphone_chat_message_get_text(msg)); - item = item->next; - } -} - - (void)scrollToLastUnread:(BOOL)animated { if (messageList == nil || chatRoom == nil) { return; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 4c29ad7b9..ea7343d3c 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -933,9 +933,6 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char NSString *from = [FastAddressBook displayNameForAddress:remoteAddress]; char *c_address = linphone_address_as_string_uri_only(remoteAddress); NSString *remote_uri = [NSString stringWithUTF8String:c_address]; - const char *chat = linphone_chat_message_get_text(msg); - if (chat == NULL) - chat = ""; ms_free(c_address); @@ -943,12 +940,13 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char // Create a new notification UILocalNotification *notif = [[UILocalNotification alloc] init]; if (notif) { + NSString *chat = [UIChatBubbleTextCell TextMessageForChat:msg]; notif.repeatInterval = 0; if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { notif.category = @"incoming_msg"; } if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) { - notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, @(chat)]; + notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, chat]; } else { notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from]; } @@ -1727,11 +1725,10 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { linphone_core_start_dtmf_stream(theLinphoneCore); /*start the video preview in case we are in the main view*/ - if (IPAD && linphone_core_video_display_enabled(theLinphoneCore) && - [self lpConfigBoolForKey:@"preview_preference"]) { + // if (linphone_core_video_display_enabled(theLinphoneCore) && [self lpConfigBoolForKey:@"preview_preference"]) { linphone_core_enable_video_preview(theLinphoneCore, TRUE); - } - /*check last keepalive handler date*/ + // } + /*check last keepalive handler date*/ if (mLastKeepAliveDate != Nil) { NSDate *current = [NSDate date]; if ([current timeIntervalSinceDate:mLastKeepAliveDate] > 700) { diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 362c503d9..e65ddad83 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -70,9 +70,16 @@ } + (NSString *)TextMessageForChat:(LinphoneChatMessage *)message { - const char *text = linphone_chat_message_get_text(message) ?: ""; - return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding] - ?: NSLocalizedString(@"(invalid string)", nil); + const char *url = linphone_chat_message_get_external_body_url(message); + const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(message); + // Last message was a file transfer (image) so display a picture... + if (url || last_content) { + return @"🗻"; + } else { + const char *text = linphone_chat_message_get_text(message) ?: ""; + return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding] + ?: NSLocalizedString(@"(invalid string)", nil); + } } + (NSString *)ContactDateForChat:(LinphoneChatMessage *)message { diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 22caf1a17..770b28736 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -69,22 +69,12 @@ LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom); if (last_message) { - const char *text = linphone_chat_message_get_text(last_message); - const char *url = linphone_chat_message_get_external_body_url(last_message); - const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(last_message); - // Last message was a file transfer (image) so display a picture... - if (url || last_content) { - _chatContentLabel.text = @"🗻"; - // otherwise show beginning of the text message - } else if (text) { - NSString *message = [NSString stringWithUTF8String:text]; - // shorten long messages - if ([message length] > 50) - message = [[message substringToIndex:50] stringByAppendingString:@"[...]"]; - - _chatContentLabel.text = message; + NSString *message = [UIChatBubbleTextCell TextMessageForChat:last_message]; + // shorten long messages + if ([message length] > 50) { + message = [[message substringToIndex:50] stringByAppendingString:@"[...]"]; } - + _chatContentLabel.text = message; _chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_chat_message_get_time(last_message) withFormat:LinphoneDateChatList]; _chatLatestTimeLabel.hidden = NO; diff --git a/Classes/LinphoneUI/UIRoundedImageView.m b/Classes/LinphoneUI/UIRoundedImageView.m index 90847d109..aab2dfe69 100644 --- a/Classes/LinphoneUI/UIRoundedImageView.m +++ b/Classes/LinphoneUI/UIRoundedImageView.m @@ -51,7 +51,8 @@ INIT_WITH_COMMON_CF { } - (void)setBordered:(BOOL)bordered { - borderView.hidden = !bordered; + // bugged on rotation yet + borderView.hidden = TRUE; //! bordered; } - (CGRect)computeBox { CGFloat min = MIN(self.frame.size.width, self.frame.size.height); diff --git a/linphone_Prefix.pch b/linphone_Prefix.pch index c562b2c3a..eebc8998b 100644 --- a/linphone_Prefix.pch +++ b/linphone_Prefix.pch @@ -13,3 +13,5 @@ #import "UIToggleButton.h" #import "UISpeakerButton.h" #import "UIBluetoothButton.h" + +#import "UIChatBubbleTextCell.h" From 80e271a964070f6fc5ab275432f8d44d98bd67dc Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 15:59:20 +0100 Subject: [PATCH 04/22] submodules: reactive opencore-amr which was disabled... somehow? --- .gitmodules | 2 +- submodules/externals/opencore-amr | 1 + submodules/externals/openh264 | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 160000 submodules/externals/opencore-amr diff --git a/.gitmodules b/.gitmodules index 1fe8d627b..f7de1ead2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,7 +9,7 @@ url = git://git.linphone.org/speex [submodule "submodules/externals/opencore-amr"] path = submodules/externals/opencore-amr - url = git://git.linphone.org/opencore-amr + url = git://git.linphone.org/opencore-amr.git ignore = dirty [submodule "submodules/msamr"] path = submodules/msamr diff --git a/submodules/externals/opencore-amr b/submodules/externals/opencore-amr new file mode 160000 index 000000000..cf4409e03 --- /dev/null +++ b/submodules/externals/opencore-amr @@ -0,0 +1 @@ +Subproject commit cf4409e03ec56b1cd85a2f9532f58bc1fa9db274 diff --git a/submodules/externals/openh264 b/submodules/externals/openh264 index 3a75956fb..2610ab183 160000 --- a/submodules/externals/openh264 +++ b/submodules/externals/openh264 @@ -1 +1 @@ -Subproject commit 3a75956fb2584cca84a95ba1fcbc72fa2c91f98d +Subproject commit 2610ab183249aee91862d2ad065f61db89107b34 From be3a94e20cd4a9b99346f8baa5d57ecc866715ae Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 16:39:02 +0100 Subject: [PATCH 05/22] settings: fix crash when opening it too quickly --- Classes/SettingsView.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 298fcd49e..9c5d2c9d2 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -282,6 +282,13 @@ INIT_WITH_COMMON_CF { } - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { + // when device is slow and you are typing an item too much, a crash may happen + // because we try to push the same view multiple times - in that case we should + // do nothing but wait for device to respond again. + if (self.navigationController.topViewController == viewController) { + return; + } + [UINavigationControllerEx removeBackground:viewController.view]; [viewController view]; // Force view From 9d4a76f0c2d8074e61b712165340d18e91332a52 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 16:47:46 +0100 Subject: [PATCH 06/22] misc: add ANIMATED macro --- Classes/AssistantView.m | 2 +- Classes/CallOutgoingView.m | 4 +-- Classes/CallView.m | 12 +++---- Classes/LinphoneCoreSettingsStore.m | 16 ++++----- Classes/LinphoneUI/TabBarView.m | 2 +- Classes/LinphoneUI/UIBouncingView.m | 4 +-- Classes/Log.h | 2 -- Classes/PhoneMainView.m | 50 ++++++++++------------------- Classes/Utils/Utils.h | 3 ++ Resources/linphonerc-factory | 2 -- 10 files changed, 38 insertions(+), 59 deletions(-) diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 2e35d179b..75a726982 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -285,7 +285,7 @@ static UICompositeViewDescription *compositeDescription = nil; } // Animation - if (animation && [[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) { + if (animation && ANIMATED) { CATransition *trans = [CATransition animation]; [trans setType:kCATransitionPush]; [trans setDuration:0.35]; diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index 723e5ef4e..420b4cdea 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -93,9 +93,9 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onRoutesClick:(id)sender { if ([_routesView isHidden]) { - [self hideRoutes:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hideRoutes:FALSE animated:ANIMATED]; } else { - [self hideRoutes:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hideRoutes:TRUE animated:ANIMATED]; } } diff --git a/Classes/CallView.m b/Classes/CallView.m index 464deeb10..d613473f9 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -674,9 +674,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { - (IBAction)onNumpadClick:(id)sender { if ([_numpadView isHidden]) { - [self hidePad:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hidePad:FALSE animated:ANIMATED]; } else { - [self hidePad:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hidePad:TRUE animated:ANIMATED]; } } @@ -703,9 +703,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { - (IBAction)onRoutesClick:(id)sender { if ([_routesView isHidden]) { - [self hideRoutes:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hideRoutes:FALSE animated:ANIMATED]; } else { - [self hideRoutes:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hideRoutes:TRUE animated:ANIMATED]; } } @@ -731,9 +731,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { - (IBAction)onOptionsClick:(id)sender { if ([_optionsView isHidden]) { - [self hideOptions:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hideOptions:FALSE animated:ANIMATED]; } else { - [self hideOptions:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self hideOptions:TRUE animated:ANIMATED]; } } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index fdf02aa8d..820adb1a9 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -364,17 +364,13 @@ // advanced section { - [self setBool:[lm lpConfigBoolForKey:@"debugenable_preference" withDefault:NO] - forKey:@"debugenable_preference"]; - [self setBool:[lm lpConfigBoolForKey:@"animations_preference" withDefault:NO] forKey:@"animations_preference"]; - [self setBool:[lm lpConfigBoolForKey:@"backgroundmode_preference" withDefault:NO] - forKey:@"backgroundmode_preference"]; - [self setBool:[lm lpConfigBoolForKey:@"start_at_boot_preference" withDefault:NO] - forKey:@"start_at_boot_preference"]; - [self setBool:[lm lpConfigBoolForKey:@"autoanswer_notif_preference" withDefault:NO] - forKey:@"autoanswer_notif_preference"]; + [self setBool:[lm lpConfigBoolForKey:@"debugenable_preference"] forKey:@"debugenable_preference"]; + [self setBool:ANIMATED forKey:@"animations_preference"]; + [self setBool:[lm lpConfigBoolForKey:@"backgroundmode_preference"] forKey:@"backgroundmode_preference"]; + [self setBool:[lm lpConfigBoolForKey:@"start_at_boot_preference"] forKey:@"start_at_boot_preference"]; + [self setBool:[lm lpConfigBoolForKey:@"autoanswer_notif_preference"] forKey:@"autoanswer_notif_preference"]; [self setBool:[lm lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES] forKey:@"show_msg_in_notif"]; - [self setBool:[lm lpConfigBoolForKey:@"enable_first_login_view_preference" withDefault:NO] + [self setBool:[lm lpConfigBoolForKey:@"enable_first_login_view_preference"] forKey:@"enable_first_login_view_preference"]; LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); if (parsed != NULL) { diff --git a/Classes/LinphoneUI/TabBarView.m b/Classes/LinphoneUI/TabBarView.m index 9899e059c..ed3c10e1b 100644 --- a/Classes/LinphoneUI/TabBarView.m +++ b/Classes/LinphoneUI/TabBarView.m @@ -131,7 +131,7 @@ : -selectedNewFrame.size.height /*hide it if none is selected*/)))); } - CGFloat delay = [[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] ? 0.3 : 0; + CGFloat delay = ANIMATED ? 0.3 : 0; [UIView animateWithDuration:delay animations:^{ _selectedButtonImage.frame = selectedNewFrame; diff --git a/Classes/LinphoneUI/UIBouncingView.m b/Classes/LinphoneUI/UIBouncingView.m index df2cf3490..9a6946596 100644 --- a/Classes/LinphoneUI/UIBouncingView.m +++ b/Classes/LinphoneUI/UIBouncingView.m @@ -34,7 +34,7 @@ INIT_WITH_COMMON_CF { } - (void)settingsUpdate:(NSNotification *)notif { - if ([[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == false) { + if (ANIMATED == false) { [self stopAnimating:NO]; } else { if (![self isHidden]) { @@ -105,7 +105,7 @@ INIT_WITH_COMMON_CF { } [self setHidden:FALSE]; - if ([[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) { + if (ANIMATED) { if (animated) { [self appearAnimation:kAppearAnimation target:self diff --git a/Classes/Log.h b/Classes/Log.h index becc2e538..b79034b48 100644 --- a/Classes/Log.h +++ b/Classes/Log.h @@ -26,8 +26,6 @@ #define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__) #define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__) -#define IPAD (LinphoneManager.runningOnIpad) - @interface LinphoneLogger : NSObject { } diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index f25ded396..36897925b 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -78,7 +78,7 @@ static RootViewManager *rootViewManagerInstance = nil; currentViewController = newMainView; LinphoneAppDelegate *delegate = (LinphoneAppDelegate *)[UIApplication sharedApplication].delegate; - if ([[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) { + if (ANIMATED) { [UIView transitionWithView:delegate.window duration:0.3 options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowAnimatedContent @@ -544,14 +544,26 @@ static RootViewManager *rootViewManagerInstance = nil; [mainViewController setFullscreen:enabled]; } +- (UIViewController *)popCurrentView { + NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; + if ([viewStack count] > 1) { + LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView, viewStack.lastObject); + [viewStack removeLastObject]; + [self _changeCurrentView:[viewStack lastObject] + transition:[PhoneMainView getBackwardTransition] + animated:ANIMATED]; + return [mainViewController getCurrentViewController]; + } + LOGW(@"PhoneMainView: Trying to pop view but none stacked!"); + return nil; +} + - (void)changeCurrentView:(UICompositeViewDescription *)view { [self changeCurrentView:view push:TRUE]; } - (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push { - [self changeCurrentView:view - push:push - animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + [self changeCurrentView:view push:push animated:ANIMATED]; } - (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push animated:(BOOL)animated { @@ -562,24 +574,10 @@ static RootViewManager *rootViewManagerInstance = nil; [self _changeCurrentView:view transition:nil animated:animated]; } -- (BOOL)isUnauthorizedView:(UICompositeViewDescription *)view { - return [[LinphoneManager.instance lpConfigStringForKey:@"unauthorized_views"] containsString:view.name]; -} - - (UIViewController *)_changeCurrentView:(UICompositeViewDescription *)view transition:(CATransition *)transition animated:(BOOL)animated { PhoneMainView *vc = [[RootViewManager instance] setViewControllerForDescription:view]; - - if ([self isUnauthorizedView:view]) { - NSString *fallback = [LinphoneManager.instance lpConfigStringForKey:@"fallback_view"]; - UICompositeViewDescription *fallback_view = DialerView.compositeViewDescription; - if (fallback && [NSClassFromString(fallback) respondsToSelector:@selector(compositeViewDescription)]) { - fallback_view = [NSClassFromString(fallback) performSelector:@selector(compositeViewDescription)]; - } - LOGW(@"Trying to access unauthorized view %@, going back to %@", view.name, fallback_view.name); - view = fallback_view; - } if (![view equal:vc.currentView] || vc != self) { LOGI(@"Change current view to %@", view.name); if (animated && transition == nil) @@ -605,7 +603,7 @@ static RootViewManager *rootViewManagerInstance = nil; } return [self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition] - animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; + animated:ANIMATED]; } - (UICompositeViewDescription *)firstView { @@ -617,20 +615,6 @@ static RootViewManager *rootViewManagerInstance = nil; return view; } -- (UIViewController *)popCurrentView { - NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; - if ([viewStack count] > 1) { - LOGI(@"PhoneMainView: Pop view"); - [viewStack removeLastObject]; - [self _changeCurrentView:[viewStack lastObject] - transition:[PhoneMainView getBackwardTransition] - animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]]; - return [mainViewController getCurrentViewController]; - } - LOGW(@"PhoneMainView: Trying to pop view but none stacked!"); - return nil; -} - - (void)displayCallError:(LinphoneCall *)call message:(NSString *)message { const char *lUserNameChars = linphone_address_get_username(linphone_call_get_remote_address(call)); NSString *lUserName = diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index af581620b..b39e90e45 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -19,6 +19,9 @@ #import "LinphoneManager.h" +#define IPAD (LinphoneManager.runningOnIpad) +#define ANIMATED ([LinphoneManager.instance lpConfigBoolForKey:@"animations_preference"]) + @interface LinphoneUtils : NSObject + (BOOL)findAndResignFirstResponder:(UIView*)view; diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index 77e05a713..b59c2071e 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -17,8 +17,6 @@ display_filter_auto_rotate=0 #contact_filter_on_default_domain=1 #use_phone_number=0 send_logs_include_linphonerc_and_chathistory=0 -fallback_view=DialerView -unauthorized_views=FirstView [assistant] username_regex=^[a-z0-9_.\-]*$ From 6a1e42a562d0a87178ecd71b285ef4d0ccbd7b8e Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 16:56:16 +0100 Subject: [PATCH 07/22] misc: replace [NSNotificationCenter defaultCenter] with NSNotificationCenter.defaultCenter --- Classes/AssistantView.m | 26 ++---- Classes/CallIncomingView.m | 10 +-- Classes/CallOutgoingView.m | 8 +- Classes/CallView.m | 28 +++---- Classes/ChatConversationView.m | 62 +++++++------- Classes/ChatsListTableView.m | 4 +- Classes/ChatsListView.m | 10 +-- Classes/DialerView.m | 20 ++--- Classes/FirstLoginView.m | 10 +-- Classes/HistoryDetailsView.m | 18 ++-- Classes/HistoryListTableView.m | 20 ++--- Classes/HistoryListView.m | 2 +- Classes/InAppProductsManager.m | 4 +- Classes/LinphoneAppDelegate.m | 12 +-- Classes/LinphoneCoreSettingsStore.m | 4 +- Classes/LinphoneManager.m | 97 +++++++++++----------- Classes/LinphoneUI/StatusBarView.m | 50 +++++------ Classes/LinphoneUI/TabBarView.m | 26 +++--- Classes/LinphoneUI/UIBackToCallButton.m | 10 +-- Classes/LinphoneUI/UIBouncingView.m | 18 ++-- Classes/LinphoneUI/UIChatBubblePhotoCell.m | 20 ++--- Classes/LinphoneUI/UICompositeView.m | 12 +-- Classes/LinphoneUI/UIPauseButton.m | 4 +- Classes/LinphoneUI/UIRoundedImageView.m | 10 +-- Classes/PhoneMainView.m | 53 +++++------- Classes/SettingsView.m | 15 ++-- Classes/SideMenuView.m | 8 +- Classes/Utils/FastAddressBook.m | 2 +- Classes/Utils/FileTransferDelegate.m | 10 +-- 29 files changed, 277 insertions(+), 296 deletions(-) diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 75a726982..df31e2a01 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -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 { diff --git a/Classes/CallIncomingView.m b/Classes/CallIncomingView.m index ec431a6d0..6d8d29b8d 100644 --- a/Classes/CallIncomingView.m +++ b/Classes/CallIncomingView.m @@ -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 diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index 420b4cdea..e167cc01c 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -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) { diff --git a/Classes/CallView.m b/Classes/CallView.m index d613473f9..1f9694af8 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -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 { diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 20a7fc1cd..933508926 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -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]; diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index ddb4ed335..8ed558546 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -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]; }]; } diff --git a/Classes/ChatsListView.m b/Classes/ChatsListView.m index 6fe1e2c28..6f7798769 100644 --- a/Classes/ChatsListView.m +++ b/Classes/ChatsListView.m @@ -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 diff --git a/Classes/DialerView.m b/Classes/DialerView.m index d6a3538dc..bf96f1f38 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -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 { diff --git a/Classes/FirstLoginView.m b/Classes/FirstLoginView.m index cd2473341..a0dd66fb7 100644 --- a/Classes/FirstLoginView.m +++ b/Classes/FirstLoginView.m @@ -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 { diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index 02216d51c..ca8f5468f 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -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 diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index d65cd98d1..807d4fa35 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -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 diff --git a/Classes/HistoryListView.m b/Classes/HistoryListView.m index fa9c6be73..72fd365ca 100644 --- a/Classes/HistoryListView.m +++ b/Classes/HistoryListView.m @@ -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 - diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m index 76cb06fca..44e04d504 100644 --- a/Classes/InAppProductsManager.m +++ b/Classes/InAppProductsManager.m @@ -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 diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index c55dd4db4..9e2d3e3b1 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -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]; diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 820adb1a9..c6a9269f3 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -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; } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index ea7343d3c..2034050bd 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -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); } } diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m index 1e0b19cdc..6457645a0 100644 --- a/Classes/LinphoneUI/StatusBarView.m +++ b/Classes/LinphoneUI/StatusBarView.m @@ -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]; diff --git a/Classes/LinphoneUI/TabBarView.m b/Classes/LinphoneUI/TabBarView.m index ed3c10e1b..af0c6fbc8 100644 --- a/Classes/LinphoneUI/TabBarView.m +++ b/Classes/LinphoneUI/TabBarView.m @@ -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 { diff --git a/Classes/LinphoneUI/UIBackToCallButton.m b/Classes/LinphoneUI/UIBackToCallButton.m index 377e1ea57..20e25fabc 100644 --- a/Classes/LinphoneUI/UIBackToCallButton.m +++ b/Classes/LinphoneUI/UIBackToCallButton.m @@ -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 { diff --git a/Classes/LinphoneUI/UIBouncingView.m b/Classes/LinphoneUI/UIBouncingView.m index 9a6946596..d43a8f305 100644 --- a/Classes/LinphoneUI/UIBouncingView.m +++ b/Classes/LinphoneUI/UIBouncingView.m @@ -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 { diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index a1b3bd068..01675d019 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -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; } diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m index 470eff907..d17a94655 100644 --- a/Classes/LinphoneUI/UICompositeView.m +++ b/Classes/LinphoneUI/UICompositeView.m @@ -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 { diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index 586de121d..d10999eab 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -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: { diff --git a/Classes/LinphoneUI/UIRoundedImageView.m b/Classes/LinphoneUI/UIRoundedImageView.m index aab2dfe69..2b75d4eee 100644 --- a/Classes/LinphoneUI/UIRoundedImageView.m +++ b/Classes/LinphoneUI/UIRoundedImageView.m @@ -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 { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 36897925b..48ec5cb01 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -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]; } diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 9c5d2c9d2..4994f1d52 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -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) { diff --git a/Classes/SideMenuView.m b/Classes/SideMenuView.m index 8400bd301..bb903046e 100644 --- a/Classes/SideMenuView.m +++ b/Classes/SideMenuView.m @@ -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]; diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 7bc2eae63..d683a7ab4 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -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) { diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index 3ffef5ae6..81c37856e 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -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 { From 60053876f9dbdb0e007a930515229954e36fcdc3 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 17:11:48 +0100 Subject: [PATCH 08/22] travis: add some debug traces --- Classes/ChatConversationView.m | 1 + Classes/LinphoneUI/UICheckBoxTableView.m | 1 + 2 files changed, 2 insertions(+) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 933508926..84902ccf4 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -496,6 +496,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDeleteClick:(id)sender { + LOGI(@"onDeleteClick"); NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"Do you want to delete selected messages?", nil)]; [UIConfirmationDialog ShowWithMessage:msg cancelMessage:nil diff --git a/Classes/LinphoneUI/UICheckBoxTableView.m b/Classes/LinphoneUI/UICheckBoxTableView.m index 4a631f02b..506fd901d 100644 --- a/Classes/LinphoneUI/UICheckBoxTableView.m +++ b/Classes/LinphoneUI/UICheckBoxTableView.m @@ -130,6 +130,7 @@ [_selectedItems removeAllObjects]; [self selectToggleButton:!_toggleSelectionButton.selected]; // TODO: why do we need that? + LOGI(@"onSelectionToggle: select %@", _toggleSelectionButton.selected ? @"NONE" : @"ALL"); for (int i = 0; i < [self numberOfSectionsInTableView:self.tableView]; i++) { for (int j = 0; j < [self tableView:self.tableView numberOfRowsInSection:i]; j++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i]; From 042e37ff93802c76a6ce1510f5f7902d0c59e441 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 16:57:23 +0100 Subject: [PATCH 09/22] assistant: do not remove default proxy config before end of assistant and add LC macro --- Classes/AssistantView.h | 2 +- Classes/AssistantView.m | 30 +++++++++---------- Classes/CallConferenceTableView.m | 4 +-- Classes/CallOutgoingView.m | 6 ++-- Classes/CallPausedTableView.m | 6 ++-- Classes/CallSideMenuView.m | 2 +- Classes/CallView.m | 35 +++++++++++------------ Classes/ChatConversationCreateTableView.m | 4 +-- Classes/ChatConversationView.m | 5 ++-- Classes/ChatsListTableView.m | 2 +- Classes/ContactDetailsView.m | 2 +- Classes/DialerView.m | 8 +++--- Classes/FirstLoginView.m | 6 ++-- Classes/HistoryDetailsTableView.m | 2 +- Classes/HistoryDetailsView.m | 4 +-- Classes/HistoryListTableView.m | 10 +++---- Classes/HistoryListView.m | 2 +- Classes/InAppProductsManager.m | 2 +- Classes/LinphoneAppDelegate.m | 18 ++++++------ Classes/LinphoneCoreSettingsStore.m | 20 ++++++------- Classes/LinphoneManager.m | 19 ++++++------ Classes/LinphoneUI/StatusBarView.m | 34 +++++++++++----------- Classes/LinphoneUI/TabBarView.m | 4 +-- Classes/LinphoneUI/UIBackToCallButton.m | 2 +- Classes/LinphoneUI/UICallButton.m | 4 +-- Classes/LinphoneUI/UICallConferenceCell.m | 2 +- Classes/LinphoneUI/UICamSwitch.m | 10 +++---- Classes/LinphoneUI/UIContactDetailsCell.m | 8 +++--- Classes/LinphoneUI/UIDigitButton.m | 10 +++---- Classes/LinphoneUI/UIHangUpButton.m | 4 +-- Classes/LinphoneUI/UIMicroButton.m | 6 ++-- Classes/LinphoneUI/UIPauseButton.m | 16 +++++------ Classes/LinphoneUI/UIVideoButton.m | 10 +++---- Classes/LinphoneUI/VideoZoomHandler.m | 6 ++-- Classes/PhoneMainView.m | 28 +++++++++--------- Classes/SettingsView.m | 31 ++++++++++---------- Classes/SideMenuTableView.m | 8 ++---- Classes/SideMenuView.m | 2 +- Classes/Utils/FastAddressBook.m | 2 +- Classes/Utils/Utils.h | 1 + 40 files changed, 184 insertions(+), 193 deletions(-) diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 524f22643..2ee58224c 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -29,7 +29,7 @@ UIView *nextView; NSMutableArray *historyViews; LinphoneProxyConfig *new_config; - LinphoneProxyConfig *previous_default_config; + int number_of_configs_before; } @property(nonatomic, strong) IBOutlet TPKeyboardAvoidingScrollView *contentView; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index df31e2a01..292abd547 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -96,6 +96,7 @@ static UICompositeViewDescription *compositeDescription = nil; new_config = NULL; [self resetTextFields]; [self changeView:_welcomeView back:FALSE animation:FALSE]; + number_of_configs_before = ms_list_size(linphone_core_get_proxy_config_list(LC)); } - (void)viewWillDisappear:(BOOL)animated { @@ -126,9 +127,8 @@ static UICompositeViewDescription *compositeDescription = nil; } [[LinphoneManager instance] resetLinphoneCore]; account_creator = linphone_account_creator_new( - [LinphoneManager getLc], - [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] - .UTF8String); + LC, [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] + .UTF8String); linphone_account_creator_set_user_data(account_creator, (__bridge void *)(self)); linphone_account_creator_cbs_set_existence_tested(linphone_account_creator_get_callbacks(account_creator), assistant_existence_tested); @@ -139,7 +139,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)loadAssistantConfig:(NSString *)rcFilename { NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]]; - linphone_core_set_provisioning_uri([LinphoneManager getLc], fullPath.UTF8String); + linphone_core_set_provisioning_uri(LC, fullPath.UTF8String); [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; [self resetLiblinphone]; @@ -149,7 +149,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[LinphoneManager instance] removeAllAccounts]; [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LCSipTransports transportValue = {5060, 5060, -1, -1}; if (linphone_core_set_sip_transports(lc, &transportValue)) { @@ -213,7 +213,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)configureProxyConfig { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneManager *lm = [LinphoneManager instance]; // remove previous proxy config, if any @@ -318,15 +318,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)fillDefaultValues { [self resetTextFields]; - LinphoneProxyConfig *current_conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); - if (current_conf != NULL) { - if (linphone_proxy_config_find_auth_info(current_conf) != NULL) { - LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); - [self onDialerClick:nil]; - } - } - - LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config(LC); const char *identity = linphone_proxy_config_get_identity(default_conf); if (identity) { LinphoneAddress *default_addr = linphone_address_new(identity); @@ -478,7 +470,7 @@ static UICompositeViewDescription *compositeDescription = nil; if ([inputEntry rangeOfString:@"://"].location == NSNotFound) { inputEntry = [NSString stringWithFormat:@"http://%@", inputEntry]; } - return (linphone_core_set_provisioning_uri([LinphoneManager getLc], inputEntry.UTF8String) != 0); + return (linphone_core_set_provisioning_uri(LC, inputEntry.UTF8String) != 0); } return TRUE; }]; @@ -556,6 +548,12 @@ static UICompositeViewDescription *compositeDescription = nil; switch (status) { case LinphoneConfiguringSuccessful: + // we successfully loaded a remote provisioned config, go to dialer + if (number_of_configs_before < ms_list_size(linphone_core_get_proxy_config_list(LC))) { + LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); + [self onDialerClick:nil]; + } + if (nextView == nil) { [self fillDefaultValues]; } else { diff --git a/Classes/CallConferenceTableView.m b/Classes/CallConferenceTableView.m index 7a5f389a8..71bd14208 100644 --- a/Classes/CallConferenceTableView.m +++ b/Classes/CallConferenceTableView.m @@ -48,7 +48,7 @@ #pragma mark - UITableViewDataSource Functions - (LinphoneCall *)conferenceCallForRow:(NSInteger)row { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int i = -1; while (calls) { if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(calls->data))) { @@ -74,7 +74,7 @@ } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int count = 0; while (calls) { if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(calls->data))) { diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index e167cc01c..a14992e8b 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -53,7 +53,7 @@ static UICompositeViewDescription *compositeDescription = nil; name:kLinphoneBluetoothAvailabilityUpdate object:nil]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (!call) { if (![PhoneMainView.instance popCurrentView]) { [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; @@ -100,9 +100,9 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDeclineClick:(id)sender { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { - linphone_core_terminate_call([LinphoneManager getLc], call); + linphone_core_terminate_call(LC, call); } if (![PhoneMainView.instance popCurrentView]) { [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; diff --git a/Classes/CallPausedTableView.m b/Classes/CallPausedTableView.m index 2f62d8e41..5878d3588 100644 --- a/Classes/CallPausedTableView.m +++ b/Classes/CallPausedTableView.m @@ -54,7 +54,7 @@ #pragma mark - UITableViewDataSource Functions - (LinphoneCall *)conferenceCallForRow:(NSInteger)row { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int i = -1; while (calls) { if (linphone_call_get_state(calls->data) == LinphoneCallPaused) { @@ -81,7 +81,7 @@ } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int count = 0; int conference_in_pause = 0; while (calls) { @@ -90,7 +90,7 @@ count++; } if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call)) && - !linphone_core_is_in_conference([LinphoneManager getLc])) { + !linphone_core_is_in_conference(LC)) { conference_in_pause = 1; } calls = calls->next; diff --git a/Classes/CallSideMenuView.m b/Classes/CallSideMenuView.m index cd46d4ba8..e53fa3ffb 100644 --- a/Classes/CallSideMenuView.m +++ b/Classes/CallSideMenuView.m @@ -134,7 +134,7 @@ } - (void)updateStats:(NSTimer *)timer { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (!call) { _statsLabel.text = NSLocalizedString(@"No call in progress", nil); diff --git a/Classes/CallView.m b/Classes/CallView.m index 1f9694af8..158e96d0d 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -134,7 +134,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self updateUnreadMessage:FALSE]; // Update on show - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; [self callUpdate:call state:state animated:FALSE]; [self hideRoutes:TRUE animated:FALSE]; @@ -144,8 +144,8 @@ static UICompositeViewDescription *compositeDescription = nil; [self callDurationUpdate]; [self onCurrentCallChange]; // Set windows (warn memory leaks) - linphone_core_set_native_video_window_id([LinphoneManager getLc], (__bridge void *)(_videoView)); - linphone_core_set_native_preview_window_id([LinphoneManager getLc], (__bridge void *)(_videoPreview)); + linphone_core_set_native_video_window_id(LC, (__bridge void *)(_videoView)); + linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview)); // Enable tap [singleFingerTap setEnabled:TRUE]; @@ -215,7 +215,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Disable tap [singleFingerTap setEnabled:FALSE]; - if (linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) { + if (linphone_core_get_calls_nb(LC) == 0) { // reseting speaker button because no more call _speakerButton.selected = FALSE; } @@ -240,7 +240,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (void)updateBottomBar:(LinphoneCall *)call state:(LinphoneCallState)state { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; [_speakerButton update]; [_microButton update]; @@ -356,7 +356,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { // only show camera switch button if we have more than 1 camera _videoCameraSwitch.hidden = (disabled || !LinphoneManager.instance.frontCamId); - _videoPreview.hidden = (disabled || !linphone_core_self_view_enabled([LinphoneManager getLc])); + _videoPreview.hidden = (disabled || !linphone_core_self_view_enabled(LC)); if (hideControlsTimer != nil) { [hideControlsTimer invalidate]; @@ -379,7 +379,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { [_videoWaitingForFirstImage setHidden:NO]; [_videoWaitingForFirstImage startAnimating]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); // linphone_call_params_get_used_video_codec return 0 if no video stream enabled if (call != NULL && linphone_call_params_get_used_video_codec(linphone_call_get_current_params(call))) { linphone_call_set_next_video_frame_decoded_callback(call, hideSpinner, (__bridge void *)(self)); @@ -403,14 +403,13 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (void)callDurationUpdate { - int duration = linphone_core_get_current_call([LinphoneManager getLc]) - ? linphone_call_get_duration(linphone_core_get_current_call([LinphoneManager getLc])) - : 0; + int duration = + linphone_core_get_current_call(LC) ? linphone_call_get_duration(linphone_core_get_current_call(LC)) : 0; _durationLabel.text = [LinphoneUtils durationToString:duration]; } - (void)onCurrentCallChange { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); _noActiveCallView.hidden = (call || linphone_core_is_in_conference(lc)); @@ -504,7 +503,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state animated:(BOOL)animated { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; [self updateBottomBar:call state:state]; if (hiddenVolume) { [PhoneMainView.instance setVolumeHidden:FALSE]; @@ -594,7 +593,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { #pragma mark - ActionSheet Functions - (void)displayAskToEnableVideoCall:(LinphoneCall *)call { - if (linphone_core_get_video_policy([LinphoneManager getLc])->automatically_accept) + if (linphone_core_get_video_policy(LC)->automatically_accept) return; NSString *username = [FastAddressBook displayNameForAddress:linphone_call_get_remote_address(call)]; @@ -604,9 +603,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { confirmMessage:NSLocalizedString(@"ACCEPT", nil) onCancelClick:^() { LOGI(@"User declined video proposal"); - if (call == linphone_core_get_current_call([LinphoneManager getLc])) { + if (call == linphone_core_get_current_call(LC)) { LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call)); - linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy); + linphone_core_accept_call_update(LC, call, paramsCopy); linphone_call_params_destroy(paramsCopy); [videoDismissTimer invalidate]; videoDismissTimer = nil; @@ -614,10 +613,10 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } onConfirmationClick:^() { LOGI(@"User accept video proposal"); - if (call == linphone_core_get_current_call([LinphoneManager getLc])) { + if (call == linphone_core_get_current_call(LC)) { LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(paramsCopy, TRUE); - linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy); + linphone_core_accept_call_update(LC, call, paramsCopy); linphone_call_params_destroy(paramsCopy); [videoDismissTimer invalidate]; videoDismissTimer = nil; @@ -738,7 +737,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (IBAction)onOptionsConferenceClick:(id)sender { - linphone_core_add_all_to_conference([LinphoneManager getLc]); + linphone_core_add_all_to_conference(LC); } #pragma mark - Animation diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index a82b4fa89..0647b128b 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -45,7 +45,7 @@ }]; // also add current entry, if not listed NSString *nsuri = filter.lowercaseString; - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], nsuri.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, nsuri.UTF8String); if (addr) { char *uri = linphone_address_as_string(addr); nsuri = [NSString stringWithUTF8String:uri]; @@ -81,7 +81,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri( - [LinphoneManager getLc], ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String); + LC, ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String); if (!room) { [PhoneMainView.instance popCurrentView]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid address", nil) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 84902ccf4..28d1a1450 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -124,7 +124,7 @@ static UICompositeViewDescription *compositeDescription = nil; } [[_tableController tableView] reloadData]; - BOOL fileSharingEnabled = linphone_core_get_file_transfer_server([LinphoneManager getLc]) != NULL; + BOOL fileSharingEnabled = linphone_core_get_file_transfer_server(LC) != NULL; [_pictureButton setEnabled:fileSharingEnabled]; [self callUpdateEvent:nil]; @@ -182,8 +182,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)callUpdateEvent:(NSNotification *)notif { - _callButton.hidden = - (_tableController.isEditing || linphone_core_get_current_call([LinphoneManager getLc]) != NULL); + _callButton.hidden = (_tableController.isEditing || linphone_core_get_current_call(LC) != NULL); } - (void)update { diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 8ed558546..045ad8ce0 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -82,7 +82,7 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo - (MSList *)sortChatRooms { MSList *sorted = nil; - const MSList *unsorted = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *unsorted = linphone_core_get_chat_rooms(LC); const MSList *iter = unsorted; while (iter) { diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 16d493c32..1cb0ba878 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -131,7 +131,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info } - (void)addCurrentContactContactField:(NSString *)address { - LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String); + LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, address.UTF8String); NSString *username = linphoneAddress ? [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)] : address; diff --git a/Classes/DialerView.m b/Classes/DialerView.m index bf96f1f38..8b21dc18c 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -116,7 +116,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Update on show LinphoneManager *mgr = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; [self callUpdate:call state:state]; @@ -222,7 +222,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)coreUpdateEvent:(NSNotification *)notif { if (IPAD) { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_video_display_enabled(lc) && linphone_core_video_preview_enabled(lc)) { linphone_core_set_native_preview_window_id(lc, (__bridge void *)(videoPreview)); [backgroundView setHidden:FALSE]; @@ -327,7 +327,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - - (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; BOOL callInProgress = (linphone_core_get_calls_nb(lc) > 0); addCallButton.hidden = (!callInProgress || transferMode); transferButton.hidden = (!callInProgress || !transferMode); @@ -342,7 +342,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)setTransferMode:(BOOL)atransferMode { transferMode = atransferMode; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; [self callUpdate:call state:state]; } diff --git a/Classes/FirstLoginView.m b/Classes/FirstLoginView.m index a0dd66fb7..c4ab68a66 100644 --- a/Classes/FirstLoginView.m +++ b/Classes/FirstLoginView.m @@ -60,7 +60,7 @@ static UICompositeViewDescription *compositeDescription = nil; [_passwordField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_password"]]; // Update on show - const MSList *list = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *list = linphone_core_get_proxy_config_list(LC); if (list != NULL) { LinphoneProxyConfig *config = (LinphoneProxyConfig *)list->data; if (config) { @@ -108,7 +108,7 @@ static UICompositeViewDescription *compositeDescription = nil; siteUrl = @"http://www.linphone.org"; } [_siteButton setTitle:siteUrl forState:UIControlStateNormal]; - account_creator = linphone_account_creator_new([LinphoneManager getLc], siteUrl.UTF8String); + account_creator = linphone_account_creator_new(LC, siteUrl.UTF8String); } - (void)shouldEnableNextButton { @@ -170,7 +170,7 @@ static UICompositeViewDescription *compositeDescription = nil; domain:_domainField.text OnSuccess:^(NSString *url) { if (url) { - linphone_core_set_provisioning_uri([LinphoneManager getLc], url.UTF8String); + linphone_core_set_provisioning_uri(LC, url.UTF8String); [[LinphoneManager instance] resetLinphoneCore]; } else { _waitView.hidden = YES; diff --git a/Classes/HistoryDetailsTableView.m b/Classes/HistoryDetailsTableView.m index 998b26949..c0a7a3dab 100644 --- a/Classes/HistoryDetailsTableView.m +++ b/Classes/HistoryDetailsTableView.m @@ -20,7 +20,7 @@ } if (peer) { - const MSList *logs = linphone_core_get_call_history_for_address([LinphoneManager getLc], peer); + const MSList *logs = linphone_core_get_call_history_for_address(LC, peer); while (logs != NULL) { LinphoneCallLog *log = (LinphoneCallLog *)logs->data; if (linphone_address_weak_equal(linphone_call_log_get_remote_address(log), peer)) { diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index ca8f5468f..291e5a135 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -100,7 +100,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Look for the call log callLog = NULL; if (_callLogId) { - const MSList *list = linphone_core_get_call_logs([LinphoneManager getLc]); + const MSList *list = linphone_core_get_call_logs(LC); while (list != NULL) { LinphoneCallLog *log = (LinphoneCallLog *)list->data; const char *cid = linphone_call_log_get_call_id(log); @@ -184,7 +184,7 @@ static UICompositeViewDescription *compositeDescription = nil; [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; ChatConversationView *view = VIEW(ChatConversationView); [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; - LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr); + LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr); [view setChatRoom:room]; } diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index 807d4fa35..565d1b1f8 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -110,7 +110,7 @@ } } - const MSList *logs = linphone_core_get_call_logs([LinphoneManager getLc]); + const MSList *logs = linphone_core_get_call_logs(LC); self.sections = [NSMutableDictionary dictionary]; while (logs != NULL) { LinphoneCallLog *log = (LinphoneCallLog *)logs->data; @@ -248,10 +248,10 @@ LinphoneCallLog *callLog = [log pointerValue]; MSList *count = linphone_call_log_get_user_data(callLog); while (count) { - linphone_core_remove_call_log([LinphoneManager getLc], count->data); + linphone_core_remove_call_log(LC, count->data); count = count->next; } - linphone_core_remove_call_log([LinphoneManager getLc], callLog); + linphone_core_remove_call_log(LC, callLog); linphone_call_log_unref(callLog); [[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log]; if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) { @@ -273,10 +273,10 @@ LinphoneCallLog *callLog = [log pointerValue]; MSList *count = linphone_call_log_get_user_data(callLog); while (count) { - linphone_core_remove_call_log([LinphoneManager getLc], count->data); + linphone_core_remove_call_log(LC, count->data); count = count->next; } - linphone_core_remove_call_log([LinphoneManager getLc], callLog); + linphone_core_remove_call_log(LC, callLog); linphone_call_log_unref(callLog); [[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log]; if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) { diff --git a/Classes/HistoryListView.m b/Classes/HistoryListView.m index 72fd365ca..06bb528be 100644 --- a/Classes/HistoryListView.m +++ b/Classes/HistoryListView.m @@ -58,7 +58,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self onEditionChangeClick:nil]; // Reset missed call - linphone_core_reset_missed_calls_count([LinphoneManager getLc]); + linphone_core_reset_missed_calls_count(LC); // Fake event [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self]; } diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m index 44e04d504..3f3bc3360 100644 --- a/Classes/InAppProductsManager.m +++ b/Classes/InAppProductsManager.m @@ -299,7 +299,7 @@ - (NSString *)getPhoneNumber { NSString *phoneNumber = @""; - LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC); if (config) { const char *identity = linphone_proxy_config_get_identity(config); if (identity) { diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 9e2d3e3b1..7e4f664ee 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -53,7 +53,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); if (call) { @@ -84,7 +84,7 @@ [instance becomeActive]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); if (call) { @@ -220,13 +220,13 @@ - (void)applicationWillTerminate:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); - linphone_core_terminate_all_calls([LinphoneManager getLc]); + linphone_core_terminate_all_calls(LC); // destroyLinphoneCore automatically unregister proxies but if we are using // remote push notifications, we want to continue receiving them if ([LinphoneManager instance].pushNotificationToken != nil) { // trick me! setting network reachable to false will avoid sending unregister - linphone_core_set_network_reachable([LinphoneManager getLc], FALSE); + linphone_core_set_network_reachable(LC, FALSE); } [[LinphoneManager instance] destroyLinphoneCore]; } @@ -276,7 +276,7 @@ NSString *loc_key = [alert objectForKey:@"loc-key"]; /*if we receive a remote notification, it is probably because our TCP background socket was no more working. As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/ - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_get_calls(lc) == NULL) { // if there are calls, obviously our TCP socket shall be working linphone_core_set_network_reachable(lc, FALSE); [LinphoneManager instance].connectivity = none; /*force connectivity to be discovered again*/ @@ -311,7 +311,7 @@ } - (LinphoneChatRoom *)findChatRoomForContact:(NSString *)contact { - const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms(LC); const char *from = [contact UTF8String]; while (rooms) { const LinphoneAddress *room_from_address = linphone_chat_room_get_peer_address((LinphoneChatRoom *)rooms->data); @@ -373,7 +373,7 @@ userInfo:nil repeats:FALSE]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; // If no call is yet received at this time, then force Linphone to drop the current socket and make new one to // register, so that we get // a better chance to receive the INVITE. @@ -411,7 +411,7 @@ LOGI(@"%@", NSStringFromSelector(_cmd)); if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LOGI(@"%@", NSStringFromSelector(_cmd)); if ([notification.category isEqualToString:@"incoming_call"]) { if ([identifier isEqualToString:@"answer"]) { @@ -511,7 +511,7 @@ selector:@selector(ConfigurationStateUpdateEvent:) name:kLinphoneConfiguringStateUpdate object:nil]; - linphone_core_set_provisioning_uri([LinphoneManager getLc], [configURL UTF8String]); + linphone_core_set_provisioning_uri(LC, [configURL UTF8String]); [[LinphoneManager instance] destroyLinphoneCore]; [[LinphoneManager instance] startLinphoneCore]; } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index c6a9269f3..528fcb247 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -99,7 +99,7 @@ } - (void)transformCodecsToKeys:(const MSList *)codecs { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; const MSList *elem = codecs; for (; elem != NULL; elem = elem->next) { @@ -115,7 +115,7 @@ } - (void)transformAccountToKeys:(NSString *)username { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; const MSList *proxies = linphone_core_get_proxy_config_list(lc); while (username && proxies && strcmp(username.UTF8String, @@ -219,11 +219,11 @@ - (void)transformLinphoneCoreToKeys { LinphoneManager *lm = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; // root section { - const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *accounts = linphone_core_get_proxy_config_list(LC); int count = ms_list_size(accounts); for (int i = 1; i <= count; i++, accounts = accounts->next) { NSString *key = [NSString stringWithFormat:@"menu_account_%d", i]; @@ -348,7 +348,7 @@ // tunnel section if (linphone_core_tunnel_available()) { - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); [self setObject:[lm lpConfigStringForKey:@"tunnel_mode_preference" withDefault:@"off"] forKey:@"tunnel_mode_preference"]; const MSList *configs = linphone_tunnel_get_servers(tunnel); @@ -400,7 +400,7 @@ - (void)synchronizeAccounts { LOGI(@"Account changed, synchronizing."); LinphoneManager *lm = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneProxyConfig *proxyCfg = NULL; NSString *error = nil; @@ -577,7 +577,7 @@ } - (void)synchronizeCodecs:(const MSList *)codecs { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; PayloadType *pt; const MSList *elem; @@ -590,7 +590,7 @@ - (BOOL)synchronize { LinphoneManager *lm = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; // root section { BOOL account_changed = NO; @@ -758,7 +758,7 @@ NSString *lTunnelPrefMode = [self stringForKey:@"tunnel_mode_preference"]; NSString *lTunnelPrefAddress = [self stringForKey:@"tunnel_address_preference"]; int lTunnelPrefPort = [self integerForKey:@"tunnel_port_preference"]; - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); TunnelMode mode = tunnel_off; int lTunnelPort = 443; if (lTunnelPrefPort) { @@ -841,7 +841,7 @@ } - (void)removeAccount { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneProxyConfig *config = ms_list_nth_data(linphone_core_get_proxy_config_list(lc), [self integerForKey:@"current_proxy_config_preference"]); diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 2034050bd..951e2fbf9 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -519,9 +519,8 @@ exit_dbmigration: /* File transfer migration */ if ([self lpConfigBoolForKey:@"file_transfer_migration_done"] == FALSE) { const char *newURL = "https://www.linphone.org:444/lft.php"; - LOGI(@"Migrating sharing server url from %s to %s", - linphone_core_get_file_transfer_server([LinphoneManager getLc]), newURL); - linphone_core_set_file_transfer_server([LinphoneManager getLc], newURL); + LOGI(@"Migrating sharing server url from %s to %s", linphone_core_get_file_transfer_server(LC), newURL); + linphone_core_set_file_transfer_server(LC, newURL); [self lpConfigSetBool:TRUE forKey:@"file_transfer_migration_done"]; } } @@ -905,7 +904,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char LinphoneAuthInfo *info = linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL, realm.UTF8String, domain.UTF8String); - linphone_core_add_auth_info([LinphoneManager getLc], info); + linphone_core_add_auth_info(LC, info); [LinphoneManager.instance refreshRegisters]; }]; [alertView addButtonWithTitle:NSLocalizedString(@"Go to settings", nil) @@ -1162,7 +1161,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach lm.connectivity = none; [LinphoneManager kickOffNetworkConnection]; } else { - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); Connectivity newConnectivity; BOOL isWifiOnly = [lm lpConfigBoolForKey:@"wifi_only_preference" withDefault:FALSE]; if (!ctx || ctx->testWWan) @@ -1944,7 +1943,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { // Continue by checking that the provided address is a valid SIP address, abort otherwise. if ([address length] == 0) { // no address provided... nothing to do - } else if ((addr = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String)) == NULL) { + } else if ((addr = linphone_core_interpret_url(LC, address.UTF8String)) == NULL) { UIAlertView *error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address", nil) message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a " @@ -2078,7 +2077,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { + (int)unreadMessageCount { int count = 0; - const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms(LC); const MSList *item = rooms; while (item) { LinphoneChatRoom *room = (LinphoneChatRoom *)item->data; @@ -2347,15 +2346,15 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { #pragma mark - - (void)removeAllAccounts { - linphone_core_clear_proxy_config([LinphoneManager getLc]); - linphone_core_clear_all_auth_info([LinphoneManager getLc]); + linphone_core_clear_proxy_config(LC); + linphone_core_clear_all_auth_info(LC); } + (BOOL)isMyself:(const LinphoneAddress *)addr { if (!addr) return NO; - const MSList *it = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *it = linphone_core_get_proxy_config_list(LC); while (it) { if (linphone_address_weak_equal(addr, linphone_proxy_config_get_identity_address(it->data))) { return YES; diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m index 6457645a0..524d80989 100644 --- a/Classes/LinphoneUI/StatusBarView.m +++ b/Classes/LinphoneUI/StatusBarView.m @@ -66,12 +66,11 @@ object:nil]; // Update to default state - LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); - messagesUnreadCount = - lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", 0); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC); + messagesUnreadCount = lp_config_get_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", 0); [self proxyConfigUpdate:config]; - [self updateUI:linphone_core_get_calls_nb([LinphoneManager getLc])]; + [self updateUI:linphone_core_get_calls_nb(LC)]; [self updateVoicemail]; } @@ -102,7 +101,7 @@ #pragma mark - Event Functions - (void)registrationUpdate:(NSNotification *)notif { - LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC); [self proxyConfigUpdate:config]; } @@ -111,7 +110,7 @@ } - (void)onCallEncryptionChanged:(NSNotification *)notif { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call && (linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) == LinphoneMediaEncryptionZRTP) && @@ -139,8 +138,7 @@ LOGI(@"Received new NOTIFY from voice mail: there is/are now %d message(s) unread", messagesUnreadCount); // save in lpconfig for future - lp_config_set_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", - messagesUnreadCount); + lp_config_set_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", messagesUnreadCount); [self updateVoicemail]; } @@ -152,7 +150,7 @@ - (void)callUpdate:(NSNotification *)notif { // show voice mail only when there is no call - [self updateUI:linphone_core_get_calls([LinphoneManager getLc]) != NULL]; + [self updateUI:linphone_core_get_calls(LC) != NULL]; [self updateVoicemail]; } @@ -174,7 +172,7 @@ - (void)proxyConfigUpdate:(LinphoneProxyConfig *)config { LinphoneRegistrationState state = LinphoneRegistrationNone; NSString *message = nil; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneGlobalState gstate = linphone_core_get_global_state(lc); if (gstate == LinphoneGlobalConfiguring) { @@ -182,7 +180,7 @@ } else if (config == NULL) { state = LinphoneRegistrationNone; if (linphone_core_get_proxy_config_list(lc) != NULL) { - if (linphone_core_is_network_reachable([LinphoneManager getLc])) { + if (linphone_core_is_network_reachable(LC)) { message = NSLocalizedString(@"No default account", nil); } else { message = NSLocalizedString(@"Network down", nil); @@ -258,7 +256,7 @@ BOOL pending = false; BOOL security = true; - const MSList *list = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *list = linphone_core_get_calls(LC); if (list == NULL) { if (securityDialog) { [securityDialog dismiss]; @@ -285,7 +283,7 @@ } - (void)callQualityUpdate { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call != NULL) { int quality = MIN(4, floor(linphone_call_get_average_quality(call))); NSString *accessibilityValue = [NSString stringWithFormat:NSLocalizedString(@"Call quality: %d", nil), quality]; @@ -304,8 +302,8 @@ #pragma mark - Action Functions - (IBAction)onSecurityClick:(id)sender { - if (linphone_core_get_calls_nb([LinphoneManager getLc])) { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + if (linphone_core_get_calls_nb(LC)) { + LinphoneCall *call = linphone_core_get_current_call(LC); if (call != NULL) { LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); @@ -319,13 +317,13 @@ cancelMessage:NSLocalizedString(@"DENY", nil) confirmMessage:NSLocalizedString(@"ACCEPT", nil) onCancelClick:^() { - if (linphone_core_get_current_call([LinphoneManager getLc]) == call) { + if (linphone_core_get_current_call(LC) == call) { linphone_call_set_authentication_token_verified(call, NO); } weakSelf->securityDialog = nil; } onConfirmationClick:^() { - if (linphone_core_get_current_call([LinphoneManager getLc]) == call) { + if (linphone_core_get_current_call(LC) == call) { linphone_call_set_authentication_token_verified(call, YES); } weakSelf->securityDialog = nil; @@ -342,7 +340,7 @@ } - (IBAction)onRegistrationStateClick:(id)sender { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_get_default_proxy_config(lc)) { linphone_core_refresh_registers(lc); } else if (linphone_core_get_proxy_config_list(lc)) { diff --git a/Classes/LinphoneUI/TabBarView.m b/Classes/LinphoneUI/TabBarView.m index af0c6fbc8..49478bcdf 100644 --- a/Classes/LinphoneUI/TabBarView.m +++ b/Classes/LinphoneUI/TabBarView.m @@ -56,7 +56,7 @@ - (void)callUpdate:(NSNotification *)notif { // LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue]; // LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue]; - [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:TRUE]; + [self updateMissedCall:linphone_core_get_missed_calls_count(LC) appear:TRUE]; } - (void)changeViewEvent:(NSNotification *)notif { @@ -74,7 +74,7 @@ - (void)update:(BOOL)appear { [self updateSelectedButton:[PhoneMainView.instance currentView]]; - [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:appear]; + [self updateMissedCall:linphone_core_get_missed_calls_count(LC) appear:appear]; [self updateUnreadMessage:appear]; } diff --git a/Classes/LinphoneUI/UIBackToCallButton.m b/Classes/LinphoneUI/UIBackToCallButton.m index 20e25fabc..a85002303 100644 --- a/Classes/LinphoneUI/UIBackToCallButton.m +++ b/Classes/LinphoneUI/UIBackToCallButton.m @@ -31,7 +31,7 @@ } - (void)update { - self.hidden = (_tableView.isEditing || linphone_core_get_current_call([LinphoneManager getLc]) == NULL); + self.hidden = (_tableView.isEditing || linphone_core_get_current_call(LC) == NULL); } - (IBAction)onBackToCallClick:(id)sender { diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index 184b5c20c..5269de7bf 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -61,7 +61,7 @@ - (void)touchUp:(id)sender { NSString *address = addressField.text; if (address.length == 0) { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCallLog *log = linphone_core_get_last_outgoing_call_log(lc); if (log) { LinphoneAddress *to = linphone_call_log_get_to(log); @@ -96,7 +96,7 @@ } - (void)updateVideoPolicy { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_video_capture_enabled(lc) && linphone_core_get_video_policy(lc)->automatically_initiate) { [self setImage:[UIImage imageNamed:@"call_video_start_default.png"] forState:UIControlStateNormal]; [self setImage:[UIImage imageNamed:@"call_video_start_disabled.png"] forState:UIControlStateDisabled]; diff --git a/Classes/LinphoneUI/UICallConferenceCell.m b/Classes/LinphoneUI/UICallConferenceCell.m index 6470df9cf..ce2dde8f8 100644 --- a/Classes/LinphoneUI/UICallConferenceCell.m +++ b/Classes/LinphoneUI/UICallConferenceCell.m @@ -43,6 +43,6 @@ } - (IBAction)onKickClick:(id)sender { - linphone_core_remove_from_conference([LinphoneManager getLc], _call); + linphone_core_remove_from_conference(LC, _call); } @end diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m index 67d36e2cc..ae606a272 100644 --- a/Classes/LinphoneUI/UICamSwitch.m +++ b/Classes/LinphoneUI/UICamSwitch.m @@ -34,8 +34,8 @@ INIT_WITH_COMMON_CF { #pragma mark - - (void)touchUp:(id)sender { - const char *currentCamId = (char *)linphone_core_get_video_device([LinphoneManager getLc]); - const char **cameras = linphone_core_get_video_devices([LinphoneManager getLc]); + const char *currentCamId = (char *)linphone_core_get_video_device(LC); + const char **cameras = linphone_core_get_video_devices(LC); const char *newCamId = NULL; int i; @@ -49,10 +49,10 @@ INIT_WITH_COMMON_CF { } if (newCamId) { LOGI(@"Switching from [%s] to [%s]", currentCamId, newCamId); - linphone_core_set_video_device([LinphoneManager getLc], newCamId); - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + linphone_core_set_video_device(LC, newCamId); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call != NULL) { - linphone_core_update_call([LinphoneManager getLc], call, NULL); + linphone_core_update_call(LC, call, NULL); } } } diff --git a/Classes/LinphoneUI/UIContactDetailsCell.m b/Classes/LinphoneUI/UIContactDetailsCell.m index 2d301fdbd..e4c023f51 100644 --- a/Classes/LinphoneUI/UIContactDetailsCell.m +++ b/Classes/LinphoneUI/UIContactDetailsCell.m @@ -43,7 +43,7 @@ - (void)setAddress:(NSString *)address { _addressLabel.text = _editTextfield.text = address; - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); _chatButton.enabled = _callButton.enabled = (addr != NULL); _chatButton.accessibilityLabel = @@ -75,7 +75,7 @@ } - (IBAction)onCallClick:(id)event { - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); if (addr == NULL) return; char *lAddress = linphone_address_as_string_uri_only(addr); @@ -89,13 +89,13 @@ } - (IBAction)onChatClick:(id)event { - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); if (addr == NULL) return; [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; ChatConversationView *view = VIEW(ChatConversationView); [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; - LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr); + LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr); [view setChatRoom:room]; linphone_address_destroy(addr); } diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m index 700b15faa..af417e17d 100644 --- a/Classes/LinphoneUI/UIDigitButton.m +++ b/Classes/LinphoneUI/UIDigitButton.m @@ -64,18 +64,18 @@ #pragma mark - Actions Functions - (void)touchDown:(id)sender { - if (addressField && (!dtmf || !linphone_core_in_call([LinphoneManager getLc]))) { + if (addressField && (!dtmf || !linphone_core_in_call(LC))) { NSString *newAddress = [NSString stringWithFormat:@"%@%c", addressField.text, digit]; [addressField setText:newAddress]; - linphone_core_play_dtmf([LinphoneManager getLc], digit, -1); + linphone_core_play_dtmf(LC, digit, -1); } else { - linphone_call_send_dtmf(linphone_core_get_current_call([LinphoneManager getLc]), digit); - linphone_core_play_dtmf([LinphoneManager getLc], digit, 100); + linphone_call_send_dtmf(linphone_core_get_current_call(LC), digit); + linphone_core_play_dtmf(LC, digit, 100); } } - (void)touchUp:(id)sender { - linphone_core_stop_dtmf([LinphoneManager getLc]); + linphone_core_stop_dtmf(LC); } @end diff --git a/Classes/LinphoneUI/UIHangUpButton.m b/Classes/LinphoneUI/UIHangUpButton.m index 47e4b2c3b..665ed00e6 100644 --- a/Classes/LinphoneUI/UIHangUpButton.m +++ b/Classes/LinphoneUI/UIHangUpButton.m @@ -76,7 +76,7 @@ #pragma mark - - (void)update { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_get_calls_nb(lc) == 1 || // One call linphone_core_get_current_call(lc) != NULL || // In call linphone_core_is_in_conference(lc) || // In conference @@ -91,7 +91,7 @@ #pragma mark - Action Functions - (void)touchUp:(id)sender { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *currentcall = linphone_core_get_current_call(lc); if (linphone_core_is_in_conference(lc) || // In conference (linphone_core_get_conference_size(lc) > 0 && [UIHangUpButton callCount:lc] == 0) // Only one conf diff --git a/Classes/LinphoneUI/UIMicroButton.m b/Classes/LinphoneUI/UIMicroButton.m index 80a1cc13e..8a4944a69 100644 --- a/Classes/LinphoneUI/UIMicroButton.m +++ b/Classes/LinphoneUI/UIMicroButton.m @@ -24,15 +24,15 @@ @implementation UIMicroButton - (void)onOn { - linphone_core_enable_mic([LinphoneManager getLc], false); + linphone_core_enable_mic(LC, false); } - (void)onOff { - linphone_core_enable_mic([LinphoneManager getLc], true); + linphone_core_enable_mic(LC, true); } - (bool)onUpdate { - return !linphone_core_mic_enabled([LinphoneManager getLc]); + return !linphone_core_mic_enabled(LC); } @end diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index d10999eab..c390d056a 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -75,7 +75,7 @@ } + (LinphoneCall *)getCall { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *currentCall = linphone_core_get_current_call(lc); if (currentCall == nil && linphone_core_get_calls_nb(lc) == 1) { currentCall = (LinphoneCall *)linphone_core_get_calls(lc)->data; @@ -96,14 +96,14 @@ switch (type) { case UIPauseButtonType_Call: { if (call != nil) { - linphone_core_pause_call([LinphoneManager getLc], call); + linphone_core_pause_call(LC, call); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } case UIPauseButtonType_Conference: { - linphone_core_leave_conference([LinphoneManager getLc]); + linphone_core_leave_conference(LC); // Fake event [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self]; @@ -112,7 +112,7 @@ case UIPauseButtonType_CurrentCall: { LinphoneCall *currentCall = [UIPauseButton getCall]; if (currentCall != nil) { - linphone_core_pause_call([LinphoneManager getLc], currentCall); + linphone_core_pause_call(LC, currentCall); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } @@ -125,14 +125,14 @@ switch (type) { case UIPauseButtonType_Call: { if (call != nil) { - linphone_core_resume_call([LinphoneManager getLc], call); + linphone_core_resume_call(LC, call); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } case UIPauseButtonType_Conference: { - linphone_core_enter_conference([LinphoneManager getLc]); + linphone_core_enter_conference(LC); // Fake event [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self]; break; @@ -140,7 +140,7 @@ case UIPauseButtonType_CurrentCall: { LinphoneCall *currentCall = [UIPauseButton getCall]; if (currentCall != nil) { - linphone_core_resume_call([LinphoneManager getLc], currentCall); + linphone_core_resume_call(LC, currentCall); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } @@ -151,7 +151,7 @@ - (bool)onUpdate { bool ret = false; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *c = call; switch (type) { case UIPauseButtonType_Conference: { diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index 0c1f5aebe..04e298e63 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -33,7 +33,7 @@ INIT_WITH_COMMON_CF { } - (void)onOn { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (!linphone_core_video_display_enabled(lc)) return; @@ -41,7 +41,7 @@ INIT_WITH_COMMON_CF { [self setEnabled:FALSE]; [waitView startAnimating]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { LinphoneCallAppData *callAppData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call); callAppData->videoRequested = @@ -56,7 +56,7 @@ INIT_WITH_COMMON_CF { } - (void)onOff { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (!linphone_core_video_display_enabled(lc)) return; @@ -64,7 +64,7 @@ INIT_WITH_COMMON_CF { [self setEnabled:FALSE]; [waitView startAnimating]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { LinphoneCallParams *call_params = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(call_params, FALSE); @@ -77,7 +77,7 @@ INIT_WITH_COMMON_CF { - (bool)onUpdate { bool video_enabled = false; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *currentCall = linphone_core_get_current_call(lc); if (linphone_core_video_supported(lc)) { if (linphone_core_video_display_enabled(lc) && currentCall && !linphone_call_media_in_progress(currentCall) && diff --git a/Classes/LinphoneUI/VideoZoomHandler.m b/Classes/LinphoneUI/VideoZoomHandler.m index 85c4940f8..87a62126a 100644 --- a/Classes/LinphoneUI/VideoZoomHandler.m +++ b/Classes/LinphoneUI/VideoZoomHandler.m @@ -36,7 +36,7 @@ } else { cx = cy = 0.5; } - linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, &cx, &cy); + linphone_call_zoom_video(linphone_core_get_current_call(LC), zoomLevel, &cx, &cy); } - (void)videoPan:(UIPanGestureRecognizer *)reco { @@ -58,7 +58,7 @@ return; } - linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, &x, &y); + linphone_call_zoom_video(linphone_core_get_current_call(LC), zoomLevel, &x, &y); cx = x; cy = y; } @@ -82,7 +82,7 @@ return; } - linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), s, &cx, &cy); + linphone_call_zoom_video(linphone_core_get_current_call(LC), s, &cx, &cy); } - (void)resetZoom { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 48ec5cb01..19ce95a01 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -288,7 +288,7 @@ static RootViewManager *rootViewManagerInstance = nil; LinphoneGlobalState state = (LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue]; static BOOL already_shown = FALSE; if (state == LinphoneGlobalOn && !already_shown && [LinphoneManager instance].wasRemoteProvisioned) { - LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config(LC); if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" inSection:@"app"] && conf == NULL) { already_shown = TRUE; AssistantView *view = VIEW(AssistantView); @@ -338,7 +338,7 @@ static RootViewManager *rootViewManagerInstance = nil; [self displayCallError:call message:message]; } case LinphoneCallEnd: { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); if (calls == NULL) { // if ((currentView == CallView.compositeViewDescription) || // (currentView == CallIncomingView.compositeViewDescription) || @@ -350,7 +350,7 @@ static RootViewManager *rootViewManagerInstance = nil; // [self popCurrentView]; // } } else { - linphone_core_resume_call([LinphoneManager getLc], (LinphoneCall *)calls->data); + linphone_core_resume_call(LC, (LinphoneCall *)calls->data); [self changeCurrentView:CallView.compositeViewDescription]; } break; @@ -375,7 +375,7 @@ static RootViewManager *rootViewManagerInstance = nil; #pragma mark - - (void)orientationUpdate:(UIInterfaceOrientation)orientation { - int oldLinphoneOrientation = linphone_core_get_device_rotation([LinphoneManager getLc]); + int oldLinphoneOrientation = linphone_core_get_device_rotation(LC); int newRotation = 0; switch (orientation) { case UIInterfaceOrientationPortrait: @@ -394,18 +394,18 @@ static RootViewManager *rootViewManagerInstance = nil; newRotation = oldLinphoneOrientation; } if (oldLinphoneOrientation != newRotation) { - linphone_core_set_device_rotation([LinphoneManager getLc], newRotation); - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + linphone_core_set_device_rotation(LC, newRotation); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { // Orientation has changed, must call update call - linphone_core_update_call([LinphoneManager getLc], call, NULL); + linphone_core_update_call(LC, call, NULL); } } } - (void)startUp { LinphoneCore *core = nil; @try { - core = [LinphoneManager getLc]; + core = LC; LinphoneManager *lm = [LinphoneManager instance]; if (linphone_core_get_global_state(core) != LinphoneGlobalOn) { [self changeCurrentView:DialerView.compositeViewDescription]; @@ -431,9 +431,9 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)updateApplicationBadgeNumber { int count = 0; - count += linphone_core_get_missed_calls_count([LinphoneManager getLc]); + count += linphone_core_get_missed_calls_count(LC); count += [LinphoneManager unreadMessageCount]; - count += linphone_core_get_calls_nb([LinphoneManager getLc]); + count += linphone_core_get_calls_nb(LC); [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count]; } @@ -616,7 +616,7 @@ static RootViewManager *rootViewManagerInstance = nil; NSString *lTitle; // get default proxy - LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config(LC); if (proxyCfg == nil) { lMessage = NSLocalizedString(@"Please make sure your device is connected to the internet and double check your " @"SIP account configuration in the settings.", @@ -700,7 +700,7 @@ static RootViewManager *rootViewManagerInstance = nil; UIDeviceBatteryState state = [UIDevice currentDevice].batteryState; LOGD(@"Battery state:%d level:%.2f", state, level); - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { LinphoneCallAppData *callData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call); if (callData != nil) { @@ -717,7 +717,7 @@ static RootViewManager *rootViewManagerInstance = nil; linphone_call_params_copy(linphone_call_get_current_params(call)); // stop video linphone_call_params_enable_video(paramsCopy, FALSE); - linphone_core_update_call([LinphoneManager getLc], call, paramsCopy); + linphone_core_update_call(LC, call, paramsCopy); }]; [sheet showInView:self.view]; callData->batteryWarningShown = TRUE; @@ -740,7 +740,7 @@ static RootViewManager *rootViewManagerInstance = nil; } - (void)incomingCallDeclined:(LinphoneCall *)call { - linphone_core_terminate_call([LinphoneManager getLc], call); + linphone_core_terminate_call(LC, call); } @end diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 4994f1d52..bf3538bb2 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -370,8 +370,8 @@ static UICompositeViewDescription *compositeDescription = nil; // Set observer [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]); + if (linphone_ringtoneplayer_is_started(linphone_core_get_ringtoneplayer(LC))) { + linphone_core_stop_ringing(LC); } } @@ -442,7 +442,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - + (IASKSpecifier *)filterSpecifier:(IASKSpecifier *)specifier { - if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) { + if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) { if ([[specifier key] isEqualToString:@"account_transport_preference"]) { NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]]; NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; @@ -456,7 +456,7 @@ static UICompositeViewDescription *compositeDescription = nil; } else { if ([[specifier key] isEqualToString:@"media_encryption_preference"]) { NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]]; - if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionZRTP)) { + if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionZRTP)) { NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; [titles removeObject:@"ZRTP"]; [dict setObject:titles forKey:@"Titles"]; @@ -464,7 +464,7 @@ static UICompositeViewDescription *compositeDescription = nil; [values removeObject:@"ZRTP"]; [dict setObject:values forKey:@"Values"]; } - if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionSRTP)) { + if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionSRTP)) { NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; [titles removeObject:@"SRTP"]; [dict setObject:titles forKey:@"Titles"]; @@ -472,7 +472,7 @@ static UICompositeViewDescription *compositeDescription = nil; [values removeObject:@"SRTP"]; [dict setObject:values forKey:@"Values"]; } - if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionDTLS)) { + if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionDTLS)) { NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; [titles removeObject:@"DTLS"]; [dict setObject:titles forKey:@"Titles"]; @@ -485,7 +485,7 @@ static UICompositeViewDescription *compositeDescription = nil; } if ([specifier.key hasPrefix:@"menu_account_"]) { - const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *accounts = linphone_core_get_proxy_config_list(LC); int index = [specifier.key substringFromIndex:@"menu_account_".length].intValue - 1; if (index < ms_list_size(accounts)) { LinphoneProxyConfig *proxy = (LinphoneProxyConfig *)ms_list_nth_data(accounts, index); @@ -502,12 +502,12 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneManager *lm = [LinphoneManager instance]; NSMutableSet *hiddenKeys = [NSMutableSet set]; - const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *accounts = linphone_core_get_proxy_config_list(LC); for (int i = ms_list_size(accounts) + 1; i <= 5; i++) { [hiddenKeys addObject:[NSString stringWithFormat:@"menu_account_%d", i]]; } - if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) { + if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) { [hiddenKeys addObject:@"media_encryption_preference"]; } @@ -538,7 +538,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"quit_button"]; // Hide for the moment [hiddenKeys addObject:@"about_button"]; // Hide for the moment - if (!linphone_core_video_supported([LinphoneManager getLc])) { + if (!linphone_core_video_supported(LC)) { [hiddenKeys addObject:@"video_menu"]; } @@ -564,16 +564,15 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"enable_first_login_view_preference"]; - if (!linphone_core_video_supported([LinphoneManager getLc])) { + if (!linphone_core_video_supported(LC)) { [hiddenKeys addObject:@"enable_video_preference"]; } - if (!linphone_core_video_display_enabled([LinphoneManager getLc])) { + if (!linphone_core_video_display_enabled(LC)) { [hiddenKeys addObject:@"video_menu"]; } - if (!linphone_core_get_video_preset([LinphoneManager getLc]) || - strcmp(linphone_core_get_video_preset([LinphoneManager getLc]), "custom") != 0) { + if (!linphone_core_get_video_preset(LC) || strcmp(linphone_core_get_video_preset(LC), "custom") != 0) { [hiddenKeys addObject:@"video_preferred_fps_preference"]; [hiddenKeys addObject:@"download_bandwidth_preference"]; } @@ -585,7 +584,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"port_preference"]; } - if (linphone_core_get_stun_server([LinphoneManager getLc]) == NULL) { + if (linphone_core_get_stun_server(LC) == NULL) { [hiddenKeys addObject:@"ice_preference"]; } @@ -671,7 +670,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[UIDevice currentDevice] _setBatteryLevel:0.01f]; [NSNotificationCenter.defaultCenter postNotificationName:UIDeviceBatteryLevelDidChangeNotification object:self]; } else if ([key isEqual:@"flush_images_button"]) { - const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms(LC); while (rooms) { const MSList *messages = linphone_chat_room_get_history(rooms->data, 0); while (messages) { diff --git a/Classes/SideMenuTableView.m b/Classes/SideMenuTableView.m index 40985246b..d5bca31d5 100644 --- a/Classes/SideMenuTableView.m +++ b/Classes/SideMenuTableView.m @@ -68,10 +68,9 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { - BOOL hasDefault = (linphone_core_get_default_proxy_config([LinphoneManager getLc]) != NULL); + BOOL hasDefault = (linphone_core_get_default_proxy_config(LC) != NULL); // default account is shown in the header already - return MAX(0, - ms_list_size(linphone_core_get_proxy_config_list([LinphoneManager getLc])) - (hasDefault ? 1 : 0)); + return MAX(0, ms_list_size(linphone_core_get_proxy_config_list(LC)) - (hasDefault ? 1 : 0)); } else { return [_sideMenuEntries count]; } @@ -80,8 +79,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[UITableViewCell alloc] init]; if (indexPath.section == 0) { - LinphoneProxyConfig *proxy = - ms_list_nth_data(linphone_core_get_proxy_config_list([LinphoneManager getLc]), (int)indexPath.row); + LinphoneProxyConfig *proxy = ms_list_nth_data(linphone_core_get_proxy_config_list(LC), (int)indexPath.row); if (proxy) { cell.textLabel.text = [NSString stringWithUTF8String:linphone_proxy_config_get_identity(proxy)]; cell.imageView.image = [StatusBarView imageForState:linphone_proxy_config_get_state(proxy)]; diff --git a/Classes/SideMenuView.m b/Classes/SideMenuView.m index bb903046e..bc1fcc5a6 100644 --- a/Classes/SideMenuView.m +++ b/Classes/SideMenuView.m @@ -47,7 +47,7 @@ } - (void)updateHeader { - LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config(LC); if (default_proxy != NULL) { const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy); diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index d683a7ab4..eb8d81520 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -90,7 +90,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info address = [[address componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString:@" "]; NSString *normalizedSipAddress = nil; - LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], [address UTF8String]); + LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, [address UTF8String]); if (linphoneAddress != NULL) { char *tmp = linphone_address_as_string_uri_only(linphoneAddress); if (tmp != NULL) { diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index b39e90e45..eb139926c 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -21,6 +21,7 @@ #define IPAD (LinphoneManager.runningOnIpad) #define ANIMATED ([LinphoneManager.instance lpConfigBoolForKey:@"animations_preference"]) +#define LC ([LinphoneManager getLc]) @interface LinphoneUtils : NSObject From 8522d77505df0e86dbeb0367090db2547753baf2 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 10:19:42 +0100 Subject: [PATCH 10/22] outgoing call: hangout button on left side --- Classes/Base.lproj/CallOutgoingView.xib | 112 ++++++++++++------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/Classes/Base.lproj/CallOutgoingView.xib b/Classes/Base.lproj/CallOutgoingView.xib index c35efb243..a11c9f463 100644 --- a/Classes/Base.lproj/CallOutgoingView.xib +++ b/Classes/Base.lproj/CallOutgoingView.xib @@ -40,7 +40,7 @@ @@ -246,7 +246,7 @@ From 39a6619dbdd1f1290143e9476c292fe07998721d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 10:37:17 +0100 Subject: [PATCH 11/22] prepare.py: do not display stubbed libraries if there are none --- prepare.py | 6 ++++-- submodules/cmake-builder | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/prepare.py b/prepare.py index c356ed368..248e79c42 100755 --- a/prepare.py +++ b/prepare.py @@ -320,8 +320,10 @@ sdk: \t\techo "[{archs}] Mixing `basename $$archive` in $$destpath"; \\ \t\tlipo -create $$all_paths -output $$destpath; \\ \tdone; \\ -\techo 'NOTE: the following libraries were STUBBED:'; \\ -\tcat WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt +\tif test -s WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; then \\ +\t\techo 'NOTE: the following libraries were STUBBED:'; \\ +\t\tcat WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; \\ +\tfi build: $(addsuffix -build, $(archs)) \t$(MAKE) sdk diff --git a/submodules/cmake-builder b/submodules/cmake-builder index bfccbef96..ed3120039 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit bfccbef964288347884757e93cd06d9821daf42e +Subproject commit ed3120039998022f54e9fb1d1368cde122e37fd5 From a3859200efb61a741c6645871826f9eefbd6324b Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 10:47:39 +0100 Subject: [PATCH 12/22] call: reposition preview on call start --- Classes/CallView.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Classes/CallView.m b/Classes/CallView.m index 158e96d0d..4e393e350 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -147,6 +147,8 @@ static UICompositeViewDescription *compositeDescription = nil; linphone_core_set_native_video_window_id(LC, (__bridge void *)(_videoView)); linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview)); + [self previewTouchLift]; + // Enable tap [singleFingerTap setEnabled:TRUE]; From 9671009541be07326e2ca2795580e65cf70b3e83 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 11:29:35 +0100 Subject: [PATCH 13/22] misc: rework views workflow --- Classes/AboutView.m | 2 +- Classes/AssistantView.m | 39 ++++--- Classes/CallOutgoingView.m | 16 ++- Classes/CallView.m | 21 ++-- Classes/ChatConversationCreateTableView.m | 2 +- Classes/ChatConversationTableView.m | 2 +- Classes/ChatConversationView.m | 11 +- Classes/ChatsListTableView.m | 10 +- Classes/ChatsListView.m | 5 +- Classes/Contact.m | 4 +- Classes/ContactDetailsTableView.m | 8 +- Classes/ContactDetailsView.m | 10 +- Classes/ContactsListTableView.m | 6 +- Classes/ContactsListView.m | 5 +- Classes/DialerView.h | 2 - Classes/DialerView.m | 36 +++---- Classes/FirstLoginView.m | 14 +-- Classes/HistoryDetailsView.m | 17 +--- Classes/HistoryListTableView.m | 7 +- Classes/ImagePickerView.m | 2 +- Classes/InAppProductsManager.m | 24 ++--- Classes/LinphoneAppDelegate.m | 46 ++++----- Classes/LinphoneCoreSettingsStore.m | 28 +++--- Classes/LinphoneManager.h | 3 +- Classes/LinphoneManager.m | 112 ++++++++++----------- Classes/LinphoneUI/UIBackToCallButton.m | 3 +- Classes/LinphoneUI/UICallButton.m | 5 +- Classes/LinphoneUI/UIChatBubblePhotoCell.m | 4 +- Classes/LinphoneUI/UIChatBubbleTextCell.m | 3 +- Classes/LinphoneUI/UIContactDetailsCell.m | 16 +-- Classes/LinphoneUI/UIHistoryCell.m | 4 +- Classes/LinphoneUI/UISpeakerButton.m | 8 +- Classes/LinphoneUI/UITransferButton.m | 5 +- Classes/PhoneMainView.h | 4 +- Classes/PhoneMainView.m | 63 +++++------- Classes/SettingsView.m | 16 ++- Classes/SideMenuTableView.m | 12 +-- Classes/Utils/FastAddressBook.m | 10 +- Classes/Utils/FileTransferDelegate.m | 11 +- TestsUI/LinphoneTestCase.m | 4 +- 40 files changed, 260 insertions(+), 340 deletions(-) diff --git a/Classes/AboutView.m b/Classes/AboutView.m index bdd061eaa..884a34013 100644 --- a/Classes/AboutView.m +++ b/Classes/AboutView.m @@ -128,6 +128,6 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDialerBackClick:(id)sender { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; } @end diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 292abd547..89317afc5 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -125,7 +125,7 @@ static UICompositeViewDescription *compositeDescription = nil; linphone_account_creator_unref(account_creator); account_creator = NULL; } - [[LinphoneManager instance] resetLinphoneCore]; + [LinphoneManager.instance resetLinphoneCore]; account_creator = linphone_account_creator_new( LC, [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] .UTF8String); @@ -140,14 +140,14 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)loadAssistantConfig:(NSString *)rcFilename { NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]]; linphone_core_set_provisioning_uri(LC, fullPath.UTF8String); - [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; + [LinphoneManager.instance lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; [self resetLiblinphone]; } - (void)reset { - [[LinphoneManager instance] removeAllAccounts]; - [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; + [LinphoneManager.instance removeAllAccounts]; + [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; LinphoneCore *lc = LC; LCSipTransports transportValue = {5060, 5060, -1, -1}; @@ -156,8 +156,8 @@ static UICompositeViewDescription *compositeDescription = nil; LOGE(@"cannot set transport"); } - [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"ice_preference"]; - [[LinphoneManager instance] lpConfigSetString:@"" forKey:@"stun_preference"]; + [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"ice_preference"]; + [LinphoneManager.instance lpConfigSetString:@"" forKey:@"stun_preference"]; linphone_core_set_stun_server(lc, NULL); linphone_core_set_firewall_policy(lc, LinphonePolicyNoFirewall); [self resetTextFields]; @@ -170,7 +170,7 @@ static UICompositeViewDescription *compositeDescription = nil; } + (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status { - BOOL usePhoneNumber = [[LinphoneManager instance] lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"]; + BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"]; switch (status) { case LinphoneAccountCreatorEmailInvalid: return NSLocalizedString(@"Invalid email.", nil); @@ -214,7 +214,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)configureProxyConfig { LinphoneCore *lc = LC; - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; // remove previous proxy config, if any if (new_config != NULL) { @@ -232,7 +232,7 @@ static UICompositeViewDescription *compositeDescription = nil; linphone_core_set_default_proxy_config(lc, new_config); // reload address book to prepend proxy config domain to contacts' phone number // todo: STOP doing that! - [[[LinphoneManager instance] fastAddressBook] reload]; + [[LinphoneManager.instance fastAddressBook] reload]; } } @@ -247,10 +247,9 @@ static UICompositeViewDescription *compositeDescription = nil; [self displayUsernameAsPhoneOrUsername]; if (view == _welcomeView) { - BOOL show_logo = - [[LinphoneManager instance] lpConfigBoolForKey:@"show_assistant_logo_in_choice_view_preference"]; - BOOL show_extern = ![[LinphoneManager instance] lpConfigBoolForKey:@"hide_assistant_custom_account"]; - BOOL show_new = ![[LinphoneManager instance] lpConfigBoolForKey:@"hide_assistant_create_account"]; + BOOL show_logo = [LinphoneManager.instance lpConfigBoolForKey:@"show_assistant_logo_in_choice_view_preference"]; + BOOL show_extern = ![LinphoneManager.instance lpConfigBoolForKey:@"hide_assistant_custom_account"]; + BOOL show_new = ![LinphoneManager.instance lpConfigBoolForKey:@"hide_assistant_create_account"]; if (!placement_done) { // visibility @@ -321,7 +320,7 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config(LC); const char *identity = linphone_proxy_config_get_identity(default_conf); if (identity) { - LinphoneAddress *default_addr = linphone_address_new(identity); + LinphoneAddress *default_addr = linphone_core_interpret_url(LC, identity); if (default_addr) { const char *domain = linphone_address_get_domain(default_addr); const char *username = linphone_address_get_username(default_addr); @@ -507,7 +506,7 @@ static UICompositeViewDescription *compositeDescription = nil; switch (state) { case LinphoneRegistrationOk: { _waitView.hidden = true; - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; break; } case LinphoneRegistrationNone: @@ -527,7 +526,7 @@ static UICompositeViewDescription *compositeDescription = nil; otherButtonTitles:nil]; [alert addButtonWithTitle:@"Continue" block:^(void) { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; }]; [alert show]; break; @@ -623,7 +622,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun [alert addButtonWithTitle:NSLocalizedString(@"Skip verification", nil) block:^{ [thiz configureProxyConfig]; - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; }]; [alert show]; } @@ -695,7 +694,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun nextView = _remoteProvisioningView; [self loadAssistantConfig:@"assistant_remote.rc"]; [self findTextField:ViewElement_URL].text = - [[LinphoneManager instance] lpConfigStringForKey:@"config-uri" inSection:@"misc"]; + [LinphoneManager.instance lpConfigStringForKey:@"config-uri" inSection:@"misc"]; } - (IBAction)onCreateAccountClick:(id)sender { @@ -720,7 +719,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun - (IBAction)onRemoteProvisioningLoginClick:(id)sender { _waitView.hidden = NO; - [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; + [LinphoneManager.instance lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; [self configureProxyConfig]; } @@ -744,7 +743,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun } - (IBAction)onDialerClick:(id)sender { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; } @end diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index a14992e8b..141b363a7 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -55,9 +55,7 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneCall *call = linphone_core_get_current_call(LC); if (!call) { - if (![PhoneMainView.instance popCurrentView]) { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; - } + [PhoneMainView.instance popCurrentView]; } else { const LinphoneAddress *addr = linphone_call_get_remote_address(call); [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr]; @@ -77,18 +75,18 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onRoutesBluetoothClick:(id)sender { [self hideRoutes:TRUE animated:TRUE]; - [[LinphoneManager instance] setBluetoothEnabled:TRUE]; + [LinphoneManager.instance setBluetoothEnabled:TRUE]; } - (IBAction)onRoutesEarpieceClick:(id)sender { [self hideRoutes:TRUE animated:TRUE]; - [[LinphoneManager instance] setSpeakerEnabled:FALSE]; - [[LinphoneManager instance] setBluetoothEnabled:FALSE]; + [LinphoneManager.instance setSpeakerEnabled:FALSE]; + [LinphoneManager.instance setBluetoothEnabled:FALSE]; } - (IBAction)onRoutesSpeakerClick:(id)sender { [self hideRoutes:TRUE animated:TRUE]; - [[LinphoneManager instance] setSpeakerEnabled:TRUE]; + [LinphoneManager.instance setSpeakerEnabled:TRUE]; } - (IBAction)onRoutesClick:(id)sender { @@ -104,9 +102,7 @@ static UICompositeViewDescription *compositeDescription = nil; if (call) { linphone_core_terminate_call(LC, call); } - if (![PhoneMainView.instance popCurrentView]) { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; - } + [PhoneMainView.instance popCurrentView]; } - (void)hideRoutes:(BOOL)hidden animated:(BOOL)animated { diff --git a/Classes/CallView.m b/Classes/CallView.m index 4e393e350..64394e1ab 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -682,24 +682,23 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (IBAction)onChatClick:(id)sender { - ChatsListView *view = VIEW(ChatsListView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; } - (IBAction)onRoutesBluetoothClick:(id)sender { [self hideRoutes:TRUE animated:TRUE]; - [[LinphoneManager instance] setBluetoothEnabled:TRUE]; + [LinphoneManager.instance setBluetoothEnabled:TRUE]; } - (IBAction)onRoutesEarpieceClick:(id)sender { [self hideRoutes:TRUE animated:TRUE]; - [[LinphoneManager instance] setSpeakerEnabled:FALSE]; - [[LinphoneManager instance] setBluetoothEnabled:FALSE]; + [LinphoneManager.instance setSpeakerEnabled:FALSE]; + [LinphoneManager.instance setBluetoothEnabled:FALSE]; } - (IBAction)onRoutesSpeakerClick:(id)sender { [self hideRoutes:TRUE animated:TRUE]; - [[LinphoneManager instance] setSpeakerEnabled:TRUE]; + [LinphoneManager.instance setSpeakerEnabled:TRUE]; } - (IBAction)onRoutesClick:(id)sender { @@ -712,22 +711,18 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { - (IBAction)onOptionsTransferClick:(id)sender { [self hideOptions:TRUE animated:TRUE]; - // Go to dialer view DialerView *view = VIEW(DialerView); + [view setAddress:@""]; + [view setTransferMode:TRUE]; [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - if (view != nil) { - [view setAddress:@""]; - [view setTransferMode:TRUE]; - } } - (IBAction)onOptionsAddClick:(id)sender { [self hideOptions:TRUE animated:TRUE]; - // Go to dialer view DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; [view setAddress:@""]; [view setTransferMode:FALSE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } - (IBAction)onOptionsClick:(id)sender { diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index 0647b128b..0e069f238 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -94,7 +94,7 @@ ChatConversationView *view = VIEW(ChatConversationView); [view setChatRoom:room]; [PhoneMainView.instance popCurrentView]; - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } } diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index b494b8379..286df380d 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -54,7 +54,7 @@ messageList = linphone_chat_room_get_history(chatRoom, 0); // also append transient upload messages because they are not in history yet! - for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) { + for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) { const LinphoneAddress *ftd_peer = linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(ftd.message)); const LinphoneAddress *peer = linphone_chat_room_get_peer_address(chatRoom); diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 28d1a1450..e5066e9e6 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -236,8 +236,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)saveAndSend:(UIImage *)image url:(NSURL *)url { // photo from Camera, must be saved first if (url == nil) { - [[LinphoneManager instance] - .photoLibrary + [LinphoneManager.instance.photoLibrary writeImageToSavedPhotosAlbum:image.CGImage orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error) { @@ -516,13 +515,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onCallClick:(id)sender { - NSString *displayName = [FastAddressBook displayNameForAddress:linphone_chat_room_get_peer_address(chatRoom)]; - // Go to dialer view - DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - char *uri = linphone_address_as_string(linphone_chat_room_get_peer_address(chatRoom)); - [view call:[NSString stringWithUTF8String:uri] displayName:displayName]; - ms_free(uri); + [LinphoneManager.instance call:linphone_chat_room_get_peer_address(chatRoom) transfer:NO]; } - (IBAction)onListSwipe:(id)sender { diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 045ad8ce0..29756c6fe 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -58,8 +58,8 @@ [super viewDidAppear:animated]; // we cannot do that in viewWillAppear because we will change view while previous transition // was not finished, leading to "[CALayer retain]: message sent to deallocated instance" error msg - if (IPAD && [self totalNumberOfItems] == 0) { - [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription]; + if (IPAD && [self totalNumberOfItems] > 0) { + [PhoneMainView.instance changeCurrentView:ChatConversationView.compositeViewDescription]; } } @@ -163,7 +163,7 @@ static void chatTable_free_chatrooms(void *data) { UIChatCell *cell = (UIChatCell *)[tableView cellForRowAtIndexPath:indexPath]; [cell updateUnreadBadge]; } - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } } @@ -181,7 +181,7 @@ static void chatTable_free_chatrooms(void *data) { } FileTransferDelegate *ftdToDelete = nil; - for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) { + for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) { if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) { ftdToDelete = ftd; break; @@ -211,7 +211,7 @@ static void chatTable_free_chatrooms(void *data) { } FileTransferDelegate *ftdToDelete = nil; - for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) { + for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) { if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) { ftdToDelete = ftd; break; diff --git a/Classes/ChatsListView.m b/Classes/ChatsListView.m index 6f7798769..c78ad994b 100644 --- a/Classes/ChatsListView.m +++ b/Classes/ChatsListView.m @@ -59,7 +59,7 @@ static UICompositeViewDescription *compositeDescription = nil; sideMenu:SideMenuView.class fullscreen:false isLeftFragment:YES - fragmentWith:ChatConversationView.class]; + fragmentWith:ChatConversationCreateView.class]; } return compositeDescription; } @@ -71,8 +71,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - Action Functions - (IBAction)onAddClick:(id)event { - ChatConversationCreateView *view = VIEW(ChatConversationCreateView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:YES]; + [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription]; } - (IBAction)onEditionChangeClick:(id)sender { diff --git a/Classes/Contact.m b/Classes/Contact.m index 1979b5a95..059fce1b8 100644 --- a/Classes/Contact.m +++ b/Classes/Contact.m @@ -64,7 +64,7 @@ for (int i = 0; i < ABMultiValueGetCount(map); ++i) { CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(map, i); if (CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { - if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, + if (CFStringCompare((CFStringRef)LinphoneManager.instance.contactSipField, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { NSString *value = (NSString *)(CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey)); @@ -211,7 +211,7 @@ - (BOOL)addSipAddress:(NSString *)sip { NSDictionary *lDict = @{ (NSString *) kABPersonInstantMessageUsernameKey : sip, (NSString *) - kABPersonInstantMessageServiceKey : [LinphoneManager instance].contactSipField + kABPersonInstantMessageServiceKey : LinphoneManager.instance.contactSipField }; BOOL ret = [self addInProperty:kABPersonInstantMessageProperty value:(__bridge CFTypeRef)(lDict)]; diff --git a/Classes/ContactDetailsTableView.m b/Classes/ContactDetailsTableView.m index a6489c035..b087b98b3 100644 --- a/Classes/ContactDetailsTableView.m +++ b/Classes/ContactDetailsTableView.m @@ -34,7 +34,7 @@ } else if (section == ContactSections_Sip) { return _contact.sipAddresses; } else if (section == ContactSections_Email) { - if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) { return _contact.emails; } } @@ -166,8 +166,8 @@ } else if ([indexPath section] == ContactSections_Sip) { value = _contact.sipAddresses[indexPath.row]; LinphoneAddress *addr = NULL; - if ([[LinphoneManager instance] lpConfigBoolForKey:@"contact_display_username_only"] && - (addr = linphone_address_new([value UTF8String]))) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"contact_display_username_only"] && + (addr = linphone_core_interpret_url(LC, [value UTF8String]))) { value = [NSString stringWithCString:linphone_address_get_username(addr) encoding:[NSString defaultCStringEncoding]]; linphone_address_destroy(addr); @@ -201,7 +201,7 @@ #pragma mark - UITableViewDelegate Functions - (void)setEditing:(BOOL)editing animated:(BOOL)animated { - BOOL showEmails = [[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"]; + BOOL showEmails = [LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"]; if (editing) { // add phone/SIP/email entries so that the user can add new data for (int section = 0; section < [self numberOfSectionsInTableView:[self tableView]]; ++section) { diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 1cb0ba878..700d1fb75 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -78,7 +78,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info - (void)removeContact { if (_contact != NULL) { inhibUpdate = TRUE; - [[[LinphoneManager instance] fastAddressBook] removeContact:_contact]; + [[LinphoneManager.instance fastAddressBook] removeContact:_contact]; inhibUpdate = FALSE; } [PhoneMainView.instance popCurrentView]; @@ -111,7 +111,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info } else { LOGI(@"Save AddressBook: Success!"); } - [[LinphoneManager instance].fastAddressBook reload]; + [LinphoneManager.instance.fastAddressBook reload]; } - (void)selectContact:(ABRecordRef)acontact andReload:(BOOL)reload { @@ -136,10 +136,10 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info linphoneAddress ? [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)] : address; if (([username rangeOfString:@"@"].length > 0) && - ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) { + ([LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) { [_tableController addEmailField:username]; } else if ((linphone_proxy_config_is_phone_number(NULL, [username UTF8String])) && - ([[LinphoneManager instance] lpConfigBoolForKey:@"save_new_contacts_as_phone_number"] == true)) { + ([LinphoneManager.instance lpConfigBoolForKey:@"save_new_contacts_as_phone_number"] == true)) { [_tableController addPhoneField:username]; } else { [_tableController addSipField:address]; @@ -312,7 +312,7 @@ static UICompositeViewDescription *compositeDescription = nil; [VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE]; } - FastAddressBook *fab = [LinphoneManager instance].fastAddressBook; + FastAddressBook *fab = LinphoneManager.instance.fastAddressBook; CFErrorRef error = NULL; if (!ABPersonRemoveImageData(_contact, (CFErrorRef *)&error)) { LOGI(@"Can't remove entry: %@", [(__bridge NSError *)error localizedDescription]); diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index 9396d6915..cb1c5ac64 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -229,7 +229,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info // Go to Contact details view ContactDetailsView *view = VIEW(ContactDetailsView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; if ([ContactSelection getSelectionMode] != ContactSelectionModeEdit) { [view setContact:lPerson]; } else { @@ -254,7 +254,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade]; } - [[[LinphoneManager instance] fastAddressBook] removeContact:contact]; + [[LinphoneManager.instance fastAddressBook] removeContact:contact]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; [tableView endUpdates]; @@ -273,7 +273,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info if ([self.tableView numberOfRowsInSection:indexPath.section] == 1) { [addressBookMap removeObjectForKey:firstChar]; } - [[[LinphoneManager instance] fastAddressBook] removeContact:contact]; + [[LinphoneManager.instance fastAddressBook] removeContact:contact]; }]; } diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 058aadc35..32d745fd2 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -131,7 +131,7 @@ static UICompositeViewDescription *compositeDescription = nil; cancelButtonTitle:NSLocalizedString(@"Continue", nil) otherButtonTitles:nil]; [error show]; - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popCurrentView]; } } @@ -178,9 +178,8 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onAddContactClick:(id)event { - // Go to Contact details view ContactDetailsView *view = VIEW(ContactDetailsView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; if ([ContactSelection getAddAddress] == nil) { [view newContact]; } else { diff --git a/Classes/DialerView.h b/Classes/DialerView.h index 41ac64876..7c745d1dd 100644 --- a/Classes/DialerView.h +++ b/Classes/DialerView.h @@ -31,8 +31,6 @@ } - (void)setAddress:(NSString *)address; -- (void)call:(NSString *)address displayName:(NSString *)displayName; -- (void)call:(NSString *)address; @property(nonatomic, assign) BOOL transferMode; diff --git a/Classes/DialerView.m b/Classes/DialerView.m index 8b21dc18c..0a1c47227 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -115,7 +115,7 @@ static UICompositeViewDescription *compositeDescription = nil; [callButton setEnabled:TRUE]; // Update on show - LinphoneManager *mgr = [LinphoneManager instance]; + LinphoneManager *mgr = LinphoneManager.instance; LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; @@ -180,7 +180,7 @@ static UICompositeViewDescription *compositeDescription = nil; [oneButton addGestureRecognizer:oneLongGesture]; if (IPAD) { - if ([LinphoneManager instance].frontCamId != nil) { + if (LinphoneManager.instance.frontCamId != nil) { // only show camera switch button if we have more than 1 camera [videoCameraSwitch setHidden:FALSE]; } @@ -288,7 +288,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (BOOL)displayDebugPopup:(NSString *)address { - LinphoneManager *mgr = [LinphoneManager instance]; + LinphoneManager *mgr = LinphoneManager.instance; NSString *debugAddress = [mgr lpConfigStringForKey:@"debug_popup_magic" withDefault:@""]; if (![debugAddress isEqualToString:@""] && [address isEqualToString:debugAddress]) { @@ -307,7 +307,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self presentMailViewWithTitle:appName forRecipients:@[ logsAddress ] attachLogs:true]; }]; - BOOL debugEnabled = [[LinphoneManager instance] lpConfigBoolForKey:@"debugenable_preference"]; + BOOL debugEnabled = [LinphoneManager.instance lpConfigBoolForKey:@"debugenable_preference"]; NSString *actionLog = (debugEnabled ? NSLocalizedString(@"Disable logs", nil) : NSLocalizedString(@"Enable logs", nil)); [alertView addButtonWithTitle:actionLog @@ -347,18 +347,6 @@ static UICompositeViewDescription *compositeDescription = nil; [self callUpdate:call state:state]; } -- (void)call:(NSString *)address { - LinphoneAddress *addr = linphone_address_new(address.UTF8String); - NSString *displayName = addr ? [FastAddressBook displayNameForAddress:addr] : nil; - if (addr) - linphone_address_destroy(addr); - [self call:address displayName:displayName]; -} - -- (void)call:(NSString *)address displayName:(NSString *)displayName { - [[LinphoneManager instance] call:address displayName:displayName transfer:transferMode]; -} - #pragma mark - UITextFieldDelegate Functions - (BOOL)textField:(UITextField *)textField @@ -394,12 +382,11 @@ static UICompositeViewDescription *compositeDescription = nil; [ContactSelection setSipFilter:nil]; [ContactSelection setNameOrEmailFilter:nil]; [ContactSelection enableEmailFilter:FALSE]; - ContactsListView *view = VIEW(ContactsListView); - [PhoneMainView.instance changeCurrentView:view.class.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription]; } - (IBAction)onBackClick:(id)event { - [PhoneMainView.instance changeCurrentView:CallView.compositeViewDescription]; + [PhoneMainView.instance popToView:CallView.compositeViewDescription]; } - (IBAction)onAddressChange:(id)sender { @@ -428,12 +415,15 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)onOneLongClick:(id)sender { - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; NSString *voiceMail = [lm lpConfigStringForKey:@"voice_mail_uri"]; - if (voiceMail != nil) { - [lm call:voiceMail displayName:NSLocalizedString(@"Voice mail", nil) transfer:FALSE]; + LinphoneAddress *addr = linphone_core_interpret_url(LC, voiceMail ? voiceMail.UTF8String : NULL); + if (addr) { + linphone_address_set_display_name(addr, NSLocalizedString(@"Voice mail", nil).UTF8String); + [lm call:addr transfer:FALSE]; + linphone_address_destroy(addr); } else { - LOGE(@"Cannot call voice mail because URI not set!"); + LOGE(@"Cannot call voice mail because URI not set or invalid!"); } } @end diff --git a/Classes/FirstLoginView.m b/Classes/FirstLoginView.m index c4ab68a66..249163798 100644 --- a/Classes/FirstLoginView.m +++ b/Classes/FirstLoginView.m @@ -56,8 +56,8 @@ static UICompositeViewDescription *compositeDescription = nil; name:kLinphoneRegistrationUpdate object:nil]; - [_usernameField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_username"]]; - [_passwordField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_password"]]; + [_usernameField setText:[LinphoneManager.instance lpConfigStringForKey:@"assistant_username"]]; + [_passwordField setText:[LinphoneManager.instance lpConfigStringForKey:@"assistant_password"]]; // Update on show const MSList *list = linphone_core_get_proxy_config_list(LC); @@ -103,7 +103,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidLoad { [super viewDidLoad]; - NSString *siteUrl = [[LinphoneManager instance] lpConfigStringForKey:@"first_login_view_url"]; + NSString *siteUrl = [LinphoneManager.instance lpConfigStringForKey:@"first_login_view_url"]; if (siteUrl == nil) { siteUrl = @"http://www.linphone.org"; } @@ -128,7 +128,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)registrationUpdate:(LinphoneRegistrationState)state { switch (state) { case LinphoneRegistrationOk: { - [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"enable_first_login_view_preference"]; + [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"enable_first_login_view_preference"]; [_waitView setHidden:true]; [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; break; @@ -142,8 +142,8 @@ static UICompositeViewDescription *compositeDescription = nil; [_waitView setHidden:true]; // erase uername passwd - [[LinphoneManager instance] lpConfigSetString:nil forKey:@"assistant_username"]; - [[LinphoneManager instance] lpConfigSetString:nil forKey:@"assistant_password"]; + [LinphoneManager.instance lpConfigSetString:nil forKey:@"assistant_username"]; + [LinphoneManager.instance lpConfigSetString:nil forKey:@"assistant_password"]; break; } case LinphoneRegistrationProgress: { @@ -171,7 +171,7 @@ static UICompositeViewDescription *compositeDescription = nil; OnSuccess:^(NSString *url) { if (url) { linphone_core_set_provisioning_uri(LC, url.UTF8String); - [[LinphoneManager instance] resetLinphoneCore]; + [LinphoneManager.instance resetLinphoneCore]; } else { _waitView.hidden = YES; } diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index 291e5a135..37cbc7b33 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -143,7 +143,7 @@ static UICompositeViewDescription *compositeDescription = nil; ABRecordRef contact = [FastAddressBook getContactWithAddress:addr]; if (contact) { ContactDetailsView *view = VIEW(ContactDetailsView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; [ContactSelection setSelectionMode:ContactSelectionModeNone]; [view setContact:contact]; } @@ -159,33 +159,24 @@ static UICompositeViewDescription *compositeDescription = nil; [ContactSelection setSipFilter:nil]; [ContactSelection enableEmailFilter:FALSE]; [ContactSelection setNameOrEmailFilter:nil]; - [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription]; ms_free(lAddress); } } - (IBAction)onCallClick:(id)event { LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); - char *lAddress = linphone_address_as_string_uri_only(addr); - if (lAddress == NULL) - return; - NSString *displayName = [FastAddressBook displayNameForAddress:addr]; - - DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - [view call:[NSString stringWithUTF8String:lAddress] displayName:displayName]; - ms_free(lAddress); + [LinphoneManager.instance call:addr transfer:NO]; } - (IBAction)onChatClick:(id)event { const LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); if (addr == NULL) return; - [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; ChatConversationView *view = VIEW(ChatConversationView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr); [view setChatRoom:room]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } @end diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index 565d1b1f8..5ef0ff972 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -228,12 +228,7 @@ [cell onDetails:self]; } else { LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); - char *uri = linphone_address_as_string(addr); - DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - [view call:[NSString stringWithUTF8String:uri] - displayName:[FastAddressBook displayNameForAddress:addr]]; - ms_free(uri); + [LinphoneManager.instance call:addr transfer:NO]; } } } diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index bf13f0773..f8a76a36f 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -173,7 +173,7 @@ static UICompositeViewDescription *compositeDescription = nil; void (^block)(UIImagePickerControllerSourceType) = ^(UIImagePickerControllerSourceType type) { ImagePickerView *view = VIEW(ImagePickerView); if (!(IPAD && ipadView && ipadPopoverView)) { - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } view.sourceType = type; diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m index 3f3bc3360..729d14a56 100644 --- a/Classes/InAppProductsManager.m +++ b/Classes/InAppProductsManager.m @@ -44,7 +44,7 @@ - (instancetype)init { if ((self = [super init]) != nil) { _enabled = (([SKPaymentQueue canMakePayments]) && - ([[LinphoneManager instance] lpConfigBoolForKey:@"enabled" inSection:@"in_app_purchase"])); + ([LinphoneManager.instance lpConfigBoolForKey:@"enabled" inSection:@"in_app_purchase"])); _initialized = false; _available = false; _accountActivationInProgress = false; @@ -107,8 +107,8 @@ monthly:(BOOL)monthly { if (phoneNumber) { NSString *productID = - [[LinphoneManager instance] lpConfigStringForKey:(monthly ? @"paid_account_id_monthly" : @"paid_account_id") - inSection:@"in_app_purchase"]; + [LinphoneManager.instance lpConfigStringForKey:(monthly ? @"paid_account_id_monthly" : @"paid_account_id") + inSection:@"in_app_purchase"]; self.accountCreationData = @{ @"phoneNumber" : phoneNumber, @"password" : password, @"email" : email }; if (![self purchaseWitID:productID]) { @@ -123,8 +123,8 @@ if (phoneNumber) { NSString *receiptBase64 = [self getReceipt]; if (receiptBase64) { - NSURL *URL = [NSURL URLWithString:[[LinphoneManager instance] lpConfigStringForKey:@"receipt_validation_url" - inSection:@"in_app_purchase"]]; + NSURL *URL = [NSURL URLWithString:[LinphoneManager.instance lpConfigStringForKey:@"receipt_validation_url" + inSection:@"in_app_purchase"]]; XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL:URL]; // buying for the first time: need to create the account // if ([transaction.transactionIdentifier @@ -175,7 +175,7 @@ #pragma mark ProductListLoading - (void)loadProducts { - NSArray *list = [[[[LinphoneManager instance] lpConfigStringForKey:@"products_list" inSection:@"in_app_purchase"] + NSArray *list = [[[LinphoneManager.instance lpConfigStringForKey:@"products_list" inSection:@"in_app_purchase"] stringByReplacingOccurrencesOfString:@" " withString:@""] componentsSeparatedByString:@","]; @@ -262,8 +262,8 @@ if (latestReceiptMD5 == nil || ![latestReceiptMD5 isEqualToString:[receiptBase64 md5]]) { // transaction is null when restoring user purchases at application start or if user clicks the "restore" button // We must validate the receipt on our server - NSURL *URL = [NSURL URLWithString:[[LinphoneManager instance] lpConfigStringForKey:@"receipt_validation_url" - inSection:@"in_app_purchase"]]; + NSURL *URL = [NSURL URLWithString:[LinphoneManager.instance lpConfigStringForKey:@"receipt_validation_url" + inSection:@"in_app_purchase"]]; XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL:URL]; // buying for the first time: need to create the account // if ([transaction.transactionIdentifier @@ -303,7 +303,7 @@ if (config) { const char *identity = linphone_proxy_config_get_identity(config); if (identity) { - LinphoneAddress *addr = linphone_address_new(identity); + LinphoneAddress *addr = linphone_core_interpret_url(LC, identity); if (addr) { phoneNumber = [NSString stringWithUTF8String:linphone_address_get_username(addr)]; linphone_address_destroy(addr); @@ -389,7 +389,7 @@ LOGI(@"XMLRPC response %@: %@", [request method], [response body]); NSString *productID = - [[LinphoneManager instance] lpConfigStringForKey:@"paid_account_id" inSection:@"in_app_purchase"]; + [LinphoneManager.instance lpConfigStringForKey:@"paid_account_id" inSection:@"in_app_purchase"]; // validation succeeded if (![response isFault] && [response object] != nil) { @@ -526,11 +526,11 @@ #pragma mark - XMLRPCConnectionDelegate Functions - (void)request:(XMLRPCRequest *)request didReceiveResponse:(XMLRPCResponse *)response { - [[[LinphoneManager instance] iapManager] XMLRPCRequest:request didReceiveResponse:response]; + [[LinphoneManager.instance iapManager] XMLRPCRequest:request didReceiveResponse:response]; } - (void)request:(XMLRPCRequest *)request didFailWithError:(NSError *)error { - [[[LinphoneManager instance] iapManager] XMLRPCRequest:request didFailWithError:error]; + [[LinphoneManager.instance iapManager] XMLRPCRequest:request didFailWithError:error]; } - (BOOL)request:(XMLRPCRequest *)request canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 7e4f664ee..32e7e37b4 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -48,7 +48,7 @@ - (void)applicationDidEnterBackground:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); - [[LinphoneManager instance] enterBackgroundMode]; + [LinphoneManager.instance enterBackgroundMode]; } - (void)applicationWillResignActive:(UIApplication *)application { @@ -58,7 +58,7 @@ if (call) { /* save call context */ - LinphoneManager *instance = [LinphoneManager instance]; + LinphoneManager *instance = LinphoneManager.instance; instance->currentCallContextBeforeGoingBackground.call = call; instance->currentCallContextBeforeGoingBackground.cameraIsEnabled = linphone_call_camera_enabled(call); @@ -68,7 +68,7 @@ } } - if (![[LinphoneManager instance] resignActive]) { + if (![LinphoneManager.instance resignActive]) { } } @@ -80,7 +80,7 @@ [PhoneMainView.instance startUp]; [PhoneMainView.instance updateStatusBar:nil]; } - LinphoneManager *instance = [LinphoneManager instance]; + LinphoneManager *instance = LinphoneManager.instance; [instance becomeActive]; @@ -159,7 +159,7 @@ UIApplication *app = [UIApplication sharedApplication]; UIApplicationState state = app.applicationState; - LinphoneManager *instance = [LinphoneManager instance]; + LinphoneManager *instance = LinphoneManager.instance; BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"]; BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"]; @@ -199,7 +199,7 @@ [[UIApplication sharedApplication] endBackgroundTask:bgStartId]; }]; - [[LinphoneManager instance] startLinphoneCore]; + [LinphoneManager.instance startLinphoneCore]; // initialize UI [self.window makeKeyAndVisible]; [RootViewManager setupWithPortrait:(PhoneMainView *)self.window.rootViewController]; @@ -224,11 +224,11 @@ // destroyLinphoneCore automatically unregister proxies but if we are using // remote push notifications, we want to continue receiving them - if ([LinphoneManager instance].pushNotificationToken != nil) { + if (LinphoneManager.instance.pushNotificationToken != nil) { // trick me! setting network reachable to false will avoid sending unregister linphone_core_set_network_reachable(LC, FALSE); } - [[LinphoneManager instance] destroyLinphoneCore]; + [LinphoneManager.instance destroyLinphoneCore]; } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { @@ -279,23 +279,20 @@ LinphoneCore *lc = LC; if (linphone_core_get_calls(lc) == NULL) { // if there are calls, obviously our TCP socket shall be working linphone_core_set_network_reachable(lc, FALSE); - [LinphoneManager instance].connectivity = none; /*force connectivity to be discovered again*/ - [[LinphoneManager instance] refreshRegisters]; + LinphoneManager.instance.connectivity = none; /*force connectivity to be discovered again*/ + [LinphoneManager.instance refreshRegisters]; if (loc_key != nil) { NSString *callId = [userInfo objectForKey:@"call-id"]; if (callId != nil) { - [[LinphoneManager instance] addPushCallId:callId]; + [LinphoneManager.instance addPushCallId:callId]; } else { LOGE(@"PushNotification: does not have call-id yet, fix it !"); } if ([loc_key isEqualToString:@"IM_MSG"] || [loc_key isEqualToString:@"IM_FULLMSG"]) { - [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; - } else if ([loc_key isEqualToString:@"IC_MSG"]) { - [self fixRing]; } } @@ -333,24 +330,23 @@ BOOL auto_answer = TRUE; // some local notifications have an internal timer to relaunch themselves at specified intervals if ([[notification.userInfo objectForKey:@"timer"] intValue] == 1) { - [[LinphoneManager instance] cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]]; - auto_answer = [[LinphoneManager instance] lpConfigBoolForKey:@"autoanswer_notif_preference"]; + [LinphoneManager.instance cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]]; + auto_answer = [LinphoneManager.instance lpConfigBoolForKey:@"autoanswer_notif_preference"]; } if (auto_answer) { - [[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]]; + [LinphoneManager.instance acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]]; } } else if ([notification.userInfo objectForKey:@"from_addr"] != nil) { NSString *remoteContact = (NSString *)[notification.userInfo objectForKey:@"from_addr"]; - [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; LinphoneChatRoom *room = [self findChatRoomForContact:remoteContact]; ChatConversationView *view = VIEW(ChatConversationView); [view setChatRoom:room]; - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } else if ([notification.userInfo objectForKey:@"callLog"] != nil) { NSString *callLog = (NSString *)[notification.userInfo objectForKey:@"callLog"]; HistoryDetailsView *view = VIEW(HistoryDetailsView); [view setCallLogId:callLog]; - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } } @@ -360,7 +356,7 @@ didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { LOGI(@"%@ : %@", NSStringFromSelector(_cmd), userInfo); - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; // save the completion handler for later execution. // 2 outcomes: @@ -389,12 +385,12 @@ - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { LOGI(@"%@ : %@", NSStringFromSelector(_cmd), deviceToken); - [[LinphoneManager instance] setPushNotificationToken:deviceToken]; + [LinphoneManager.instance setPushNotificationToken:deviceToken]; } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { LOGI(@"%@ : %@", NSStringFromSelector(_cmd), [error localizedDescription]); - [[LinphoneManager instance] setPushNotificationToken:nil]; + [LinphoneManager.instance setPushNotificationToken:nil]; } #pragma mark - User notifications @@ -512,8 +508,8 @@ name:kLinphoneConfiguringStateUpdate object:nil]; linphone_core_set_provisioning_uri(LC, [configURL UTF8String]); - [[LinphoneManager instance] destroyLinphoneCore]; - [[LinphoneManager instance] startLinphoneCore]; + [LinphoneManager.instance destroyLinphoneCore]; + [LinphoneManager.instance startLinphoneCore]; } @end diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 528fcb247..1b37579ce 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -151,7 +151,7 @@ const LinphoneAddress *identity_addr = linphone_proxy_config_get_identity_address(proxy); if (identity_addr) { const char *server_addr = linphone_proxy_config_get_server_addr(proxy); - LinphoneAddress *proxy_addr = linphone_address_new(server_addr); + LinphoneAddress *proxy_addr = linphone_core_interpret_url(LC, server_addr); int port = linphone_address_get_port(proxy_addr); [self setCString:linphone_address_get_username(identity_addr) @@ -218,7 +218,7 @@ } - (void)transformLinphoneCoreToKeys { - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; LinphoneCore *lc = LC; // root section @@ -399,7 +399,7 @@ - (void)synchronizeAccounts { LOGI(@"Account changed, synchronizing."); - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; LinphoneCore *lc = LC; LinphoneProxyConfig *proxyCfg = NULL; NSString *error = nil; @@ -453,7 +453,7 @@ const char *route = NULL; - if (isWifiOnly && [LinphoneManager instance].connectivity == wwan) + if (isWifiOnly && LinphoneManager.instance.connectivity == wwan) expire = 0; if ((!proxyAddress || [proxyAddress length] < 1) && domain) { @@ -465,7 +465,7 @@ } char *proxy = ms_strdup(proxyAddress.UTF8String); - LinphoneAddress *proxy_addr = linphone_address_new(proxy); + LinphoneAddress *proxy_addr = linphone_core_interpret_url(LC, proxy); if (proxy_addr) { LinphoneTransportType type = LinphoneTransportUdp; @@ -480,7 +480,7 @@ } char normalizedUserName[256]; - LinphoneAddress *linphoneAddress = linphone_address_new("sip:user@domain.com"); + LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, "sip:user@domain.com"); proxyCfg = ms_list_nth_data(linphone_core_get_proxy_config_list(lc), [self integerForKey:@"current_proxy_config_preference"]); @@ -523,7 +523,7 @@ } [lm lpConfigSetInt:pushnotification forKey:@"pushnotification_preference"]; - [[LinphoneManager instance] configurePushTokenForProxyConfig:proxyCfg]; + [LinphoneManager.instance configurePushTokenForProxyConfig:proxyCfg]; linphone_proxy_config_enable_register(proxyCfg, is_enabled); linphone_proxy_config_enable_avpf(proxyCfg, use_avpf); @@ -544,7 +544,7 @@ if (proxyAi) { linphone_core_remove_auth_info(lc, proxyAi); } - LinphoneAddress *from = linphone_address_new(identity); + LinphoneAddress *from = linphone_core_interpret_url(LC, identity); if (from) { const char *userid_str = (userID != nil) ? [userID UTF8String] : NULL; LinphoneAuthInfo *info = linphone_auth_info_new( @@ -573,7 +573,7 @@ } } // reload address book to prepend proxy config domain to contacts' phone number - [[[LinphoneManager instance] fastAddressBook] reload]; + [[LinphoneManager.instance fastAddressBook] reload]; } - (void)synchronizeCodecs:(const MSList *)codecs { @@ -589,7 +589,7 @@ } - (BOOL)synchronize { - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; LinphoneCore *lc = LC; // root section { @@ -636,7 +636,7 @@ BOOL equalizer = [self boolForKey:@"eq_active"]; [lm lpConfigSetBool:equalizer forKey:@"eq_active" inSection:@"sound"]; - [[LinphoneManager instance] configureVbrCodecs]; + [LinphoneManager.instance configureVbrCodecs]; NSString *au_device = @"AU: Audio Unit Receiver"; if (!voice_processing) { @@ -709,7 +709,7 @@ BOOL wifiOnly = [self boolForKey:@"wifi_only_preference"]; [lm lpConfigSetInt:wifiOnly forKey:@"wifi_only_preference"]; if ([self valueChangedForKey:@"wifi_only_preference"]) { - [[LinphoneManager instance] setupNetworkReachabilityCallback]; + [LinphoneManager.instance setupNetworkReachabilityCallback]; } NSString *stun_server = [self stringForKey:@"stun_preference"]; @@ -786,7 +786,7 @@ } [lm lpConfigSetString:lTunnelPrefMode forKey:@"tunnel_mode_preference"]; - [[LinphoneManager instance] setTunnelMode:mode]; + [LinphoneManager.instance setTunnelMode:mode]; } } @@ -794,7 +794,7 @@ { BOOL debugmode = [self boolForKey:@"debugenable_preference"]; [lm lpConfigSetInt:debugmode forKey:@"debugenable_preference"]; - [[LinphoneManager instance] setLogsEnabled:debugmode]; + [LinphoneManager.instance setLogsEnabled:debugmode]; BOOL animations = [self boolForKey:@"animations_preference"]; [lm lpConfigSetInt:animations forKey:@"animations_preference"]; diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index ba7a45232..f48d0d6e9 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -162,8 +162,7 @@ typedef struct _LinphoneManagerSounds { + (NSString*)cacheDirectory; - (void)acceptCall:(LinphoneCall *)call evenWithVideo:(BOOL)video; -- (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer; - +- (BOOL)call:(const LinphoneAddress *)address transfer:(BOOL)transfer; +(id)getMessageAppDataForKey:(NSString*)key inMessage:(LinphoneChatMessage*)msg; +(void)setValueInMessageAppData:(id)value forKey:(NSString*)key inMessage:(LinphoneChatMessage*)msg; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 951e2fbf9..fa7ea0919 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -567,7 +567,7 @@ static void dump_section(const char *section, void *data) { + (void)dumpLcConfig { if (theLinphoneCore) { - LpConfig *conf = [LinphoneManager instance].configDb; + LpConfig *conf = LinphoneManager.instance.configDb; lp_config_for_each_section(conf, dump_section, conf); } } @@ -649,7 +649,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char LinphoneCallLog *callLog = linphone_call_get_call_log(call); NSString *callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)]; - if (![[LinphoneManager instance] popPushCallID:callId]) { + if (![LinphoneManager.instance popPushCallID:callId]) { // case where a remote notification is not already received // Create a new local notification data->notification = [[UILocalNotification alloc] init]; @@ -909,8 +909,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char }]; [alertView addButtonWithTitle:NSLocalizedString(@"Go to settings", nil) block:^{ - SettingsView *view = VIEW(SettingsView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + [PhoneMainView.instance changeCurrentView:SettingsView.compositeViewDescription]; }]; [alertView show]; } @@ -943,7 +942,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { notif.category = @"incoming_msg"; } - if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) { notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, chat]; } else { notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from]; @@ -1129,7 +1128,7 @@ static void showNetworkFlags(SCNetworkReachabilityFlags flags) { static void networkReachabilityNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { - LinphoneManager *mgr = [LinphoneManager instance]; + LinphoneManager *mgr = LinphoneManager.instance; SCNetworkReachabilityFlags flags; // for an unknown reason, we are receiving multiple time the notification, so @@ -1147,7 +1146,7 @@ static void networkReachabilityNotification(CFNotificationCenterRef center, void void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *nilCtx) { showNetworkFlags(flags); - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; SCNetworkReachabilityFlags networkDownFlags = kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand; @@ -1385,7 +1384,7 @@ static LinphoneCoreVTable linphonec_vtable = { NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"]; [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCoreUpdate - object:[LinphoneManager instance] + object:LinphoneManager.instance userInfo:dict]; } @@ -1534,7 +1533,7 @@ static BOOL libStarted = FALSE; NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"]; [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCoreUpdate - object:[LinphoneManager instance] + object:LinphoneManager.instance userInfo:dict]; SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); @@ -1619,7 +1618,7 @@ static int comp_call_id(const LinphoneCall *call, const char *callid) { if (!success) { LOGE(@"Could not play the message sound"); } - AudioServicesPlaySystemSound([LinphoneManager instance].sounds.vibrate); + AudioServicesPlaySystemSound(LinphoneManager.instance.sounds.vibrate); } static int comp_call_state_paused(const LinphoneCall *call, const void *param) { @@ -1640,14 +1639,14 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { // handle proxy config if any if (proxyCfg) { - if ([[LinphoneManager instance] lpConfigBoolForKey:@"backgroundmode_preference"] || - [[LinphoneManager instance] lpConfigBoolForKey:@"pushnotification_preference"]) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"] || + [LinphoneManager.instance lpConfigBoolForKey:@"pushnotification_preference"]) { // For registration register [self refreshRegisters]; } - if ([[LinphoneManager instance] lpConfigBoolForKey:@"backgroundmode_preference"]) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"]) { // register keepalive if ([[UIApplication sharedApplication] @@ -1693,7 +1692,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { LOGI(@"Entering [%s] bg mode", shouldEnterBgMode ? "normal" : "lite"); if (!shouldEnterBgMode) { - if ([[LinphoneManager instance] lpConfigBoolForKey:@"pushnotification_preference"]) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"pushnotification_preference"]) { LOGI(@"Keeping lc core to handle push"); /*destroy voip socket if any and reset connectivity mode*/ connectivity = none; @@ -1909,7 +1908,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { linphone_core_accept_call_with_params(theLinphoneCore, call, lcallParams); } -- (void)call:(NSString *)address displayName:(NSString *)displayName transfer:(BOOL)transfer { +- (BOOL)call:(const LinphoneAddress *)iaddr transfer:(BOOL)transfer { // First verify that network is available, abort otherwise. if (!linphone_core_is_network_reachable(theLinphoneCore)) { UIAlertView *error = [[UIAlertView alloc] @@ -1922,7 +1921,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:nil]; [error show]; - return; + return FALSE; } // Then check that no GSM calls are in progress, abort otherwise. @@ -1936,14 +1935,11 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:nil]; [error show]; - return; + return FALSE; } - LinphoneAddress *addr = NULL; - // Continue by checking that the provided address is a valid SIP address, abort otherwise. - if ([address length] == 0) { - // no address provided... nothing to do - } else if ((addr = linphone_core_interpret_url(LC, address.UTF8String)) == NULL) { + // Then check that the supplied address is valid + if (!iaddr) { UIAlertView *error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address", nil) message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a " @@ -1953,44 +1949,48 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:nil]; [error show]; + return FALSE; + } + LinphoneAddress *addr = linphone_address_clone(iaddr); + NSString *displayName = [FastAddressBook displayNameForAddress:addr]; + + // Finally we can make the call + LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL); + if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) { + LOGI(@"Enabling low bandwidth mode"); + linphone_call_params_enable_low_bandwidth(lcallParams, YES); + } + + if (displayName != nil) { + linphone_address_set_display_name(addr, displayName.UTF8String); + } + if ([LinphoneManager.instance lpConfigBoolForKey:@"override_domain_with_default_one"]) { + linphone_address_set_domain( + addr, [[LinphoneManager.instance lpConfigStringForKey:@"domain" inSection:@"assistant"] UTF8String]); + } + if (transfer) { + char *caddr = linphone_address_as_string(addr); + linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), caddr); + ms_free(caddr); } else { - // Finally we can make the call - LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL); - if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) { - LOGI(@"Enabling low bandwidth mode"); - linphone_call_params_enable_low_bandwidth(lcallParams, YES); - } - - if (displayName != nil) { - linphone_address_set_display_name(addr, displayName.UTF8String); - } - if ([[LinphoneManager instance] lpConfigBoolForKey:@"override_domain_with_default_one"]) { - linphone_address_set_domain( - addr, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" inSection:@"assistant"] UTF8String]); - } - - if (transfer) { - char *caddr = linphone_address_as_string(addr); - linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), caddr); - ms_free(caddr); - } else { - LinphoneCall *call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams); - if (call) { - // The LinphoneCallAppData object should be set on call creation with callback - // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash - // We are NOT responsible for creating the AppData. - LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call); - if (data == nil) { - LOGE(@"New call instanciated but app data was not set. Expect it to crash."); - /* will be used later to notify user if video was not activated because of the linphone core*/ - } else { - data->videoRequested = linphone_call_params_video_enabled(lcallParams); - } + LinphoneCall *call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams); + if (call) { + // The LinphoneCallAppData object should be set on call creation with callback + // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash + // We are NOT responsible for creating the AppData. + LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call); + if (data == nil) { + LOGE(@"New call instanciated but app data was not set. Expect it to crash."); + /* will be used later to notify user if video was not activated because of the linphone core*/ + } else { + data->videoRequested = linphone_call_params_video_enabled(lcallParams); } } - linphone_address_destroy(addr); - linphone_call_params_destroy(lcallParams); } + linphone_address_destroy(addr); + linphone_call_params_destroy(lcallParams); + + return TRUE; } #pragma mark - Property Functions diff --git a/Classes/LinphoneUI/UIBackToCallButton.m b/Classes/LinphoneUI/UIBackToCallButton.m index a85002303..5cc7f05a2 100644 --- a/Classes/LinphoneUI/UIBackToCallButton.m +++ b/Classes/LinphoneUI/UIBackToCallButton.m @@ -35,8 +35,7 @@ } - (IBAction)onBackToCallClick:(id)sender { - CallView *view = VIEW(CallView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + [PhoneMainView.instance popToView:CallView.compositeViewDescription]; } @end diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index 5269de7bf..36ec0f4a4 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -87,11 +87,10 @@ } if ([address length] > 0) { - LinphoneAddress *addr = linphone_address_new(address.UTF8String); - NSString *displayName = addr ? [FastAddressBook displayNameForAddress:addr] : nil; + LinphoneAddress *addr = linphone_core_interpret_url(LC, address.UTF8String); + [LinphoneManager.instance call:addr transfer:FALSE]; if (addr) linphone_address_destroy(addr); - [LinphoneManager.instance call:address displayName:displayName transfer:FALSE]; } } diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index 01675d019..9170fe311 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -62,7 +62,7 @@ const LinphoneContent *c = linphone_chat_message_get_file_transfer_information(amessage); if (c) { const char *name = linphone_content_get_name(c); - for (FileTransferDelegate *aftd in [[LinphoneManager instance] fileTransferDelegates]) { + for (FileTransferDelegate *aftd in [LinphoneManager.instance fileTransferDelegates]) { if (linphone_chat_message_get_file_transfer_information(aftd.message) && (linphone_chat_message_is_outgoing(aftd.message) == linphone_chat_message_is_outgoing(amessage)) && strcmp(name, linphone_content_get_name( @@ -191,7 +191,7 @@ } else { if (![_messageImageView isLoading]) { ImageView *view = VIEW(ImageView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; CGImageRef fullScreenRef = [[_messageImageView.fullImageUrl defaultRepresentation] fullScreenImage]; UIImage *fullScreen = [UIImage imageWithCGImage:fullScreenRef]; [view setImage:fullScreen]; diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index e65ddad83..a670d77e6 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -192,8 +192,7 @@ [self onDeleteClick:nil]; - [[LinphoneManager instance] - .photoLibrary assetForURL:imageUrl + [LinphoneManager.instance.photoLibrary assetForURL:imageUrl resultBlock:^(ALAsset *asset) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) { diff --git a/Classes/LinphoneUI/UIContactDetailsCell.m b/Classes/LinphoneUI/UIContactDetailsCell.m index e4c023f51..2c1d5eaa5 100644 --- a/Classes/LinphoneUI/UIContactDetailsCell.m +++ b/Classes/LinphoneUI/UIContactDetailsCell.m @@ -76,27 +76,19 @@ - (IBAction)onCallClick:(id)event { LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); - if (addr == NULL) - return; - char *lAddress = linphone_address_as_string_uri_only(addr); - NSString *displayName = [FastAddressBook displayNameForAddress:addr]; - - DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - [view call:[NSString stringWithUTF8String:lAddress] displayName:displayName]; - ms_free(lAddress); - linphone_address_destroy(addr); + [LinphoneManager.instance call:addr transfer:NO]; + if (addr) + linphone_address_destroy(addr); } - (IBAction)onChatClick:(id)event { LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); if (addr == NULL) return; - [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; ChatConversationView *view = VIEW(ChatConversationView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr); [view setChatRoom:room]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; linphone_address_destroy(addr); } diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m index f34708b5b..15458d2fd 100644 --- a/Classes/LinphoneUI/UIHistoryCell.m +++ b/Classes/LinphoneUI/UIHistoryCell.m @@ -60,7 +60,9 @@ // Go to History details view HistoryDetailsView *view = VIEW(HistoryDetailsView); [view setCallLogId:[NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)]]; - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + } else { + LOGE(@"Cannot open selected call log, it is NULL or corrupted"); } } diff --git a/Classes/LinphoneUI/UISpeakerButton.m b/Classes/LinphoneUI/UISpeakerButton.m index 8b0279666..5580f12be 100644 --- a/Classes/LinphoneUI/UISpeakerButton.m +++ b/Classes/LinphoneUI/UISpeakerButton.m @@ -60,16 +60,16 @@ INIT_WITH_COMMON_CF { #pragma mark - UIToggleButtonDelegate Functions - (void)onOn { - [[LinphoneManager instance] setSpeakerEnabled:TRUE]; + [LinphoneManager.instance setSpeakerEnabled:TRUE]; } - (void)onOff { - [[LinphoneManager instance] setSpeakerEnabled:FALSE]; + [LinphoneManager.instance setSpeakerEnabled:FALSE]; } - (bool)onUpdate { - [self setEnabled:[[LinphoneManager instance] allowSpeaker]]; - return [[LinphoneManager instance] speakerEnabled]; + [self setEnabled:[LinphoneManager.instance allowSpeaker]]; + return [LinphoneManager.instance speakerEnabled]; } @end diff --git a/Classes/LinphoneUI/UITransferButton.m b/Classes/LinphoneUI/UITransferButton.m index 809336ee8..8ad3a577e 100644 --- a/Classes/LinphoneUI/UITransferButton.m +++ b/Classes/LinphoneUI/UITransferButton.m @@ -58,7 +58,10 @@ #pragma mark - - (void)touchUp:(id)sender { - [[LinphoneManager instance] call:[addressField text] displayName:nil transfer:TRUE]; + LinphoneAddress *addr = linphone_core_interpret_url(LC, addressField.text.UTF8String); + [LinphoneManager.instance call:addr transfer:TRUE]; + if (addr) + linphone_address_destroy(addr); } @end diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index 855b41570..b3122151d 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -81,9 +81,7 @@ @property(weak, readonly) UICompositeViewDescription *currentView; @property(readonly, strong) MPVolumeView *volumeView; -- (void)changeCurrentView:(UICompositeViewDescription *)currentView; -- (void)changeCurrentView:(UICompositeViewDescription *)currentView push:(BOOL)push; -- (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push animated:(BOOL)animated; +- (void)changeCurrentView:(UICompositeViewDescription *)view; - (UIViewController*)popCurrentView; - (UIViewController *)popToView:(UICompositeViewDescription *)currentView; - (UICompositeViewDescription *)firstView; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 19ce95a01..fb5e26926 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -287,9 +287,9 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)onGlobalStateChanged:(NSNotification *)notif { LinphoneGlobalState state = (LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue]; static BOOL already_shown = FALSE; - if (state == LinphoneGlobalOn && !already_shown && [LinphoneManager instance].wasRemoteProvisioned) { + if (state == LinphoneGlobalOn && !already_shown && LinphoneManager.instance.wasRemoteProvisioned) { LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config(LC); - if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" inSection:@"app"] && conf == NULL) { + if ([LinphoneManager.instance lpConfigBoolForKey:@"show_login_view" inSection:@"app"] && conf == NULL) { already_shown = TRUE; AssistantView *view = VIEW(AssistantView); [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; @@ -322,7 +322,7 @@ static RootViewManager *rootViewManagerInstance = nil; case LinphoneCallPausedByRemote: case LinphoneCallConnected: case LinphoneCallStreamsRunning: { - [self changeCurrentView:CallView.compositeViewDescription push:NO]; + [self changeCurrentView:CallView.compositeViewDescription]; break; } case LinphoneCallUpdatedByRemote: { @@ -340,15 +340,11 @@ static RootViewManager *rootViewManagerInstance = nil; case LinphoneCallEnd: { const MSList *calls = linphone_core_get_calls(LC); if (calls == NULL) { - // if ((currentView == CallView.compositeViewDescription) || - // (currentView == CallIncomingView.compositeViewDescription) || - // (currentView == CallOutgoingView.compositeViewDescription)) { - DialerView *view = VIEW(DialerView); - [view setAddress:@""]; - [view setTransferMode:FALSE]; - [self changeCurrentView:view.compositeViewDescription push:NO]; - // [self popCurrentView]; - // } + if ((currentView == CallView.compositeViewDescription) || + (currentView == CallIncomingView.compositeViewDescription) || + (currentView == CallOutgoingView.compositeViewDescription)) { + [self popCurrentView]; + } } else { linphone_core_resume_call(LC, (LinphoneCall *)calls->data); [self changeCurrentView:CallView.compositeViewDescription]; @@ -406,10 +402,10 @@ static RootViewManager *rootViewManagerInstance = nil; LinphoneCore *core = nil; @try { core = LC; - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; if (linphone_core_get_global_state(core) != LinphoneGlobalOn) { [self changeCurrentView:DialerView.compositeViewDescription]; - } else if ([[LinphoneManager instance] lpConfigBoolForKey:@"enable_first_login_view_preference"] == true) { + } else if ([LinphoneManager.instance lpConfigBoolForKey:@"enable_first_login_view_preference"] == true) { [PhoneMainView.instance changeCurrentView:FirstLoginView.compositeViewDescription]; } else { // always start to dialer when testing @@ -539,32 +535,23 @@ static RootViewManager *rootViewManagerInstance = nil; - (UIViewController *)popCurrentView { NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; - if ([viewStack count] > 1) { - LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView, viewStack.lastObject); + if (viewStack.count <= 1) { + [viewStack removeAllObjects]; + LOGW(@"PhoneMainView: Trying to pop view but none stacked, going to %@!", DialerView.compositeViewDescription); + } else { [viewStack removeLastObject]; - [self _changeCurrentView:[viewStack lastObject] - transition:[PhoneMainView getBackwardTransition] - animated:ANIMATED]; - return [mainViewController getCurrentViewController]; + LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView, viewStack.lastObject); } - LOGW(@"PhoneMainView: Trying to pop view but none stacked!"); - return nil; + [self _changeCurrentView:viewStack.lastObject ?: DialerView.compositeViewDescription + transition:[PhoneMainView getBackwardTransition] + animated:ANIMATED]; + return [mainViewController getCurrentViewController]; } - (void)changeCurrentView:(UICompositeViewDescription *)view { - [self changeCurrentView:view push:TRUE]; -} - -- (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push { - [self changeCurrentView:view push:push animated:ANIMATED]; -} - -- (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push animated:(BOOL)animated { NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; - if (push && view) { - [viewStack addObject:view]; - } - [self _changeCurrentView:view transition:nil animated:animated]; + [viewStack addObject:view]; + [self _changeCurrentView:view transition:nil animated:ANIMATED]; } - (UIViewController *)_changeCurrentView:(UICompositeViewDescription *)view @@ -665,7 +652,7 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)playMessageSoundForCallID:(NSString *)callID { if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) { - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; // if the message was already received through a push notif, we don't need to ring if (![lm popPushCallID:callID]) { [lm playMessageSound]; @@ -678,7 +665,7 @@ static RootViewManager *rootViewManagerInstance = nil; NSString *callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)]; if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) { - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; BOOL callIDFromPush = [lm popPushCallID:callId]; BOOL autoAnswer = [lm lpConfigBoolForKey:@"autoanswer_notif_preference"]; @@ -688,7 +675,7 @@ static RootViewManager *rootViewManagerInstance = nil; } else { AudioServicesPlaySystemSound(lm.sounds.vibrate); CallIncomingView *view = VIEW(CallIncomingView); - [self changeCurrentView:view.compositeViewDescription push:TRUE]; + [self changeCurrentView:view.compositeViewDescription]; [view setCall:call]; [view setDelegate:self]; } @@ -736,7 +723,7 @@ static RootViewManager *rootViewManagerInstance = nil; } - (void)incomingCallAccepted:(LinphoneCall *)call evenWithVideo:(BOOL)video { - [[LinphoneManager instance] acceptCall:call evenWithVideo:video]; + [LinphoneManager.instance acceptCall:call evenWithVideo:video]; } - (void)incomingCallDeclined:(LinphoneCall *)call { diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index bf3538bb2..2e7e27db1 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -414,7 +414,7 @@ static UICompositeViewDescription *compositeDescription = nil; removeFromHiddenKeys = debugEnabled; [keys addObject:@"send_logs_button"]; [keys addObject:@"reset_logs_button"]; - [[LinphoneManager instance] setLogsEnabled:debugEnabled]; + [LinphoneManager.instance setLogsEnabled:debugEnabled]; } else if ([@"account_mandatory_advanced_preference" compare:notif.object] == NSOrderedSame) { removeFromHiddenKeys = [[notif.userInfo objectForKey:@"account_mandatory_advanced_preference"] boolValue]; for (NSString *key in settingsStore->dict) { @@ -499,7 +499,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (NSSet *)findHiddenKeys { - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneManager *lm = LinphoneManager.instance; NSMutableSet *hiddenKeys = [NSMutableSet set]; const MSList *accounts = linphone_core_get_proxy_config_list(LC); @@ -520,7 +520,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"flush_images_button"]; #endif - if (![[LinphoneManager instance] lpConfigBoolForKey:@"debugenable_preference"]) { + if (![LinphoneManager.instance lpConfigBoolForKey:@"debugenable_preference"]) { [hiddenKeys addObject:@"send_logs_button"]; [hiddenKeys addObject:@"reset_logs_button"]; } @@ -611,7 +611,7 @@ static UICompositeViewDescription *compositeDescription = nil; } } - if (![[[LinphoneManager instance] iapManager] enabled]) { + if (![[LinphoneManager.instance iapManager] enabled]) { [hiddenKeys addObject:@"in_app_products_button"]; } @@ -660,7 +660,7 @@ static UICompositeViewDescription *compositeDescription = nil; if ([key isEqual:@"release_button"]) { [UIApplication sharedApplication].keyWindow.rootViewController = nil; [[UIApplication sharedApplication].keyWindow setRootViewController:nil]; - [[LinphoneManager instance] destroyLinphoneCore]; + [LinphoneManager.instance destroyLinphoneCore]; [LinphoneManager instanceRelease]; } else if ([key isEqual:@"clear_cache_button"]) { [PhoneMainView.instance.mainViewController @@ -701,7 +701,7 @@ static UICompositeViewDescription *compositeDescription = nil; }]; [alert show]; } else if ([key isEqual:@"about_button"]) { - [PhoneMainView.instance changeCurrentView:AboutView.compositeViewDescription push:TRUE]; + [PhoneMainView.instance changeCurrentView:AboutView.compositeViewDescription]; } else if ([key isEqual:@"reset_logs_button"]) { linphone_core_reset_log_collection(); } else if ([key isEqual:@"send_logs_button"]) { @@ -826,9 +826,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onDialerBackClick:(id)sender { [_settingsController.navigationController popViewControllerAnimated:NO]; - - DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; } - (IBAction)onBackClick:(id)sender { diff --git a/Classes/SideMenuTableView.m b/Classes/SideMenuTableView.m index d5bca31d5..6495f93ac 100644 --- a/Classes/SideMenuTableView.m +++ b/Classes/SideMenuTableView.m @@ -39,24 +39,18 @@ addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Assistant", nil) tapBlock:^() { [PhoneMainView.instance - changeCurrentView:AssistantView.compositeViewDescription - push:NO - animated:NO]; + changeCurrentView:AssistantView.compositeViewDescription]; }]]; [_sideMenuEntries addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Settings", nil) tapBlock:^() { [PhoneMainView.instance - changeCurrentView:SettingsView.compositeViewDescription - push:NO - animated:NO]; + changeCurrentView:SettingsView.compositeViewDescription]; }]]; [_sideMenuEntries addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"About", nil) tapBlock:^() { [PhoneMainView.instance - changeCurrentView:AboutView.compositeViewDescription - push:NO - animated:NO]; + changeCurrentView:AboutView.compositeViewDescription]; }]]; } diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index eb8d81520..b86eb6e9e 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -76,7 +76,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info + (NSString *)appendCountryCodeIfPossible:(NSString *)number { if (![number hasPrefix:@"+"] && ![number hasPrefix:@"00"]) { - NSString *lCountryCode = [[LinphoneManager instance] lpConfigStringForKey:@"countrycode_preference"]; + NSString *lCountryCode = [LinphoneManager.instance lpConfigStringForKey:@"countrycode_preference"]; if (lCountryCode && [lCountryCode length] > 0) { // append country code return [lCountryCode stringByAppendingString:number]; @@ -211,7 +211,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, i); BOOL add = false; if (CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { - if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, + if (CFStringCompare((CFStringRef)LinphoneManager.instance.contactSipField, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { add = true; @@ -273,14 +273,14 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void if (CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { CFStringRef serviceKey = CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey); - if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, serviceKey, + if (CFStringCompare((CFStringRef)LinphoneManager.instance.contactSipField, serviceKey, kCFCompareCaseInsensitive) == 0) { match = true; } } else if (domain != nil) { // check domain - LinphoneAddress *address = linphone_address_new( - [(NSString *)CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey) UTF8String]); + LinphoneAddress *address = linphone_core_interpret_url( + LC, [(NSString *)CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey) UTF8String]); if (address) { const char *dom = linphone_address_get_domain(address); diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index 81c37856e..65931496b 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -22,7 +22,7 @@ } + (FileTransferDelegate *)messageDelegate:(LinphoneChatMessage *)message { - for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) { + for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) { if (ftd.message == message) { return ftd; } @@ -47,14 +47,13 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con UIImage *image = [UIImage imageWithData:thiz.data]; CFBridgingRetain(thiz); - [[[LinphoneManager instance] fileTransferDelegates] removeObject:thiz]; + [[LinphoneManager.instance fileTransferDelegates] removeObject:thiz]; // until image is properly saved, keep a reminder on it so that the // chat bubble is aware of the fact that image is being saved to device [LinphoneManager setValueInMessageAppData:@"saving..." forKey:@"localimage" inMessage:message]; - [[LinphoneManager instance] - .photoLibrary + [LinphoneManager.instance.photoLibrary writeImageToSavedPhotosAlbum:image.CGImage orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error) { @@ -172,7 +171,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m } - (BOOL)download:(LinphoneChatMessage *)message { - [[[LinphoneManager instance] fileTransferDelegates] addObject:self]; + [[LinphoneManager.instance fileTransferDelegates] addObject:self]; _message = message; @@ -191,7 +190,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m } - (void)stopAndDestroy { - [[[LinphoneManager instance] fileTransferDelegates] removeObject:self]; + [[LinphoneManager.instance fileTransferDelegates] removeObject:self]; if (_message != NULL) { LinphoneChatMessage *msg = _message; _message = NULL; diff --git a/TestsUI/LinphoneTestCase.m b/TestsUI/LinphoneTestCase.m index d3d672543..cb2deb163 100644 --- a/TestsUI/LinphoneTestCase.m +++ b/TestsUI/LinphoneTestCase.m @@ -104,8 +104,8 @@ linphone_core_clear_proxy_config(lc); linphone_core_clear_all_auth_info(lc); - LinphoneAddress *testAddr = linphone_address_new( - [[NSString stringWithFormat:@"sip:%@@%@", [self me], [self accountDomain]] UTF8String]); + LinphoneAddress *testAddr = linphone_core_interpret_url( + LC, [[NSString stringWithFormat:@"sip:%@@%@", [self me], [self accountDomain]] UTF8String]); linphone_address_set_header(testAddr, "X-Create-Account", "yes"); linphone_address_set_transport(testAddr, LinphoneTransportTcp); linphone_address_set_port(testAddr, 0); From 19fe1bd5d96a60e50ffee8d09cdd9cb7491088cd Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 12:39:55 +0100 Subject: [PATCH 14/22] log: application logs are now separated of liblinphone logs --- Classes/DialerView.m | 5 +- Classes/LinphoneCoreSettingsStore.m | 4 -- Classes/LinphoneManager.h | 1 - Classes/LinphoneManager.m | 21 +------ Classes/Log.h | 17 +++--- Classes/SettingsView.m | 7 +-- Classes/Utils/Log.m | 74 ++++++++++++++---------- Settings/InAppSettings.bundle/Root.plist | 16 ----- TestsUI/LinphoneTestCase.m | 1 + submodules/linphone | 2 +- 10 files changed, 60 insertions(+), 88 deletions(-) diff --git a/Classes/DialerView.m b/Classes/DialerView.m index 0a1c47227..fd87eca38 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -313,9 +313,8 @@ static UICompositeViewDescription *compositeDescription = nil; [alertView addButtonWithTitle:actionLog block:^{ // enable / disable - BOOL enableDebug = ![mgr lpConfigBoolForKey:@"debugenable_preference"]; - [mgr lpConfigSetBool:enableDebug forKey:@"debugenable_preference"]; - [mgr setLogsEnabled:enableDebug]; + BOOL enableDebug = !debugEnabled; + [Log enableLogs:enableDebug]; }]; [alertView show]; diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 1b37579ce..c453ccc24 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -792,10 +792,6 @@ // advanced section { - BOOL debugmode = [self boolForKey:@"debugenable_preference"]; - [lm lpConfigSetInt:debugmode forKey:@"debugenable_preference"]; - [LinphoneManager.instance setLogsEnabled:debugmode]; - BOOL animations = [self boolForKey:@"animations_preference"]; [lm lpConfigSetInt:animations forKey:@"animations_preference"]; diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index f48d0d6e9..3387f31cf 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -154,7 +154,6 @@ typedef struct _LinphoneManagerSounds { - (bool)allowSpeaker; - (void)configureVbrCodecs; -- (void)setLogsEnabled:(BOOL)enabled; + (BOOL)copyFile:(NSString*)src destination:(NSString*)dst override:(BOOL)override; + (NSString*)bundleFile:(NSString*)file; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index fa7ea0919..d21d529cd 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1441,7 +1441,7 @@ static BOOL libStarted = FALSE; return; } linphone_core_set_log_collection_path([[LinphoneManager cacheDirectory] UTF8String]); - [self setLogsEnabled:[self lpConfigBoolForKey:@"debugenable_preference"]]; + [Log enableLogs:([self lpConfigBoolForKey:@"debugenable_preference"] || LinphoneManager.instance.isTesting)]; connectivity = none; ms_init(); // Need to initialize mediastreamer2 before loading the plugins @@ -2133,25 +2133,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } } -- (void)setLogsEnabled:(BOOL)enabled { - if ([LinphoneManager isRunningTests]) { - NSLog(@"Running tests, forcing logs to MESSAGE level"); - linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); - linphone_core_set_log_level(ORTP_MESSAGE); - } else { - if (enabled) { - NSLog(@"Enabling debug logs"); - linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); - linphone_core_set_log_level(ORTP_DEBUG); - linphone_core_enable_log_collection(enabled); - } else { - NSLog(@"Disabling debug logs"); - linphone_core_enable_log_collection(enabled); - linphone_core_disable_logs(); - } - } -} - + (id)getMessageAppDataForKey:(NSString *)key inMessage:(LinphoneChatMessage *)msg { if (msg == nil) diff --git a/Classes/Log.h b/Classes/Log.h index b79034b48..c1d98b0c4 100644 --- a/Classes/Log.h +++ b/Classes/Log.h @@ -19,16 +19,19 @@ #import "LinphoneManager.h" -#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__] -#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__) -#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__) -#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__) -#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__) -#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__) +#define APP_LVL 1 << 7 +#define LOGV(level, ...) [Log log:APP_LVL & level file:__FILE__ line:__LINE__ format:__VA_ARGS__] +#define LOGD(...) LOGV(APP_LVL | ORTP_DEBUG, __VA_ARGS__) +#define LOGI(...) LOGV(APP_LVL | ORTP_MESSAGE, __VA_ARGS__) +#define LOGW(...) LOGV(APP_LVL | ORTP_WARNING, __VA_ARGS__) +#define LOGE(...) LOGV(APP_LVL | ORTP_ERROR, __VA_ARGS__) +#define LOGF(...) LOGV(APP_LVL | ORTP_FATAL, __VA_ARGS__) -@interface LinphoneLogger : NSObject { +@interface Log : NSObject { } + (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...; ++ (void)enableLogs:(BOOL)enabled; + void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); @end \ No newline at end of file diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 2e7e27db1..f25e62394 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -414,7 +414,7 @@ static UICompositeViewDescription *compositeDescription = nil; removeFromHiddenKeys = debugEnabled; [keys addObject:@"send_logs_button"]; [keys addObject:@"reset_logs_button"]; - [LinphoneManager.instance setLogsEnabled:debugEnabled]; + [Log enableLogs:(debugEnabled || LinphoneManager.instance.isTesting)]; } else if ([@"account_mandatory_advanced_preference" compare:notif.object] == NSOrderedSame) { removeFromHiddenKeys = [[notif.userInfo objectForKey:@"account_mandatory_advanced_preference"] boolValue]; for (NSString *key in settingsStore->dict) { @@ -535,9 +535,6 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"wifi_only_preference"]; - [hiddenKeys addObject:@"quit_button"]; // Hide for the moment - [hiddenKeys addObject:@"about_button"]; // Hide for the moment - if (!linphone_core_video_supported(LC)) { [hiddenKeys addObject:@"video_menu"]; } @@ -700,8 +697,6 @@ static UICompositeViewDescription *compositeDescription = nil; [_settingsController.navigationController popViewControllerAnimated:NO]; }]; [alert show]; - } else if ([key isEqual:@"about_button"]) { - [PhoneMainView.instance changeCurrentView:AboutView.compositeViewDescription]; } else if ([key isEqual:@"reset_logs_button"]) { linphone_core_reset_log_collection(); } else if ([key isEqual:@"send_logs_button"]) { diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m index 1c93ba76b..de3a8dc2d 100644 --- a/Classes/Utils/Log.m +++ b/Classes/Utils/Log.m @@ -19,7 +19,7 @@ #import "Log.h" -@implementation LinphoneLogger +@implementation Log + (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ... { va_list args; @@ -28,45 +28,59 @@ const char *utf8str = [str cStringUsingEncoding:NSString.defaultCStringEncoding]; int filesize = 20; const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file; - if (severity <= ORTP_DEBUG) { - // lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even - // not in debug build... - ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str); - } else { - ortp_log(severity, "%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, - utf8str); + + char levelC = 'U'; // undefined + if ((severity & ORTP_FATAL) != 0) { + levelC = 'F'; + } else if ((severity & ORTP_ERROR) != 0) { + levelC = 'E'; + } else if ((severity & ORTP_WARNING) != 0) { + levelC = 'W'; + } else if ((severity & ORTP_MESSAGE) != 0) { + levelC = 'I'; + } else if (((severity & ORTP_TRACE) != 0) || ((severity & ORTP_DEBUG) != 0)) { + levelC = 'D'; } + // we want application logs to be always enabled so use | ORTP_ERROR extra mask + ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize, + filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str); va_end(args); } ++ (void)enableLogs:(BOOL)enabled { + [LinphoneManager.instance lpConfigSetBool:enabled forKey:@"debugenable_preference"]; + linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); + if (enabled) { + NSLog(@"Enabling debug logs"); + linphone_core_set_log_level(ORTP_DEBUG); + } else { + NSLog(@"Disabling debug logs"); + linphone_core_set_log_level(ORTP_ERROR); + } + linphone_core_enable_log_collection(enabled); +} + #pragma mark - Logs Functions callbacks void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) { NSString *format = [[NSString alloc] initWithUTF8String:fmt]; NSString *formatedString = [[NSString alloc] initWithFormat:format arguments:args]; - char levelC = 'I'; - switch ((OrtpLogLevel)lev) { - case ORTP_FATAL: - levelC = 'F'; - break; - case ORTP_ERROR: - levelC = 'E'; - break; - case ORTP_WARNING: - levelC = 'W'; - break; - case ORTP_MESSAGE: - levelC = 'I'; - break; - case ORTP_TRACE: - case ORTP_DEBUG: - levelC = 'D'; - break; - case ORTP_LOGLEV_END: - return; + NSString *lvl = @""; + if ((lev & APP_LVL) == 0) { + if ((lev & ORTP_FATAL) != 0) { + lvl = @"F "; + } else if ((lev & ORTP_ERROR) != 0) { + lvl = @"E "; + } else if ((lev & ORTP_WARNING) != 0) { + lvl = @"W "; + } else if ((lev & ORTP_MESSAGE) != 0) { + lvl = @"I "; + } else if (((lev & ORTP_TRACE) != 0) || ((lev & ORTP_DEBUG) != 0)) { + lvl = @"D "; + } } - // since \r are interpreted like \n, avoid double new lines when logging packets - NSLog(@"%c %@", levelC, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]); + // since \r are interpreted like \n, avoid double new lines when logging network packets (belle-sip) + NSLog(@"%@%@", lvl, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]); } @end diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist index 30e709696..f37c4fd13 100644 --- a/Settings/InAppSettings.bundle/Root.plist +++ b/Settings/InAppSettings.bundle/Root.plist @@ -150,22 +150,6 @@ Type PSGroupSpecifier - - Key - about_button - Title - About - Type - IASKButtonSpecifier - - - Key - quit_button - Title - Quit - Type - IASKButtonSpecifier - Key release_button diff --git a/TestsUI/LinphoneTestCase.m b/TestsUI/LinphoneTestCase.m index cb2deb163..371ef2365 100644 --- a/TestsUI/LinphoneTestCase.m +++ b/TestsUI/LinphoneTestCase.m @@ -48,6 +48,7 @@ - (void)beforeEach { [[LinphoneManager instance] lpConfigSetInt:NO forKey:@"animations_preference"]; + linphone_core_set_log_level(ORTP_MESSAGE); } - (NSString *)me { diff --git a/submodules/linphone b/submodules/linphone index 454e9834a..67f9bd206 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 454e9834aed36270db6cdf2e4ca7240713dcf930 +Subproject commit 67f9bd2068ab6d040ddadd4209a538aef99a893a From bda8fb6ac2ec6961565d8ccc499bedff50a55928 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 13:45:26 +0100 Subject: [PATCH 15/22] log: application debug logs should be still disabled until debug is enabled --- Classes/Utils/Log.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m index de3a8dc2d..e05118de9 100644 --- a/Classes/Utils/Log.m +++ b/Classes/Utils/Log.m @@ -38,12 +38,20 @@ levelC = 'W'; } else if ((severity & ORTP_MESSAGE) != 0) { levelC = 'I'; - } else if (((severity & ORTP_TRACE) != 0) || ((severity & ORTP_DEBUG) != 0)) { + } else if ((severity & ORTP_DEBUG) != 0) { levelC = 'D'; } - // we want application logs to be always enabled so use | ORTP_ERROR extra mask - ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize, - filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str); + + if ((severity & ORTP_DEBUG) != 0) { + // lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even + // not in debug build... + ortp_debug("%c %*s:%3d - %s", levelC, filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, + utf8str); + } else { + // we want application logs to be always enabled (except debug ones) so use | ORTP_ERROR extra mask + ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize, + filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str); + } va_end(args); } From f7f3840aa71250bebbdeb2f737ce5006ef2c25b4 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 13:45:49 +0100 Subject: [PATCH 16/22] file transfer: remove duplicate code not needed anymore --- .../LinphoneUI/Base.lproj/UICompositeView.xib | 19 ++----------------- .../Base.lproj/UICompositeView~ipad.xib | 5 +---- Classes/LinphoneUI/UIChatBubblePhotoCell.m | 10 +--------- Classes/Utils/FileTransferDelegate.m | 2 +- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib index 1668cddf2..baa4d9320 100644 --- a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib +++ b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib @@ -1,9 +1,9 @@ - + - + @@ -26,17 +26,12 @@ - - - - - @@ -46,22 +41,18 @@ - - - - @@ -73,34 +64,28 @@ - - - - - - diff --git a/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib b/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib index d4b20b633..13cacd621 100644 --- a/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib +++ b/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib @@ -1,5 +1,5 @@ - + @@ -28,9 +28,6 @@ - - - diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index 9170fe311..b85a67c4e 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -156,21 +156,13 @@ [_ftd download:self.message]; _cancelButton.hidden = NO; _downloadButton.hidden = YES; - - // we must tell the tableview to refresh the cell to reflect its internal state - ChatConversationView *view = VIEW(ChatConversationView); - [view.tableController updateChatEntry:self.message]; } - (IBAction)onCancelClick:(id)sender { FileTransferDelegate *tmp = _ftd; [self disconnectFromFileDelegate]; - [tmp cancel]; _fileTransferProgress.progress = 0; - [self update]; - // we must tell the tableview to refresh the cell to reflect its internal state - ChatConversationView *view = VIEW(ChatConversationView); - [view.tableController updateChatEntry:self.message]; + [tmp cancel]; } - (void)onResendClick:(id)event { diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index 65931496b..fc18b2fe6 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -202,7 +202,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m linphone_chat_message_cancel_file_transfer(msg); } _data = nil; - LOGI(@"%p Destroying", self); + LOGD(@"%p Destroying", self); } - (void)cancel { From 2eded652e7ed0eed35cab8d83ebd755ad7cfa4b6 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 13:48:20 +0100 Subject: [PATCH 17/22] UITester: handle logs independently --- Classes/LinphoneManager.m | 2 +- Classes/SettingsView.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index d21d529cd..b33b56c56 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1441,7 +1441,7 @@ static BOOL libStarted = FALSE; return; } linphone_core_set_log_collection_path([[LinphoneManager cacheDirectory] UTF8String]); - [Log enableLogs:([self lpConfigBoolForKey:@"debugenable_preference"] || LinphoneManager.instance.isTesting)]; + [Log enableLogs:[self lpConfigBoolForKey:@"debugenable_preference"]]; connectivity = none; ms_init(); // Need to initialize mediastreamer2 before loading the plugins diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index f25e62394..5973357f2 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -414,7 +414,7 @@ static UICompositeViewDescription *compositeDescription = nil; removeFromHiddenKeys = debugEnabled; [keys addObject:@"send_logs_button"]; [keys addObject:@"reset_logs_button"]; - [Log enableLogs:(debugEnabled || LinphoneManager.instance.isTesting)]; + [Log enableLogs:debugEnabled]; } else if ([@"account_mandatory_advanced_preference" compare:notif.object] == NSOrderedSame) { removeFromHiddenKeys = [[notif.userInfo objectForKey:@"account_mandatory_advanced_preference"] boolValue]; for (NSString *key in settingsStore->dict) { From 9c9d1fff794f6f808f1f0de80ca28855ec01e4bf Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 14:09:47 +0100 Subject: [PATCH 18/22] outgoing call: refresh mute/speaker buttons --- Classes/Base.lproj/CallIncomingView.xib | 4 ++-- Classes/Base.lproj/CallOutgoingView.xib | 1 + Classes/CallOutgoingView.h | 1 + Classes/CallOutgoingView.m | 4 ++++ linphone_Prefix.pch | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Classes/Base.lproj/CallIncomingView.xib b/Classes/Base.lproj/CallIncomingView.xib index e18d31111..396c20878 100644 --- a/Classes/Base.lproj/CallIncomingView.xib +++ b/Classes/Base.lproj/CallIncomingView.xib @@ -148,7 +148,7 @@ - + @@ -281,7 +281,7 @@ - + diff --git a/Classes/Base.lproj/CallOutgoingView.xib b/Classes/Base.lproj/CallOutgoingView.xib index a11c9f463..12030996d 100644 --- a/Classes/Base.lproj/CallOutgoingView.xib +++ b/Classes/Base.lproj/CallOutgoingView.xib @@ -10,6 +10,7 @@ + diff --git a/Classes/CallOutgoingView.h b/Classes/CallOutgoingView.h index 94c65d56d..5ad6a1504 100644 --- a/Classes/CallOutgoingView.h +++ b/Classes/CallOutgoingView.h @@ -35,6 +35,7 @@ @property(weak, nonatomic) IBOutlet UIBluetoothButton *routesBluetoothButton; @property(weak, nonatomic) IBOutlet UIButton *routesEarpieceButton; @property(weak, nonatomic) IBOutlet UISpeakerButton *routesSpeakerButton; +@property(weak, nonatomic) IBOutlet UIMicroButton *microButton; - (IBAction)onDeclineClick:(id)sender; diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index 141b363a7..3efe75470 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -66,6 +66,10 @@ static UICompositeViewDescription *compositeDescription = nil; } [self hideSpeaker:LinphoneManager.instance.bluetoothAvailable]; + + [_speakerButton update]; + [_microButton update]; + [_routesButton update]; } - (void)viewWillDisappear:(BOOL)animated { diff --git a/linphone_Prefix.pch b/linphone_Prefix.pch index eebc8998b..7bc9a548d 100644 --- a/linphone_Prefix.pch +++ b/linphone_Prefix.pch @@ -13,5 +13,6 @@ #import "UIToggleButton.h" #import "UISpeakerButton.h" #import "UIBluetoothButton.h" +#import "UIMicroButton.h" #import "UIChatBubbleTextCell.h" From 134b4202a824f2b1b941a06e5a04fabf8e65182b Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 14:23:47 +0100 Subject: [PATCH 19/22] misc: fix call views workflow --- Classes/CallOutgoingView.m | 1 - Classes/PhoneMainView.m | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index 3efe75470..eba576e8b 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -106,7 +106,6 @@ static UICompositeViewDescription *compositeDescription = nil; if (call) { linphone_core_terminate_call(LC, call); } - [PhoneMainView.instance popCurrentView]; } - (void)hideRoutes:(BOOL)hidden animated:(BOOL)animated { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index fb5e26926..d17bccbda 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -322,6 +322,11 @@ static RootViewManager *rootViewManagerInstance = nil; case LinphoneCallPausedByRemote: case LinphoneCallConnected: case LinphoneCallStreamsRunning: { + if ((currentView == CallView.compositeViewDescription) || + (currentView == CallIncomingView.compositeViewDescription) || + (currentView == CallOutgoingView.compositeViewDescription)) { + [self popCurrentView]; + } [self changeCurrentView:CallView.compositeViewDescription]; break; } @@ -340,9 +345,9 @@ static RootViewManager *rootViewManagerInstance = nil; case LinphoneCallEnd: { const MSList *calls = linphone_core_get_calls(LC); if (calls == NULL) { - if ((currentView == CallView.compositeViewDescription) || - (currentView == CallIncomingView.compositeViewDescription) || - (currentView == CallOutgoingView.compositeViewDescription)) { + while ((currentView == CallView.compositeViewDescription) || + (currentView == CallIncomingView.compositeViewDescription) || + (currentView == CallOutgoingView.compositeViewDescription)) { [self popCurrentView]; } } else { @@ -537,10 +542,12 @@ static RootViewManager *rootViewManagerInstance = nil; NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; if (viewStack.count <= 1) { [viewStack removeAllObjects]; - LOGW(@"PhoneMainView: Trying to pop view but none stacked, going to %@!", DialerView.compositeViewDescription); + LOGW(@"PhoneMainView: Trying to pop view but none stacked, going to %@!", + DialerView.compositeViewDescription.name); } else { [viewStack removeLastObject]; - LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView, viewStack.lastObject); + LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView.name, + ((UICompositeViewDescription *)(viewStack.lastObject ?: DialerView.compositeViewDescription)).name); } [self _changeCurrentView:viewStack.lastObject ?: DialerView.compositeViewDescription transition:[PhoneMainView getBackwardTransition] @@ -549,8 +556,6 @@ static RootViewManager *rootViewManagerInstance = nil; } - (void)changeCurrentView:(UICompositeViewDescription *)view { - NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; - [viewStack addObject:view]; [self _changeCurrentView:view transition:nil animated:ANIMATED]; } @@ -560,6 +565,8 @@ static RootViewManager *rootViewManagerInstance = nil; PhoneMainView *vc = [[RootViewManager instance] setViewControllerForDescription:view]; if (![view equal:vc.currentView] || vc != self) { LOGI(@"Change current view to %@", view.name); + NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack; + [viewStack addObject:view]; if (animated && transition == nil) transition = [PhoneMainView getTransition:vc.currentView new:view]; [vc.mainViewController setViewTransition:(animated ? transition : nil)]; From 7ff37d9a63eec7562a42fa8f3153aa2a5a55101b Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 14:45:21 +0100 Subject: [PATCH 20/22] i18n: update translations --- Classes/fr.lproj/AssistantViewScreens.strings | Bin 27326 -> 27334 bytes Resources/fr.lproj/Localizable.strings | Bin 39896 -> 39942 bytes .../ar.lproj/Root.strings | Bin 1426 -> 1338 bytes .../de.lproj/Root.strings | Bin 1462 -> 1382 bytes .../en.lproj/Root.strings | 2 -- .../fr.lproj/Network.strings | Bin 948 -> 952 bytes .../fr.lproj/Root.strings | Bin 1462 -> 1378 bytes .../fr.lproj/Video.strings | Bin 914 -> 946 bytes .../ja.lproj/Root.strings | Bin 1338 -> 1272 bytes .../nl.lproj/Root.strings | Bin 1404 -> 1334 bytes .../ru.lproj/Root.strings | Bin 1432 -> 1346 bytes .../sv.lproj/Root.strings | Bin 1382 -> 1310 bytes .../zh_TW.lproj/Root.strings | Bin 1400 -> 1328 bytes 13 files changed, 2 deletions(-) diff --git a/Classes/fr.lproj/AssistantViewScreens.strings b/Classes/fr.lproj/AssistantViewScreens.strings index 258d79c3e10f54da9dee5081c91c3f934b18f640..ca028abe0ef51320a92ef39093eca1363d1a7e65 100644 GIT binary patch delta 32 ocmdmYmGRhB#tj{IlPlyTCYJ;Xu(~q%FlbH|WShR(#lA`#0MhUaD*ylh delta 18 acmX?hm2uxy#tj{IlYiN2ZQf+B_jDjCpd5tH$J0aa0l|CW?BHIz2W+pe`MVs>utPWjD`Zp2r9PTv!k| diff --git a/Settings/InAppSettings.bundle/de.lproj/Root.strings b/Settings/InAppSettings.bundle/de.lproj/Root.strings index bd0a0f89bde143478c2f40b5d28587c56b139261..3520844433db939ff0fd05af0ff6c45b8934cd18 100644 GIT binary patch delta 12 UcmdnS{fukF8s^P^n0GM(040_MegFUf delta 80 zcmaFHwT*kj8fIrlh9ri3hEj$S1|hoOJyhmvaA`nfMg(0J`+Vn7+5}s PA(5e&p?LFr=HrY2pr;TI diff --git a/Settings/InAppSettings.bundle/en.lproj/Root.strings b/Settings/InAppSettings.bundle/en.lproj/Root.strings index e6aefd61f..7bc369289 100644 --- a/Settings/InAppSettings.bundle/en.lproj/Root.strings +++ b/Settings/InAppSettings.bundle/en.lproj/Root.strings @@ -14,8 +14,6 @@ "Tunnel" = "Tunnel"; "Advanced" = "Advanced"; "Development debug actions" = "Development debug actions"; -"About" = "About"; -"Quit" = "Quit"; "Release core" = "Release core"; "Clear cache" = "Clear cache"; "Battery alert" = "Battery alert"; diff --git a/Settings/InAppSettings.bundle/fr.lproj/Network.strings b/Settings/InAppSettings.bundle/fr.lproj/Network.strings index 3ee85d5cb800461ac8e2f477eab50c98ac3cda43..f297b0d4832043b1a8c303d9becab2eea58460d2 100644 GIT binary patch delta 28 jcmdnOzJq;(7!!XoLkUABLm5LVLlJ`lL(XPJrpb%|YMBPr delta 24 fcmdnNzJ+~*7!!96Lk>eeLpg&2gXd;drpb%|P`w4? diff --git a/Settings/InAppSettings.bundle/fr.lproj/Root.strings b/Settings/InAppSettings.bundle/fr.lproj/Root.strings index b2b62337774c4aa055ceab8984e203e2e67f3610..bc18aae58078daffdb83cd27164c7d615136c5be 100644 GIT binary patch delta 12 TcmdnS{fKKrAM@r%%vTrzBxnU( delta 88 zcmaFFwT*j2AG5b3LlQ$iLn%WEgA#)RgDns%F&qGr0SrYz@d6+&28viSZ~@6cpt?*H Rl`xSKhE#^4&8^IL837fl5lsL9 diff --git a/Settings/InAppSettings.bundle/fr.lproj/Video.strings b/Settings/InAppSettings.bundle/fr.lproj/Video.strings index a530a1e8d34960bce4be4d25531c11b006ec9e4b..887fff3de02c8bf2bee64dee49479583196a841d 100644 GIT binary patch delta 44 ucmbQlzKMMU6QjHWLjgl7Lmop4Ln4qYVNhVmVNeIM3&7$zn;97=G64Y8`3XD# delta 12 TcmdnQK8bw;6XRwj#tBRS8Ds-) diff --git a/Settings/InAppSettings.bundle/ja.lproj/Root.strings b/Settings/InAppSettings.bundle/ja.lproj/Root.strings index cbee92d3c48399a637185a56524fb363a29f3c86..e3214cc1bafcb52daea4d164e37aab768351231d 100644 GIT binary patch delta 16 YcmdnR^@DRm4)f#-%u<_AFc&cb06R7YRsaA1 delta 80 zcmeytxr=K<4zs-@LlQ$iLn%WEgA#)RgDns%F*Id1b}BJgGjIXffk3%T6j_7_P{rhK LX4%bc%tedesbz~@GC}zk3 S>q&&Dn>>+Oc5@H&Bt`(W)DOr2 diff --git a/Settings/InAppSettings.bundle/zh_TW.lproj/Root.strings b/Settings/InAppSettings.bundle/zh_TW.lproj/Root.strings index d1219411f3aefd5f4b1eaf831d200075fab649f6..30046b6463090b70c6864ed16d68ab34bd4c0813 100644 GIT binary patch delta 12 TcmeytwSj9x4fEzB%v%@%BufPw delta 86 zcmdnM^@D3e4YR8wLlQ$iLn%WEgA#)RgDns%F(8XsGjIV#0)Z+rQPdzrfGQ@>W|rMN Ijd>O$0Mup>6aWAK From e71afc56f8b3e8ca03cd7cc6d9e95b1dd0acc954 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 14:45:36 +0100 Subject: [PATCH 21/22] misc: fix some error logs and broken UI glitchs --- Classes/Base.lproj/CallIncomingView.xib | 28 ++++++++++++------------ Classes/Base.lproj/CallOutgoingView.xib | 28 ++++++++++++------------ Classes/Base.lproj/CallView.xib | 4 ++-- Classes/Base.lproj/DialerView.xib | 4 ++-- Classes/Base.lproj/DialerView~ipad.xib | 16 +++++++------- Classes/Base.lproj/SideMenuView.xib | 15 +++---------- Classes/Base.lproj/SideMenuView~ipad.xib | 13 ++--------- Classes/CallOutgoingView.m | 4 ---- Classes/DialerView.m | 8 +++++++ Classes/LinphoneCoreSettingsStore.m | 4 ++-- Classes/LinphoneManager.m | 7 +++--- Classes/PhoneMainView.m | 11 ++-------- 12 files changed, 60 insertions(+), 82 deletions(-) diff --git a/Classes/Base.lproj/CallIncomingView.xib b/Classes/Base.lproj/CallIncomingView.xib index 396c20878..6651bf888 100644 --- a/Classes/Base.lproj/CallIncomingView.xib +++ b/Classes/Base.lproj/CallIncomingView.xib @@ -34,13 +34,6 @@ - + - + diff --git a/Classes/Base.lproj/CallOutgoingView.xib b/Classes/Base.lproj/CallOutgoingView.xib index 12030996d..6d3ac0234 100644 --- a/Classes/Base.lproj/CallOutgoingView.xib +++ b/Classes/Base.lproj/CallOutgoingView.xib @@ -177,13 +177,6 @@ - + @@ -224,13 +224,6 @@ - + diff --git a/Classes/Base.lproj/CallView.xib b/Classes/Base.lproj/CallView.xib index 12237d2f5..8eda3cad7 100644 --- a/Classes/Base.lproj/CallView.xib +++ b/Classes/Base.lproj/CallView.xib @@ -716,8 +716,8 @@ - - + + diff --git a/Classes/Base.lproj/DialerView.xib b/Classes/Base.lproj/DialerView.xib index 3f30ab4d2..6cceee355 100644 --- a/Classes/Base.lproj/DialerView.xib +++ b/Classes/Base.lproj/DialerView.xib @@ -47,7 +47,7 @@ - + @@ -55,7 +55,7 @@ - + diff --git a/Classes/Base.lproj/DialerView~ipad.xib b/Classes/Base.lproj/DialerView~ipad.xib index af249e670..1b8acb03f 100644 --- a/Classes/Base.lproj/DialerView~ipad.xib +++ b/Classes/Base.lproj/DialerView~ipad.xib @@ -1,5 +1,5 @@ - + @@ -63,8 +63,8 @@ - - + + @@ -72,7 +72,7 @@ - + @@ -389,8 +389,8 @@ - - + + @@ -398,7 +398,7 @@ - + @@ -709,7 +709,7 @@ - + diff --git a/Classes/Base.lproj/SideMenuView.xib b/Classes/Base.lproj/SideMenuView.xib index 50397d262..9e99f1e38 100644 --- a/Classes/Base.lproj/SideMenuView.xib +++ b/Classes/Base.lproj/SideMenuView.xib @@ -1,8 +1,8 @@ - + - + @@ -31,10 +31,9 @@ -