From ea272d6bdff932efe3d4373384c95cd9f6454ac6 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 8 Apr 2016 11:23:51 +0200 Subject: [PATCH] tunnel: remove deprecated API calls --- Classes/LinphoneCoreSettingsStore.m | 13 ++++--- Classes/LinphoneManager.h | 9 ----- Classes/LinphoneManager.m | 40 ---------------------- Settings/InAppSettings.bundle/Tunnel.plist | 2 -- submodules/linphone | 2 +- 5 files changed, 7 insertions(+), 59 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index ed6232b32..90a385030 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -21,6 +21,7 @@ #import "Utils.h" #include "linphone/lpconfig.h" +#include "linphone/linphone_tunnel.h" @implementation LinphoneCoreSettingsStore @@ -758,7 +759,7 @@ NSString *lTunnelPrefAddress = [self stringForKey:@"tunnel_address_preference"]; int lTunnelPrefPort = [self integerForKey:@"tunnel_port_preference"]; LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); - TunnelMode mode = tunnel_off; + LinphoneTunnelMode mode = LinphoneTunnelModeDisable; int lTunnelPort = 443; if (lTunnelPrefPort) { lTunnelPort = lTunnelPrefPort; @@ -772,20 +773,18 @@ linphone_tunnel_add_server(tunnel, ltc); if ([lTunnelPrefMode isEqualToString:@"off"]) { - mode = tunnel_off; + mode = LinphoneTunnelModeDisable; } else if ([lTunnelPrefMode isEqualToString:@"on"]) { - mode = tunnel_on; - } else if ([lTunnelPrefMode isEqualToString:@"wwan"]) { - mode = tunnel_wwan; + mode = LinphoneTunnelModeEnable; } else if ([lTunnelPrefMode isEqualToString:@"auto"]) { - mode = tunnel_auto; + mode = LinphoneTunnelModeAuto; } else { LOGE(@"Unexpected tunnel mode [%s]", [lTunnelPrefMode UTF8String]); } } [lm lpConfigSetString:lTunnelPrefMode forKey:@"tunnel_mode_preference"]; - [LinphoneManager.instance setTunnelMode:mode]; + linphone_tunnel_set_mode(tunnel, mode); } } diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index fa9dac6c2..013001e63 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -33,7 +33,6 @@ #import "InAppProductsManager.h" #include "linphone/linphonecore.h" -#include "linphone/linphone_tunnel.h" extern NSString *const LINPHONERC_APPLICATION_KEY; @@ -64,13 +63,6 @@ typedef enum _NetworkType { network_wifi } NetworkType; -typedef enum _TunnelMode { - tunnel_off = 0, - tunnel_on, - tunnel_wwan, - tunnel_auto -} TunnelMode; - typedef enum _Connectivity { wifi, wwan, @@ -208,7 +200,6 @@ typedef struct _LinphoneManagerSounds { @property (nonatomic, assign) BOOL bluetoothAvailable; @property (nonatomic, assign) BOOL bluetoothEnabled; @property (readonly) ALAssetsLibrary *photoLibrary; -@property (nonatomic, assign) TunnelMode tunnelMode; @property (readonly) NSString* contactSipField; @property (readonly,copy) NSString* contactFilter; @property (copy) void (^silentPushCompletion)(UIBackgroundFetchResult); diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 37d67e471..3a4af019d 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -248,7 +248,6 @@ struct codec_name_pref_table codec_pref_table[] = {{"speex", 8000, "speex_8k_pre _database = NULL; _speakerEnabled = FALSE; _bluetoothEnabled = FALSE; - _tunnelMode = FALSE; _fileTransferDelegates = [[NSMutableArray alloc] init]; @@ -1210,7 +1209,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach lm.connectivity = none; [LinphoneManager kickOffNetworkConnection]; } else { - LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); Connectivity newConnectivity; BOOL isWifiOnly = [lm lpConfigBoolForKey:@"wifi_only_preference" withDefault:FALSE]; if (!ctx || ctx->testWWan) @@ -1229,8 +1227,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } if (lm.connectivity != newConnectivity) { - if (tunnel) - linphone_tunnel_reconnect(tunnel); // connectivity has changed linphone_core_set_network_reachable(theLinphoneCore, false); if (newConnectivity == wwan && proxy && isWifiOnly) { @@ -1241,17 +1237,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach LOGI(@"Network connectivity changed to type [%s]", (newConnectivity == wifi ? "wifi" : "wwan")); } lm.connectivity = newConnectivity; - switch (lm.tunnelMode) { - case tunnel_wwan: - linphone_tunnel_enable(tunnel, lm.connectivity == wwan); - break; - case tunnel_auto: - linphone_tunnel_auto_detect(tunnel); - break; - default: - // nothing to do - break; - } } if (ctx && ctx->networkStateChanged) { (*ctx->networkStateChanged)(lm.connectivity); @@ -2343,31 +2328,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { return filter; } -#pragma Tunnel - -- (void)setTunnelMode:(TunnelMode)atunnelMode { - LinphoneTunnel *tunnel = linphone_core_get_tunnel(theLinphoneCore); - _tunnelMode = atunnelMode; - switch (_tunnelMode) { - case tunnel_off: - linphone_tunnel_enable(tunnel, false); - break; - case tunnel_on: - linphone_tunnel_enable(tunnel, true); - break; - case tunnel_wwan: - if (connectivity != wwan) { - linphone_tunnel_enable(tunnel, false); - } else { - linphone_tunnel_enable(tunnel, true); - } - break; - case tunnel_auto: - linphone_tunnel_auto_detect(tunnel); - break; - } -} - #pragma mark - InApp Purchase events - (void)inappReady:(NSNotification *)notif { diff --git a/Settings/InAppSettings.bundle/Tunnel.plist b/Settings/InAppSettings.bundle/Tunnel.plist index e118b3a85..aee4e8bec 100644 --- a/Settings/InAppSettings.bundle/Tunnel.plist +++ b/Settings/InAppSettings.bundle/Tunnel.plist @@ -11,7 +11,6 @@ Off On - WWAN Auto Key @@ -24,7 +23,6 @@ off on - wwan auto diff --git a/submodules/linphone b/submodules/linphone index fa75613e8..88e593e94 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit fa75613e8e8a042c78b76972ca14398bc82549cf +Subproject commit 88e593e944cafecfc63ddbff23038fff96325ba7