[imdm] fix accusé reception on background mode or inactive mode

This commit is contained in:
Brieuc Viel 2017-04-05 17:10:50 +02:00
parent 787e6b3524
commit 5447d74226
4 changed files with 19 additions and 8 deletions

View file

@ -127,8 +127,10 @@
if (index == -1 && count > 0) {
index = (int)count - 1;
}
linphone_chat_room_mark_as_read(_chatRoom);
if (!([UIApplication sharedApplication].applicationState == UIApplicationStateBackground ||
[UIApplication sharedApplication].applicationState == UIApplicationStateInactive)) {
linphone_chat_room_mark_as_read(_chatRoom);
}
TabBarView *tab = (TabBarView *)[PhoneMainView.instance.mainViewController
getCachedController:NSStringFromClass(TabBarView.class)];
[tab update:YES];

View file

@ -157,6 +157,7 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark -
- (void)setChatRoom:(LinphoneChatRoom *)chatRoom {
_chatRoom = chatRoom;
[_messageField setText:@""];
[_tableController setChatRoom:_chatRoom];
@ -357,10 +358,11 @@ static UICompositeViewDescription *compositeDescription = nil;
if (fromStr && cr_from_string) {
if (strcasecmp(cr_from_string, fromStr) == 0) {
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
if (!([UIApplication sharedApplication].applicationState == UIApplicationStateBackground ||
[UIApplication sharedApplication].applicationState == UIApplicationStateInactive)) {
linphone_chat_room_mark_as_read(room);
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
}
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
[_tableController addChatEntry:chat];
[_tableController scrollToLastUnread:TRUE];
}

View file

@ -900,7 +900,9 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
NSString *from = [notification.userInfo objectForKey:@"from_addr"];
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(LC, [from UTF8String]);
if (room) {
linphone_chat_room_mark_as_read(room);
if (!([UIApplication sharedApplication].applicationState == UIApplicationStateBackground ||
[UIApplication sharedApplication].applicationState == UIApplicationStateInactive))
linphone_chat_room_mark_as_read(room);
TabBarView *tab = (TabBarView *)[PhoneMainView.instance.mainViewController
getCachedController:NSStringFromClass(TabBarView.class)];
[tab update:YES];
@ -949,8 +951,10 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(room)) {
[LinphoneManager.instance alertLIME:room];
}
linphone_chat_room_mark_as_read(room);
if (!([UIApplication sharedApplication].applicationState == UIApplicationStateBackground ||
[UIApplication sharedApplication].applicationState == UIApplicationStateInactive)) {
linphone_chat_room_mark_as_read(room);
}
[PhoneMainView.instance updateApplicationBadgeNumber];
}
}

View file

@ -150,7 +150,10 @@
[_messageText setAccessibilityLabel:@"Outgoing message"];
} else {
[_messageText setAccessibilityLabel:@"Incoming message"];
VIEW(ChatConversationView).markAsRead;
if (!([UIApplication sharedApplication].applicationState != UIApplicationStateBackground ||
[UIApplication sharedApplication].applicationState != UIApplicationStateInactive)) {
VIEW(ChatConversationView).markAsRead;
}
}
if (outgoing &&