From 6fae63450ec9fe62bd0fca0c6751cc6e05fbc28b Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 26 Apr 2011 14:47:56 +0200 Subject: [PATCH 1/2] move proximity sensor code as proposed by Rene Dohmen --- Classes/LinphoneAppDelegate.m | 4 +--- Classes/PhoneViewController.m | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index dc44c57e0..b7eeb00a2 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -121,9 +121,7 @@ [[LinphoneManager instance] setCallDelegate:myPhoneViewController]; [[LinphoneManager instance] startLibLinphone]; - - [ [UIDevice currentDevice] setProximityMonitoringEnabled:true]; - + return YES; diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 8b0efb8cc..0e1432f29 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -182,6 +182,9 @@ [hangup setEnabled:false]; [callDuration stop]; + UIDevice *device = [UIDevice currentDevice]; + device.proximityMonitoringEnabled = NO; + [peerLabel setText:@""]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstlogindone_preference" ] == true) { @@ -192,7 +195,13 @@ } -(void) displayIncalViewforUser:(NSString*) username withDisplayName:(NSString*) displayName { - [hangup setEnabled:true]; + UIDevice *device = [UIDevice currentDevice]; + device.proximityMonitoringEnabled = YES; + if (device.proximityMonitoringEnabled == YES) { + ms_message("Ok this device support proximity, and I just enabled it"); + } + + [hangup setEnabled:true]; if (displayName && [displayName length]>0) { [peerLabel setText:displayName]; } else { From f004f72b2151e820cce6dc1960087ea9c49f2df8 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 29 Apr 2011 10:31:10 +0200 Subject: [PATCH 2/2] remove network handler unregistration --- Classes/LinphoneUI/LinphoneManager.m | 3 --- 1 file changed, 3 deletions(-) diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 5e486983b..4b1abd8aa 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -349,9 +349,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_clear_all_auth_info(theLinphoneCore); //clear existing proxy config linphone_core_clear_proxy_config(theLinphoneCore); - if (proxyReachability !=nil) { - SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability,CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - } if (username && [username length] >0 && domain && [domain length]>0) {