From 2d879e19cceec0611a20619e07c5be46505cdc58 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 9 Sep 2014 14:23:09 +0200 Subject: [PATCH 01/51] Add possibility to change adaptive rate algorithm in audio settings --- Classes/LinphoneCoreSettingsStore.m | 754 +++++++++++----------- Settings/InAppSettings.bundle/Audio.plist | 20 + submodules/belle-sip | 2 +- submodules/build/Makefile | 20 +- submodules/linphone | 2 +- 5 files changed, 411 insertions(+), 387 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 16d58ba71..e8a66aec9 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "LinphoneCoreSettingsStore.h" @@ -43,14 +43,14 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); - (void)transformKeysToLinphoneCore { //LinphoneCore *lc=[LinphoneManager getLc]; - + } - (void)setString:(const char*)value forKey:(NSString*)key { id obj=Nil; if (value) obj=[[NSString alloc] initWithCString:value encoding:[NSString defaultCStringEncoding] ]; [self setObject:obj forKey:key]; - [obj release]; + [obj release]; } - (NSString*)stringForKey:(NSString*) key { @@ -64,7 +64,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); PayloadType *pt=(PayloadType*)elem->data; NSString *pref=[LinphoneManager getPreferenceForCodec:pt->mime_type withRate:pt->clock_rate]; if (pref){ - bool_t value = linphone_core_payload_type_enabled(lc,pt); + bool_t value = linphone_core_payload_type_enabled(lc,pt); [self setBool:value forKey: pref]; }else{ [LinphoneLogger logc:LinphoneLoggerWarning format:"Codec %s/%i supported by core is not shown in iOS app config view.", @@ -76,7 +76,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); - (void)transformLinphoneCoreToKeys { LinphoneCore *lc=[LinphoneManager getLc]; LinphoneProxyConfig *cfg=NULL; - LpConfig* conf = linphone_core_get_config(lc); + LpConfig* conf = linphone_core_get_config(lc); linphone_core_get_default_proxy(lc,&cfg); if (cfg){ const char *identity=linphone_proxy_config_get_identity(cfg); @@ -85,10 +85,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); const char *proxy=linphone_proxy_config_get_addr(cfg); LinphoneAddress *proxy_addr=linphone_address_new(proxy); int port=linphone_address_get_port(proxy_addr); - + [self setString: linphone_address_get_username(addr) forKey:@"username_preference"]; [self setString: linphone_address_get_domain(addr) forKey:@"domain_preference"]; - [self setInteger: linphone_proxy_config_get_expires(cfg) forKey:@"expire_preference"]; + [self setInteger: linphone_proxy_config_get_expires(cfg) forKey:@"expire_preference"]; [self setString: linphone_proxy_config_get_dial_prefix(cfg) forKey:@"prefix_preference"]; if (strcmp(linphone_address_get_domain(addr),linphone_address_get_domain(proxy_addr))!=0 || port>0){ char tmp[256]={0}; @@ -98,74 +98,74 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setString:tmp forKey:@"proxy_preference"]; } - const char* tname = "udp"; - switch (linphone_address_get_transport(proxy_addr)) { - case LinphoneTransportTcp: tname = "tcp"; break; - case LinphoneTransportTls: tname = "tls"; break; - default: break; - } - [self setString:tname forKey:@"transport_preference"]; + const char* tname = "udp"; + switch (linphone_address_get_transport(proxy_addr)) { + case LinphoneTransportTcp: tname = "tcp"; break; + case LinphoneTransportTls: tname = "tls"; break; + default: break; + } + [self setString:tname forKey:@"transport_preference"]; linphone_address_destroy(addr); linphone_address_destroy(proxy_addr); [self setBool: (linphone_proxy_config_get_route(cfg)!=NULL) forKey:@"outbound_proxy_preference"]; [self setBool:linphone_proxy_config_get_dial_escape_plus(cfg) forKey:@"substitute_+_by_00_preference"]; - [self setBool:linphone_proxy_config_avpf_enabled(cfg) forKey:@"avpf_preference"]; - + [self setBool:linphone_proxy_config_avpf_enabled(cfg) forKey:@"avpf_preference"]; + } } else { [self setInteger: lp_config_get_int(conf,"default_values","reg_expires", 600) forKey:@"expire_preference"]; - [self setObject:@"" forKey:@"username_preference"]; - [self setObject:@"" forKey:@"domain_preference"]; - [self setObject:@"" forKey:@"proxy_preference"]; - [self setObject:@"" forKey:@"password_preference"]; - [self setBool:FALSE forKey:@"outbound_proxy_preference"]; - [self setString:"udp" forKey:@"transport_preference"]; - [self setBool:FALSE forKey:@"avpf_preference"]; + [self setObject:@"" forKey:@"username_preference"]; + [self setObject:@"" forKey:@"domain_preference"]; + [self setObject:@"" forKey:@"proxy_preference"]; + [self setObject:@"" forKey:@"password_preference"]; + [self setBool:FALSE forKey:@"outbound_proxy_preference"]; + [self setString:"udp" forKey:@"transport_preference"]; + [self setBool:FALSE forKey:@"avpf_preference"]; } - [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "pushnotification_preference", 0) forKey:@"pushnotification_preference"]; - { - LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); - if(parsed != NULL) { - [self setString: linphone_address_get_display_name(parsed) forKey:@"primary_displayname_preference"]; - [self setString: linphone_address_get_username(parsed) forKey:@"primary_username_preference"]; - } - linphone_address_destroy(parsed); - } - { - { - int minPort, maxPort; - linphone_core_get_audio_port_range(lc, &minPort, &maxPort); - if(minPort != maxPort) - [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"audio_port_preference"]; - else - [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"audio_port_preference"]; - } - { - int minPort, maxPort; - linphone_core_get_video_port_range(lc, &minPort, &maxPort); - if(minPort != maxPort) - [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"video_port_preference"]; - else - [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"video_port_preference"]; - } - } - { - [self setInteger: linphone_core_get_upload_bandwidth(lc) forKey:@"upload_bandwidth_preference"]; - [self setInteger: linphone_core_get_download_bandwidth(lc) forKey:@"download_bandwidth_preference"]; - } - { - [self setFloat:linphone_core_get_playback_gain_db(lc) forKey:@"playback_gain_preference"]; - [self setFloat:linphone_core_get_mic_gain_db(lc) forKey:@"microphone_gain_preference"]; - } + [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "pushnotification_preference", 0) forKey:@"pushnotification_preference"]; { - int port = lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "port_preference", 5060); - [self setInteger:port forKey:@"port_preference"]; - int random_port_preference = lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"random_port_preference", 1); - [self setInteger:random_port_preference forKey:@"random_port_preference"]; + LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); + if(parsed != NULL) { + [self setString: linphone_address_get_display_name(parsed) forKey:@"primary_displayname_preference"]; + [self setString: linphone_address_get_username(parsed) forKey:@"primary_username_preference"]; + } + linphone_address_destroy(parsed); + } + { + { + int minPort, maxPort; + linphone_core_get_audio_port_range(lc, &minPort, &maxPort); + if(minPort != maxPort) + [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"audio_port_preference"]; + else + [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"audio_port_preference"]; + } + { + int minPort, maxPort; + linphone_core_get_video_port_range(lc, &minPort, &maxPort); + if(minPort != maxPort) + [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"video_port_preference"]; + else + [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"video_port_preference"]; + } + } + { + [self setInteger: linphone_core_get_upload_bandwidth(lc) forKey:@"upload_bandwidth_preference"]; + [self setInteger: linphone_core_get_download_bandwidth(lc) forKey:@"download_bandwidth_preference"]; + } + { + [self setFloat:linphone_core_get_playback_gain_db(lc) forKey:@"playback_gain_preference"]; + [self setFloat:linphone_core_get_mic_gain_db(lc) forKey:@"microphone_gain_preference"]; + } + { + int port = lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "port_preference", 5060); + [self setInteger:port forKey:@"port_preference"]; + int random_port_preference = lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"random_port_preference", 1); + [self setInteger:random_port_preference forKey:@"random_port_preference"]; } { LinphoneAuthInfo *ai; @@ -173,25 +173,26 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); if (elem && (ai=(LinphoneAuthInfo*)elem->data)){ [self setString: linphone_auth_info_get_passwd(ai) forKey:@"password_preference"]; [self setString: linphone_auth_info_get_ha1(ai) forKey:@"ha1_preference"]; // hidden but useful if provisioned - [self setString:linphone_auth_info_get_userid(ai) forKey:@"userid_preference"]; + [self setString:linphone_auth_info_get_userid(ai) forKey:@"userid_preference"]; } } { [self setString: linphone_core_get_stun_server(lc) forKey:@"stun_preference"]; - [self setBool:linphone_core_get_firewall_policy(lc)==LinphonePolicyUseIce forKey:@"ice_preference"]; + [self setBool:linphone_core_get_firewall_policy(lc)==LinphonePolicyUseIce forKey:@"ice_preference"]; } - + { [self transformCodecsToKeys: linphone_core_get_audio_codecs(lc)]; [self transformCodecsToKeys: linphone_core_get_video_codecs(lc)]; - [self setBool:linphone_core_adaptive_rate_control_enabled(lc) forKey:@"adaptive_rate_control_preference"]; - [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; + [self setBool:linphone_core_adaptive_rate_control_enabled(lc) forKey:@"adaptive_rate_control_preference"]; + [self setString:linphone_core_get_adaptive_rate_algorithm(lc) forKey:@"adaptive_rate_algorithm_preference"]; + [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; } - [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", 0) forKey:@"advanced_account_preference"]; + [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", 0) forKey:@"advanced_account_preference"]; - { + { LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc); const char *val; switch(menc){ @@ -201,16 +202,16 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } [self setString:val forKey:@"media_encryption_preference"]; } - [self setString: lp_config_get_string(conf, LINPHONERC_APPLICATION_KEY, "rotation_preference", "auto") forKey:@"rotation_preference"]; + [self setString: lp_config_get_string(conf, LINPHONERC_APPLICATION_KEY, "rotation_preference", "auto") forKey:@"rotation_preference"]; [self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "edge_opt_preference", 0) forKey:@"edge_opt_preference"]; - [self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"]; + [self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"]; [self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "debugenable_preference", 0) forKey:@"debugenable_preference"]; [self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "animations_preference", 1) forKey:@"animations_preference"]; [self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "wifi_only_preference", 0) forKey:@"wifi_only_preference"]; [self setString: lp_config_get_string(conf, LINPHONERC_APPLICATION_KEY, "sharing_server_preference", NULL) forKey:@"sharing_server_preference"]; - [self setBool:lp_config_get_int(conf, "sip", "use_ipv6", 0) forKey:@"use_ipv6"]; + [self setBool:lp_config_get_int(conf, "sip", "use_ipv6", 0) forKey:@"use_ipv6"]; + - [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"start_at_boot_preference",1) forKey:@"start_at_boot_preference"]; [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"backgroundmode_preference",1) forKey:@"backgroundmode_preference"]; [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"autoanswer_notif_preference",1) forKey:@"autoanswer_notif_preference"]; @@ -221,10 +222,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool: linphone_core_video_enabled(lc) forKey:@"enable_video_preference"]; pol=linphone_core_get_video_policy(lc); [self setBool:(pol->automatically_initiate) forKey:@"start_video_preference"]; - [self setBool:(pol->automatically_accept) forKey:@"accept_video_preference"]; - [self setBool:linphone_core_self_view_enabled(lc) forKey:@"self_video_preference"]; + [self setBool:(pol->automatically_accept) forKey:@"accept_video_preference"]; + [self setBool:linphone_core_self_view_enabled(lc) forKey:@"self_video_preference"]; BOOL previewEnabled=lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"preview_preference",1); - [self setBool:previewEnabled forKey:@"preview_preference"]; + [self setBool:previewEnabled forKey:@"preview_preference"]; MSVideoSize vsize = linphone_core_get_preferred_video_size(lc); int index; if ((vsize.width == MS_VIDEO_SIZE_720P_W) && (vsize.height == MS_VIDEO_SIZE_720P_H)) { @@ -236,35 +237,35 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } [self setInteger:index forKey:@"video_preferred_size_preference"]; } - { - [self setBool:linphone_core_get_use_info_for_dtmf(lc) forKey:@"sipinfo_dtmf_preference"]; - [self setBool:linphone_core_get_use_rfc2833_for_dtmf(lc) forKey:@"rfc_dtmf_preference"]; - - [self setInteger:linphone_core_get_inc_timeout(lc) forKey:@"incoming_call_timeout_preference"]; - [self setInteger:linphone_core_get_in_call_timeout(lc) forKey:@"in_call_timeout_preference"]; - } - - // Tunnel - if (linphone_core_tunnel_available()){ - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); - [self setString:lp_config_get_string(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "tunnel_mode_preference", "off") forKey:@"tunnel_mode_preference"]; - const MSList* configs = linphone_tunnel_get_servers(tunnel); - if(configs != NULL) { - LinphoneTunnelConfig *ltc = (LinphoneTunnelConfig *)configs->data; - [self setString:linphone_tunnel_config_get_host(ltc) forKey:@"tunnel_address_preference"]; - [self setInteger:linphone_tunnel_config_get_port(ltc) forKey:@"tunnel_port_preference"]; - } else { - [self setString:"" forKey:@"tunnel_address_preference"]; - [self setInteger:443 forKey:@"tunnel_port_preference"]; - } - } - + { + [self setBool:linphone_core_get_use_info_for_dtmf(lc) forKey:@"sipinfo_dtmf_preference"]; + [self setBool:linphone_core_get_use_rfc2833_for_dtmf(lc) forKey:@"rfc_dtmf_preference"]; + + [self setInteger:linphone_core_get_inc_timeout(lc) forKey:@"incoming_call_timeout_preference"]; + [self setInteger:linphone_core_get_in_call_timeout(lc) forKey:@"in_call_timeout_preference"]; + } + + // Tunnel + if (linphone_core_tunnel_available()){ + LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + [self setString:lp_config_get_string(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "tunnel_mode_preference", "off") forKey:@"tunnel_mode_preference"]; + const MSList* configs = linphone_tunnel_get_servers(tunnel); + if(configs != NULL) { + LinphoneTunnelConfig *ltc = (LinphoneTunnelConfig *)configs->data; + [self setString:linphone_tunnel_config_get_host(ltc) forKey:@"tunnel_address_preference"]; + [self setInteger:linphone_tunnel_config_get_port(ltc) forKey:@"tunnel_port_preference"]; + } else { + [self setString:"" forKey:@"tunnel_address_preference"]; + [self setInteger:443 forKey:@"tunnel_port_preference"]; + } + } + [changedDict release]; changedDict = [[NSMutableDictionary alloc] init]; - - // Post event - NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"]; - [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic]; + + // Post event + NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic]; } - (void)setObject:(id)value forKey:(NSString *)key { @@ -273,7 +274,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } - (id)objectForKey:(NSString*)key { - return [dict valueForKey:key]; + return [dict valueForKey:key]; } - (BOOL)valueChangedForKey:(NSString*)key { @@ -281,70 +282,70 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } - (void)alertAccountError:(NSString*)error { - UIAlertView* alertview = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) - message:error - delegate:nil - cancelButtonTitle:NSLocalizedString(@"OK", nil) - otherButtonTitles: nil]; - [alertview show]; - [alertview release]; + UIAlertView* alertview = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) + message:error + delegate:nil + cancelButtonTitle:NSLocalizedString(@"OK", nil) + otherButtonTitles: nil]; + [alertview show]; + [alertview release]; } - (void)synchronizeAccount { LinphoneCore *lc = [LinphoneManager getLc]; - LpConfig* conf = linphone_core_get_config(lc); + LpConfig* conf = linphone_core_get_config(lc); LinphoneProxyConfig* proxyCfg = NULL; BOOL isEditing = FALSE; - NSString* error = nil; + NSString* error = nil; int port_preference = [self integerForKey:@"port_preference"]; - - BOOL random_port_preference = [self boolForKey:@"random_port_preference"]; - lp_config_set_int(conf, LINPHONERC_APPLICATION_KEY, "random_port_preference", random_port_preference); - if(random_port_preference) { - port_preference = -1; - } + + BOOL random_port_preference = [self boolForKey:@"random_port_preference"]; + lp_config_set_int(conf, LINPHONERC_APPLICATION_KEY, "random_port_preference", random_port_preference); + if(random_port_preference) { + port_preference = -1; + } LCSipTransports transportValue={ port_preference, port_preference, -1, -1 }; - // will also update the sip_*_port section of the config - if (linphone_core_set_sip_transports(lc, &transportValue)) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"]; - } + // will also update the sip_*_port section of the config + if (linphone_core_set_sip_transports(lc, &transportValue)) { + [LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"]; + } - port_preference = linphone_core_get_sip_port(lc); - [self setInteger:port_preference forKey:@"port_preference"]; // Update back preference + port_preference = linphone_core_get_sip_port(lc); + [self setInteger:port_preference forKey:@"port_preference"]; // Update back preference - BOOL enable_ipv6 = [self boolForKey:@"use_ipv6"]; - lp_config_set_int(conf, "sip", "use_ipv6", enable_ipv6); - if( linphone_core_ipv6_enabled(lc) != enable_ipv6){ - [LinphoneLogger logc:LinphoneLoggerDebug format:"%@ IPV6", enable_ipv6?@"ENABLING":@"DISABLING"]; - linphone_core_enable_ipv6(lc, enable_ipv6); - } + BOOL enable_ipv6 = [self boolForKey:@"use_ipv6"]; + lp_config_set_int(conf, "sip", "use_ipv6", enable_ipv6); + if( linphone_core_ipv6_enabled(lc) != enable_ipv6){ + [LinphoneLogger logc:LinphoneLoggerDebug format:"%@ IPV6", enable_ipv6?@"ENABLING":@"DISABLING"]; + linphone_core_enable_ipv6(lc, enable_ipv6); + } //configure sip account - + //mandatory parameters NSString* username = [self stringForKey:@"username_preference"]; - NSString* userID = [self stringForKey:@"userid_preference"]; + NSString* userID = [self stringForKey:@"userid_preference"]; NSString* domain = [self stringForKey:@"domain_preference"]; - NSString* transport = [self stringForKey:@"transport_preference"]; - NSString* accountHa1 = [self stringForKey:@"ha1_preference"]; + NSString* transport = [self stringForKey:@"transport_preference"]; + NSString* accountHa1 = [self stringForKey:@"ha1_preference"]; NSString* accountPassword = [self stringForKey:@"password_preference"]; - bool isOutboundProxy = [self boolForKey:@"outbound_proxy_preference"]; - BOOL use_avpf = [self boolForKey:@"avpf_preference"]; + bool isOutboundProxy = [self boolForKey:@"outbound_proxy_preference"]; + BOOL use_avpf = [self boolForKey:@"avpf_preference"]; if (username && [username length] >0 && domain && [domain length]>0) { - int expire = [self integerForKey:@"expire_preference"]; - BOOL isWifiOnly = [self boolForKey:@"wifi_only_preference"]; - BOOL pushnotification = [self boolForKey:@"pushnotification_preference"]; - NSString* prefix = [self stringForKey:@"prefix_preference"]; - NSString* proxyAddress = [self stringForKey:@"proxy_preference"]; + int expire = [self integerForKey:@"expire_preference"]; + BOOL isWifiOnly = [self boolForKey:@"wifi_only_preference"]; + BOOL pushnotification = [self boolForKey:@"pushnotification_preference"]; + NSString* prefix = [self stringForKey:@"prefix_preference"]; + NSString* proxyAddress = [self stringForKey:@"proxy_preference"]; - LinphoneAuthInfo *info = NULL; - const char* route = NULL; + LinphoneAuthInfo *info = NULL; + const char* route = NULL; if( isWifiOnly && [LinphoneManager instance].connectivity == wwan ) expire = 0; @@ -353,19 +354,19 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } else { proxyAddress = [NSString stringWithFormat:@"sip:%@",proxyAddress] ; } - + char* proxy = ms_strdup([proxyAddress cStringUsingEncoding:[NSString defaultCStringEncoding]]); - LinphoneAddress* proxy_addr = linphone_address_new(proxy); + LinphoneAddress* proxy_addr = linphone_address_new(proxy); - if( proxy_addr ){ - LinphoneTransportType type = LinphoneTransportUdp; - if ( [transport isEqualToString:@"tcp"] ) type = LinphoneTransportTcp; - else if ( [transport isEqualToString:@"tls"] ) type = LinphoneTransportTls; + if( proxy_addr ){ + LinphoneTransportType type = LinphoneTransportUdp; + if ( [transport isEqualToString:@"tcp"] ) type = LinphoneTransportTcp; + else if ( [transport isEqualToString:@"tls"] ) type = LinphoneTransportTls; - linphone_address_set_transport(proxy_addr, type); - ms_free(proxy); - proxy = linphone_address_as_string_uri_only(proxy_addr); - } + linphone_address_set_transport(proxy_addr, type); + ms_free(proxy); + proxy = linphone_address_as_string_uri_only(proxy_addr); + } // use proxy as route if outbound_proxy is enabled route = isOutboundProxy? proxy : NULL; @@ -391,7 +392,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); if( linphone_proxy_config_set_identity(proxyCfg, identity) == -1 ) { error = NSLocalizedString(@"Invalid username or domain",nil); goto bad_proxy;} - if( linphone_proxy_config_set_server_addr(proxyCfg, proxy) == -1 ) { error = NSLocalizedString(@"Invalid proxy address", nil); goto bad_proxy; } + if( linphone_proxy_config_set_server_addr(proxyCfg, proxy) == -1 ) { error = NSLocalizedString(@"Invalid proxy address", nil); goto bad_proxy; } if( linphone_proxy_config_set_route(proxyCfg, route) == -1 ) { error = NSLocalizedString(@"Invalid route", nil); goto bad_proxy; } if ([prefix length]>0) { @@ -403,26 +404,26 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); linphone_proxy_config_set_dial_escape_plus(proxyCfg,substitute_plus_by_00); } - lp_config_set_int(conf, LINPHONERC_APPLICATION_KEY, "pushnotification_preference", pushnotification); - if( pushnotification ) [[LinphoneManager instance] addPushTokenToProxyConfig:proxyCfg]; + lp_config_set_int(conf, LINPHONERC_APPLICATION_KEY, "pushnotification_preference", pushnotification); + if( pushnotification ) [[LinphoneManager instance] addPushTokenToProxyConfig:proxyCfg]; - linphone_proxy_config_enable_register(proxyCfg, true); - linphone_proxy_config_enable_avpf(proxyCfg, use_avpf); + linphone_proxy_config_enable_register(proxyCfg, true); + linphone_proxy_config_enable_avpf(proxyCfg, use_avpf); linphone_proxy_config_set_expires(proxyCfg, expire); // setup auth info LinphoneAddress *from = linphone_address_new(identity); if (from != 0){ - const char* userid_str = (userID != nil)? [userID UTF8String] : NULL; + const char* userid_str = (userID != nil)? [userID UTF8String] : NULL; info=linphone_auth_info_new(linphone_address_get_username(from),userid_str,password,ha1,NULL,linphone_proxy_config_get_domain(proxyCfg)); - linphone_address_destroy(from); + linphone_address_destroy(from); } - // We reached here without hitting the goto: the new settings are correct, so replace the previous ones. + // We reached here without hitting the goto: the new settings are correct, so replace the previous ones. // add auth info linphone_core_clear_all_auth_info(lc); - if( info ) { linphone_core_add_auth_info(lc,info); } + if( info ) { linphone_core_add_auth_info(lc,info); } // setup new proxycfg if( isEditing ){ @@ -433,116 +434,119 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); linphone_core_set_default_proxy(lc,proxyCfg); } - bad_proxy: + bad_proxy: if( linphoneAddress) - linphone_address_destroy(linphoneAddress); - if( proxy) - ms_free(proxy); - if( info ) - linphone_auth_info_destroy(info); + linphone_address_destroy(linphoneAddress); + if( proxy) + ms_free(proxy); + if( info ) + linphone_auth_info_destroy(info); // in case of error, show an alert to the user - if( error != nil ){ + if( error != nil ){ if( isEditing ) linphone_proxy_config_done(proxyCfg); else linphone_proxy_config_destroy(proxyCfg); - [self alertAccountError:error]; - } + [self alertAccountError:error]; + } } - [[[LinphoneManager instance] fastAddressBook] reload]; + [[[LinphoneManager instance] fastAddressBook] reload]; } + (int)validPort:(int)port { - if(port < 0) { - return 0; - } - if(port > 65535) { - return 65535; - } - return port; + if(port < 0) { + return 0; + } + if(port > 65535) { + return 65535; + } + return port; } + (BOOL)parsePortRange:(NSString*)text minPort:(int*)minPort maxPort:(int*)maxPort { - NSError* error = nil; - *minPort = -1; - *maxPort = -1; - NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:@"([0-9]+)(([^0-9]+)([0-9]+))?" options:0 error:&error]; - if(error != NULL) - return FALSE; - NSArray* matches = [regex matchesInString:text options:0 range:NSMakeRange(0, [text length])]; - if([matches count] == 1) { - NSTextCheckingResult *match = [matches objectAtIndex:0]; - bool range = [match rangeAtIndex:2].length > 0; - if(!range) { - NSRange rangeMinPort = [match rangeAtIndex:1]; - *minPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMinPort] integerValue]]; - *maxPort = *minPort; - return TRUE; - } else { - NSRange rangeMinPort = [match rangeAtIndex:1]; - *minPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMinPort] integerValue]]; - NSRange rangeMaxPort = [match rangeAtIndex:4]; - *maxPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMaxPort] integerValue]]; - if(*minPort > *maxPort) { - *minPort = *maxPort; - } - return TRUE; - } - } - return FALSE; + NSError* error = nil; + *minPort = -1; + *maxPort = -1; + NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:@"([0-9]+)(([^0-9]+)([0-9]+))?" options:0 error:&error]; + if(error != NULL) + return FALSE; + NSArray* matches = [regex matchesInString:text options:0 range:NSMakeRange(0, [text length])]; + if([matches count] == 1) { + NSTextCheckingResult *match = [matches objectAtIndex:0]; + bool range = [match rangeAtIndex:2].length > 0; + if(!range) { + NSRange rangeMinPort = [match rangeAtIndex:1]; + *minPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMinPort] integerValue]]; + *maxPort = *minPort; + return TRUE; + } else { + NSRange rangeMinPort = [match rangeAtIndex:1]; + *minPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMinPort] integerValue]]; + NSRange rangeMaxPort = [match rangeAtIndex:4]; + *maxPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMaxPort] integerValue]]; + if(*minPort > *maxPort) { + *minPort = *maxPort; + } + return TRUE; + } + } + return FALSE; } - (BOOL)synchronize { if (![LinphoneManager isLcReady]) return YES; LinphoneCore *lc=[LinphoneManager getLc]; - + BOOL account_changed; - - account_changed=[self valueChangedForKey:@"username_preference"] - || [self valueChangedForKey:@"password_preference"] - || [self valueChangedForKey:@"domain_preference"] - || [self valueChangedForKey:@"expire_preference"] + + account_changed=[self valueChangedForKey:@"username_preference"] + || [self valueChangedForKey:@"password_preference"] + || [self valueChangedForKey:@"domain_preference"] + || [self valueChangedForKey:@"expire_preference"] || [self valueChangedForKey:@"proxy_preference"] || [self valueChangedForKey:@"outbound_proxy_preference"] || [self valueChangedForKey:@"transport_preference"] - || [self valueChangedForKey:@"port_preference"] - || [self valueChangedForKey:@"random_port_preference"] + || [self valueChangedForKey:@"port_preference"] + || [self valueChangedForKey:@"random_port_preference"] || [self valueChangedForKey:@"prefix_preference"] || [self valueChangedForKey:@"substitute_+_by_00_preference"] - || [self valueChangedForKey:@"use_ipv6"] - || [self valueChangedForKey:@"avpf_preference"] - || [self valueChangedForKey:@"pushnotification_preference"]; - + || [self valueChangedForKey:@"use_ipv6"] + || [self valueChangedForKey:@"avpf_preference"] + || [self valueChangedForKey:@"pushnotification_preference"]; + if (account_changed) [self synchronizeAccount]; - + //Configure Codecs - + PayloadType *pt; const MSList *elem; - + for (elem=linphone_core_get_audio_codecs(lc);elem!=NULL;elem=elem->next){ pt=(PayloadType*)elem->data; NSString *pref=[LinphoneManager getPreferenceForCodec:pt->mime_type withRate:pt->clock_rate]; linphone_core_enable_payload_type(lc,pt,[self boolForKey: pref]); } - + for (elem=linphone_core_get_video_codecs(lc);elem!=NULL;elem=elem->next){ pt=(PayloadType*)elem->data; NSString *pref=[LinphoneManager getPreferenceForCodec:pt->mime_type withRate:pt->clock_rate]; linphone_core_enable_payload_type(lc,pt,[self boolForKey: pref]); } - LpConfig *config = linphone_core_get_config(lc); - lp_config_set_int(config, "audio", "codec_bitrate_limit", [self integerForKey:@"audio_codec_bitrate_limit_preference"]); + LpConfig *config = linphone_core_get_config(lc); + lp_config_set_int(config, "audio", "codec_bitrate_limit", [self integerForKey:@"audio_codec_bitrate_limit_preference"]); [[LinphoneManager instance] configureVbrCodecs]; - linphone_core_enable_adaptive_rate_control(lc, [self boolForKey:@"adaptive_rate_control_preference"]); - - linphone_core_set_use_info_for_dtmf(lc, [self boolForKey:@"sipinfo_dtmf_preference"]); - linphone_core_set_use_rfc2833_for_dtmf(lc, [self boolForKey:@"rfc_dtmf_preference"]); - linphone_core_set_inc_timeout(lc, [self integerForKey:@"incoming_call_timeout_preference"]); - linphone_core_set_in_call_timeout(lc, [self integerForKey:@"in_call_timeout_preference"]); - + linphone_core_enable_adaptive_rate_control(lc, [self boolForKey:@"adaptive_rate_control_preference"]); + linphone_core_set_adaptive_rate_algorithm(lc, [ + [self stringForKey:@"adaptive_rate_algorithm_preference"] cStringUsingEncoding:[NSString defaultCStringEncoding] + ]); + + linphone_core_set_use_info_for_dtmf(lc, [self boolForKey:@"sipinfo_dtmf_preference"]); + linphone_core_set_use_rfc2833_for_dtmf(lc, [self boolForKey:@"rfc_dtmf_preference"]); + linphone_core_set_inc_timeout(lc, [self integerForKey:@"incoming_call_timeout_preference"]); + linphone_core_set_in_call_timeout(lc, [self integerForKey:@"in_call_timeout_preference"]); + bool enableVideo = [self boolForKey:@"enable_video_preference"]; linphone_core_enable_video(lc, enableVideo, enableVideo); @@ -552,27 +556,27 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); else if (menc && [menc compare:@"ZRTP"] == NSOrderedSame) linphone_core_set_media_encryption(lc, LinphoneMediaEncryptionZRTP); else - linphone_core_set_media_encryption(lc, LinphoneMediaEncryptionNone); - - NSString* stun_server = [self stringForKey:@"stun_preference"]; - if ([stun_server length] > 0){ - linphone_core_set_stun_server(lc, [stun_server UTF8String]); - BOOL ice_preference = [self boolForKey:@"ice_preference"]; - if(ice_preference) { - linphone_core_set_firewall_policy(lc, LinphonePolicyUseIce); - } else { - linphone_core_set_firewall_policy(lc, LinphonePolicyUseStun); - } - } else { - linphone_core_set_stun_server(lc, NULL); - linphone_core_set_firewall_policy(lc, LinphonePolicyNoFirewall); - } - - LinphoneVideoPolicy policy; - policy.automatically_accept = [self boolForKey:@"accept_video_preference"]; - policy.automatically_initiate = [self boolForKey:@"start_video_preference"]; - linphone_core_set_video_policy(lc, &policy); - linphone_core_enable_self_view(lc, [self boolForKey:@"self_video_preference"]); + linphone_core_set_media_encryption(lc, LinphoneMediaEncryptionNone); + + NSString* stun_server = [self stringForKey:@"stun_preference"]; + if ([stun_server length] > 0){ + linphone_core_set_stun_server(lc, [stun_server UTF8String]); + BOOL ice_preference = [self boolForKey:@"ice_preference"]; + if(ice_preference) { + linphone_core_set_firewall_policy(lc, LinphonePolicyUseIce); + } else { + linphone_core_set_firewall_policy(lc, LinphonePolicyUseStun); + } + } else { + linphone_core_set_stun_server(lc, NULL); + linphone_core_set_firewall_policy(lc, LinphonePolicyNoFirewall); + } + + LinphoneVideoPolicy policy; + policy.automatically_accept = [self boolForKey:@"accept_video_preference"]; + policy.automatically_initiate = [self boolForKey:@"start_video_preference"]; + linphone_core_set_video_policy(lc, &policy); + linphone_core_enable_self_view(lc, [self boolForKey:@"self_video_preference"]); BOOL preview_preference=[self boolForKey:@"preview_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "preview_preference", preview_preference); MSVideoSize vsize; @@ -580,13 +584,13 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); switch ([self integerForKey:@"video_preferred_size_preference"]) { case 0: MS_VIDEO_SIZE_ASSIGN(vsize, 720P); - // 128 = margin for audio, the BW includes both video and audio + // 128 = margin for audio, the BW includes both video and audio bw = 1024 + 128; - break; + break; case 1: MS_VIDEO_SIZE_ASSIGN(vsize, VGA); - // no margin for VGA or QVGA, because video encoders can encode the - // target resulution in less than the asked bandwidth + // no margin for VGA or QVGA, because video encoders can encode the + // target resulution in less than the asked bandwidth bw = 512; break; case 2: @@ -598,47 +602,47 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); linphone_core_set_preferred_video_size(lc, vsize); [self setInteger: bw forKey:@"upload_bandwidth_preference"]; [self setInteger: bw forKey:@"download_bandwidth_preference"]; - - // Primary contact - NSString* displayname = [self stringForKey:@"primary_displayname_preference"]; - NSString* username = [self stringForKey:@"primary_username_preference"]; - LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); - if(parsed != NULL) { - linphone_address_set_display_name(parsed,[displayname cStringUsingEncoding:[NSString defaultCStringEncoding]]); - linphone_address_set_username(parsed,[username cStringUsingEncoding:[NSString defaultCStringEncoding]]); - char *contact = linphone_address_as_string(parsed); - linphone_core_set_primary_contact(lc, contact); - ms_free(contact); - linphone_address_destroy(parsed); - } - - // Audio & Video Port - { - NSString *audio_port_preference = [self stringForKey:@"audio_port_preference"]; - int minPort, maxPort; - [LinphoneCoreSettingsStore parsePortRange:audio_port_preference minPort:&minPort maxPort:&maxPort]; - linphone_core_set_audio_port_range(lc, minPort, maxPort); - } - { - NSString *video_port_preference = [self stringForKey:@"video_port_preference"]; - int minPort, maxPort; - [LinphoneCoreSettingsStore parsePortRange:video_port_preference minPort:&minPort maxPort:&maxPort]; - linphone_core_set_video_port_range(lc, minPort, maxPort); - } - - int upload_bandwidth = [self integerForKey:@"upload_bandwidth_preference"]; - linphone_core_set_upload_bandwidth(lc, upload_bandwidth); - - int download_bandwidth = [self integerForKey:@"download_bandwidth_preference"]; - linphone_core_set_download_bandwidth(lc, download_bandwidth); - - float playback_gain = [self floatForKey:@"playback_gain_preference"]; - linphone_core_set_playback_gain_db(lc, playback_gain); - - float mic_gain = [self floatForKey:@"microphone_gain_preference"]; - linphone_core_set_mic_gain_db(lc, mic_gain); - + // Primary contact + NSString* displayname = [self stringForKey:@"primary_displayname_preference"]; + NSString* username = [self stringForKey:@"primary_username_preference"]; + LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); + if(parsed != NULL) { + linphone_address_set_display_name(parsed,[displayname cStringUsingEncoding:[NSString defaultCStringEncoding]]); + linphone_address_set_username(parsed,[username cStringUsingEncoding:[NSString defaultCStringEncoding]]); + char *contact = linphone_address_as_string(parsed); + linphone_core_set_primary_contact(lc, contact); + ms_free(contact); + linphone_address_destroy(parsed); + } + + + // Audio & Video Port + { + NSString *audio_port_preference = [self stringForKey:@"audio_port_preference"]; + int minPort, maxPort; + [LinphoneCoreSettingsStore parsePortRange:audio_port_preference minPort:&minPort maxPort:&maxPort]; + linphone_core_set_audio_port_range(lc, minPort, maxPort); + } + { + NSString *video_port_preference = [self stringForKey:@"video_port_preference"]; + int minPort, maxPort; + [LinphoneCoreSettingsStore parsePortRange:video_port_preference minPort:&minPort maxPort:&maxPort]; + linphone_core_set_video_port_range(lc, minPort, maxPort); + } + + int upload_bandwidth = [self integerForKey:@"upload_bandwidth_preference"]; + linphone_core_set_upload_bandwidth(lc, upload_bandwidth); + + int download_bandwidth = [self integerForKey:@"download_bandwidth_preference"]; + linphone_core_set_download_bandwidth(lc, download_bandwidth); + + float playback_gain = [self floatForKey:@"playback_gain_preference"]; + linphone_core_set_playback_gain_db(lc, playback_gain); + + float mic_gain = [self floatForKey:@"microphone_gain_preference"]; + linphone_core_set_mic_gain_db(lc, mic_gain); + UIDevice* device = [UIDevice currentDevice]; bool backgroundSupported = false; if ([device respondsToSelector:@selector(isMultitaskingSupported)]) @@ -652,84 +656,84 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "backgroundmode_preference", isbackgroundModeEnabled); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "start_at_boot_preference", [self boolForKey:@"start_at_boot_preference"]); - lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "autoanswer_notif_preference", [self boolForKey:@"autoanswer_notif_preference"]); - lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", [self boolForKey:@"advanced_account_preference"]); + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "autoanswer_notif_preference", [self boolForKey:@"autoanswer_notif_preference"]); + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", [self boolForKey:@"advanced_account_preference"]); + + BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"]; + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", firstloginview); + + BOOL edgeOpt = [self boolForKey:@"edge_opt_preference"]; + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "edge_opt_preference", edgeOpt); + + NSString *landscape = [self stringForKey:@"rotation_preference"]; + lp_config_set_string(config, LINPHONERC_APPLICATION_KEY, "rotation_preference", [landscape UTF8String]); - BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"]; - lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", firstloginview); - - BOOL edgeOpt = [self boolForKey:@"edge_opt_preference"]; - lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "edge_opt_preference", edgeOpt); - - NSString *landscape = [self stringForKey:@"rotation_preference"]; - lp_config_set_string(config, LINPHONERC_APPLICATION_KEY, "rotation_preference", [landscape UTF8String]); - BOOL debugmode = [self boolForKey:@"debugenable_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "debugenable_preference", debugmode); if (debugmode) { - linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); - ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); - } else { - linphone_core_disable_logs(); - } - - BOOL animations = [self boolForKey:@"animations_preference"]; + linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); + ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); + } else { + linphone_core_disable_logs(); + } + + BOOL animations = [self boolForKey:@"animations_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "animations_preference", animations); - - BOOL wifiOnly = [self boolForKey:@"wifi_only_preference"]; + + BOOL wifiOnly = [self boolForKey:@"wifi_only_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "wifi_only_preference", wifiOnly); - if([self valueChangedForKey:@"wifi_only_preference"]) { - [[LinphoneManager instance] setupNetworkReachabilityCallback]; - } - + if([self valueChangedForKey:@"wifi_only_preference"]) { + [[LinphoneManager instance] setupNetworkReachabilityCallback]; + } + NSString* sharing_server = [self stringForKey:@"sharing_server_preference"]; [[LinphoneManager instance] lpConfigSetString:sharing_server forKey:@"sharing_server_preference"]; - - - //Tunnel - if (linphone_core_tunnel_available()){ - 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]); - TunnelMode mode = tunnel_off; - int lTunnelPort = 443; - if (lTunnelPrefPort) { - lTunnelPort = lTunnelPrefPort; - } - - linphone_tunnel_clean_servers(tunnel); - if (lTunnelPrefAddress && [lTunnelPrefAddress length]) { - LinphoneTunnelConfig *ltc = linphone_tunnel_config_new(); - linphone_tunnel_config_set_host(ltc, [lTunnelPrefAddress UTF8String]); - linphone_tunnel_config_set_port(ltc, lTunnelPort); - linphone_tunnel_add_server(tunnel, ltc); - - if ([lTunnelPrefMode isEqualToString:@"off"]) { - mode = tunnel_off; - } else if ([lTunnelPrefMode isEqualToString:@"on"]) { - mode = tunnel_on; - } else if ([lTunnelPrefMode isEqualToString:@"wwan"]) { - mode = tunnel_wwan; - } else if ([lTunnelPrefMode isEqualToString:@"auto"]) { - mode = tunnel_auto; - } else { - [LinphoneLogger logc:LinphoneLoggerError format:"Unexpected tunnel mode [%s]",[lTunnelPrefMode cStringUsingEncoding:[NSString defaultCStringEncoding]]]; - } - } - - lp_config_set_string(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "tunnel_mode_preference", [lTunnelPrefMode UTF8String]); - [[LinphoneManager instance] setTunnelMode:mode]; - } - + + + //Tunnel + if (linphone_core_tunnel_available()){ + 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]); + TunnelMode mode = tunnel_off; + int lTunnelPort = 443; + if (lTunnelPrefPort) { + lTunnelPort = lTunnelPrefPort; + } + + linphone_tunnel_clean_servers(tunnel); + if (lTunnelPrefAddress && [lTunnelPrefAddress length]) { + LinphoneTunnelConfig *ltc = linphone_tunnel_config_new(); + linphone_tunnel_config_set_host(ltc, [lTunnelPrefAddress UTF8String]); + linphone_tunnel_config_set_port(ltc, lTunnelPort); + linphone_tunnel_add_server(tunnel, ltc); + + if ([lTunnelPrefMode isEqualToString:@"off"]) { + mode = tunnel_off; + } else if ([lTunnelPrefMode isEqualToString:@"on"]) { + mode = tunnel_on; + } else if ([lTunnelPrefMode isEqualToString:@"wwan"]) { + mode = tunnel_wwan; + } else if ([lTunnelPrefMode isEqualToString:@"auto"]) { + mode = tunnel_auto; + } else { + [LinphoneLogger logc:LinphoneLoggerError format:"Unexpected tunnel mode [%s]",[lTunnelPrefMode cStringUsingEncoding:[NSString defaultCStringEncoding]]]; + } + } + + lp_config_set_string(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "tunnel_mode_preference", [lTunnelPrefMode UTF8String]); + [[LinphoneManager instance] setTunnelMode:mode]; + } + [changedDict release]; changedDict = [[NSMutableDictionary alloc] init]; - - // Post event - NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"]; - [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneSettingsUpdate object:self userInfo:eventDic]; - - return YES; + + // Post event + NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneSettingsUpdate object:self userInfo:eventDic]; + + return YES; } @end diff --git a/Settings/InAppSettings.bundle/Audio.plist b/Settings/InAppSettings.bundle/Audio.plist index ac3e769a2..a164683f5 100644 --- a/Settings/InAppSettings.bundle/Audio.plist +++ b/Settings/InAppSettings.bundle/Audio.plist @@ -198,6 +198,26 @@ Type PSToggleSwitchSpecifier + + DefaultValue + Simple + Key + adaptive_rate_algorithm_preference + Title + Adaptive rate algorithm + Titles + + Simple + Stateful + + Type + PSMultiValueSpecifier + Values + + Simple + Stateful + + DefaultValue 36 diff --git a/submodules/belle-sip b/submodules/belle-sip index ee99cb136..fa1c112cb 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit ee99cb136b23558faadab3b0c654561f4a92e371 +Subproject commit fa1c112cb33d2c0a42b351652a4779a8aea77c56 diff --git a/submodules/build/Makefile b/submodules/build/Makefile index dedb3cd7b..056dc6e9a 100644 --- a/submodules/build/Makefile +++ b/submodules/build/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# Makefile +# Makefile # Copyright (C) 2009 Belledonne Communications,Grenoble France # ############################################################################ @@ -56,7 +56,7 @@ endif ifeq ($(enable_gpl_third_parties),yes) warning: - @echo + @echo @echo "***************************************************************************" @echo "***************************************************************************" @echo "*****CAUTION, this liblinphone SDK is built using 3rd party GPL code ******" @@ -68,7 +68,7 @@ warning: @echo "***************************************************************************" else warning: - @echo + @echo @echo "*****************************************************************" @echo "*****************************************************************" @echo "*****Linphone SDK without 3rd party GPL software ******" @@ -84,17 +84,17 @@ LINPHONE_OPTIONS=enable_gpl_third_parties=$(enable_gpl_third_parties) \ enable_debug=$(enable_debug) enable_ffmpeg=$(enable_ffmpeg) enable_tunnel=$(enable_tunnel) -armv7-%: +armv7-%: make -f builder-iphone-os.mk $(LINPHONE_OPTIONS) $* -armv7s-%: +armv7s-%: make -f builder-iphone-os.mk host=armv7s-apple-darwin $(LINPHONE_OPTIONS) $* -simu-%: +simu-%: make -f builder-iphone-simulator.mk $(LINPHONE_OPTIONS) $* -build-% clean-% veryclean-%: +build-% clean-% veryclean-%: make -f builder-iphone-simulator.mk $(LINPHONE_OPTIONS) $@ \ && make -f builder-iphone-os.mk $(LINPHONE_OPTIONS) $@ \ && make -f builder-iphone-os.mk host=armv7s-apple-darwin $(LINPHONE_OPTIONS) $@ @@ -106,8 +106,8 @@ broadcast_%: && make -f builder-iphone-os.mk $(LINPHONE_OPTIONS) $* \ && make -f builder-iphone-os.mk host=armv7s-apple-darwin $(LINPHONE_OPTIONS) $* -sdk: - make -f builder-iphone-os.mk delivery-sdk +sdk: + make -f builder-iphone-os.mk delivery-sdk build: broadcast_all sdk @@ -119,7 +119,7 @@ veryclean: broadcast_veryclean zipres: - @tar -C ../.. -czf ../../ios_assets.tar.gz Resources iTunesArtwork + @tar -C ../.. -czf ../../ios_assets.tar.gz Resources iTunesArtwork @echo Archive 'ios_assets.tar.gz' placed in root directory help: diff --git a/submodules/linphone b/submodules/linphone index 3c32fd439..cb925cfff 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 3c32fd43972ad9560f33e1f056ad7be694d8e685 +Subproject commit cb925cfff94bf0a2955271f953372d8e36d924f9 From efdac3faa69dae3c4470eab27daf9a7f4be2ece8 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 9 Sep 2014 14:25:32 +0200 Subject: [PATCH 02/51] Update bzrtp submodule --- submodules/bzrtp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/bzrtp b/submodules/bzrtp index 8ceda7ef0..0948658db 160000 --- a/submodules/bzrtp +++ b/submodules/bzrtp @@ -1 +1 @@ -Subproject commit 8ceda7ef0d35130057affc2e5a61c0667cde15aa +Subproject commit 0948658db85a7c9933ed2d39a159239d9ee5c734 From 9253f631caef13a18b75e3b03c37d1c8aef21cbf Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Tue, 9 Sep 2014 23:03:56 +0200 Subject: [PATCH 03/51] Update linphone for tests --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index cb925cfff..b3181855a 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit cb925cfff94bf0a2955271f953372d8e36d924f9 +Subproject commit b3181855af54fdfe58fbada051dadcdeb9678cdb From f7b6210750f174b17c16c14340fbe29f102edcf8 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 11 Sep 2014 11:33:30 +0200 Subject: [PATCH 04/51] Default on random port for initial linphonerc --- Resources/linphonerc | 2 ++ Resources/linphonerc~ipad | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Resources/linphonerc b/Resources/linphonerc index 4da97f006..314bb41c4 100644 --- a/Resources/linphonerc +++ b/Resources/linphonerc @@ -2,6 +2,8 @@ contact="Linphone iPhone" keepalive_period=30000 default_proxy=0 +sip_port=-1 +sip_tcp_port=-1 [rtp] audio_rtp_port=7076 diff --git a/Resources/linphonerc~ipad b/Resources/linphonerc~ipad index 008d4a702..89537baaa 100644 --- a/Resources/linphonerc~ipad +++ b/Resources/linphonerc~ipad @@ -2,6 +2,8 @@ contact="Linphone iPhone" keepalive_period=30000 default_proxy=0 +sip_port=-1 +sip_tcp_port=-1 [rtp] audio_rtp_port=7076 From 5d162519cd9f010f710d99cec825a867489b8e5c Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 11 Sep 2014 11:33:43 +0200 Subject: [PATCH 05/51] Reorder log levels --- Classes/Utils/Utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index 9b2b36a78..28b950d5d 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -27,8 +27,8 @@ }) typedef enum _LinphoneLoggerSeverity { - LinphoneLoggerLog = 0, - LinphoneLoggerDebug, + LinphoneLoggerDebug = 0, + LinphoneLoggerLog, LinphoneLoggerWarning, LinphoneLoggerError, LinphoneLoggerFatal From 5c1bd07b1be1f29107dabc3c90cb87811166520d Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 11 Sep 2014 11:39:39 +0200 Subject: [PATCH 06/51] Add a unit-test framework for iOS. Launch using the following command: xcodebuild -sdk iphonesimulator -project linphone.xcodeproj -scheme "LinphoneTester" test RUN_UNIT_TEST_WITH_IOS_SIM=YES --- LinphoneTester Tests/DTObjectBlockExecutor.h | 26 ++ LinphoneTester Tests/DTObjectBlockExecutor.m | 30 ++ .../LinphoneTester Tests-Info.plist | 0 .../LinphoneTester Tests-Prefix.pch | 10 + LinphoneTester Tests/LinphoneTester_Tests.m | 106 +++++ LinphoneTester Tests/NSObject+DTRuntime.h | 56 +++ LinphoneTester Tests/NSObject+DTRuntime.m | 101 +++++ .../en.lproj/InfoPlist.strings | 0 LinphoneTester/MasterViewController.m | 28 +- LinphoneTesterTests/LinphoneTesterTests.m | 34 -- linphone.xcodeproj/project.pbxproj | 412 +++++++++++++++--- 11 files changed, 706 insertions(+), 97 deletions(-) create mode 100644 LinphoneTester Tests/DTObjectBlockExecutor.h create mode 100644 LinphoneTester Tests/DTObjectBlockExecutor.m rename LinphoneTesterTests/LinphoneTesterTests-Info.plist => LinphoneTester Tests/LinphoneTester Tests-Info.plist (100%) create mode 100644 LinphoneTester Tests/LinphoneTester Tests-Prefix.pch create mode 100644 LinphoneTester Tests/LinphoneTester_Tests.m create mode 100644 LinphoneTester Tests/NSObject+DTRuntime.h create mode 100644 LinphoneTester Tests/NSObject+DTRuntime.m rename {LinphoneTesterTests => LinphoneTester Tests}/en.lproj/InfoPlist.strings (100%) delete mode 100644 LinphoneTesterTests/LinphoneTesterTests.m diff --git a/LinphoneTester Tests/DTObjectBlockExecutor.h b/LinphoneTester Tests/DTObjectBlockExecutor.h new file mode 100644 index 000000000..19926d805 --- /dev/null +++ b/LinphoneTester Tests/DTObjectBlockExecutor.h @@ -0,0 +1,26 @@ +// +// DTObjectBlockExecutor.h +// DTFoundation +// +// Created by Oliver Drobnik on 12.02.13. +// Copyright (c) 2013 Cocoanetics. All rights reserved. +// + +/** + This class is used by [NSObject addDeallocBlock:] to execute blocks on dealloc + */ + +@interface DTObjectBlockExecutor : NSObject + +/** + Convenience method to create a block executor with a deallocation block + @param block The block to execute when the created receiver is being deallocated + */ ++ (id)blockExecutorWithDeallocBlock:(void(^)())block; + +/** + Block to execute when dealloc of the receiver is called + */ +@property (nonatomic, copy) void (^deallocBlock)(); + +@end diff --git a/LinphoneTester Tests/DTObjectBlockExecutor.m b/LinphoneTester Tests/DTObjectBlockExecutor.m new file mode 100644 index 000000000..4e9dfd0fd --- /dev/null +++ b/LinphoneTester Tests/DTObjectBlockExecutor.m @@ -0,0 +1,30 @@ +// +// DTObjectBlockExecutor.m +// DTFoundation +// +// Created by Oliver Drobnik on 12.02.13. +// Copyright (c) 2013 Cocoanetics. All rights reserved. +// + +#import "DTObjectBlockExecutor.h" + + +@implementation DTObjectBlockExecutor + ++ (id)blockExecutorWithDeallocBlock:(void(^)())block +{ + DTObjectBlockExecutor *executor = [[DTObjectBlockExecutor alloc] init]; + executor.deallocBlock = block; // copy + return executor; +} + +- (void)dealloc +{ + if (_deallocBlock) + { + _deallocBlock(); + _deallocBlock = nil; + } +} + +@end diff --git a/LinphoneTesterTests/LinphoneTesterTests-Info.plist b/LinphoneTester Tests/LinphoneTester Tests-Info.plist similarity index 100% rename from LinphoneTesterTests/LinphoneTesterTests-Info.plist rename to LinphoneTester Tests/LinphoneTester Tests-Info.plist diff --git a/LinphoneTester Tests/LinphoneTester Tests-Prefix.pch b/LinphoneTester Tests/LinphoneTester Tests-Prefix.pch new file mode 100644 index 000000000..b5ffd7806 --- /dev/null +++ b/LinphoneTester Tests/LinphoneTester Tests-Prefix.pch @@ -0,0 +1,10 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/LinphoneTester Tests/LinphoneTester_Tests.m b/LinphoneTester Tests/LinphoneTester_Tests.m new file mode 100644 index 000000000..d0a2aa1d5 --- /dev/null +++ b/LinphoneTester Tests/LinphoneTester_Tests.m @@ -0,0 +1,106 @@ +// +// LinphoneTester_Tests.m +// LinphoneTester Tests +// +// Created by guillaume on 10/09/2014. +// +// + +#import +#include "linphone/linphonecore.h" +#include "linphone/liblinphone_tester.h" +#import "NSObject+DTRuntime.h" + +@interface LinphoneTester_Tests : XCTestCase + +@end + +@implementation LinphoneTester_Tests { + NSString* bundlePath; + NSString* documentPath; +} + + +static void linphone_log_function(OrtpLogLevel lev, const char *fmt, va_list args) { + NSString* log = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:fmt] arguments:args]; + NSLog(@"%@",log); +} + + +void LSLog(NSString* fmt, ...){ + va_list args; + va_start(args, fmt); + linphone_log_function(ORTP_MESSAGE, [fmt UTF8String], args); + va_end(args); +} + + + + +- (id)init { + self = [super init]; + if( self ){ + bundlePath = [[NSBundle mainBundle] bundlePath]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + documentPath = [paths objectAtIndex:0]; + LSLog(@"Bundle path: %@", bundlePath); + LSLog(@"Document path: %@", documentPath); + + liblinphone_tester_set_fileprefix([bundlePath UTF8String]); + liblinphone_tester_set_writable_dir_prefix( ms_strdup([documentPath UTF8String]) ); + } + return self; +} + ++ (NSArray*)skippedSuites { + NSArray* skipped_suites = @[@"Flexisip"]; + return skipped_suites; +} + ++ (void)initialize { + liblinphone_tester_init(); + + int count = liblinphone_tester_nb_test_suites(); + + for (int i=0; i +#import "DTObjectBlockExecutor.h" + +@implementation NSObject (DTRuntime) + +static char DTRuntimeDeallocBlocks; + +#pragma mark - Blocks + +- (void)addDeallocBlock:(void(^)())block +{ + // don't accept NULL block + NSParameterAssert(block); + + NSMutableArray *deallocBlocks = objc_getAssociatedObject(self, &DTRuntimeDeallocBlocks); + + // add array of dealloc blocks if not existing yet + if (!deallocBlocks) + { + deallocBlocks = [[NSMutableArray alloc] init]; + + objc_setAssociatedObject(self, &DTRuntimeDeallocBlocks, deallocBlocks, OBJC_ASSOCIATION_RETAIN); + } + + DTObjectBlockExecutor *executor = [DTObjectBlockExecutor blockExecutorWithDeallocBlock:block]; + + [deallocBlocks addObject:executor]; +} + ++ (BOOL)addInstanceMethodWithSelectorName:(NSString *)selectorName block:(void(^)(id))block +{ + // don't accept nil name + NSParameterAssert(selectorName); + + // don't accept NULL block + NSParameterAssert(block); + + // See http://stackoverflow.com/questions/6357663/casting-a-block-to-a-void-for-dynamic-class-method-resolution + +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_7 + void *impBlockForIMP = (void *)objc_unretainedPointer(block); +#else + id impBlockForIMP = (__bridge id)objc_unretainedPointer(block); +#endif + + IMP myIMP = imp_implementationWithBlock(impBlockForIMP); + + SEL selector = NSSelectorFromString(selectorName); + return class_addMethod(self, selector, myIMP, "v@:"); +} + +#pragma mark - Method Swizzling + ++ (void)swizzleMethod:(SEL)selector withMethod:(SEL)otherSelector +{ + // my own class is being targetted + Class c = [self class]; + + // get the methods from the selectors + Method originalMethod = class_getInstanceMethod(c, selector); + Method otherMethod = class_getInstanceMethod(c, otherSelector); + + if (class_addMethod(c, selector, method_getImplementation(otherMethod), method_getTypeEncoding(otherMethod))) + { + class_replaceMethod(c, otherSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); + } + else + { + method_exchangeImplementations(originalMethod, otherMethod); + } +} + ++ (void)swizzleClassMethod:(SEL)selector withMethod:(SEL)otherSelector +{ + // my own class is being targetted + Class c = [self class]; + + // get the methods from the selectors + Method originalMethod = class_getClassMethod(c, selector); + Method otherMethod = class_getClassMethod(c, otherSelector); + +// if (class_addMethod(c, selector, method_getImplementation(otherMethod), method_getTypeEncoding(otherMethod))) +// { +// class_replaceMethod(c, otherSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); +// } +// else +// { + method_exchangeImplementations(originalMethod, otherMethod); +// } + +} + +@end diff --git a/LinphoneTesterTests/en.lproj/InfoPlist.strings b/LinphoneTester Tests/en.lproj/InfoPlist.strings similarity index 100% rename from LinphoneTesterTests/en.lproj/InfoPlist.strings rename to LinphoneTester Tests/en.lproj/InfoPlist.strings diff --git a/LinphoneTester/MasterViewController.m b/LinphoneTester/MasterViewController.m index d1d0243ad..665d89832 100644 --- a/LinphoneTester/MasterViewController.m +++ b/LinphoneTester/MasterViewController.m @@ -47,20 +47,20 @@ static void linphone_log_function(OrtpLogLevel lev, const char *fmt, va_list arg NSString* log = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:fmt] arguments:args]; NSLog(@"%@",log); - [logsBuffer addObject:log]; - - if (logsBuffer.count >= kLogsBufferCapacity ) { - [lastLogs addObjectsFromArray:logsBuffer]; - - if( lastLogs.count >= kLastLogsCapacity - kLogsBufferCapacity ){ - [lastLogs removeObjectsInRange:NSMakeRange(0, kLogsBufferCapacity)]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:kLogsUpdateNotification - object:nil - userInfo:@{@"newlogs": [logsBuffer copy]}]; - [logsBuffer removeAllObjects]; - } - +// [logsBuffer addObject:log]; +// +// if (logsBuffer.count >= kLogsBufferCapacity ) { +// [lastLogs addObjectsFromArray:logsBuffer]; +// +// if( lastLogs.count >= kLastLogsCapacity - kLogsBufferCapacity ){ +// [lastLogs removeObjectsInRange:NSMakeRange(0, kLogsBufferCapacity)]; +// } +// [[NSNotificationCenter defaultCenter] postNotificationName:kLogsUpdateNotification +// object:nil +// userInfo:@{@"newlogs": [logsBuffer copy]}]; +// [logsBuffer removeAllObjects]; +// } + } diff --git a/LinphoneTesterTests/LinphoneTesterTests.m b/LinphoneTesterTests/LinphoneTesterTests.m deleted file mode 100644 index 28c813448..000000000 --- a/LinphoneTesterTests/LinphoneTesterTests.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// LinphoneTesterTests.m -// LinphoneTesterTests -// -// Created by guillaume on 28/05/2014. -// -// - -#import - -@interface LinphoneTesterTests : XCTestCase - -@end - -@implementation LinphoneTesterTests - -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample -{ - XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); -} - -@end diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 17ccb5ea7..8416bb05c 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -1355,6 +1355,15 @@ F0818E7F17FC51D8005A3330 /* linphone_icon_76.png in Resources */ = {isa = PBXBuildFile; fileRef = F0818E7C17FC51D8005A3330 /* linphone_icon_76.png */; }; F0818E8017FC51D8005A3330 /* linphone_icon_152.png in Resources */ = {isa = PBXBuildFile; fileRef = F0818E7D17FC51D8005A3330 /* linphone_icon_152.png */; }; F0818E8117FC51D8005A3330 /* linphone_icon_152.png in Resources */ = {isa = PBXBuildFile; fileRef = F0818E7D17FC51D8005A3330 /* linphone_icon_152.png */; }; + F08F118519C09C6B007D70C2 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F03A9B3318C0CF7000C4D7FE /* XCTest.framework */; }; + F08F118619C09C6B007D70C2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + F08F118719C09C6B007D70C2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + F08F118D19C09C6B007D70C2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F08F118B19C09C6B007D70C2 /* InfoPlist.strings */; }; + F08F118F19C09C6B007D70C2 /* LinphoneTester_Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = F08F118E19C09C6B007D70C2 /* LinphoneTester_Tests.m */; }; + F08F119919C09D88007D70C2 /* flexisip in Resources */ = {isa = PBXBuildFile; fileRef = F08F119819C09D88007D70C2 /* flexisip */; }; + F08F119A19C09D88007D70C2 /* flexisip in Resources */ = {isa = PBXBuildFile; fileRef = F08F119819C09D88007D70C2 /* flexisip */; }; + F08F119D19C0A65B007D70C2 /* NSObject+DTRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = F08F119C19C0A65B007D70C2 /* NSObject+DTRuntime.m */; }; + F08F11A019C0A6CB007D70C2 /* DTObjectBlockExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = F08F119F19C0A6CB007D70C2 /* DTObjectBlockExecutor.m */; }; F0938159188E629800A55DFA /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = F0938158188E629800A55DFA /* iTunesArtwork */; }; F093815A188E629800A55DFA /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = F0938158188E629800A55DFA /* iTunesArtwork */; }; F0A2759C18157A6000B6D61A /* linphone_icon_120.png in Resources */ = {isa = PBXBuildFile; fileRef = F0818E7B17FC5160005A3330 /* linphone_icon_120.png */; }; @@ -1417,11 +1426,9 @@ F0BB8C3C19362C2200974404 /* certificates in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C3919362C2200974404 /* certificates */; }; F0BB8C3D19362C2200974404 /* images in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C3A19362C2200974404 /* images */; }; F0BB8C3E19362C2200974404 /* sounds in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C3B19362C2200974404 /* sounds */; }; - F0BB8C44193630CA00974404 /* flexisip.conf in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C3F193630CA00974404 /* flexisip.conf */; }; F0BB8C45193630CA00974404 /* local_tester_hosts in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C40193630CA00974404 /* local_tester_hosts */; }; F0BB8C46193630CA00974404 /* marie_xml in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C41193630CA00974404 /* marie_xml */; }; F0BB8C47193630CA00974404 /* tester_hosts in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C42193630CA00974404 /* tester_hosts */; }; - F0BB8C48193630CA00974404 /* userdb.conf in Resources */ = {isa = PBXBuildFile; fileRef = F0BB8C43193630CA00974404 /* userdb.conf */; }; F0BB8C4C193631D200974404 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22276E8813C73DC000210156 /* CoreMedia.framework */; }; F0BB8C4D193631DF00974404 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 224567C1107B968500F10948 /* AVFoundation.framework */; }; F476004B147AAF2800FFF19B /* liblinphone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2211DB911475562600DEE054 /* liblinphone.a */; }; @@ -1474,6 +1481,13 @@ remoteGlobalIDString = D2AAC07D0554694100DB518D; remoteInfo = NinePatch; }; + F08F119119C09C6B007D70C2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = F0BB8BD41936208100974404; + remoteInfo = LinphoneTester; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -2265,6 +2279,16 @@ F0818E7B17FC5160005A3330 /* linphone_icon_120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone_icon_120.png; path = Resources/linphone_icon_120.png; sourceTree = ""; }; F0818E7C17FC51D8005A3330 /* linphone_icon_76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone_icon_76.png; path = Resources/linphone_icon_76.png; sourceTree = ""; }; F0818E7D17FC51D8005A3330 /* linphone_icon_152.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone_icon_152.png; path = Resources/linphone_icon_152.png; sourceTree = ""; }; + F08F118419C09C6A007D70C2 /* LinphoneTester Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "LinphoneTester Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + F08F118A19C09C6B007D70C2 /* LinphoneTester Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LinphoneTester Tests-Info.plist"; sourceTree = ""; }; + F08F118C19C09C6B007D70C2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + F08F118E19C09C6B007D70C2 /* LinphoneTester_Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LinphoneTester_Tests.m; sourceTree = ""; }; + F08F119019C09C6B007D70C2 /* LinphoneTester Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LinphoneTester Tests-Prefix.pch"; sourceTree = ""; }; + F08F119819C09D88007D70C2 /* flexisip */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flexisip; path = submodules/linphone/tester/flexisip; sourceTree = SOURCE_ROOT; }; + F08F119B19C0A65A007D70C2 /* NSObject+DTRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+DTRuntime.h"; sourceTree = ""; }; + F08F119C19C0A65B007D70C2 /* NSObject+DTRuntime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DTRuntime.m"; sourceTree = ""; }; + F08F119E19C0A6CB007D70C2 /* DTObjectBlockExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTObjectBlockExecutor.h; sourceTree = ""; }; + F08F119F19C0A6CB007D70C2 /* DTObjectBlockExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTObjectBlockExecutor.m; sourceTree = ""; }; F0938158188E629800A55DFA /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = ""; }; F09548181883F15300E8A69B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ChatRoomViewController.xib; sourceTree = ""; }; F09548191883F15300E8A69B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ChatViewController.xib; sourceTree = ""; }; @@ -2356,9 +2380,6 @@ F0BB8BEE1936208200974404 /* DetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; F0BB8BEF1936208200974404 /* DetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; F0BB8BF11936208200974404 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - F0BB8BFF1936208200974404 /* LinphoneTesterTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LinphoneTesterTests-Info.plist"; sourceTree = ""; }; - F0BB8C011936208200974404 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - F0BB8C031936208200974404 /* LinphoneTesterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LinphoneTesterTests.m; sourceTree = ""; }; F0BB8C0F193623F200974404 /* liblinphonetester.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblinphonetester.a; path = "liblinphone-sdk/apple-darwin/lib/liblinphonetester.a"; sourceTree = ""; }; F0BB8C111936240300974404 /* libcunit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcunit.a; path = "liblinphone-sdk/apple-darwin/lib/libcunit.a"; sourceTree = ""; }; F0BB8C311936246600974404 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; @@ -2367,11 +2388,9 @@ F0BB8C3919362C2200974404 /* certificates */ = {isa = PBXFileReference; lastKnownFileType = folder; name = certificates; path = submodules/linphone/tester/certificates; sourceTree = SOURCE_ROOT; }; F0BB8C3A19362C2200974404 /* images */ = {isa = PBXFileReference; lastKnownFileType = folder; name = images; path = submodules/linphone/tester/images; sourceTree = SOURCE_ROOT; }; F0BB8C3B19362C2200974404 /* sounds */ = {isa = PBXFileReference; lastKnownFileType = folder; name = sounds; path = submodules/linphone/tester/sounds; sourceTree = SOURCE_ROOT; }; - F0BB8C3F193630CA00974404 /* flexisip.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = flexisip.conf; path = submodules/linphone/tester/flexisip.conf; sourceTree = SOURCE_ROOT; }; F0BB8C40193630CA00974404 /* local_tester_hosts */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = local_tester_hosts; path = submodules/linphone/tester/local_tester_hosts; sourceTree = SOURCE_ROOT; }; F0BB8C41193630CA00974404 /* marie_xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = marie_xml; path = submodules/linphone/tester/marie_xml; sourceTree = SOURCE_ROOT; }; F0BB8C42193630CA00974404 /* tester_hosts */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tester_hosts; path = submodules/linphone/tester/tester_hosts; sourceTree = SOURCE_ROOT; }; - F0BB8C43193630CA00974404 /* userdb.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = userdb.conf; path = submodules/linphone/tester/userdb.conf; sourceTree = SOURCE_ROOT; }; F0BB8C4A193631B300974404 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; F84015BC1939FE37006ABAB5 /* test_failed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = test_failed.png; path = Resources/test_failed.png; sourceTree = ""; }; F84015BD1939FE37006ABAB5 /* test_inprogress.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = test_inprogress.png; path = Resources/test_inprogress.png; sourceTree = ""; }; @@ -2498,6 +2517,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F08F118119C09C6A007D70C2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F08F118519C09C6B007D70C2 /* XCTest.framework in Frameworks */, + F08F118719C09C6B007D70C2 /* UIKit.framework in Frameworks */, + F08F118619C09C6B007D70C2 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F0BB8BD21936208100974404 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -2643,6 +2672,7 @@ 1D6058910D05DD3D006BFB54 /* linphone.app */, 22D8F187147548E2008C97DB /* linphone-no-gpl-thirdparties.app */, F0BB8BD51936208100974404 /* LinphoneTester.app */, + F08F118419C09C6A007D70C2 /* LinphoneTester Tests.xctest */, ); name = Products; sourceTree = ""; @@ -2739,15 +2769,15 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( - F0938158188E629800A55DFA /* iTunesArtwork */, - 2258633C11410BAC00C5A737 /* README */, - F04892FE180C3296002FED35 /* ImageOptim.sh */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97323FDCFA39411CA2CEA /* Frameworks */, + F04892FE180C3296002FED35 /* ImageOptim.sh */, + F0938158188E629800A55DFA /* iTunesArtwork */, F0BB8BD91936208100974404 /* LinphoneTester */, - F0BB8BFD1936208200974404 /* LinphoneTesterTests */, + F08F118819C09C6B007D70C2 /* LinphoneTester Tests */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 19C28FACFE9D520D11CA2CBB /* Products */, + 2258633C11410BAC00C5A737 /* README */, 29B97317FDCFA39411CA2CEA /* Resources */, D398D3031594B0FB00FD553C /* Settings */, ); @@ -3038,6 +3068,29 @@ name = UACellBackgroundView; sourceTree = ""; }; + F08F118819C09C6B007D70C2 /* LinphoneTester Tests */ = { + isa = PBXGroup; + children = ( + F08F118E19C09C6B007D70C2 /* LinphoneTester_Tests.m */, + F08F119E19C0A6CB007D70C2 /* DTObjectBlockExecutor.h */, + F08F119F19C0A6CB007D70C2 /* DTObjectBlockExecutor.m */, + F08F119B19C0A65A007D70C2 /* NSObject+DTRuntime.h */, + F08F119C19C0A65B007D70C2 /* NSObject+DTRuntime.m */, + F08F118919C09C6B007D70C2 /* Supporting Files */, + ); + path = "LinphoneTester Tests"; + sourceTree = ""; + }; + F08F118919C09C6B007D70C2 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + F08F118A19C09C6B007D70C2 /* LinphoneTester Tests-Info.plist */, + F08F118B19C09C6B007D70C2 /* InfoPlist.strings */, + F08F119019C09C6B007D70C2 /* LinphoneTester Tests-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; F0B89C2318DC90850050B60E /* images */ = { isa = PBXGroup; children = ( @@ -3555,11 +3608,10 @@ F0BB8BDA1936208100974404 /* Supporting Files */ = { isa = PBXGroup; children = ( - F0BB8C3F193630CA00974404 /* flexisip.conf */, + F08F119819C09D88007D70C2 /* flexisip */, F0BB8C40193630CA00974404 /* local_tester_hosts */, F0BB8C41193630CA00974404 /* marie_xml */, F0BB8C42193630CA00974404 /* tester_hosts */, - F0BB8C43193630CA00974404 /* userdb.conf */, F0BB8C3919362C2200974404 /* certificates */, F0BB8C3A19362C2200974404 /* images */, F0BB8C3B19362C2200974404 /* sounds */, @@ -3572,24 +3624,6 @@ name = "Supporting Files"; sourceTree = ""; }; - F0BB8BFD1936208200974404 /* LinphoneTesterTests */ = { - isa = PBXGroup; - children = ( - F0BB8C031936208200974404 /* LinphoneTesterTests.m */, - F0BB8BFE1936208200974404 /* Supporting Files */, - ); - path = LinphoneTesterTests; - sourceTree = ""; - }; - F0BB8BFE1936208200974404 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - F0BB8BFF1936208200974404 /* LinphoneTesterTests-Info.plist */, - F0BB8C001936208200974404 /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -3635,6 +3669,24 @@ productReference = 22D8F187147548E2008C97DB /* linphone-no-gpl-thirdparties.app */; productType = "com.apple.product-type.application"; }; + F08F118319C09C6A007D70C2 /* LinphoneTester Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = F08F119319C09C6B007D70C2 /* Build configuration list for PBXNativeTarget "LinphoneTester Tests" */; + buildPhases = ( + F08F118019C09C6A007D70C2 /* Sources */, + F08F118119C09C6A007D70C2 /* Frameworks */, + F08F118219C09C6A007D70C2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + F08F119219C09C6B007D70C2 /* PBXTargetDependency */, + ); + name = "LinphoneTester Tests"; + productName = "LinphoneTester Tests"; + productReference = F08F118419C09C6A007D70C2 /* LinphoneTester Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; F0BB8BD41936208100974404 /* LinphoneTester */ = { isa = PBXNativeTarget; buildConfigurationList = F0BB8C051936208200974404 /* Build configuration list for PBXNativeTarget "LinphoneTester" */; @@ -3642,6 +3694,7 @@ F0BB8BD11936208100974404 /* Sources */, F0BB8BD21936208100974404 /* Frameworks */, F0BB8BD31936208100974404 /* Resources */, + F08F11A219C0AC2F007D70C2 /* ShellScript */, ); buildRules = ( ); @@ -3666,6 +3719,9 @@ 22D8F11D147548E2008C97DB = { DevelopmentTeam = Z2V957B3D6; }; + F08F118319C09C6A007D70C2 = { + TestTargetID = F0BB8BD41936208100974404; + }; F0BB8BD41936208100974404 = { DevelopmentTeam = Z2V957B3D6; }; @@ -3702,6 +3758,7 @@ 1D6058900D05DD3D006BFB54 /* linphone */, 22D8F11D147548E2008C97DB /* linphone-no-gpl-thirdparties */, F0BB8BD41936208100974404 /* LinphoneTester */, + F08F118319C09C6A007D70C2 /* LinphoneTester Tests */, ); }; /* End PBXProject section */ @@ -4816,16 +4873,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F08F118219C09C6A007D70C2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F08F119A19C09D88007D70C2 /* flexisip in Resources */, + F08F118D19C09C6B007D70C2 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F0BB8BD31936208100974404 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( F0BB8C3819362C1500974404 /* rcfiles in Resources */, F84015C11939FE37006ABAB5 /* test_passed.png in Resources */, - F0BB8C44193630CA00974404 /* flexisip.conf in Resources */, + F08F119919C09D88007D70C2 /* flexisip in Resources */, F0BB8C46193630CA00974404 /* marie_xml in Resources */, F0BB8BEA1936208200974404 /* Main_iPad.storyboard in Resources */, - F0BB8C48193630CA00974404 /* userdb.conf in Resources */, F0BB8C3E19362C2200974404 /* sounds in Resources */, F84015BF1939FE37006ABAB5 /* test_failed.png in Resources */, F0BB8BF21936208200974404 /* Images.xcassets in Resources */, @@ -4868,6 +4933,19 @@ shellPath = /bin/sh; shellScript = $SRCROOT/ImageOptim.sh; }; + F08F11A219C0AC2F007D70C2 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 12; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [ \"$RUN_UNIT_TEST_WITH_IOS_SIM\" = \"YES\" ]; then\ntest_bundle_path=\"$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION\"\nios-sim launch \"$(dirname \"$TEST_HOST\")\" --setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=\"$test_bundle_path\" --setenv XCInjectBundleInto=\"$TEST_HOST\" --args -SenTest All \"$test_bundle_path\"\necho \"Finished running tests with ios-sim\"\nelse\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\nfi"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -5069,6 +5147,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F08F118019C09C6A007D70C2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F08F119D19C0A65B007D70C2 /* NSObject+DTRuntime.m in Sources */, + F08F118F19C09C6B007D70C2 /* LinphoneTester_Tests.m in Sources */, + F08F11A019C0A6CB007D70C2 /* DTObjectBlockExecutor.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F0BB8BD11936208100974404 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -5104,6 +5192,11 @@ name = NinePatch; targetProxy = D3B90E1C15C2CBCD00F64F8C /* PBXContainerItemProxy */; }; + F08F119219C09C6B007D70C2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F0BB8BD41936208100974404 /* LinphoneTester */; + targetProxy = F08F119119C09C6B007D70C2 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -5367,6 +5460,14 @@ name = "IncomingCallViewController~ipad.xib"; sourceTree = ""; }; + F08F118B19C09C6B007D70C2 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + F08F118C19C09C6B007D70C2 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; F0BB8BDC1936208100974404 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -5391,14 +5492,6 @@ name = Main_iPad.storyboard; sourceTree = ""; }; - F0BB8C001936208200974404 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - F0BB8C011936208200974404 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -5833,6 +5926,200 @@ }; name = Debug; }; + F08F119419C09C6B007D70C2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LinphoneTester.app/LinphoneTester"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "LinphoneTester Tests/LinphoneTester Tests-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "liblinphone-sdk/apple-darwin/include", + Classes/Utils/NinePatch/, + Classes/Utils/XMLRPC/, + ); + INFOPLIST_FILE = "LinphoneTester Tests/LinphoneTester Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", + ); + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + F08F119519C09C6B007D70C2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LinphoneTester.app/LinphoneTester"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "LinphoneTester Tests/LinphoneTester Tests-Prefix.pch"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "liblinphone-sdk/apple-darwin/include", + Classes/Utils/NinePatch/, + Classes/Utils/XMLRPC/, + ); + INFOPLIST_FILE = "LinphoneTester Tests/LinphoneTester Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; + F08F119619C09C6B007D70C2 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LinphoneTester.app/LinphoneTester"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "LinphoneTester Tests/LinphoneTester Tests-Prefix.pch"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "liblinphone-sdk/apple-darwin/include", + Classes/Utils/NinePatch/, + Classes/Utils/XMLRPC/, + ); + INFOPLIST_FILE = "LinphoneTester Tests/LinphoneTester Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = xctest; + }; + name = Distribution; + }; + F08F119719C09C6B007D70C2 /* DistributionAdhoc */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LinphoneTester.app/LinphoneTester"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "LinphoneTester Tests/LinphoneTester Tests-Prefix.pch"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "liblinphone-sdk/apple-darwin/include", + Classes/Utils/NinePatch/, + Classes/Utils/XMLRPC/, + ); + INFOPLIST_FILE = "LinphoneTester Tests/LinphoneTester Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", + "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = xctest; + }; + name = DistributionAdhoc; + }; F0BB8C061936208200974404 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -5850,6 +6137,10 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -5871,7 +6162,7 @@ Classes/Utils/XMLRPC/, ); INFOPLIST_FILE = "LinphoneTester/LinphoneTester-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", @@ -5879,7 +6170,7 @@ ); ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "72278EC2-F54D-4717-86AD-08D6E2AEC22B"; + PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; }; name = Debug; @@ -5902,6 +6193,10 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "LinphoneTester/LinphoneTester-Prefix.pch"; @@ -5916,14 +6211,14 @@ Classes/Utils/XMLRPC/, ); INFOPLIST_FILE = "LinphoneTester/LinphoneTester-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", ); PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "72278EC2-F54D-4717-86AD-08D6E2AEC22B"; + PROVISIONING_PROFILE = ""; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; @@ -5947,6 +6242,10 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "LinphoneTester/LinphoneTester-Prefix.pch"; @@ -5961,14 +6260,14 @@ Classes/Utils/XMLRPC/, ); INFOPLIST_FILE = "LinphoneTester/LinphoneTester-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", ); PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "72278EC2-F54D-4717-86AD-08D6E2AEC22B"; + PROVISIONING_PROFILE = ""; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; @@ -5992,6 +6291,10 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "LinphoneTester/LinphoneTester-Prefix.pch"; @@ -6006,14 +6309,14 @@ Classes/Utils/XMLRPC/, ); INFOPLIST_FILE = "LinphoneTester/LinphoneTester-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib", "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins", ); PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "72278EC2-F54D-4717-86AD-08D6E2AEC22B"; + PROVISIONING_PROFILE = ""; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; @@ -6055,6 +6358,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + F08F119319C09C6B007D70C2 /* Build configuration list for PBXNativeTarget "LinphoneTester Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F08F119419C09C6B007D70C2 /* Debug */, + F08F119519C09C6B007D70C2 /* Release */, + F08F119619C09C6B007D70C2 /* Distribution */, + F08F119719C09C6B007D70C2 /* DistributionAdhoc */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; F0BB8C051936208200974404 /* Build configuration list for PBXNativeTarget "LinphoneTester" */ = { isa = XCConfigurationList; buildConfigurations = ( From 51efa463e4d814c7023077f02e5bec06f547e32b Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 11 Sep 2014 11:42:31 +0200 Subject: [PATCH 07/51] Update linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index b3181855a..2d9de5a1b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit b3181855af54fdfe58fbada051dadcdeb9678cdb +Subproject commit 2d9de5a1bd601b4ce17da28c24af650b97e175b3 From 05a36f2a142c5c48370f98c0b51f88e461e718b4 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 11 Sep 2014 11:42:53 +0200 Subject: [PATCH 08/51] Update Bellesip --- submodules/belle-sip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index fa1c112cb..164ecf766 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit fa1c112cb33d2c0a42b351652a4779a8aea77c56 +Subproject commit 164ecf766cc9d2e48cfab3e170aed41e09023dc7 From 70b035e57177de5b7acc12eb62303cd12ef5fbcc Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 10 Jul 2014 23:37:08 +0200 Subject: [PATCH 09/51] Add makefile target to retrieve the prebuilt sdk from linphone.org --- submodules/build/Makefile | 3 +++ submodules/build/builder-iphone-os.mk | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/submodules/build/Makefile b/submodules/build/Makefile index 056dc6e9a..c7a0cfcc5 100644 --- a/submodules/build/Makefile +++ b/submodules/build/Makefile @@ -109,6 +109,9 @@ broadcast_%: sdk: make -f builder-iphone-os.mk delivery-sdk +download-sdk: + make -f builder-iphone-os.mk download-sdk + build: broadcast_all sdk ipa: build broadcast_ipa diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index 066387b54..bf539f2cf 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -329,6 +329,14 @@ delivery-sdk: multi-arch -x liblinphone-tutorials/hello-world/hello-world.xcodeproj/*.pbxuser \ -x liblinphone-tutorials/hello-world/hello-world.xcodeproj/*.mode1v3 +download-sdk: + cd $(BUILDER_SRC_DIR)/../ + rm -fr liblinphone-iphone-sdk-latest* + wget http://linphone.org/snapshots/ios/liblinphone-iphone-sdk-latest.zip + unzip -o -q liblinphone-iphone-sdk-latest.zip + rm -fr ../../liblinphone-sdk/ + mv liblinphone-sdk ../.. + .PHONY delivery: cd $(BUILDER_SRC_DIR)/../../ \ && zip -r $(BUILDER_SRC_DIR)/linphone-iphone.zip \ From b475d0a1fbbf7834d4f4ed0c93fa4578e9bee130 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 11 Sep 2014 14:35:18 +0200 Subject: [PATCH 10/51] LinphoneTester scheme is now shared --- .../xcschemes/LinphoneTester.xcscheme | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme diff --git a/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme b/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme new file mode 100644 index 000000000..00754381c --- /dev/null +++ b/linphone.xcodeproj/xcshareddata/xcschemes/LinphoneTester.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 06ded676dc3f0503fa37127061d40b3577a64701 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 12 Sep 2014 11:57:19 +0200 Subject: [PATCH 11/51] Add signal handler in linphone tester to get backtrace in logs --- LinphoneTester Tests/LinphoneTester_Tests.m | 2 +- LinphoneTester/main.m | 87 +++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/LinphoneTester Tests/LinphoneTester_Tests.m b/LinphoneTester Tests/LinphoneTester_Tests.m index d0a2aa1d5..b4631e2a0 100644 --- a/LinphoneTester Tests/LinphoneTester_Tests.m +++ b/LinphoneTester Tests/LinphoneTester_Tests.m @@ -65,7 +65,6 @@ void LSLog(NSString* fmt, ...){ for (int i=0; i #import "AppDelegate.h" +#include +#include + +static NSString * const kKEY_CRASH_REPORT = @"CRASH_REPORT"; +static NSString * const kKEY_ExceptionName = @"UnhandledExceptionName"; +static NSString * const kKEY_ExceptionReason = @"UnhandledExceptionReason"; +static NSString * const kKEY_ExceptionUserInfo = @"UnhandledExceptionUserInfo"; +static NSString * const kKEY_ExceptionCallStack = @"UnhandledExceptionCallStack"; +static NSString * const kKEY_ExceptionScreenshot = @"UnhandledExceptionScreenshot"; +static NSString * const kKEY_ExceptionTimestamp = @"UnhandledExceptionTimestamp"; + +__unused void unhandledExceptionHandler(NSException *exception) { + NSMutableDictionary *crashReport = [NSMutableDictionary dictionary]; + crashReport[kKEY_ExceptionName] = exception.name; + crashReport[kKEY_ExceptionReason] = exception.reason; + crashReport[kKEY_ExceptionUserInfo] = exception.userInfo ?: [NSNull null].debugDescription; + crashReport[kKEY_ExceptionCallStack] = exception.callStackSymbols.debugDescription; + + NSLog(@"CRASH: %@ - %@", exception.name, exception.callStackSymbols.debugDescription); + + [[NSUserDefaults standardUserDefaults] setObject:[NSDictionary dictionaryWithDictionary:crashReport] forKey:kKEY_CRASH_REPORT]; + [[NSUserDefaults standardUserDefaults] synchronize]; + exit(1); +} + +/* SignalHandler + * + * Handle uncaught signals + */ + +void SignalHandler(int sig, siginfo_t *info, void *context) +{ + void *frames[128]; + int i,len = backtrace(frames, 128); + char **symbols = backtrace_symbols(frames,len); + + /* + * Now format into a message for sending to the user + */ + + NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:4096]; + + NSBundle *bundle = [NSBundle mainBundle]; + [buffer appendFormat:@"PComp version %@ build %@\n\n", + [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + [bundle objectForInfoDictionaryKey:@"CIMBuildNumber"]]; + [buffer appendString:@"Uncaught Signal\n"]; + [buffer appendFormat:@"si_signo %d\n",info->si_signo]; + [buffer appendFormat:@"si_code %d\n",info->si_code]; + [buffer appendFormat:@"si_value %d\n",info->si_value.sival_int]; + [buffer appendFormat:@"si_errno %d\n",info->si_errno]; + [buffer appendFormat:@"si_addr %p\n",info->si_addr]; + [buffer appendFormat:@"si_status %d\n",info->si_status]; + [buffer appendString:@"Stack trace:\n\n"]; + for (i = 0; i < len; ++i) { + [buffer appendFormat:@"%4d - %s\n",i,symbols[i]]; + } + + /* + * Get the error file to write this to + */ + + NSLog(@"Error %@",buffer); + exit(1); +} + + + +void InstallUncaughtExceptionHandler() +{ + NSSetUncaughtExceptionHandler(&unhandledExceptionHandler); + struct sigaction mySigAction; + mySigAction.sa_sigaction = SignalHandler; + mySigAction.sa_flags = SA_SIGINFO; + + sigemptyset(&mySigAction.sa_mask); + sigaction(SIGQUIT, &mySigAction, NULL); + sigaction(SIGILL, &mySigAction, NULL); + sigaction(SIGTRAP, &mySigAction, NULL); + sigaction(SIGABRT, &mySigAction, NULL); + sigaction(SIGEMT, &mySigAction, NULL); + sigaction(SIGFPE, &mySigAction, NULL); + sigaction(SIGBUS, &mySigAction, NULL); + sigaction(SIGSEGV, &mySigAction, NULL); + sigaction(SIGSYS, &mySigAction, NULL); +} int main(int argc, char * argv[]) { + InstallUncaughtExceptionHandler(); @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } From 3fef14583485da51932890d359e5e9b4e6569622 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 15 Sep 2014 10:16:34 +0200 Subject: [PATCH 12/51] update submodules (mainly for UPDATE within dialog support) --- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index 164ecf766..be3b4509f 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 164ecf766cc9d2e48cfab3e170aed41e09023dc7 +Subproject commit be3b4509f7be3e15bf702256222453dd22047cd4 diff --git a/submodules/linphone b/submodules/linphone index 2d9de5a1b..321f1accb 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 2d9de5a1bd601b4ce17da28c24af650b97e175b3 +Subproject commit 321f1accb3180c54768ed2c79845f184b45db167 From fcc1f51e4ef77b598ca30b7ca9336abe9404d60e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 17 Sep 2014 14:46:46 +0200 Subject: [PATCH 13/51] update linphone& belle-sip --- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index be3b4509f..c8be3ffd4 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit be3b4509f7be3e15bf702256222453dd22047cd4 +Subproject commit c8be3ffd42a625358a5da1b5ec4cf2d4bcd13839 diff --git a/submodules/linphone b/submodules/linphone index 321f1accb..df58cddb5 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 321f1accb3180c54768ed2c79845f184b45db167 +Subproject commit df58cddb5d09bba69802ee33aee5385607fd1a68 From 9cf5835e1299b60e48d96793c87768113729790f Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Tue, 19 Aug 2014 17:00:25 +0200 Subject: [PATCH 14/51] Add a button in the UI to switch to non-voice-processing audio. Also defaults to use bass boost with equalizer. --- Classes/LinphoneCoreSettingsStore.m | 17 ++++++++++------- Resources/linphonerc-factory | 3 +++ Resources/linphonerc-factory~ipad | 3 +++ Settings/InAppSettings.bundle/Audio.plist | 10 ++++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index e8a66aec9..0832178db 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -109,7 +109,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); linphone_address_destroy(addr); linphone_address_destroy(proxy_addr); - [self setBool: (linphone_proxy_config_get_route(cfg)!=NULL) forKey:@"outbound_proxy_preference"]; + [self setBool:(linphone_proxy_config_get_route(cfg)!=NULL) forKey:@"outbound_proxy_preference"]; [self setBool:linphone_proxy_config_get_dial_escape_plus(cfg) forKey:@"substitute_+_by_00_preference"]; [self setBool:linphone_proxy_config_avpf_enabled(cfg) forKey:@"avpf_preference"]; @@ -186,8 +186,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self transformCodecsToKeys: linphone_core_get_video_codecs(lc)]; [self setBool:linphone_core_adaptive_rate_control_enabled(lc) forKey:@"adaptive_rate_control_preference"]; [self setString:linphone_core_get_adaptive_rate_algorithm(lc) forKey:@"adaptive_rate_algorithm_preference"]; - [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; - + + [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; + [self setInteger:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "disable_voiceproc", 0) forKey:@"disable_voiceproc"]; } [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", 0) forKey:@"advanced_account_preference"]; @@ -542,10 +543,12 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self stringForKey:@"adaptive_rate_algorithm_preference"] cStringUsingEncoding:[NSString defaultCStringEncoding] ]); - linphone_core_set_use_info_for_dtmf(lc, [self boolForKey:@"sipinfo_dtmf_preference"]); - linphone_core_set_use_rfc2833_for_dtmf(lc, [self boolForKey:@"rfc_dtmf_preference"]); - linphone_core_set_inc_timeout(lc, [self integerForKey:@"incoming_call_timeout_preference"]); - linphone_core_set_in_call_timeout(lc, [self integerForKey:@"in_call_timeout_preference"]); + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "disable_voiceproc", [self boolForKey:@"disable_voiceproc"]); + + linphone_core_set_use_info_for_dtmf(lc, [self boolForKey:@"sipinfo_dtmf_preference"]); + linphone_core_set_use_rfc2833_for_dtmf(lc, [self boolForKey:@"rfc_dtmf_preference"]); + linphone_core_set_inc_timeout(lc, [self integerForKey:@"incoming_call_timeout_preference"]); + linphone_core_set_in_call_timeout(lc, [self integerForKey:@"in_call_timeout_preference"]); bool enableVideo = [self boolForKey:@"enable_video_preference"]; linphone_core_enable_video(lc, enableVideo, enableVideo); diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index 862641b0e..e8e802eb6 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -31,6 +31,9 @@ ringer_dev_id=AQ: Audio Queue Device capture_dev_id=AU: Audio Unit Receiver echocancellation=0 dtmf_player_amp=0.007 +eq_active=1 +eq_location=mic +eq_gains=50:8:50 100:2:50 200:2:50 [misc] history_max_size=30 diff --git a/Resources/linphonerc-factory~ipad b/Resources/linphonerc-factory~ipad index 7f828cd26..e8b1f4f86 100644 --- a/Resources/linphonerc-factory~ipad +++ b/Resources/linphonerc-factory~ipad @@ -31,6 +31,9 @@ ringer_dev_id=AQ: Audio Queue Device capture_dev_id=AU: Audio Unit Receiver echocancellation=0 dtmf_player_amp=0.007 +eq_active=1 +eq_location=mic +eq_gains=50:8:50 100:2:50 200:2:50 [misc] history_max_size=30 diff --git a/Settings/InAppSettings.bundle/Audio.plist b/Settings/InAppSettings.bundle/Audio.plist index a164683f5..64d1cecba 100644 --- a/Settings/InAppSettings.bundle/Audio.plist +++ b/Settings/InAppSettings.bundle/Audio.plist @@ -246,6 +246,16 @@ 128 + + DefaultValue + + Key + disable_voiceproc + Title + Disable VoiceProc and Equalizer + Type + PSToggleSwitchSpecifier + From 965dc5b57445d2a6c7a1c08fb3a089a5b2a69552 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Tue, 19 Aug 2014 17:19:44 +0200 Subject: [PATCH 15/51] Tune the equalizer for the 512 steps fft (was for 1024). --- Resources/linphonerc-factory | 2 +- Resources/linphonerc-factory~ipad | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index e8e802eb6..09882a861 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -33,7 +33,7 @@ echocancellation=0 dtmf_player_amp=0.007 eq_active=1 eq_location=mic -eq_gains=50:8:50 100:2:50 200:2:50 +eq_gains=50:2:50 100:2:50 [misc] history_max_size=30 diff --git a/Resources/linphonerc-factory~ipad b/Resources/linphonerc-factory~ipad index e8b1f4f86..2cb9a3139 100644 --- a/Resources/linphonerc-factory~ipad +++ b/Resources/linphonerc-factory~ipad @@ -33,7 +33,7 @@ echocancellation=0 dtmf_player_amp=0.007 eq_active=1 eq_location=mic -eq_gains=50:8:50 100:2:50 200:2:50 +eq_gains=50:2:50 100:2:50 [misc] history_max_size=30 From e4d66021cfb377bd2f72b2dd577e29de5c2cebad Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 19 Sep 2014 10:05:26 +0200 Subject: [PATCH 16/51] Fix crash on iOS8 --- Classes/ContactDetailsTableViewController.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 2556f7dd7..de95d9679 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -74,6 +74,12 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe - (void)initContactDetailsTableViewController { dataCache = [[NSMutableArray alloc] init]; + + // pre-fill the data-cache with empty arrays + for(int i=ContactSections_Number; i< ContactSections_MAX; i++){ + [dataCache addObject:@[]]; + } + labelArray = [[NSMutableArray alloc] initWithObjects: [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"], [NSString stringWithString:(NSString*)kABPersonPhoneMobileLabel], From 8f2a736bb00a8fd38e096e9c4ccb37ed188f9a37 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 19 Sep 2014 10:10:39 +0200 Subject: [PATCH 17/51] Add bass-boost and voice processing activation switches in the settings --- Classes/LinphoneCoreSettingsStore.m | 16 +++++++++++++--- Resources/linphonerc | 7 ++++++- Resources/linphonerc-factory | 3 --- Resources/linphonerc-factory~ipad | 3 --- Resources/linphonerc~ipad | 6 ++++++ Settings/InAppSettings.bundle/Audio.plist | 14 ++++++++++++-- .../InAppSettings.bundle/en.lproj/Audio.strings | 6 ++++++ .../InAppSettings.bundle/fr.lproj/Audio.strings | 13 +++++++++++++ .../InAppSettings.bundle/ru.lproj/Audio.strings | 6 ++++++ submodules/linphone | 2 +- 10 files changed, 63 insertions(+), 13 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 0832178db..15caf27fe 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -187,8 +187,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool:linphone_core_adaptive_rate_control_enabled(lc) forKey:@"adaptive_rate_control_preference"]; [self setString:linphone_core_get_adaptive_rate_algorithm(lc) forKey:@"adaptive_rate_algorithm_preference"]; - [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; - [self setInteger:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "disable_voiceproc", 0) forKey:@"disable_voiceproc"]; + [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; + [self setInteger:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "voiceproc_preference", 1) forKey:@"voiceproc_preference"]; + [self setInteger:lp_config_get_int(conf, "sound", "eq_active", 0) forKey:@"eq_active"]; } [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", 0) forKey:@"advanced_account_preference"]; @@ -543,7 +544,16 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self stringForKey:@"adaptive_rate_algorithm_preference"] cStringUsingEncoding:[NSString defaultCStringEncoding] ]); - lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "disable_voiceproc", [self boolForKey:@"disable_voiceproc"]); + // Voice processing + BOOL voice_processing = [self boolForKey:@"voiceproc_preference"]; + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "voiceproc_preference", voice_processing); + NSString* au_device = @"AU: Audio Unit Receiver"; + if( !voice_processing ){ au_device = @"AU: Audio Unit NoVoiceProc"; } + linphone_core_set_capture_device(lc, [au_device UTF8String]); + linphone_core_set_playback_device(lc, [au_device UTF8String]); + + BOOL equalizer = [self boolForKey:@"eq_active"]; + lp_config_set_int(config, "sound", "eq_active", equalizer); linphone_core_set_use_info_for_dtmf(lc, [self boolForKey:@"sipinfo_dtmf_preference"]); linphone_core_set_use_rfc2833_for_dtmf(lc, [self boolForKey:@"rfc_dtmf_preference"]); diff --git a/Resources/linphonerc b/Resources/linphonerc index 314bb41c4..360d286b7 100644 --- a/Resources/linphonerc +++ b/Resources/linphonerc @@ -23,6 +23,11 @@ firewall_policy=0 download_bw=380 upload_bw=380 +[sound] +playback_dev_id=AU: Audio Unit Receiver +capture_dev_id=AU: Audio Unit Receiver +eq_active=0 + [app] rotation_preference=auto animations_preference=1 @@ -31,7 +36,7 @@ use_system_contacts=0 start_at_boot_preference=1 backgroundmode_preference=1 autoanswer_notif_preference=1 - +voiceproc_preference=1 [default_values] reg_expires=600 \ No newline at end of file diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index 09882a861..67ca24af6 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -26,12 +26,9 @@ video_jitt_comp=60 nortp_timeout=30 [sound] -playback_dev_id=AU: Audio Unit Receiver ringer_dev_id=AQ: Audio Queue Device -capture_dev_id=AU: Audio Unit Receiver echocancellation=0 dtmf_player_amp=0.007 -eq_active=1 eq_location=mic eq_gains=50:2:50 100:2:50 diff --git a/Resources/linphonerc-factory~ipad b/Resources/linphonerc-factory~ipad index 2cb9a3139..7ab44ac65 100644 --- a/Resources/linphonerc-factory~ipad +++ b/Resources/linphonerc-factory~ipad @@ -26,12 +26,9 @@ video_jitt_comp=60 nortp_timeout=30 [sound] -playback_dev_id=AU: Audio Unit Receiver ringer_dev_id=AQ: Audio Queue Device -capture_dev_id=AU: Audio Unit Receiver echocancellation=0 dtmf_player_amp=0.007 -eq_active=1 eq_location=mic eq_gains=50:2:50 100:2:50 diff --git a/Resources/linphonerc~ipad b/Resources/linphonerc~ipad index 89537baaa..2f010650c 100644 --- a/Resources/linphonerc~ipad +++ b/Resources/linphonerc~ipad @@ -23,6 +23,11 @@ firewall_policy=0 download_bw=512 upload_bw=512 +[sound] +playback_dev_id=AU: Audio Unit Receiver +capture_dev_id=AU: Audio Unit Receiver +eq_active=0 + [app] rotation_preference=auto animations_preference=1 @@ -31,6 +36,7 @@ use_system_contacts=0 start_at_boot_preference=1 backgroundmode_preference=1 autoanswer_notif_preference=1 +voiceproc_preference=1 [default_values] reg_expires=600 diff --git a/Settings/InAppSettings.bundle/Audio.plist b/Settings/InAppSettings.bundle/Audio.plist index 64d1cecba..1121dd229 100644 --- a/Settings/InAppSettings.bundle/Audio.plist +++ b/Settings/InAppSettings.bundle/Audio.plist @@ -246,13 +246,23 @@ 128 + + DefaultValue + + Key + voiceproc_preference + Title + Enable Voice Processing + Type + PSToggleSwitchSpecifier + DefaultValue Key - disable_voiceproc + eq_active Title - Disable VoiceProc and Equalizer + Enable Bass Boost Type PSToggleSwitchSpecifier diff --git a/Settings/InAppSettings.bundle/en.lproj/Audio.strings b/Settings/InAppSettings.bundle/en.lproj/Audio.strings index 4384de768..db5389c2a 100644 --- a/Settings/InAppSettings.bundle/en.lproj/Audio.strings +++ b/Settings/InAppSettings.bundle/en.lproj/Audio.strings @@ -48,3 +48,9 @@ /* Codec bitrate limit */ "Codec bitrate limit" = "Codec bitrate limit"; + +/* Voice processing */ +"Enable Voice Processing"="Enable Voice Processing"; + +/* Bass Boost / equalizer */ +"Enable Bass Boost"="Enable Bass Boost"; \ No newline at end of file diff --git a/Settings/InAppSettings.bundle/fr.lproj/Audio.strings b/Settings/InAppSettings.bundle/fr.lproj/Audio.strings index c90dc9783..5295f9cc3 100644 --- a/Settings/InAppSettings.bundle/fr.lproj/Audio.strings +++ b/Settings/InAppSettings.bundle/fr.lproj/Audio.strings @@ -48,3 +48,16 @@ /* Codec bitrate limit */ "Codec bitrate limit" = "Limite de débit du codec"; + +/* Voice processing */ +"Enable Voice Processing"="Optimiser le son pour la VoIP"; + +/* Bass Boost / equalizer */ +"Enable Bass Boost"="Activer Bass Boost"; + +/* Adaptative */ +"Adaptive rate algorithm"="Adaptation du débit"; + +"Simple"="Simple"; + +"Stateful"="Stateful"; \ No newline at end of file diff --git a/Settings/InAppSettings.bundle/ru.lproj/Audio.strings b/Settings/InAppSettings.bundle/ru.lproj/Audio.strings index 2b325e3ae..05456dfcd 100644 --- a/Settings/InAppSettings.bundle/ru.lproj/Audio.strings +++ b/Settings/InAppSettings.bundle/ru.lproj/Audio.strings @@ -48,3 +48,9 @@ /* Codec bitrate limit */ "Codec bitrate limit" = "Codec bitrate limit"; + +/* Voice processing */ +"Enable Voice Processing"="Enable Voice Processing"; + +/* Bass Boost / equalizer */ +"Enable Bass Boost"="Enable Bass Boost"; \ No newline at end of file diff --git a/submodules/linphone b/submodules/linphone index df58cddb5..ebdc286d6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit df58cddb5d09bba69802ee33aee5385607fd1a68 +Subproject commit ebdc286d6d9e9b6b90f0096f9932a6d25642a0a3 From ca20b174145e724692030b1cb1646d272cc281ab Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 19 Sep 2014 11:33:58 +0200 Subject: [PATCH 18/51] Modify SDK compilation step for XCode 6 --- submodules/build/builders.d/x264.patch | 13 +++++++++++++ submodules/build/iphone-config.site | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/submodules/build/builders.d/x264.patch b/submodules/build/builders.d/x264.patch index 60ffc6701..62bd0789e 100644 --- a/submodules/build/builders.d/x264.patch +++ b/submodules/build/builders.d/x264.patch @@ -134,3 +134,16 @@ index e851562..c159f9e 100644 movlt r0, #0 bx lr .endfunc +diff --git a/configure b/configure +index 250b0ac..af69d44 100755 +--- a/configure ++++ b/configure +@@ -456,7 +456,7 @@ case $host_os in + ;; + darwin*) + SYS="MACOSX" +- CFLAGS="$CFLAGS -falign-loops=16" ++ CFLAGS="$CFLAGS" + libm="-lm" + if [ "$pic" = "no" ]; then + cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic" diff --git a/submodules/build/iphone-config.site b/submodules/build/iphone-config.site index 995023e4a..c62de78fe 100644 --- a/submodules/build/iphone-config.site +++ b/submodules/build/iphone-config.site @@ -1,7 +1,7 @@ # -*- shell-script -*- -SDK_VERSION_MAJOR=4 -SDK_VERSION=4.0 +SDK_VERSION_MAJOR=5 +SDK_VERSION=5.0 MCPU="" CLANG_TARGET_SPECIFIER=miphoneos-version-min if test "${host_alias}" = "i386-apple-darwin" ; then From 26dd53e9fb3c35f6eefbfaba0f04878ddd94b087 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 19 Sep 2014 16:07:07 +0200 Subject: [PATCH 19/51] Update linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index ebdc286d6..b7c6893d2 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit ebdc286d6d9e9b6b90f0096f9932a6d25642a0a3 +Subproject commit b7c6893d274bc3d646da066fbc9f7457e75b83c8 From 375b6e3d394a99d79cce4be037ced31d200806a0 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Sat, 20 Sep 2014 15:45:36 +0200 Subject: [PATCH 20/51] Use new notification system for iOS8: answer/decline calls and reply/mark read messages from within the notifications --- Classes/LinphoneAppDelegate.m | 104 +++++++++++++++++++++++++++++++++- Classes/LinphoneManager.m | 4 +- 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index c2db65be7..45da851d0 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -118,10 +118,77 @@ } } +- (UIUserNotificationCategory*)newMessageNotificationCategory { + + UIMutableUserNotificationAction* reply = [[UIMutableUserNotificationAction alloc] init]; + reply.identifier = @"reply"; + reply.title = NSLocalizedString(@"Reply", nil); + reply.activationMode = UIUserNotificationActivationModeForeground; + reply.destructive = NO; + reply.authenticationRequired = YES; + + UIMutableUserNotificationAction* mark_read = [[UIMutableUserNotificationAction alloc] init]; + mark_read.identifier = @"mark_read"; + mark_read.title = NSLocalizedString(@"Mark Read", nil); + mark_read.activationMode = UIUserNotificationActivationModeBackground; + mark_read.destructive = NO; + mark_read.authenticationRequired = NO; + + + NSArray* localRingActions = @[mark_read, reply]; + + UIMutableUserNotificationCategory* localRingNotifAction = [[UIMutableUserNotificationCategory alloc] init]; + localRingNotifAction.identifier = @"incoming_msg"; + [localRingNotifAction setActions:localRingActions forContext:UIUserNotificationActionContextDefault]; + [localRingNotifAction setActions:localRingActions forContext:UIUserNotificationActionContextMinimal]; + + return localRingNotifAction; +} + +- (UIUserNotificationCategory*)newCallNotificationCategory { + UIMutableUserNotificationAction* Answer = [[UIMutableUserNotificationAction alloc] init]; + Answer.identifier = @"answer"; + Answer.title = NSLocalizedString(@"Answer", nil); + Answer.activationMode = UIUserNotificationActivationModeForeground; + Answer.destructive = NO; + Answer.authenticationRequired = YES; + + UIMutableUserNotificationAction* Decline = [[UIMutableUserNotificationAction alloc] init]; + Decline.identifier = @"decline"; + Decline.title = NSLocalizedString(@"Decline", nil); + Decline.activationMode = UIUserNotificationActivationModeBackground; + Decline.destructive = YES; + Decline.authenticationRequired = NO; + + + NSArray* localRingActions = @[Decline, Answer]; + + UIMutableUserNotificationCategory* localRingNotifAction = [[UIMutableUserNotificationCategory alloc] init]; + localRingNotifAction.identifier = @"incoming_call"; + [localRingNotifAction setActions:localRingActions forContext:UIUserNotificationActionContextDefault]; + [localRingNotifAction setActions:localRingActions forContext:UIUserNotificationActionContextMinimal]; + + return localRingNotifAction; +} + - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeNewsstandContentAvailability]; + + UIApplication* app= [UIApplication sharedApplication]; + + if( [app respondsToSelector:@selector(registerUserNotificationSettings:)] ){ + /* iOS8 notifications can be actioned! Awesome: */ + UIUserNotificationType notifTypes = UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert; + + NSSet* categories = [NSSet setWithObjects:[self newCallNotificationCategory], [self newMessageNotificationCategory], nil]; + UIUserNotificationSettings* userSettings = [UIUserNotificationSettings settingsForTypes:notifTypes categories:categories]; + [app registerUserNotificationSettings:userSettings]; + [app registerForRemoteNotifications]; + } else { + NSUInteger notifTypes = UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeNewsstandContentAvailability; + [app registerForRemoteNotificationTypes:notifTypes]; + } LinphoneManager* instance = [LinphoneManager instance]; @@ -353,6 +420,41 @@ [[LinphoneManager instance] setPushNotificationToken:nil]; } +#pragma mark - User notifications + +- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { + [LinphoneLogger log:LinphoneLoggerLog format:@"%@", NSStringFromSelector(_cmd)]; +} + +- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler { + [LinphoneLogger log:LinphoneLoggerLog format:@"%@", NSStringFromSelector(_cmd)]; + if( [notification.category isEqualToString:@"incoming_call"]) { + if( [identifier isEqualToString:@"answer"] ){ + // use the standard handler + [self application:application didReceiveLocalNotification:notification]; + } else if( [identifier isEqualToString:@"decline"] ){ + LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); + if( call ) linphone_core_decline_call([LinphoneManager getLc], call, LinphoneReasonDeclined); + } + } else if( [notification.category isEqualToString:@"incoming_msg"] ){ + if( [identifier isEqualToString:@"reply"] ){ + // use the standard handler + [self application:application didReceiveLocalNotification:notification]; + } else if( [identifier isEqualToString:@"mark_read"] ){ + LinphoneChatRoom* room = [[notification.userInfo objectForKey:@"room"] pointerValue]; + if( room ){ + linphone_chat_room_mark_as_read(room); + } + + } + } + completionHandler(); +} + +- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler { + completionHandler(); +} + #pragma mark - Remote configuration Functions (URL Handler) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 6e759060d..26b20632c 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -669,6 +669,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char data->timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(localNotifContinue:) userInfo:data->notification repeats:TRUE]; data->notification.repeatInterval = 0; + data->notification.category = @"incoming_call"; data->notification.alertBody =[NSString stringWithFormat:NSLocalizedString(@"IC_MSG",nil), address]; data->notification.alertAction = NSLocalizedString(@"Answer", nil); data->notification.soundName = @"shortring.caf"; @@ -893,10 +894,11 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo UILocalNotification* notif = [[[UILocalNotification alloc] init] autorelease]; if (notif) { notif.repeatInterval = 0; + notif.category = @"@incoming_msg"; notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG",nil), address]; notif.alertAction = NSLocalizedString(@"Show", nil); notif.soundName = @"msg.caf"; - notif.userInfo = @{@"from":from_address }; + notif.userInfo = @{@"from":from_address, @"room":[NSValue valueWithPointer:room] }; [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; From e9d76cfd417f960285a0757e4744176bcc364ef9 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 22 Sep 2014 14:09:26 +0200 Subject: [PATCH 21/51] Fix bad message_ref placement, which lead to crashes --- Classes/ChatRoomTableViewController.m | 2 +- Classes/ChatRoomViewController.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index 323c6943a..e1995274b 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -73,7 +73,7 @@ - (void)addChatEntry:(LinphoneChatMessage*)chat { - messageList = ms_list_append(messageList, chat); + messageList = ms_list_append(messageList, linphone_chat_message_ref(chat)); int pos = ms_list_size(messageList) - 1; [self.tableView beginUpdates]; diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index cdfc82e09..c51b94ca7 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -333,7 +333,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [LinphoneManager setValueInMessageAppData:[internalUrl absoluteString] forKey:@"localimage" inMessage:msg]; } - [tableController addChatEntry:linphone_chat_message_ref(msg)]; + [tableController addChatEntry:msg]; [tableController scrollToBottom:true]; return TRUE; } From 733405e0c684340a56eb863f8dd77d79af19215e Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 22 Sep 2014 14:31:10 +0200 Subject: [PATCH 22/51] Fix new notification handling behavior for messages --- Classes/LinphoneAppDelegate.m | 10 ++++++---- Classes/LinphoneManager.m | 6 +++--- Classes/PhoneMainView.h | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 45da851d0..835b88311 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -427,25 +427,27 @@ } - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler { + LinphoneCore* lc = [LinphoneManager getLc]; [LinphoneLogger log:LinphoneLoggerLog format:@"%@", NSStringFromSelector(_cmd)]; if( [notification.category isEqualToString:@"incoming_call"]) { if( [identifier isEqualToString:@"answer"] ){ // use the standard handler [self application:application didReceiveLocalNotification:notification]; } else if( [identifier isEqualToString:@"decline"] ){ - LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); - if( call ) linphone_core_decline_call([LinphoneManager getLc], call, LinphoneReasonDeclined); + LinphoneCall* call = linphone_core_get_current_call(lc); + if( call ) linphone_core_decline_call(lc, call, LinphoneReasonDeclined); } } else if( [notification.category isEqualToString:@"incoming_msg"] ){ if( [identifier isEqualToString:@"reply"] ){ // use the standard handler [self application:application didReceiveLocalNotification:notification]; } else if( [identifier isEqualToString:@"mark_read"] ){ - LinphoneChatRoom* room = [[notification.userInfo objectForKey:@"room"] pointerValue]; + NSString* from = [notification.userInfo objectForKey:@"from"]; + LinphoneChatRoom* room = linphone_core_get_or_create_chat_room(lc, [from UTF8String]); if( room ){ linphone_chat_room_mark_as_read(room); + [[PhoneMainView instance] updateApplicationBadgeNumber]; } - } } completionHandler(); diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 26b20632c..ee9d64838 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -871,7 +871,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive) { - const LinphoneAddress* remoteAddress = linphone_chat_message_get_from(msg); + const LinphoneAddress* remoteAddress = linphone_chat_message_get_from_address(msg); char* c_address = linphone_address_as_string_uri_only(remoteAddress); NSString* address = [NSString stringWithUTF8String:c_address]; NSString* from_address = [address copy]; @@ -894,11 +894,11 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo UILocalNotification* notif = [[[UILocalNotification alloc] init] autorelease]; if (notif) { notif.repeatInterval = 0; - notif.category = @"@incoming_msg"; + notif.category = @"incoming_msg"; notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG",nil), address]; notif.alertAction = NSLocalizedString(@"Show", nil); notif.soundName = @"msg.caf"; - notif.userInfo = @{@"from":from_address, @"room":[NSValue valueWithPointer:room] }; + notif.userInfo = @{@"from":from_address}; [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index 0c1f5edb9..0586e1619 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -73,6 +73,7 @@ - (void)addInhibitedEvent:(id)event; - (BOOL)removeInhibitedEvent:(id)event; +- (void)updateApplicationBadgeNumber; + (PhoneMainView*) instance; @end From aae8ef1aa2992d9599e915536d0bb7fe9f9a2f50 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 22 Sep 2014 16:17:07 +0200 Subject: [PATCH 23/51] Update Opus to pull ARM assembly optimizations --- submodules/build/builders.d/opus.mk | 4 ++-- submodules/externals/opus | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/build/builders.d/opus.mk b/submodules/build/builders.d/opus.mk index f0e6dcf32..54d816d22 100644 --- a/submodules/build/builders.d/opus.mk +++ b/submodules/build/builders.d/opus.mk @@ -24,10 +24,10 @@ enable_opus?=yes libopus_configure_options=--disable-extra-programs --disable-doc ifneq (,$(findstring armv7,$(host))) - libopus_configure_options+= --enable-fixed-point --disable-asm + libopus_configure_options+= --enable-fixed-point endif ifneq (,$(findstring armv7s,$(host))) - libopus_configure_options+= --enable-fixed-point --disable-asm + libopus_configure_options+= --enable-fixed-point endif $(BUILDER_SRC_DIR)/$(opus_dir)/configure: diff --git a/submodules/externals/opus b/submodules/externals/opus index fcecd29ab..da97db1ca 160000 --- a/submodules/externals/opus +++ b/submodules/externals/opus @@ -1 +1 @@ -Subproject commit fcecd29abf32164326e568acdcdf7d8e877b33b1 +Subproject commit da97db1ca1f92592af3534c9a2596da0e9a009ca From 80b6d865c8f6718a6bc2ec3891e23c76974cdbbf Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 24 Sep 2014 09:48:24 +0200 Subject: [PATCH 24/51] Use a specific class for long press dialer "0" button instead of hardcoding a specific case in base class --- Classes/Base.lproj/DialerViewController.xib | 17 +++++++--- .../Base.lproj/DialerViewController~ipad.xib | 13 +++++-- Classes/LinphoneUI/UIDigitButton.h | 2 +- Classes/LinphoneUI/UIDigitButton.m | 13 ------- Classes/LinphoneUI/UIDigitButtonLongPlus.h | 29 ++++++++++++++++ Classes/LinphoneUI/UIDigitButtonLongPlus.m | 34 +++++++++++++++++++ Classes/LinphoneUI/UIPlusDigitButton.m | 12 +++++++ linphone.xcodeproj/project.pbxproj | 16 ++++++--- submodules/externals/antlr3 | 2 +- submodules/externals/polarssl | 2 +- 10 files changed, 112 insertions(+), 28 deletions(-) create mode 100644 Classes/LinphoneUI/UIDigitButtonLongPlus.h create mode 100644 Classes/LinphoneUI/UIDigitButtonLongPlus.m create mode 100644 Classes/LinphoneUI/UIPlusDigitButton.m diff --git a/Classes/Base.lproj/DialerViewController.xib b/Classes/Base.lproj/DialerViewController.xib index 51f2e90aa..f7461f667 100644 --- a/Classes/Base.lproj/DialerViewController.xib +++ b/Classes/Base.lproj/DialerViewController.xib @@ -1,8 +1,8 @@ - + - - + + @@ -194,7 +194,7 @@ - - - - - - + + + @@ -114,12 +124,26 @@ + + + - \ No newline at end of file + + + + + + From 6065ac73c31d5bdb86f6c066b1cf8fb9c34670a0 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 25 Sep 2014 12:21:43 +0200 Subject: [PATCH 30/51] Add fuzzy search bar in Contacts view --- Classes/Base.lproj/ChatViewController.xib | 19 +- Classes/Base.lproj/ContactsViewController.xib | 26 +- Classes/ChatViewController.m | 3 +- Classes/ContactDetailsTableViewController.m | 3 +- Classes/ContactsTableViewController.m | 414 ++++++++++-------- Classes/ContactsViewController.h | 62 ++- Classes/ContactsViewController.m | 351 ++++++++------- Classes/DialerViewController.m | 75 ++-- Classes/HistoryDetailsViewController.m | 123 +++--- Classes/LinphoneUI/UIMainBar.m | 107 ++--- 10 files changed, 645 insertions(+), 538 deletions(-) diff --git a/Classes/Base.lproj/ChatViewController.xib b/Classes/Base.lproj/ChatViewController.xib index 878b38caf..4f30247c4 100644 --- a/Classes/Base.lproj/ChatViewController.xib +++ b/Classes/Base.lproj/ChatViewController.xib @@ -1,8 +1,7 @@ - + - - + @@ -91,14 +90,11 @@ + + - - - - - @@ -113,4 +109,9 @@ - \ No newline at end of file + + + + + + diff --git a/Classes/Base.lproj/ContactsViewController.xib b/Classes/Base.lproj/ContactsViewController.xib index d16430f4d..ab36f8c0b 100644 --- a/Classes/Base.lproj/ContactsViewController.xib +++ b/Classes/Base.lproj/ContactsViewController.xib @@ -1,8 +1,8 @@ - + - - + + @@ -11,6 +11,7 @@ + @@ -21,7 +22,7 @@ - + @@ -109,11 +110,21 @@ + + + + + + + + + + @@ -127,4 +138,9 @@ - \ No newline at end of file + + + + + + diff --git a/Classes/ChatViewController.m b/Classes/ChatViewController.m index 73e3878bd..61b3cdbba 100644 --- a/Classes/ChatViewController.m +++ b/Classes/ChatViewController.m @@ -123,7 +123,8 @@ static UICompositeViewDescription *compositeDescription = nil; [ContactSelection setSelectionMode:ContactSelectionModeMessage]; [ContactSelection setAddAddress:nil]; [ContactSelection setSipFilter: [LinphoneManager instance].contactFilter]; - [ContactSelection setEmailFilter:FALSE]; + [ContactSelection enableEmailFilter:FALSE]; + [ContactSelection setNameOrEmailFilter:nil]; [[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE]; } else { [self startChatRoom]; diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index de95d9679..ee3ebf4f8 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -207,7 +207,8 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe if(CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey), kCFCompareCaseInsensitive) == 0) { add = true; } - } else { //check domain + } else { + //check domain LinphoneAddress* address = linphone_address_new([(NSString*)CFDictionaryGetValue(lDict,kABPersonInstantMessageUsernameKey) UTF8String]); if (address) { if ([[ContactSelection getSipFilter] compare:@"*" options:NSCaseInsensitiveSearch] == NSOrderedSame) { diff --git a/Classes/ContactsTableViewController.m b/Classes/ContactsTableViewController.m index 459f86e4e..c591b5dbc 100644 --- a/Classes/ContactsTableViewController.m +++ b/Classes/ContactsTableViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "ContactsTableViewController.h" #import "UIContactCell.h" @@ -33,237 +33,273 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf #pragma mark - Lifecycle Functions - (void)initContactsTableViewController { - addressBookMap = [[OrderedDictionary alloc] init]; - avatarMap = [[NSMutableDictionary alloc] init]; - - addressBook = ABAddressBookCreateWithOptions(nil, nil); - - ABAddressBookRegisterExternalChangeCallback(addressBook, sync_address_book, self); + addressBookMap = [[OrderedDictionary alloc] init]; + avatarMap = [[NSMutableDictionary alloc] init]; + + addressBook = ABAddressBookCreateWithOptions(nil, nil); + + ABAddressBookRegisterExternalChangeCallback(addressBook, sync_address_book, self); } - (id)init { - self = [super init]; - if (self) { + self = [super init]; + if (self) { [self initContactsTableViewController]; - } - return self; + } + return self; } - (id)initWithCoder:(NSCoder *)decoder { - self = [super initWithCoder:decoder]; - if (self) { + self = [super initWithCoder:decoder]; + if (self) { [self initContactsTableViewController]; } - return self; -} + return self; +} - (void)dealloc { - ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self); - CFRelease(addressBook); - [addressBookMap release]; - [avatarMap release]; - [super dealloc]; + ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self); + CFRelease(addressBook); + [addressBookMap release]; + [avatarMap release]; + [super dealloc]; } -#pragma mark - +#pragma mark - + +- (BOOL)contactHasValidSipDomain:(ABRecordRef)person { + // Check if one of the contact' sip URI matches the expected SIP filter + ABMultiValueRef personSipAddresses = ABRecordCopyValue(person, kABPersonInstantMessageProperty); + BOOL match = false; + NSString * filter = [ContactSelection getSipFilter]; + + for(int i = 0; i < ABMultiValueGetCount(personSipAddresses) && !match; ++i) { + CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(personSipAddresses, i); + if(CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { + CFStringRef serviceKey = CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey); + + if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, serviceKey, kCFCompareCaseInsensitive) == 0) { + match = true; + } + } else { + //check domain + LinphoneAddress* address = linphone_address_new([(NSString*)CFDictionaryGetValue(lDict,kABPersonInstantMessageUsernameKey) UTF8String]); + + if (address) { + NSString* domain = [NSString stringWithCString:linphone_address_get_domain(address) + encoding:[NSString defaultCStringEncoding]]; + + if (([filter compare:@"*" options:NSCaseInsensitiveSearch] == NSOrderedSame) + || ([filter compare:domain options:NSCaseInsensitiveSearch] == NSOrderedSame)) { + match = true; + } + linphone_address_destroy(address); + } + } + CFRelease(lDict); + } + return match; +} + +static int ms_strcmpfuz(const char * fuzzy_word, const char * sentence) { + if (! fuzzy_word || !sentence) { + return fuzzy_word == sentence; + } + const char * c = fuzzy_word; + const char * within_sentence = sentence; + for (; c != NULL && *c != '\0' && within_sentence != NULL; ++c) { + within_sentence = strchr(within_sentence, *c); + // Could not find c character in sentence. Abort. + if (within_sentence == NULL) { + break; + } + // since strchr returns the index of the matched char, move forward + within_sentence++; + } + + // If the whole fuzzy was found, returns 0. Otherwise returns number of characters left. + return (within_sentence != NULL ? 0 : fuzzy_word + strlen(fuzzy_word) - c); +} - (void)loadData { - [LinphoneLogger logc:LinphoneLoggerLog format:"Load contact list"]; - @synchronized (addressBookMap) { - - // Reset Address book - [addressBookMap removeAllObjects]; - - NSArray *lContacts = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); - for (id lPerson in lContacts) { - BOOL add = true; - if([ContactSelection getSipFilter] || [ContactSelection getEmailFilter]) { - add = false; - } - if([ContactSelection getSipFilter]) { - ABMultiValueRef lMap = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonInstantMessageProperty); - for(int i = 0; i < ABMultiValueGetCount(lMap); ++i) { - CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, i); - if(CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { - CFStringRef serviceKey = CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey); - CFStringRef username = username=CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey); - if(CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, serviceKey, kCFCompareCaseInsensitive) == 0) { - add = true; - } else { - add=false; + [LinphoneLogger logc:LinphoneLoggerLog format:"Load contact list"]; + @synchronized (addressBookMap) { + + // Reset Address book + [addressBookMap removeAllObjects]; + + NSArray *lContacts = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); + for (id lPerson in lContacts) { + BOOL add = true; + ABRecordRef person = (ABRecordRef)lPerson; + + // Do not add the contact directly if we set some filter + if([ContactSelection getSipFilter] || [ContactSelection emailFilterEnabled]) { + add = false; + } + if([ContactSelection getSipFilter] && [self contactHasValidSipDomain:person]) { + add = true; + } + if (!add && [ContactSelection emailFilterEnabled]) { + ABMultiValueRef personEmailAddresses = ABRecordCopyValue(person, kABPersonEmailProperty); + // Add this contact if it has an email + add = (ABMultiValueGetCount(personEmailAddresses) > 0); + + CFRelease(personEmailAddresses); + } + + if(add) { + CFStringRef lFirstName = ABRecordCopyValue(person, kABPersonFirstNameProperty); + CFStringRef lLocalizedFirstName = (lFirstName != nil)? ABAddressBookCopyLocalizedLabel(lFirstName): nil; + CFStringRef lLastName = ABRecordCopyValue(person, kABPersonLastNameProperty); + CFStringRef lLocalizedLastName = (lLastName != nil)? ABAddressBookCopyLocalizedLabel(lLastName): nil; + CFStringRef lOrganization = ABRecordCopyValue(person, kABPersonOrganizationProperty); + CFStringRef lLocalizedlOrganization = (lOrganization != nil)? ABAddressBookCopyLocalizedLabel(lOrganization): nil; + NSString *name = nil; + if(lLocalizedFirstName != nil && lLocalizedLastName != nil) { + name=[NSString stringWithFormat:@"%@ %@", [(NSString *)lLocalizedFirstName retain], [(NSString *)lLocalizedLastName retain]]; + } else if(lLocalizedLastName != nil) { + name=[NSString stringWithFormat:@"%@",[(NSString *)lLocalizedLastName retain]]; + } else if(lLocalizedFirstName != nil) { + name=[NSString stringWithFormat:@"%@",[(NSString *)lLocalizedFirstName retain]]; + } else if(lLocalizedlOrganization != nil) { + name=[NSString stringWithFormat:@"%@",[(NSString *)lLocalizedlOrganization retain]]; + } + + if(name != nil && [name length] > 0) { + // Add the contact only if it fuzzy match filter too (if any) + if ([ContactSelection getNameOrEmailFilter] == nil || + (ms_strcmpfuz([[[ContactSelection getNameOrEmailFilter] lowercaseString] UTF8String], [[name lowercaseString] UTF8String]) == 0)) { + + // Put in correct subDic + NSString *firstChar = [[name substringToIndex:1] uppercaseString]; + if([firstChar characterAtIndex:0] < 'A' || [firstChar characterAtIndex:0] > 'Z') { + firstChar = @"#"; } - } else { - //check domain - LinphoneAddress* address = linphone_address_new([(NSString*)CFDictionaryGetValue(lDict,kABPersonInstantMessageUsernameKey) UTF8String]); - if (address) { - if ([[ContactSelection getSipFilter] compare:@"*" options:NSCaseInsensitiveSearch] == NSOrderedSame) { - add = true; - } else { - NSString* domain = [NSString stringWithCString:linphone_address_get_domain(address) - encoding:[NSString defaultCStringEncoding]]; - add = [domain compare:[ContactSelection getSipFilter] options:NSCaseInsensitiveSearch] == NSOrderedSame; - } - linphone_address_destroy(address); - } else { - add = false; - } - } - CFRelease(lDict); - } - CFRelease(lMap); - } - if ((add == false) && [ContactSelection getEmailFilter]) { - ABMultiValueRef lMap = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonEmailProperty); - if (ABMultiValueGetCount(lMap) > 0) { - add = true; - } - CFRelease(lMap); - } - if(add) { - CFStringRef lFirstName = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonFirstNameProperty); - CFStringRef lLocalizedFirstName = (lFirstName != nil)? ABAddressBookCopyLocalizedLabel(lFirstName): nil; - CFStringRef lLastName = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonLastNameProperty); - CFStringRef lLocalizedLastName = (lLastName != nil)? ABAddressBookCopyLocalizedLabel(lLastName): nil; - CFStringRef lOrganization = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonOrganizationProperty); - CFStringRef lLocalizedlOrganization = (lOrganization != nil)? ABAddressBookCopyLocalizedLabel(lOrganization): nil; - NSString *name = nil; - if(lLocalizedFirstName != nil && lLocalizedLastName != nil) { - name=[NSString stringWithFormat:@"%@%@", [(NSString *)lLocalizedFirstName retain], [(NSString *)lLocalizedLastName retain]]; - } else if(lLocalizedLastName != nil) { - name=[NSString stringWithFormat:@"%@",[(NSString *)lLocalizedLastName retain]]; - } else if(lLocalizedFirstName != nil) { - name=[NSString stringWithFormat:@"%@",[(NSString *)lLocalizedFirstName retain]]; - } else if(lLocalizedlOrganization != nil) { - name=[NSString stringWithFormat:@"%@",[(NSString *)lLocalizedlOrganization retain]]; - } - if(name != nil && [name length] > 0) { - // Put in correct subDic - NSString *firstChar = [[name substringToIndex:1] uppercaseString]; - if([firstChar characterAtIndex:0] < 'A' || [firstChar characterAtIndex:0] > 'Z') { - firstChar = @"#"; - } - OrderedDictionary *subDic =[addressBookMap objectForKey: firstChar]; - if(subDic == nil) { - subDic = [[[OrderedDictionary alloc] init] autorelease]; - [addressBookMap insertObject:subDic forKey:firstChar selector:@selector(caseInsensitiveCompare:)]; - } - [subDic insertObject:lPerson forKey:name selector:@selector(caseInsensitiveCompare:)]; - } - if(lLocalizedlOrganization != nil) - CFRelease(lLocalizedlOrganization); - if(lOrganization != nil) - CFRelease(lOrganization); - if(lLocalizedLastName != nil) - CFRelease(lLocalizedLastName); - if(lLastName != nil) - CFRelease(lLastName); - if(lLocalizedFirstName != nil) - CFRelease(lLocalizedFirstName); - if(lFirstName != nil) - CFRelease(lFirstName); - } - } - if (lContacts) CFRelease(lContacts); - } - [self.tableView reloadData]; + OrderedDictionary *subDic =[addressBookMap objectForKey: firstChar]; + if(subDic == nil) { + subDic = [[[OrderedDictionary alloc] init] autorelease]; + [addressBookMap insertObject:subDic forKey:firstChar selector:@selector(caseInsensitiveCompare:)]; + } + [subDic insertObject:lPerson forKey:name selector:@selector(caseInsensitiveCompare:)]; + } + } + if(lLocalizedlOrganization != nil) + CFRelease(lLocalizedlOrganization); + if(lOrganization != nil) + CFRelease(lOrganization); + if(lLocalizedLastName != nil) + CFRelease(lLocalizedLastName); + if(lLastName != nil) + CFRelease(lLastName); + if(lLocalizedFirstName != nil) + CFRelease(lLocalizedFirstName); + if(lFirstName != nil) + CFRelease(lFirstName); + } + } + if (lContacts) + CFRelease(lContacts); + } + [self.tableView reloadData]; } static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef info, void *context) { - ContactsTableViewController* controller = (ContactsTableViewController*)context; - ABAddressBookRevert(addressBook); - [controller->avatarMap removeAllObjects]; - [controller loadData]; + ContactsTableViewController* controller = (ContactsTableViewController*)context; + ABAddressBookRevert(addressBook); + [controller->avatarMap removeAllObjects]; + [controller loadData]; } #pragma mark - ViewController Functions - (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; + [super viewWillDisappear:animated]; } #pragma mark - UITableViewDataSource Functions - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { - return [addressBookMap allKeys]; + return [addressBookMap allKeys]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return [addressBookMap count]; + return [addressBookMap count]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [(OrderedDictionary *)[addressBookMap objectForKey: [addressBookMap keyAtIndex: section]] count]; + return [(OrderedDictionary *)[addressBookMap objectForKey: [addressBookMap keyAtIndex: section]] count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *kCellId = @"UIContactCell"; - UIContactCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId]; - if (cell == nil) { - cell = [[[UIContactCell alloc] initWithIdentifier:kCellId] autorelease]; - - // Background View - UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease]; - cell.selectedBackgroundView = selectedBackgroundView; - [selectedBackgroundView setBackgroundColor:LINPHONE_TABLE_CELL_BACKGROUND_COLOR]; - } - OrderedDictionary *subDic = [addressBookMap objectForKey: [addressBookMap keyAtIndex: [indexPath section]]]; - - NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]]; - ABRecordRef contact = [subDic objectForKey:key]; - - // Cached avatar - UIImage *image = nil; - id data = [avatarMap objectForKey:[NSNumber numberWithInt: ABRecordGetRecordID(contact)]]; - if(data == nil) { - image = [FastAddressBook getContactImage:contact thumbnail:true]; - if(image != nil) { - [avatarMap setObject:image forKey:[NSNumber numberWithInt: ABRecordGetRecordID(contact)]]; - } else { - [avatarMap setObject:[NSNull null] forKey:[NSNumber numberWithInt: ABRecordGetRecordID(contact)]]; - } - } else if(data != [NSNull null]) { - image = data; - } - if(image == nil) { - image = [UIImage imageNamed:@"avatar_unknown_small.png"]; - } - [[cell avatarImage] setImage:image]; - - [cell setContact: contact]; - return cell; + static NSString *kCellId = @"UIContactCell"; + UIContactCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId]; + if (cell == nil) { + cell = [[[UIContactCell alloc] initWithIdentifier:kCellId] autorelease]; + + // Background View + UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease]; + cell.selectedBackgroundView = selectedBackgroundView; + [selectedBackgroundView setBackgroundColor:LINPHONE_TABLE_CELL_BACKGROUND_COLOR]; + } + OrderedDictionary *subDic = [addressBookMap objectForKey: [addressBookMap keyAtIndex: [indexPath section]]]; + + NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]]; + ABRecordRef contact = [subDic objectForKey:key]; + + // Cached avatar + UIImage *image = nil; + id data = [avatarMap objectForKey:[NSNumber numberWithInt: ABRecordGetRecordID(contact)]]; + if(data == nil) { + image = [FastAddressBook getContactImage:contact thumbnail:true]; + if(image != nil) { + [avatarMap setObject:image forKey:[NSNumber numberWithInt: ABRecordGetRecordID(contact)]]; + } else { + [avatarMap setObject:[NSNull null] forKey:[NSNumber numberWithInt: ABRecordGetRecordID(contact)]]; + } + } else if(data != [NSNull null]) { + image = data; + } + if(image == nil) { + image = [UIImage imageNamed:@"avatar_unknown_small.png"]; + } + [[cell avatarImage] setImage:image]; + + [cell setContact: contact]; + return cell; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - return [addressBookMap keyAtIndex: section]; + return [addressBookMap keyAtIndex: section]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - OrderedDictionary *subDic = [addressBookMap objectForKey: [addressBookMap keyAtIndex: [indexPath section]]]; - ABRecordRef lPerson = [subDic objectForKey: [subDic keyAtIndex:[indexPath row]]]; - - // Go to Contact details view - ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController); - if(controller != nil) { - if([ContactSelection getSelectionMode] != ContactSelectionModeEdit) { - [controller setContact:lPerson]; - } else { - [controller editContact:lPerson address:[ContactSelection getAddAddress]]; - } - } + OrderedDictionary *subDic = [addressBookMap objectForKey: [addressBookMap keyAtIndex: [indexPath section]]]; + ABRecordRef lPerson = [subDic objectForKey: [subDic keyAtIndex:[indexPath row]]]; + + // Go to Contact details view + ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController); + if(controller != nil) { + if([ContactSelection getSelectionMode] != ContactSelectionModeEdit) { + [controller setContact:lPerson]; + } else { + [controller editContact:lPerson address:[ContactSelection getAddAddress]]; + } + } } #pragma mark - UITableViewDelegate Functions - (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { - // Detemine if it's in editing mode - if (self.editing) { - return UITableViewCellEditingStyleDelete; - } - return UITableViewCellEditingStyleNone; + // Detemine if it's in editing mode + if (self.editing) { + return UITableViewCellEditingStyleDelete; + } + return UITableViewCellEditingStyleNone; } @end diff --git a/Classes/ContactsViewController.h b/Classes/ContactsViewController.h index c580d82bf..a7a91c866 100644 --- a/Classes/ContactsViewController.h +++ b/Classes/ContactsViewController.h @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import #import @@ -30,18 +30,48 @@ typedef enum _ContactSelectionMode { ContactSelectionModeMessage } ContactSelectionMode; -@interface ContactSelection : NSObject { +@interface ContactSelection : NSObject { } + (void)setSelectionMode:(ContactSelectionMode)selectionMode; + (ContactSelectionMode)getSelectionMode; + (void)setAddAddress:(NSString*)address; + (NSString*)getAddAddress; -/* define sip filter, can be * or sip domain*/ +/*! + * Filters contacts by SIP domain. + * @param domain SIP domain to filter. Use @"*" or nil to disable it. + */ + (void)setSipFilter:(NSString*) domain; + +/*! + * Weither contacts are filtered by SIP domain or not. + * @return the filter used, or nil if none. + */ + (NSString*)getSipFilter; -+ (void)setEmailFilter:(BOOL)enable; -+ (BOOL)getEmailFilter; + +/*! + * Weither always keep contacts with an email address or not. + * @param enable TRUE if you want to always keep contacts with an email. + */ ++ (void)enableEmailFilter:(BOOL)enable; + +/*! + * Weither always keep contacts with an email address or not. + * @return TRUE if this behaviour is enabled. + */ ++ (BOOL)emailFilterEnabled; + +/*! + * Filters contacts by name and/or email fuzzy matching pattern. + * @param fuzzyName fuzzy word to match. Use nil to disable it. + */ ++ (void)setNameOrEmailFilter:(NSString*)fuzzyName; + +/*! + * Weither contacts are filtered by name and/or email. + * @return the filter used, or nil if none. + */ ++ (NSString*)getNameOrEmailFilter; @end @@ -57,10 +87,12 @@ typedef enum _ContactSelectionMode { @property (nonatomic, retain) IBOutlet UIButton* linphoneButton; @property (nonatomic, retain) IBOutlet UIButton *backButton; @property (nonatomic, retain) IBOutlet UIButton *addButton; +@property (retain, nonatomic) IBOutlet UISearchBar *searchBar; - (IBAction)onAllClick:(id)event; - (IBAction)onLinphoneClick:(id)event; - (IBAction)onAddContactClick:(id)event; - (IBAction)onBackClick:(id)event; +- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText; @end diff --git a/Classes/ContactsViewController.m b/Classes/ContactsViewController.m index 621f3c13f..b2a898eba 100644 --- a/Classes/ContactsViewController.m +++ b/Classes/ContactsViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "ContactsViewController.h" #import "PhoneMainView.h" @@ -28,47 +28,58 @@ static ContactSelectionMode sSelectionMode = ContactSelectionModeNone; static NSString* sAddAddress = nil; static NSString* sSipFilter = nil; -static BOOL sEmailFilter = FALSE; +static BOOL sEnableEmailFilter = FALSE; +static NSString* sNameOrEmailFilter; + (void)setSelectionMode:(ContactSelectionMode)selectionMode { - sSelectionMode = selectionMode; + sSelectionMode = selectionMode; } + (ContactSelectionMode)getSelectionMode { - return sSelectionMode; + return sSelectionMode; } + (void)setAddAddress:(NSString*)address { - if(sAddAddress != nil) { - [sAddAddress release]; - sAddAddress= nil; - } - if(address != nil) { - sAddAddress = [address retain]; - } + if(sAddAddress != nil) { + [sAddAddress release]; + sAddAddress= nil; + } + if(address != nil) { + sAddAddress = [address retain]; + } } + (NSString*)getAddAddress { - return sAddAddress; + return sAddAddress; } + (void)setSipFilter:(NSString*)domain { - [sSipFilter release]; + [sSipFilter release]; sSipFilter = [domain retain]; } + (NSString*)getSipFilter { - return sSipFilter; + return sSipFilter; } -+ (void)setEmailFilter:(BOOL)enable { - sEmailFilter = enable; ++ (void)enableEmailFilter:(BOOL)enable { + sEnableEmailFilter = enable; } -+ (BOOL)getEmailFilter { - return sEmailFilter; ++ (BOOL)emailFilterEnabled { + return sEnableEmailFilter; } ++ (void)setNameOrEmailFilter:(NSString*)fuzzyName { + [sNameOrEmailFilter release]; + sNameOrEmailFilter = [fuzzyName retain]; +} + ++ (NSString*)getNameOrEmailFilter { + return sNameOrEmailFilter; +} + + @end @implementation ContactsViewController @@ -85,28 +96,30 @@ static BOOL sEmailFilter = FALSE; @synthesize toolBar; typedef enum _HistoryView { - History_All, - History_Linphone, - History_MAX + History_All, + History_Linphone, + History_Search, + History_MAX } HistoryView; #pragma mark - Lifecycle Functions - (id)init { - return [super initWithNibName:@"ContactsViewController" bundle:[NSBundle mainBundle]]; + return [super initWithNibName:@"ContactsViewController" bundle:[NSBundle mainBundle]]; } - (void)dealloc { - [tableController release]; - [tableView release]; - - [allButton release]; - [linphoneButton release]; - [backButton release]; - [addButton release]; - - [super dealloc]; + [tableController release]; + [tableView release]; + + [allButton release]; + [linphoneButton release]; + [backButton release]; + [addButton release]; + + [_searchBar release]; + [super dealloc]; } #pragma mark - UICompositeViewDelegate Functions @@ -114,181 +127,181 @@ typedef enum _HistoryView { static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { - if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"Contacts" - content:@"ContactsViewController" - stateBar:nil - stateBarEnabled:false - tabBar:@"UIMainBar" - tabBarEnabled:true - fullscreen:false - landscapeMode:[LinphoneManager runningOnIpad] - portraitMode:true]; - } - return compositeDescription; + if(compositeDescription == nil) { + compositeDescription = [[UICompositeViewDescription alloc] init:@"Contacts" + content:@"ContactsViewController" + stateBar:nil + stateBarEnabled:false + tabBar:@"UIMainBar" + tabBarEnabled:true + fullscreen:false + landscapeMode:[LinphoneManager runningOnIpad] + portraitMode:true]; + } + return compositeDescription; } #pragma mark - ViewController Functions - (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; + [super viewWillDisappear:animated]; } - (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - BOOL use_system = [[LinphoneManager instance] lpConfigBoolForKey:@"use_system_contacts"]; - if( use_system && !self.sysViewController){// use system contacts - ABPeoplePickerNavigationController* picker = [[ABPeoplePickerNavigationController alloc] init]; - picker.peoplePickerDelegate = self; - picker.view.frame = self.view.frame; + [super viewWillAppear:animated]; - [self.view addSubview:picker.view]; + BOOL use_system = [[LinphoneManager instance] lpConfigBoolForKey:@"use_system_contacts"]; + if( use_system && !self.sysViewController){// use system contacts + ABPeoplePickerNavigationController* picker = [[ABPeoplePickerNavigationController alloc] init]; + picker.peoplePickerDelegate = self; + picker.view.frame = self.view.frame; - self.sysViewController = picker; + [self.view addSubview:picker.view]; - } else if( !use_system && !self.tableController ){ + self.sysViewController = picker; - CGRect subViewFrame= self.view.frame; - // let the toolBar be visible - subViewFrame.origin.y += self.toolBar.frame.size.height; - subViewFrame.size.height -= self.toolBar.frame.size.height; + } else if( !use_system && !self.tableController ){ - self.tableController = [[[ContactsTableViewController alloc] init] autorelease]; - self.tableView = [[[UITableView alloc] init] autorelease]; + CGRect subViewFrame= self.view.frame; + // let the toolBar be visible + subViewFrame.origin.y += self.toolBar.frame.size.height; + subViewFrame.size.height -= self.toolBar.frame.size.height; - self.tableController.view = self.tableView; - self.tableView.frame = subViewFrame; + self.tableController = [[[ContactsTableViewController alloc] init] autorelease]; + self.tableView = [[[UITableView alloc] init] autorelease]; - self.tableView.dataSource = self.tableController; - self.tableView.delegate = self.tableController; + self.tableController.view = self.tableView; + self.tableView.frame = subViewFrame; - self.tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | - UIViewAutoresizingFlexibleWidth | - UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin; + self.tableView.dataSource = self.tableController; + self.tableView.delegate = self.tableController; - [self.view addSubview:tableView]; - [self update]; - } + self.tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleTopMargin | + UIViewAutoresizingFlexibleBottomMargin | + UIViewAutoresizingFlexibleLeftMargin | + UIViewAutoresizingFlexibleRightMargin; + + [self.view addSubview:tableView]; + [self update]; + } } - (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - if(![FastAddressBook isAuthorized]) { - UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Address book",nil) + [super viewDidAppear:animated]; + if(![FastAddressBook isAuthorized]) { + UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Address book",nil) message:NSLocalizedString(@"You must authorize the application to have access to address book.\n" - "Toggle the application in Settings > Privacy > Contacts",nil) + "Toggle the application in Settings > Privacy > Contacts",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"Continue",nil) otherButtonTitles:nil]; [error show]; [error release]; - [[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]]; - } + [[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]]; + } } - (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; + [super viewDidDisappear:animated]; } - (void)viewDidLoad { - [super viewDidLoad]; - - [self changeView:History_All]; - - // Set selected+over background: IB lack ! - [linphoneButton setBackgroundImage:[UIImage imageNamed:@"contacts_linphone_selected.png"] - forState:(UIControlStateHighlighted | UIControlStateSelected)]; - - [linphoneButton setTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] + [super viewDidLoad]; + + [self changeView:History_All]; + + // Set selected+over background: IB lack ! + [linphoneButton setBackgroundImage:[UIImage imageNamed:@"contacts_linphone_selected.png"] + forState:(UIControlStateHighlighted | UIControlStateSelected)]; + + [linphoneButton setTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] forState:UIControlStateNormal]; - + [LinphoneUtils buttonFixStates:linphoneButton]; - - // Set selected+over background: IB lack ! - [allButton setBackgroundImage:[UIImage imageNamed:@"contacts_all_selected.png"] - forState:(UIControlStateHighlighted | UIControlStateSelected)]; - - [LinphoneUtils buttonFixStates:allButton]; - - [tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4 - [tableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4 + + // Set selected+over background: IB lack ! + [allButton setBackgroundImage:[UIImage imageNamed:@"contacts_all_selected.png"] + forState:(UIControlStateHighlighted | UIControlStateSelected)]; + + [LinphoneUtils buttonFixStates:allButton]; + + [tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4 + [tableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4 } #pragma mark - - (void)changeView:(HistoryView)view { - if(view == History_All) { - [ContactSelection setSipFilter:nil]; - [ContactSelection setEmailFilter:FALSE]; - [tableController loadData]; - allButton.selected = TRUE; - } else { - allButton.selected = FALSE; - } + if(view == History_All) { + [ContactSelection setSipFilter:nil]; + [ContactSelection enableEmailFilter:FALSE]; + [tableController loadData]; + allButton.selected = TRUE; + } else { + allButton.selected = FALSE; + } - if(view == History_Linphone) { - [ContactSelection setSipFilter:[LinphoneManager instance].contactFilter]; - [ContactSelection setEmailFilter:FALSE]; - [tableController loadData]; - linphoneButton.selected = TRUE; - } else { - linphoneButton.selected = FALSE; - } + if(view == History_Linphone) { + [ContactSelection setSipFilter:[LinphoneManager instance].contactFilter]; + [ContactSelection enableEmailFilter:FALSE]; + [tableController loadData]; + linphoneButton.selected = TRUE; + } else { + linphoneButton.selected = FALSE; + } } - (void)update { - switch ([ContactSelection getSelectionMode]) { - case ContactSelectionModePhone: - case ContactSelectionModeMessage: - [addButton setHidden:TRUE]; - [backButton setHidden:FALSE]; - break; - default: - [addButton setHidden:FALSE]; - [backButton setHidden:TRUE]; - break; - } - if([ContactSelection getSipFilter]) { - allButton.selected = FALSE; - linphoneButton.selected = TRUE; - } else { - allButton.selected = TRUE; - linphoneButton.selected = FALSE; - } - [tableController loadData]; + switch ([ContactSelection getSelectionMode]) { + case ContactSelectionModePhone: + case ContactSelectionModeMessage: + [addButton setHidden:TRUE]; + [backButton setHidden:FALSE]; + break; + default: + [addButton setHidden:FALSE]; + [backButton setHidden:TRUE]; + break; + } + if([ContactSelection getSipFilter]) { + allButton.selected = FALSE; + linphoneButton.selected = TRUE; + } else { + allButton.selected = TRUE; + linphoneButton.selected = FALSE; + } + [tableController loadData]; } #pragma mark - Action Functions - (IBAction)onAllClick:(id)event { - [self changeView: History_All]; + [self changeView: History_All]; } - (IBAction)onLinphoneClick:(id)event { - [self changeView: History_Linphone]; + [self changeView: History_Linphone]; } - (IBAction)onAddContactClick:(id)event { - // Go to Contact details view - ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController); - if(controller != nil) { - if([ContactSelection getAddAddress] == nil) { - [controller newContact]; - } else { - [controller newContact:[ContactSelection getAddAddress]]; - } - } + // Go to Contact details view + ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController); + if(controller != nil) { + if([ContactSelection getAddAddress] == nil) { + [controller newContact]; + } else { + [controller newContact:[ContactSelection getAddAddress]]; + } + } } - (IBAction)onBackClick:(id)event { - [[PhoneMainView instance] popCurrentView]; + [[PhoneMainView instance] popCurrentView]; } @@ -296,8 +309,8 @@ static UICompositeViewDescription *compositeDescription = nil; -(void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker { - [[PhoneMainView instance] popCurrentView]; - return; + [[PhoneMainView instance] popCurrentView]; + return; } - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker @@ -314,19 +327,23 @@ static UICompositeViewDescription *compositeDescription = nil; CFTypeRef multiValue = ABRecordCopyValue(person, property); CFIndex valueIdx = ABMultiValueGetIndexForIdentifier(multiValue,identifier); NSString *phoneNumber = (NSString *)ABMultiValueCopyValueAtIndex(multiValue, valueIdx); - // Go to dialer view - DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); - if(controller != nil) { - [controller call:phoneNumber displayName:[(NSString*)ABRecordCopyCompositeName(person) autorelease]]; - } - [phoneNumber release]; - CFRelease(multiValue); + // Go to dialer view + DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); + if(controller != nil) { + [controller call:phoneNumber displayName:[(NSString*)ABRecordCopyCompositeName(person) autorelease]]; + } + [phoneNumber release]; + CFRelease(multiValue); return false; } +- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { + [ContactSelection setNameOrEmailFilter:searchText]; + [tableController loadData]; +} - (void)viewDidUnload { - [self setToolBar:nil]; - [super viewDidUnload]; + [self setToolBar:nil]; + [super viewDidUnload]; } @end diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index 7a0a37efe..2f809a90f 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import #import @@ -76,7 +76,7 @@ [callButton release]; [addCallButton release]; [transferButton release]; - + [oneButton release]; [twoButton release]; [threeButton release]; @@ -89,13 +89,13 @@ [starButton release]; [zeroButton release]; [sharpButton release]; - + [videoPreview release]; [videoCameraSwitch release]; - + // Remove all observers [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [super dealloc]; } @@ -106,12 +106,12 @@ static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"Dialer" - content:@"DialerViewController" - stateBar:@"UIStateBar" - stateBarEnabled:true - tabBar:@"UIMainBar" - tabBarEnabled:true + compositeDescription = [[UICompositeViewDescription alloc] init:@"Dialer" + content:@"DialerViewController" + stateBar:@"UIStateBar" + stateBarEnabled:true + tabBar:@"UIMainBar" + tabBarEnabled:true fullscreen:false landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; @@ -124,13 +124,13 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - + // Set observer - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(callUpdateEvent:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(callUpdateEvent:) name:kLinphoneCallUpdate object:nil]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(coreUpdateEvent:) name:kLinphoneCoreUpdate @@ -178,16 +178,16 @@ static UICompositeViewDescription *compositeDescription = nil; #endif } -} +} - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - + // Remove observer - [[NSNotificationCenter defaultCenter] removeObserver:self + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil]; - + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCoreUpdate object:nil]; @@ -195,7 +195,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidLoad { [super viewDidLoad]; - + [zeroButton setDigit:'0']; [oneButton setDigit:'1']; [twoButton setDigit:'2']; @@ -208,9 +208,9 @@ static UICompositeViewDescription *compositeDescription = nil; [nineButton setDigit:'9']; [starButton setDigit:'*']; [sharpButton setDigit:'#']; - + [addressField setAdjustsFontSizeToFitWidth:TRUE]; // Not put it in IB: issue with placeholder size - + if([LinphoneManager runningOnIpad]) { if ([LinphoneManager instance].frontCamId != nil) { // only show camera switch button if we have more than 1 camera @@ -248,7 +248,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - Event Functions -- (void)callUpdateEvent:(NSNotification*)notif { +- (void)callUpdateEvent:(NSNotification*)notif { LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue]; LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue]; [self callUpdate:call state:state]; @@ -283,7 +283,7 @@ static UICompositeViewDescription *compositeDescription = nil; [transferButton setHidden:true]; } [callButton setHidden:true]; - [backButton setHidden:false]; + [backButton setHidden:false]; [addContactButton setHidden:true]; } else { [addCallButton setHidden:true]; @@ -330,7 +330,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == addressField) { [addressField resignFirstResponder]; - } + } return YES; } @@ -341,10 +341,11 @@ static UICompositeViewDescription *compositeDescription = nil; [ContactSelection setSelectionMode:ContactSelectionModeEdit]; [ContactSelection setAddAddress:[addressField text]]; [ContactSelection setSipFilter:nil]; - [ContactSelection setEmailFilter:FALSE]; + [ContactSelection setNameOrEmailFilter:nil]; + [ContactSelection enableEmailFilter:FALSE]; ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController); if(controller != nil) { - + } } diff --git a/Classes/HistoryDetailsViewController.m b/Classes/HistoryDetailsViewController.m index dfaf43580..e327e4040 100644 --- a/Classes/HistoryDetailsViewController.m +++ b/Classes/HistoryDetailsViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "HistoryDetailsViewController.h" #import "PhoneMainView.h" @@ -55,10 +55,10 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [dateFormatter release]; [callLogId release]; - + [avatarImage release]; [addressLabel release]; [dateLabel release]; @@ -72,7 +72,7 @@ [callButton release]; [messageButton release]; [addContactButton release]; - + [super dealloc]; } @@ -83,12 +83,12 @@ static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"HistoryDetails" - content:@"HistoryDetailsViewController" - stateBar:nil - stateBarEnabled:false - tabBar:@"UIMainBar" - tabBarEnabled:true + compositeDescription = [[UICompositeViewDescription alloc] init:@"HistoryDetails" + content:@"HistoryDetailsViewController" + stateBar:nil + stateBarEnabled:false + tabBar:@"UIMainBar" + tabBarEnabled:true fullscreen:false landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; @@ -124,12 +124,12 @@ static UICompositeViewDescription *compositeDescription = nil; if( use_system ){ [addContactButton setHidden:TRUE]; } - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(update) + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(update) name:kLinphoneAddressBookUpdate object:nil]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(coreUpdateEvent:) name:kLinphoneCoreUpdate @@ -138,11 +138,11 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - - [[NSNotificationCenter defaultCenter] removeObserver:self + + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneAddressBookUpdate object:nil]; - + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCoreUpdate object:nil]; @@ -156,7 +156,7 @@ static UICompositeViewDescription *compositeDescription = nil; } -#pragma mark - +#pragma mark - + (void)adaptSize:(UILabel*)label field:(UIView*)field { // @@ -164,20 +164,20 @@ static UICompositeViewDescription *compositeDescription = nil; // CGRect labelFrame = [label frame]; CGRect fieldFrame = [field frame]; - + fieldFrame.origin.x -= labelFrame.size.width; - + // Compute firstName size CGSize contraints; contraints.height = [label frame].size.height; contraints.width = ([field frame].size.width + [field frame].origin.x) - [label frame].origin.x; CGSize firstNameSize = [[label text] sizeWithFont:[label font] constrainedToSize: contraints]; labelFrame.size.width = firstNameSize.width; - + // Compute lastName size & position fieldFrame.origin.x += labelFrame.size.width; fieldFrame.size.width = (contraints.width + [label frame].origin.x) - fieldFrame.origin.x; - + [label setFrame: labelFrame]; [field setFrame: fieldFrame]; } @@ -186,7 +186,7 @@ static UICompositeViewDescription *compositeDescription = nil; if(![LinphoneManager isLcReady]) { return; } - + // Look for the call log callLog = NULL; const MSList *list = linphone_core_get_call_logs([LinphoneManager getLc]); @@ -199,20 +199,20 @@ static UICompositeViewDescription *compositeDescription = nil; } list = list->next; } - + // Pop if callLog is null if(callLog == NULL) { [[PhoneMainView instance] popCurrentView]; return; } - + LinphoneAddress* addr =linphone_call_log_get_remote_address(callLog); - + UIImage *image = nil; NSString* address = nil; if(addr != NULL) { BOOL useLinphoneAddress = true; - // contact name + // contact name char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress) { NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]]; @@ -227,25 +227,25 @@ static UICompositeViewDescription *compositeDescription = nil; if(useLinphoneAddress) { const char* lDisplayName = linphone_address_get_display_name(addr); const char* lUserName = linphone_address_get_username(addr); - if (lDisplayName) + if (lDisplayName) address = [NSString stringWithUTF8String:lDisplayName]; - else if(lUserName) + else if(lUserName) address = [NSString stringWithUTF8String:lUserName]; } } - + // Set Image if(image == nil) { image = [UIImage imageNamed:@"avatar_unknown.png"]; } [avatarImage setImage:image]; - + // Set Address if(address == nil) { address = NSLocalizedString(@"Unknown", nil); } [addressLabel setText:address]; - + // Hide/Show add button BOOL use_system = [[LinphoneManager instance] lpConfigBoolForKey:@"use_system_contacts"]; if(contact) { @@ -253,7 +253,7 @@ static UICompositeViewDescription *compositeDescription = nil; } else if (!use_system) { [addContactButton setHidden:FALSE]; } - + // State NSMutableString *state = [NSMutableString string]; if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) { @@ -283,7 +283,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Duration int duration = linphone_call_log_get_duration(callLog); [durationLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration/60), duration - 60 * (duration / 60), nil]]; - + // contact name [plainAddressLabel setText:@""]; if (addr != NULL) { @@ -297,7 +297,7 @@ static UICompositeViewDescription *compositeDescription = nil; } } } - + if (addr != NULL) { [callButton setHidden:FALSE]; [messageButton setHidden:FALSE]; @@ -305,7 +305,7 @@ static UICompositeViewDescription *compositeDescription = nil; [callButton setHidden:TRUE]; [messageButton setHidden:TRUE]; } - + } @@ -327,16 +327,17 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onAddContactClick:(id)event { LinphoneAddress* addr; - + addr=linphone_call_log_get_remote_address(callLog); if (addr != NULL) { char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress != NULL) { [ContactSelection setAddAddress:[NSString stringWithUTF8String:lAddress]]; [ContactSelection setSelectionMode:ContactSelectionModeEdit]; - + [ContactSelection setSipFilter:nil]; - [ContactSelection setEmailFilter:FALSE]; + [ContactSelection enableEmailFilter:FALSE]; + [ContactSelection setNameOrEmailFilter:nil]; ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController); if(controller != nil) { } @@ -346,26 +347,26 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onCallClick:(id)event { - LinphoneAddress* addr; + LinphoneAddress* addr; addr=linphone_call_log_get_remote_address(callLog); - + char* lAddress = linphone_address_as_string_uri_only(addr); - if(lAddress == NULL) + if(lAddress == NULL) return; - + NSString *displayName = nil; if(contact != nil) { - displayName = [FastAddressBook getContactDisplayName:contact]; + displayName = [FastAddressBook getContactDisplayName:contact]; } else { const char* lDisplayName = linphone_address_get_display_name(addr); const char* lUserName = linphone_address_get_username(addr); - if (lDisplayName) + if (lDisplayName) displayName = [NSString stringWithUTF8String:lDisplayName]; - else if(lUserName) + else if(lUserName) displayName = [NSString stringWithUTF8String:lUserName]; } - - + + DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); if(controller != nil) { if(displayName != nil) { @@ -380,11 +381,11 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onMessageClick:(id)event { LinphoneAddress* addr; addr=linphone_call_log_get_remote_address(callLog); - + char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress == NULL) return; - + NSString *displayName = nil; if(contact != nil) { displayName = [FastAddressBook getContactDisplayName:contact]; @@ -396,7 +397,7 @@ static UICompositeViewDescription *compositeDescription = nil; else if(lUserName) displayName = [NSString stringWithUTF8String:lUserName]; } - + // Go to ChatRoom view [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController); diff --git a/Classes/LinphoneUI/UIMainBar.m b/Classes/LinphoneUI/UIMainBar.m index 899435fab..dbacbeb29 100644 --- a/Classes/LinphoneUI/UIMainBar.m +++ b/Classes/LinphoneUI/UIMainBar.m @@ -4,16 +4,16 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -46,7 +46,7 @@ static NSString * const kDisappearAnimation = @"disappear"; - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [historyButton release]; [contactsButton release]; [dialerButton release]; @@ -56,7 +56,7 @@ static NSString * const kDisappearAnimation = @"disappear"; [historyNotificationLabel release]; [chatNotificationView release]; [chatNotificationLabel release]; - + [super dealloc]; } @@ -65,17 +65,17 @@ static NSString * const kDisappearAnimation = @"disappear"; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(changeViewEvent:) + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(changeViewEvent:) name:kLinphoneMainViewChange object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(callUpdate:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(callUpdate:) name:kLinphoneCallUpdate object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(textReceived:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(textReceived:) name:kLinphoneTextReceived object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -87,14 +87,14 @@ static NSString * const kDisappearAnimation = @"disappear"; - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - - [[NSNotificationCenter defaultCenter] removeObserver:self + + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneMainViewChange object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneTextReceived object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self @@ -103,35 +103,35 @@ static NSString * const kDisappearAnimation = @"disappear"; } - (void)viewDidLoad { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(applicationWillEnterForeground:) - name:UIApplicationWillEnterForegroundNotification + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillEnterForeground:) + name:UIApplicationWillEnterForegroundNotification object:nil]; - + { UIButton *historyButtonLandscape = (UIButton*) [landscapeView viewWithTag:[historyButton tag]]; // Set selected+over background: IB lack ! [historyButton setBackgroundImage:[UIImage imageNamed:@"history_selected.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + // Set selected+over background: IB lack ! [historyButtonLandscape setBackgroundImage:[UIImage imageNamed:@"history_selected_landscape.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + [LinphoneUtils buttonFixStatesForTabs:historyButton]; [LinphoneUtils buttonFixStatesForTabs:historyButtonLandscape]; } - + { UIButton *contactsButtonLandscape = (UIButton*) [landscapeView viewWithTag:[contactsButton tag]]; // Set selected+over background: IB lack ! [contactsButton setBackgroundImage:[UIImage imageNamed:@"contacts_selected.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + // Set selected+over background: IB lack ! [contactsButtonLandscape setBackgroundImage:[UIImage imageNamed:@"contacts_selected_landscape.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + [LinphoneUtils buttonFixStatesForTabs:contactsButton]; [LinphoneUtils buttonFixStatesForTabs:contactsButtonLandscape]; } @@ -140,11 +140,11 @@ static NSString * const kDisappearAnimation = @"disappear"; // Set selected+over background: IB lack ! [dialerButton setBackgroundImage:[UIImage imageNamed:@"dialer_selected.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + // Set selected+over background: IB lack ! [dialerButtonLandscape setBackgroundImage:[UIImage imageNamed:@"dialer_selected_landscape.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + [LinphoneUtils buttonFixStatesForTabs:dialerButton]; [LinphoneUtils buttonFixStatesForTabs:dialerButtonLandscape]; } @@ -153,37 +153,37 @@ static NSString * const kDisappearAnimation = @"disappear"; // Set selected+over background: IB lack ! [settingsButton setBackgroundImage:[UIImage imageNamed:@"settings_selected.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + // Set selected+over background: IB lack ! [settingsButtonLandscape setBackgroundImage:[UIImage imageNamed:@"settings_selected_landscape.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + [LinphoneUtils buttonFixStatesForTabs:settingsButton]; [LinphoneUtils buttonFixStatesForTabs:settingsButtonLandscape]; } - + { UIButton *chatButtonLandscape = (UIButton*) [landscapeView viewWithTag:[chatButton tag]]; // Set selected+over background: IB lack ! [chatButton setBackgroundImage:[UIImage imageNamed:@"chat_selected.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + // Set selected+over background: IB lack ! [chatButtonLandscape setBackgroundImage:[UIImage imageNamed:@"chat_selected_landscape.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + [LinphoneUtils buttonFixStatesForTabs:chatButton]; [LinphoneUtils buttonFixStatesForTabs:chatButtonLandscape]; } - + [super viewDidLoad]; // Have to be after due to TPMultiLayoutViewController } - (void)viewDidUnload { [super viewDidUnload]; - - [[NSNotificationCenter defaultCenter] removeObserver:self - name:UIApplicationWillEnterForegroundNotification + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:UIApplicationWillEnterForegroundNotification object:nil]; } @@ -203,8 +203,8 @@ static NSString * const kDisappearAnimation = @"disappear"; #pragma mark - Event Functions -- (void)applicationWillEnterForeground:(NSNotification*)notif { - // Force the animations +- (void)applicationWillEnterForeground:(NSNotification*)notif { + // Force the animations [[self.view layer] removeAllAnimations]; [historyNotificationView.layer setTransform:CATransform3DIdentity]; [chatNotificationView.layer setTransform:CATransform3DIdentity]; @@ -219,7 +219,7 @@ static NSString * const kDisappearAnimation = @"disappear"; [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:TRUE]; } -- (void)changeViewEvent:(NSNotification*)notif { +- (void)changeViewEvent:(NSNotification*)notif { //UICompositeViewDescription *view = [notif.userInfo objectForKey: @"view"]; //if(view != nil) [self updateView:[[PhoneMainView instance] firstView]]; @@ -246,7 +246,7 @@ static NSString * const kDisappearAnimation = @"disappear"; } -#pragma mark - +#pragma mark - - (void)update:(BOOL)appear{ [self updateView:[[PhoneMainView instance] firstView]]; @@ -354,14 +354,14 @@ static NSString * const kDisappearAnimation = @"disappear"; bounce.autoreverses = TRUE; bounce.repeatCount = HUGE_VALF; [target.layer addAnimation:bounce forKey:animationID]; - + } - (void)stopBounceAnimation:(NSString *)animationID target:(UIView *)target { [target.layer removeAnimationForKey:animationID]; } - -- (void)updateView:(UICompositeViewDescription*) view { + +- (void)updateView:(UICompositeViewDescription*) view { // Update buttons if([view equal:[HistoryViewController compositeViewDescription]]) { historyButton.selected = TRUE; @@ -401,7 +401,8 @@ static NSString * const kDisappearAnimation = @"disappear"; [ContactSelection setSelectionMode:ContactSelectionModeNone]; [ContactSelection setAddAddress:nil]; [ContactSelection setSipFilter:nil]; - [ContactSelection setEmailFilter:FALSE]; + [ContactSelection enableEmailFilter:FALSE]; + [ContactSelection setNameOrEmailFilter:nil]; [[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]]; } @@ -422,7 +423,7 @@ static NSString * const kDisappearAnimation = @"disappear"; - (NSDictionary*)attributesForView:(UIView*)view { NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; - + [attributes setObject:[NSValue valueWithCGRect:view.frame] forKey:@"frame"]; [attributes setObject:[NSValue valueWithCGRect:view.bounds] forKey:@"bounds"]; if([view isKindOfClass:[UIButton class]]) { @@ -430,7 +431,7 @@ static NSString * const kDisappearAnimation = @"disappear"; [LinphoneUtils buttonMultiViewAddAttributes:attributes button:button]; } [attributes setObject:[NSNumber numberWithInteger:view.autoresizingMask] forKey:@"autoresizingMask"]; - + return attributes; } From bfad83a085c76c9a480b2ea9dc1d3d81710c43e7 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 25 Sep 2014 12:24:44 +0200 Subject: [PATCH 31/51] Disable voice mail "1" button in call bar --- Classes/LinphoneUI/Base.lproj/UICallBar.xib | 4 ++-- Classes/LinphoneUI/Base.lproj/UICallBar~ipad.xib | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/LinphoneUI/Base.lproj/UICallBar.xib b/Classes/LinphoneUI/Base.lproj/UICallBar.xib index c70bfbb03..2144dad66 100644 --- a/Classes/LinphoneUI/Base.lproj/UICallBar.xib +++ b/Classes/LinphoneUI/Base.lproj/UICallBar.xib @@ -59,7 +59,7 @@ -