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 {
minSdkVersion 8
targetSdkVersion 19
versionCode 287
versionCode 288
versionName "1.6.1"
}
}

View file

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

View file

@ -1984,7 +1984,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
messages.add(0, dateObj);
}
if (!obj.isOut() && obj.messageOwner.unread) {
obj.messageOwner.unread = false;
if (!paused) {
obj.messageOwner.unread = false;
}
markAsRead = true;
}
dayArray.add(0, obj);
@ -2379,6 +2381,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
paused = false;
if (readWhenResume && !messages.isEmpty()) {
for (MessageObject messageObject : messages) {
if (!messageObject.isUnread() && !messageObject.isFromMe()) {
break;
}
messageObject.messageOwner.unread = false;
}
readWhenResume = false;
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
public boolean canPerformActions() {
return !actionBarLayer.isActionModeShowed();
return actionBarLayer != null && !actionBarLayer.isActionModeShowed();
}
};
if (view instanceof ChatMediaCell) {