Fixed not working notifications in opened chat while app in background

This commit is contained in:
DrKLO 2014-07-21 01:49:33 +04:00
parent 5855dc0567
commit e2a6511fbf
3 changed files with 15 additions and 12 deletions

View file

@ -83,7 +83,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 287 versionCode 288
versionName "1.6.1" versionName "1.6.1"
} }
} }

View file

@ -2231,16 +2231,11 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (request.completed) { if (request.completed) {
break; break;
} }
if ((request.flags & RPCRequest.RPCRequestClassDownloadMedia) != 0) { if (request.lastResendTime == 0 || request.lastResendTime + 60 < (int)(System.currentTimeMillis() / 1000)) {
if (request.lastResendTime == 0 || request.lastResendTime + 60 < (int)(System.currentTimeMillis() / 1000)) { request.lastResendTime = (int)(System.currentTimeMillis() / 1000);
request.lastResendTime = (int)(System.currentTimeMillis() / 1000);
requestResend = true;
} else {
confirm = false;
}
break;
} else {
requestResend = true; requestResend = true;
} else {
confirm = false;
} }
break; break;
} }

View file

@ -1984,7 +1984,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
messages.add(0, dateObj); messages.add(0, dateObj);
} }
if (!obj.isOut() && obj.messageOwner.unread) { if (!obj.isOut() && obj.messageOwner.unread) {
obj.messageOwner.unread = false; if (!paused) {
obj.messageOwner.unread = false;
}
markAsRead = true; markAsRead = true;
} }
dayArray.add(0, obj); dayArray.add(0, obj);
@ -2379,6 +2381,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
paused = false; paused = false;
if (readWhenResume && !messages.isEmpty()) { if (readWhenResume && !messages.isEmpty()) {
for (MessageObject messageObject : messages) {
if (!messageObject.isUnread() && !messageObject.isFromMe()) {
break;
}
messageObject.messageOwner.unread = false;
}
readWhenResume = false; readWhenResume = false;
MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, readWithMid, 0, readWithDate, true); MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, readWithMid, 0, readWithDate, true);
} }
@ -3310,7 +3318,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override @Override
public boolean canPerformActions() { public boolean canPerformActions() {
return !actionBarLayer.isActionModeShowed(); return actionBarLayer != null && !actionBarLayer.isActionModeShowed();
} }
}; };
if (view instanceof ChatMediaCell) { if (view instanceof ChatMediaCell) {