From 427a46c84b34277449f43a162ba188e6fc567eb4 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 29 Sep 2010 15:24:12 +0200 Subject: [PATCH] cancel local notif in case of canceled incomming call --- Classes/linphoneAppDelegate.h | 1 + Classes/linphoneAppDelegate.m | 6 +++++- linphone-Info.plist | 2 +- linphone.xcodeproj/project.pbxproj | 8 ++++---- submodules/build/iphone-config.site | 6 ++++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Classes/linphoneAppDelegate.h b/Classes/linphoneAppDelegate.h index ec0e68a43..bc41e5c2c 100644 --- a/Classes/linphoneAppDelegate.h +++ b/Classes/linphoneAppDelegate.h @@ -85,6 +85,7 @@ bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach @property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController; @property (nonatomic, retain) ABPeoplePickerNavigationController* myPeoplePickerController; @property (nonatomic, retain) IBOutlet PhoneViewController* myPhoneViewController; +@property(readonly) bool backgroundSupported; @end diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index 3f1523e6b..6aa1fc682 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -60,6 +60,9 @@ void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, LinphoneCa linphoneAppDelegate* lAppDelegate = (linphoneAppDelegate*) linphone_core_get_user_data(lc); if (state == LinphoneCallIncomingReceived) { [lAppDelegate newIncomingCall:[[NSString alloc] initWithCString:linphone_address_get_username(linphone_call_get_remote_address(call))]]; + } else if (lAppDelegate.backgroundSupported && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground && (LinphoneCallEnd|LinphoneCallError)) { + // cancel local notif if needed + [[UIApplication sharedApplication] cancelAllLocalNotifications]; } PhoneViewController* lPhone = lAppDelegate.myPhoneViewController; [lPhone onCall:call StateChanged:state withMessage:message]; @@ -115,6 +118,7 @@ LinphoneCoreVTable linphonec_vtable = { @synthesize myTabBarController; @synthesize myPeoplePickerController; @synthesize myPhoneViewController; +@synthesize backgroundSupported; - (void)applicationDidEnterBackground:(UIApplication *)application { @@ -600,7 +604,7 @@ extern void libmsilbc_init(); notif.repeatInterval = 0; notif.alertBody =[NSString stringWithFormat:@" %@ is calling you",from]; notif.alertAction = @"Answer"; - notif.soundName = @"oldphone-mono-30s.wav"; + notif.soundName = @"oldphone-mono-30s.caf"; [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; } diff --git a/linphone-Info.plist b/linphone-Info.plist index 634ac9945..5d714aa61 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -25,7 +25,7 @@ CFBundleSignature ???? CFBundleVersion - 1.0.2 + 1.0.3 NSMainNibFile PhoneMainView UIBackgroundModes diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 55c43b379..c25c20f3e 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -32,10 +32,10 @@ 2242D91A10D66C2100E9963F /* mic_active.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91810D66C2100E9963F /* mic_active.png */; }; 2242D91B10D66C2100E9963F /* mic_muted.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91910D66C2100E9963F /* mic_muted.png */; }; 2242D9C910D691F900E9963F /* GenericTabViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2242D9C810D691F900E9963F /* GenericTabViewController.m */; }; + 2242E313125235120061DDCE /* oldphone-mono-30s.caf in Resources */ = {isa = PBXBuildFile; fileRef = 2242E312125235120061DDCE /* oldphone-mono-30s.caf */; }; 2245671D107699F700F10948 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2245671C107699F700F10948 /* Settings.bundle */; }; 224567C2107B968500F10948 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 224567C1107B968500F10948 /* AVFoundation.framework */; }; 2245F78A1201D38000C4179D /* MoreViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22E0A81B111C44E100B04932 /* MoreViewController.xib */; }; - 224E7F4D124CB00900113C4A /* oldphone-mono-30s.wav in Resources */ = {isa = PBXBuildFile; fileRef = 224E7F4C124CB00900113C4A /* oldphone-mono-30s.wav */; }; 225CB2EA11ABB51000628906 /* clavier-01-106px.png in Resources */ = {isa = PBXBuildFile; fileRef = 225CB2E811ABB51000628906 /* clavier-01-106px.png */; }; 225CB2EB11ABB51000628906 /* clavier-01-108px.png in Resources */ = {isa = PBXBuildFile; fileRef = 225CB2E911ABB51000628906 /* clavier-01-108px.png */; }; 225CB2EE11ABB65D00628906 /* clavier-01-160px.png in Resources */ = {isa = PBXBuildFile; fileRef = 225CB2ED11ABB65D00628906 /* clavier-01-160px.png */; }; @@ -213,10 +213,10 @@ 2242D91910D66C2100E9963F /* mic_muted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mic_muted.png; path = "liblinphone-sdk/apple-darwin/share/pixmaps/linphone/mic_muted.png"; sourceTree = ""; }; 2242D9C710D691F900E9963F /* GenericTabViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericTabViewController.h; sourceTree = ""; }; 2242D9C810D691F900E9963F /* GenericTabViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GenericTabViewController.m; sourceTree = ""; }; + 2242E312125235120061DDCE /* oldphone-mono-30s.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "oldphone-mono-30s.caf"; path = "liblinphone-sdk/apple-darwin/share/sounds/linphone/rings/oldphone-mono-30s.caf"; sourceTree = ""; }; 2245671C107699F700F10948 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 224567C1107B968500F10948 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 2245F77E1201D2AF00C4179D /* linphone-Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "linphone-Info copy.plist"; sourceTree = ""; }; - 224E7F4C124CB00900113C4A /* oldphone-mono-30s.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "oldphone-mono-30s.wav"; path = "liblinphone-sdk/apple-darwin/share/sounds/linphone/rings/oldphone-mono-30s.wav"; sourceTree = ""; }; 2258633C11410BAC00C5A737 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; 225CB2E811ABB51000628906 /* clavier-01-106px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-01-106px.png"; path = "Resources/clavier-01-106px.png"; sourceTree = ""; }; 225CB2E911ABB51000628906 /* clavier-01-108px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-01-108px.png"; path = "Resources/clavier-01-108px.png"; sourceTree = ""; }; @@ -565,7 +565,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - 224E7F4C124CB00900113C4A /* oldphone-mono-30s.wav */, + 2242E312125235120061DDCE /* oldphone-mono-30s.caf */, 225CB2F911ABB76400628906 /* linphone-banner.png */, 225CB2ED11ABB65D00628906 /* clavier-01-160px.png */, 225CB2E811ABB51000628906 /* clavier-01-106px.png */, @@ -686,7 +686,7 @@ 225CB2EE11ABB65D00628906 /* clavier-01-160px.png in Resources */, 225CB2FA11ABB76400628906 /* linphone-banner.png in Resources */, 2245F78A1201D38000C4179D /* MoreViewController.xib in Resources */, - 224E7F4D124CB00900113C4A /* oldphone-mono-30s.wav in Resources */, + 2242E313125235120061DDCE /* oldphone-mono-30s.caf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/submodules/build/iphone-config.site b/submodules/build/iphone-config.site index 8fe007b12..2ecff3de8 100644 --- a/submodules/build/iphone-config.site +++ b/submodules/build/iphone-config.site @@ -1,6 +1,7 @@ # -*- shell-script -*- GCC_VERSION=4.2 +SDK_VERSION_MAJOR=4 SDK_VERSION=4.0 if test "${host_alias}" = "i386-apple-darwin" ; then @@ -15,9 +16,10 @@ else fi echo "Loading config.site for iPhone platform=${PLATFORM} version=${SDK_VERSION}" +SDK_PATH_LIST=`ls -drt /Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}4*` SDK_BIN_PATH=/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin -SYSROOT_PATH=/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk - +for SYSROOT_PATH in $SDK_PATH_LIST ; do echo $SYSROOT_PATH ; done ; +echo "Selecting SDK path = ${SYSROOT_PATH}" CC="${SDK_BIN_PATH}/gcc-${GCC_VERSION} -std=c99 -arch ${ARCH} --sysroot=${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION}" CXX="${SDK_BIN_PATH}/g++-${GCC_VERSION} -arch ${ARCH} --sysroot=${SYSROOT_PATH}" LD="${SDK_BIN_PATH}/ld-${GCC_VERSION} -arch ${ARCH}"