diff --git a/Classes/DialerView.m b/Classes/DialerView.m index 766085646..a22ea7415 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -192,17 +192,27 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)coreUpdateEvent:(NSNotification *)notif { - if (IPAD) { - 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]; - [_videoCameraSwitch setHidden:FALSE]; - } else { - linphone_core_set_native_preview_window_id(LC, NULL); - [_backgroundView setHidden:TRUE]; - [_videoCameraSwitch setHidden:TRUE]; + @try { + if (IPAD) { + 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]; + [_videoCameraSwitch setHidden:FALSE]; + } else { + linphone_core_set_native_preview_window_id(LC, NULL); + [_backgroundView setHidden:TRUE]; + [_videoCameraSwitch setHidden:TRUE]; + } } } + @catch (NSException *exception) { + if ([exception.name isEqualToString:@"LinphoneCoreException"]) { + LOGE(@"Core already destroyed"); + return; + } + LOGE(@"Uncaught exception : %@", exception.description); + abort(); + } } #pragma mark - Debug Functions diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index b3360caee..d33dbc4d7 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -97,7 +97,17 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - Event Functions - (void)coreUpdateEvent:(NSNotification *)notif { - [self update]; + @try { + [self update]; + } + @catch (NSException *exception) { + if ([exception.name isEqualToString:@"LinphoneCoreException"]) { + LOGE(@"Core already destroyed"); + return; + } + LOGE(@"Uncaught exception : %@", exception.description); + abort(); + } } - (void) deviceOrientationDidChange:(NSNotification*) notif { diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index 09cf99016..8bb004fe5 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -81,8 +81,18 @@ #pragma mark - Event Functions - (void)coreUpdateEvent:(NSNotification *)notif { - // Invalid all pointers - [self loadData]; + @try { + // Invalid all pointers + [self loadData]; + } + @catch (NSException *exception) { + if ([exception.name isEqualToString:@"LinphoneCoreException"]) { + LOGE(@"Core already destroyed"); + return; + } + LOGE(@"Uncaught exception : %@", exception.description); + abort(); + } } #pragma mark - Property Functions diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 2b15f87e8..afafdb147 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -814,6 +814,8 @@ didInvalidatePushTokenForType:(NSString *)type { } #pragma mark - NSUser notifications +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-prototypes" - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier @@ -894,7 +896,7 @@ didInvalidatePushTokenForType:(NSString *)type { } completionHandler(); } - +#pragma clang diagnostic pop #pragma deploymate pop #pragma mark - Remote configuration Functions (URL Handler) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index e08f76863..2debfe0a2 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -36,6 +36,7 @@ #import "Utils/AudioHelper.h" #import "Utils/FileTransferDelegate.h" +#include "linphone/factory.h" #include "linphone/linphonecore_utils.h" #include "linphone/lpconfig.h" #include "mediastreamer2/mscommon.h" @@ -610,7 +611,7 @@ static void linphone_iphone_log_user_warning(struct _LinphoneCore *lc, const cha static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char *message) { NSString *status = [[NSString alloc] initWithCString:message encoding:[NSString defaultCStringEncoding]]; - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) displayStatus:status]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) displayStatus:status]; } #pragma mark - Call State Functions @@ -985,7 +986,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState state, const char *message) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onCall:call StateChanged:state withMessage:message]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onCall:call StateChanged:state withMessage:message]; } #pragma mark - Transfert State Functions @@ -996,7 +997,7 @@ static void linphone_iphone_transfer_state_changed(LinphoneCore *lc, LinphoneCal #pragma mark - Global state change static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onGlobalStateChanged:gstate withMessage:message]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onGlobalStateChanged:gstate withMessage:message]; } - (void)onGlobalStateChanged:(LinphoneGlobalState)state withMessage:(const char *)message { @@ -1022,7 +1023,7 @@ static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGloba static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, LinphoneConfiguringState status, const char *message) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onConfiguringStatusChanged:status withMessage:message]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onConfiguringStatusChanged:status withMessage:message]; } - (void)onConfiguringStatusChanged:(LinphoneConfiguringState)status withMessage:(const char *)message { @@ -1127,15 +1128,17 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onRegister:lc cfg:cfg state:state message:message]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onRegister:lc cfg:cfg state:state message:message]; } #pragma mark - Auth info Function -static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char *realmC, const char *usernameC, - const char *domainC) { +static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method) { // let the wizard handle its own errors if ([PhoneMainView.instance currentView] != AssistantView.compositeViewDescription) { + const char * realmC = linphone_auth_info_get_realm(auth_info); + const char * usernameC = linphone_auth_info_get_username(auth_info); + const char * domainC = linphone_auth_info_get_domain(auth_info); static UIAlertController *alertView = nil; // avoid having multiple popups @@ -1370,7 +1373,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char } static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onMessageReceived:lc room:room message:message]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onMessageReceived:lc room:room message:message]; } static void linphone_iphone_message_received_unable_decrypt(LinphoneCore *lc, LinphoneChatRoom *room, @@ -1465,7 +1468,7 @@ static void linphone_iphone_message_received_unable_decrypt(LinphoneCore *lc, Li static void linphone_iphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onNotifyReceived:lc + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onNotifyReceived:lc event:lev notifyEvent:notified_event content:body]; @@ -1488,7 +1491,7 @@ static void linphone_iphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev static void linphone_iphone_notify_presence_received_for_uri_or_tel(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence_model) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onNotifyPresenceReceivedForUriOrTel:lc + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onNotifyPresenceReceivedForUriOrTel:lc friend:lf uri:uri_or_tel presenceModel:presence_model]; @@ -1496,7 +1499,7 @@ static void linphone_iphone_notify_presence_received_for_uri_or_tel(LinphoneCore static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onCallEncryptionChanged:lc + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onCallEncryptionChanged:lc call:call on:on token:authentication_token]; @@ -1580,7 +1583,7 @@ static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCa } static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) { - [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onMessageComposeReceived:lc forRoom:room]; + [(__bridge LinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onMessageComposeReceived:lc forRoom:room]; } #pragma mark - Network Functions @@ -1834,23 +1837,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } } -#pragma mark - VTable - -static LinphoneCoreVTable linphonec_vtable = { - .call_state_changed = (LinphoneCoreCallStateChangedCb)linphone_iphone_call_state, - .registration_state_changed = linphone_iphone_registration_state, - .notify_presence_received_for_uri_or_tel = linphone_iphone_notify_presence_received_for_uri_or_tel, - .auth_info_requested = linphone_iphone_popup_password_request, - .message_received = linphone_iphone_message_received, - .message_received_unable_decrypt = linphone_iphone_message_received_unable_decrypt, - .transfer_state_changed = linphone_iphone_transfer_state_changed, - .is_composing_received = linphone_iphone_is_composing_received, - .configuring_status = linphone_iphone_configuring_status_changed, - .global_state_changed = linphone_iphone_global_state_changed, - .notify_received = linphone_iphone_notify_received, - .call_encryption_changed = linphone_iphone_call_encryption_changed, -}; - #pragma mark - // scheduling loop @@ -2082,7 +2068,26 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat [self lpConfigSetString:[LinphoneManager bundleFile:ringback] forKey:@"remote_ring" inSection:@"sound"]; [self lpConfigSetString:[LinphoneManager bundleFile:hold] forKey:@"hold_music" inSection:@"sound"]; - theLinphoneCore = linphone_core_new_with_config(&linphonec_vtable, _configDb, (__bridge void *)(self)); + LinphoneFactory *factory = linphone_factory_get(); + LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(factory); + linphone_core_cbs_set_call_state_changed(cbs, linphone_iphone_call_state); + linphone_core_cbs_set_registration_state_changed(cbs,linphone_iphone_registration_state); + linphone_core_cbs_set_notify_presence_received_for_uri_or_tel(cbs, linphone_iphone_notify_presence_received_for_uri_or_tel); + linphone_core_cbs_set_authentication_requested(cbs, linphone_iphone_popup_password_request); + linphone_core_cbs_set_message_received(cbs, linphone_iphone_message_received); + linphone_core_cbs_set_message_received_unable_decrypt(cbs, linphone_iphone_message_received_unable_decrypt); + linphone_core_cbs_set_transfer_state_changed(cbs, linphone_iphone_transfer_state_changed); + linphone_core_cbs_set_is_composing_received(cbs, linphone_iphone_is_composing_received); + linphone_core_cbs_set_configuring_status(cbs, linphone_iphone_configuring_status_changed); + linphone_core_cbs_set_global_state_changed(cbs, linphone_iphone_global_state_changed); + linphone_core_cbs_set_notify_received(cbs, linphone_iphone_notify_received); + linphone_core_cbs_set_call_encryption_changed(cbs, linphone_iphone_call_encryption_changed); + linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self)); + + theLinphoneCore = linphone_factory_create_core_with_config(factory, cbs, _configDb); + // Let the core handle cbs + linphone_core_cbs_unref(cbs); + LOGI(@"Create linphonecore %p", theLinphoneCore); // Load plugins if available in the linphone SDK - otherwise these calls will do nothing diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m index 0441d51b5..791d46f92 100644 --- a/Classes/Utils/Log.m +++ b/Classes/Utils/Log.m @@ -61,7 +61,7 @@ stderrInUse = YES; } linphone_core_set_log_collection_path([self cacheDirectory].UTF8String); - linphone_core_enable_logs_with_cb(linphone_iphone_log_handler); + linphone_core_set_log_handler(linphone_iphone_log_handler); linphone_core_enable_log_collection(enabled); if (level == 0) { linphone_core_set_log_level(ORTP_FATAL); diff --git a/Resources/Images.xcassets/AppIcon.appiconset/Contents.json b/Resources/Images.xcassets/AppIcon.appiconset/Contents.json index 8a8659e60..9a8a814a4 100644 --- a/Resources/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Resources/Images.xcassets/AppIcon.appiconset/Contents.json @@ -129,8 +129,9 @@ "scale" : "2x" }, { - "idiom" : "ios-marketing", "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "linphone_icon_1024.png", "scale" : "1x" } ], diff --git a/Resources/Images.xcassets/AppIcon.appiconset/linphone_icon_1024.png b/Resources/Images.xcassets/AppIcon.appiconset/linphone_icon_1024.png new file mode 100644 index 000000000..d3c00f9f6 Binary files /dev/null and b/Resources/Images.xcassets/AppIcon.appiconset/linphone_icon_1024.png differ diff --git a/TestsUI/LinphoneTestCase.m b/TestsUI/LinphoneTestCase.m index 667e14afc..ac2bb896e 100644 --- a/TestsUI/LinphoneTestCase.m +++ b/TestsUI/LinphoneTestCase.m @@ -128,7 +128,7 @@ linphone_address_set_transport(testAddr, LinphoneTransportTcp); linphone_address_set_port(testAddr, 0); - LinphoneProxyConfig *testProxy = linphone_proxy_config_new(); + LinphoneProxyConfig *testProxy = linphone_core_create_proxy_config(LC); linphone_proxy_config_set_identity_address(testProxy, testAddr); linphone_proxy_config_set_server_addr(testProxy, [self accountProxyRoute].UTF8String); linphone_proxy_config_set_route(testProxy, [self accountProxyRoute].UTF8String); @@ -145,7 +145,7 @@ [[LinphoneManager instance] configurePushTokenForProxyConfig:testProxy]; linphone_proxy_config_unref(testProxy); - linphone_auth_info_destroy(testAuth); + linphone_auth_info_unref(testAuth); linphone_address_unref(testAddr); linphone_core_set_file_transfer_server(lc, "https://www.linphone.org:444/lft.php"); diff --git a/linphone-Info.plist b/linphone-Info.plist index ea003511e..630b626a0 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -53,7 +53,7 @@ CFBundleVersion - 2 + 3 ITSAppUsesNonExemptEncryption ITSEncryptionExportComplianceCode diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 204a66318..9f6f0c305 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -3131,7 +3131,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0820; + LastUpgradeCheck = 0900; TargetAttributes = { 1D6058900D05DD3D006BFB54 = { DevelopmentTeam = Z2V957B3D6; @@ -4570,12 +4570,18 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -4667,12 +4673,18 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -4764,12 +4776,18 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -4861,12 +4879,18 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme b/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme index 83ffc3fa0..2f5987fbe 100644 --- a/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme +++ b/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme @@ -1,6 +1,6 @@