mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Chat: do not ring/vibrate when receive new message if we are already in the room and bump v5
This commit is contained in:
parent
876e949cb7
commit
7347f56bc7
1 changed files with 19 additions and 13 deletions
|
|
@ -261,10 +261,26 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
- (void)textReceived:(NSNotification *)notif {
|
||||
LinphoneAddress *from = [[notif.userInfo objectForKey:@"from_address"] pointerValue];
|
||||
NSString *callID = [notif.userInfo objectForKey:@"call-id"];
|
||||
if (from != nil) {
|
||||
[self playMessageSoundForCallID:callID];
|
||||
}
|
||||
[self updateApplicationBadgeNumber];
|
||||
LinphoneChatRoom *room = from ? linphone_core_get_chat_room(LC, from) : NULL;
|
||||
|
||||
if (from == nil || room == NULL)
|
||||
return;
|
||||
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
// if we already are in the conversation, we should not ring/vibrate
|
||||
if (view.chatRoom && linphone_address_weak_equal(linphone_chat_room_get_peer_address(room),
|
||||
linphone_chat_room_get_peer_address(view.chatRoom)))
|
||||
return;
|
||||
|
||||
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground)
|
||||
return;
|
||||
|
||||
LinphoneManager *lm = LinphoneManager.instance;
|
||||
// if the message was already received through a push notif, we don't need to ring
|
||||
if (![lm popPushCallID:callID]) {
|
||||
[lm playMessageSound];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registrationUpdate:(NSNotification *)notif {
|
||||
|
|
@ -644,16 +660,6 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
|
||||
#pragma mark - ActionSheet Functions
|
||||
|
||||
- (void)playMessageSoundForCallID:(NSString *)callID {
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
|
||||
LinphoneManager *lm = LinphoneManager.instance;
|
||||
// if the message was already received through a push notif, we don't need to ring
|
||||
if (![lm popPushCallID:callID]) {
|
||||
[lm playMessageSound];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)displayIncomingCall:(LinphoneCall *)call {
|
||||
LinphoneCallLog *callLog = linphone_call_get_call_log(call);
|
||||
NSString *callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue