Fix issue where the chatroom could not be found for local notifications.

This commit is contained in:
Guillaume BIENKOWSKI 2015-02-24 12:13:43 +01:00
parent 8a860df7d8
commit 44af28fd8a
2 changed files with 5 additions and 4 deletions

View file

@ -347,8 +347,8 @@
{
[[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]];
}
} else if([notification.userInfo objectForKey:@"from"] != nil) {
NSString *remoteContact = (NSString*)[notification.userInfo objectForKey:@"from"];
} else if([notification.userInfo objectForKey:@"from_addr"] != nil) {
NSString *remoteContact = (NSString*)[notification.userInfo objectForKey:@"from_addr"];
// Go to ChatRoom view
[[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]];
LinphoneChatRoom*room = [self findChatRoomForContact:remoteContact];
@ -428,7 +428,7 @@
// use the standard handler
[self application:application didReceiveLocalNotification:notification];
} else if( [identifier isEqualToString:@"mark_read"] ){
NSString* from = [notification.userInfo objectForKey:@"from"];
NSString* from = [notification.userInfo objectForKey:@"from_addr"];
LinphoneChatRoom* room = linphone_core_get_or_create_chat_room(lc, [from UTF8String]);
if( room ){
linphone_chat_room_mark_as_read(room);

View file

@ -895,6 +895,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
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* remote_uri = [NSString stringWithUTF8String:c_address];
const char* call_id = linphone_chat_message_get_custom_header(msg, "Call-ID");
NSString* callID = [NSString stringWithUTF8String:call_id];
@ -926,7 +927,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG",nil), address];
notif.alertAction = NSLocalizedString(@"Show", nil);
notif.soundName = @"msg.caf";
notif.userInfo = @{@"from":address, @"call-id":callID};
notif.userInfo = @{@"from":address, @"from_addr":remote_uri, @"call-id":callID};
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
}