mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
fix crash with NSDate not retained
Merge remote-tracking branch 'origin/endlessring' Conflicts: Classes/LinphoneManager.h
This commit is contained in:
commit
7f8237956b
7 changed files with 64 additions and 8 deletions
|
|
@ -243,9 +243,18 @@
|
|||
}
|
||||
|
||||
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
|
||||
[[UIApplication sharedApplication] cancelLocalNotification:notification];
|
||||
|
||||
[self fixRing];
|
||||
|
||||
|
||||
if([notification.userInfo objectForKey:@"callId"] != nil) {
|
||||
[[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]];
|
||||
// some local notifications have an internal timer to relaunch themselves at specified intervals
|
||||
if( [[notification.userInfo objectForKey:@"timer"] intValue] == 1 ){
|
||||
[[LinphoneManager instance] cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]];
|
||||
} else {
|
||||
// auto answer only for non-timed local notifications
|
||||
[[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]];
|
||||
}
|
||||
} else if([notification.userInfo objectForKey:@"chat"] != nil) {
|
||||
NSString *remoteContact = (NSString*)[notification.userInfo objectForKey:@"chat"];
|
||||
// Go to ChatRoom view
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ struct NetworkReachabilityContext {
|
|||
UILocalNotification *notification;
|
||||
NSMutableDictionary *userInfos;
|
||||
bool_t videoRequested; /*set when user has requested for video*/
|
||||
NSTimer* timer;
|
||||
};
|
||||
@end
|
||||
|
||||
|
|
@ -129,6 +130,8 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)cfg;
|
||||
- (BOOL)shouldAutoAcceptCallForCallId:(NSString*) callId;
|
||||
- (void)acceptCallForCallId:(NSString*)callid;
|
||||
- (void)cancelLocalNotifTimerForCallId:(NSString*)callid;
|
||||
|
||||
|
||||
+ (void)kickOffNetworkConnection;
|
||||
- (void)setupNetworkReachabilityCallback;
|
||||
|
|
|
|||
|
|
@ -441,6 +441,15 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
|
|||
|
||||
#pragma mark - Call State Functions
|
||||
|
||||
- (void)localNotifContinue:(NSTimer*) timer {
|
||||
UILocalNotification* notif = [timer userInfo];
|
||||
if (notif){
|
||||
[LinphoneLogger log:LinphoneLoggerLog format:@"cancelling/presenting local notif"];
|
||||
[[UIApplication sharedApplication] cancelLocalNotification:notif];
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onCall:(LinphoneCall*)call StateChanged:(LinphoneCallState)state withMessage:(const char *)message {
|
||||
|
||||
// Handling wrapper
|
||||
|
|
@ -516,12 +525,15 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
|
|||
// Create a new local notification
|
||||
data->notification = [[UILocalNotification alloc] init];
|
||||
if (data->notification) {
|
||||
data->notification.repeatInterval = 0;
|
||||
data->timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(localNotifContinue:) userInfo:data->notification repeats:TRUE];
|
||||
|
||||
data->notification.repeatInterval = 0;
|
||||
data->notification.alertBody =[NSString stringWithFormat:NSLocalizedString(@"IC_MSG",nil), address];
|
||||
data->notification.alertAction = NSLocalizedString(@"Answer", nil);
|
||||
data->notification.soundName = @"ring.caf";
|
||||
data->notification.userInfo = [NSDictionary dictionaryWithObject:callId forKey:@"callId"];
|
||||
|
||||
data->notification.soundName = @"shortring.caf";
|
||||
data->notification.userInfo = @{@"callId": callId, @"timer":[NSNumber numberWithInt:1] };
|
||||
data->notification.applicationIconBadgeNumber = 1;
|
||||
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:data->notification];
|
||||
|
||||
if (!incallBgTask){
|
||||
|
|
@ -530,6 +542,8 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
|
|||
[[UIApplication sharedApplication] endBackgroundTask:incallBgTask];
|
||||
incallBgTask=0;
|
||||
}];
|
||||
|
||||
[[NSRunLoop currentRunLoop] addTimer:data->timer forMode:NSRunLoopCommonModes];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -555,7 +569,12 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
|
|||
LinphoneCallLog *log = linphone_call_get_call_log(call);
|
||||
|
||||
// cancel local notif if needed
|
||||
if( data->timer ){
|
||||
[data->timer invalidate];
|
||||
data->timer = nil;
|
||||
}
|
||||
[[UIApplication sharedApplication] cancelLocalNotification:data->notification];
|
||||
|
||||
[data->notification release];
|
||||
data->notification = nil;
|
||||
|
||||
|
|
@ -1174,6 +1193,21 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) {
|
|||
return strcmp(linphone_call_log_get_call_id(linphone_call_get_call_log(call)), callid);
|
||||
}
|
||||
|
||||
- (void)cancelLocalNotifTimerForCallId:(NSString*)callid {
|
||||
//first, make sure this callid is not already involved in a call
|
||||
if ([LinphoneManager isLcReady]) {
|
||||
MSList* calls = (MSList*)linphone_core_get_calls(theLinphoneCore);
|
||||
MSList* call = ms_list_find_custom(calls, (MSCompareFunc)comp_call_id, [callid UTF8String]);
|
||||
if (call != NULL) {
|
||||
LinphoneCallAppData* data = linphone_call_get_user_pointer((LinphoneCall*)call->data);
|
||||
if ( data->timer )
|
||||
[data->timer invalidate];
|
||||
data->timer = nil;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)acceptCallForCallId:(NSString*)callid {
|
||||
//first, make sure this callid is not already involved in a call
|
||||
if ([LinphoneManager isLcReady]) {
|
||||
|
|
@ -1255,7 +1289,10 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param)
|
|||
if ([[UIApplication sharedApplication] setKeepAliveTimeout:600/*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/
|
||||
handler:^{
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"keepalive handler"];
|
||||
if (mLastKeepAliveDate)
|
||||
[mLastKeepAliveDate release];
|
||||
mLastKeepAliveDate=[NSDate date];
|
||||
[mLastKeepAliveDate retain];
|
||||
if (theLinphoneCore == nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"It seems that Linphone BG mode was deactivated, just skipping"];
|
||||
return;
|
||||
|
|
@ -1291,6 +1328,7 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param)
|
|||
linphone_core_enable_video_preview(theLinphoneCore, FALSE);
|
||||
linphone_core_iterate(theLinphoneCore);
|
||||
}
|
||||
linphone_core_stop_dtmf_stream(theLinphoneCore);
|
||||
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Entering [%s] bg mode",shouldEnterBgMode?"normal":"lite"];
|
||||
|
||||
|
|
|
|||
2
README
2
README
|
|
@ -12,7 +12,7 @@ Make sure that /opt/local/bin (macport tools) arrives first in your PATH env var
|
|||
|
||||
Once xcode and macports are installed, open a terminal and install the required build-time tools with:
|
||||
|
||||
$ sudo port install coreutils automake autoconf libtool intltool wget pkgconfig nasm cmake gmake yasm grep doxygen ImageMagick optipng antlr3
|
||||
$ sudo port install coreutils automake autoconf libtool intltool wget pkgconfig cmake gmake yasm nasm grep doxygen ImageMagick optipng antlr3
|
||||
|
||||
|
||||
Install gas-preprosessor.pl version above Jully 2013 (http://github.com/yuvi/gas-preprocessor/ ) to be copied into /opt/local/bin :
|
||||
|
|
|
|||
BIN
Resources/shortring.caf
Normal file
BIN
Resources/shortring.caf
Normal file
Binary file not shown.
|
|
@ -1344,6 +1344,8 @@
|
|||
F01A77C518EBEC6200E287CA /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0B89C2118DC89E30050B60E /* MediaPlayer.framework */; };
|
||||
F01A77C618EBECCB00E287CA /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDEF14850AE9007420B6 /* libc++.1.dylib */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
F01A77C718EBECEA00E287CA /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
F01A77EB18ED989B00E287CA /* shortring.caf in Resources */ = {isa = PBXBuildFile; fileRef = F01A77EA18ED989B00E287CA /* shortring.caf */; };
|
||||
F01A77EC18ED989B00E287CA /* shortring.caf in Resources */ = {isa = PBXBuildFile; fileRef = F01A77EA18ED989B00E287CA /* shortring.caf */; };
|
||||
F03A9B1D18C0CF7000C4D7FE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
||||
F03A9B1E18C0CF7000C4D7FE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
|
||||
F03A9B1F18C0CF7000C4D7FE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
|
||||
|
|
@ -2464,6 +2466,7 @@
|
|||
D3F9A9EC15AF277D0045320F /* UACellBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UACellBackgroundView.h; path = Utils/UACellBackgroundView/UACellBackgroundView.h; sourceTree = "<group>"; };
|
||||
D3F9A9ED15AF277D0045320F /* UACellBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UACellBackgroundView.m; path = Utils/UACellBackgroundView/UACellBackgroundView.m; sourceTree = "<group>"; };
|
||||
F0181B6B18BF7B1200A9A357 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
F01A77EA18ED989B00E287CA /* shortring.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = shortring.caf; path = Resources/shortring.caf; sourceTree = "<group>"; };
|
||||
F03A9B1C18C0CF7000C4D7FE /* linphonetester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = linphonetester.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F03A9B2218C0CF7000C4D7FE /* tester-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "tester-Info.plist"; sourceTree = "<group>"; };
|
||||
F03A9B2418C0CF7000C4D7FE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
|
|
@ -3395,6 +3398,7 @@
|
|||
D3804E5E15D92A57008072A5 /* msg.caf */,
|
||||
D3804E5F15D92A57008072A5 /* msg.wav */,
|
||||
2242E312125235120061DDCE /* ring.caf */,
|
||||
F01A77EA18ED989B00E287CA /* shortring.caf */,
|
||||
2237D4081084D7A9001383EE /* ring.wav */,
|
||||
22F254801073D99800AC9B3F /* ringback.wav */,
|
||||
70571E1913FABCB000CDD3C2 /* rootca.pem */,
|
||||
|
|
@ -4824,6 +4828,7 @@
|
|||
D3F83F1E158205A100336684 /* speaker_off_over.png in Resources */,
|
||||
D3F83F20158205A100336684 /* speaker_on_default.png in Resources */,
|
||||
D3F83F22158205A100336684 /* speaker_on_over.png in Resources */,
|
||||
F01A77EB18ED989B00E287CA /* shortring.caf in Resources */,
|
||||
D3F83F24158205A100336684 /* video_off_default.png in Resources */,
|
||||
D3F83F26158205A100336684 /* video_off_over.png in Resources */,
|
||||
D3F83F28158205A100336684 /* video_on_default.png in Resources */,
|
||||
|
|
@ -5369,6 +5374,7 @@
|
|||
D34BD72F15C13DD40070C209 /* LinphoneApp.xib in Resources */,
|
||||
D34BD73015C13DD40070C209 /* AboutViewController.xib in Resources */,
|
||||
D34BD73115C13DD40070C209 /* PhoneMainView.xib in Resources */,
|
||||
F01A77EC18ED989B00E287CA /* shortring.caf in Resources */,
|
||||
D34BD73215C13DD40070C209 /* SettingsViewController.xib in Resources */,
|
||||
D38187DE15FE348A00C3EDCA /* WizardViewController.xib in Resources */,
|
||||
D34BD62815C13DB60070C209 /* back_over.png in Resources */,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a253e5af931cadd5d3c0aff1f56697b2b52c1cfd
|
||||
Subproject commit 07b55ce81adca894bf6bd1ed86eb27f4578562f1
|
||||
Loading…
Add table
Reference in a new issue