Skip to content

Commit

Permalink
Fixed not working notifications in opened chat while app in background
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Jul 20, 2014
1 parent 5855dc0 commit e2a6511
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 287
versionCode 288
versionName "1.6.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2231,16 +2231,11 @@ public void run() {
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;
}
Expand Down
12 changes: 10 additions & 2 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,9 @@ public void run() {
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);
Expand Down Expand Up @@ -2379,6 +2381,12 @@ public void onResume() {
}
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);
}
Expand Down Expand Up @@ -3310,7 +3318,7 @@ public void didLongPressed(ChatBaseCell cell) {

@Override
public boolean canPerformActions() {
return !actionBarLayer.isActionModeShowed();
return actionBarLayer != null && !actionBarLayer.isActionModeShowed();
}
};
if (view instanceof ChatMediaCell) {
Expand Down

0 comments on commit e2a6511

Please sign in to comment.