Browse Source

Fix unread count

master
Eduard Kuzmenko 5 years ago
parent
commit
971135ff8b
  1. BIN
      .DS_Store
  2. 3
      src/lib/appManagers/appDialogsManager.ts
  3. 3
      src/lib/appManagers/appImManager.ts
  4. 11
      src/lib/appManagers/appMessagesManager.ts
  5. 10
      src/scss/partials/_chat.scss

BIN
.DS_Store vendored

Binary file not shown.

3
src/lib/appManagers/appDialogsManager.ts

@ -195,6 +195,9 @@ export class AppDialogsManager { @@ -195,6 +195,9 @@ export class AppDialogsManager {
} else if(document.type == 'voice') {
lastMessageText += '<i>Voice message</i>';
found = true;
} else if(document.type == 'gif') {
lastMessageText += '<i>GIF</i>';
found = true;
}
if(found) {

3
src/lib/appManagers/appImManager.ts

@ -350,9 +350,10 @@ export class AppImManager { @@ -350,9 +350,10 @@ export class AppImManager {
if(readed.length) {
let max = Math.max(...readed);
let min = Math.min(...readed);
//appMessagesManager.readMessages(readed);
appMessagesManager.readHistory(this.peerID, max);
appMessagesManager.readHistory(this.peerID, max, min);
}
if(this.scroll.scrollHeight - (this.scroll.scrollTop + this.scroll.offsetHeight) == 0/* <= 5 */) {

11
src/lib/appManagers/appMessagesManager.ts

@ -1878,7 +1878,7 @@ export class AppMessagesManager { @@ -1878,7 +1878,7 @@ export class AppMessagesManager {
this.newDialogsToHandle = {};
}
public readHistory(peerID: number, maxID = 0) {
public readHistory(peerID: number, maxID = 0, minID = 0) {
// console.trace('start read')
var isChannel = AppPeersManager.isChannel(peerID);
var historyStorage = this.historiesStorage[peerID];
@ -1971,16 +1971,18 @@ export class AppMessagesManager { @@ -1971,16 +1971,18 @@ export class AppMessagesManager {
message = this.messagesStorage[messageID];
if(message && !message.pFlags.out) {
message.pFlags.unread = false;
if(this.messagesForHistory[messageID]) {
this.messagesForHistory[messageID].pFlags.unread = false;
}
if(this.messagesForDialogs[messageID]) {
this.messagesForDialogs[messageID].pFlags.unread = false;
}
//NotificationsManager.cancel('msg' + messageID); // warning
}
if(messageID == maxID) break;
if(messageID == minID) break;
}
}
@ -2372,11 +2374,10 @@ export class AppMessagesManager { @@ -2372,11 +2374,10 @@ export class AppMessagesManager {
}
}
if(foundDialog[0]) {
if(!isOut &&
newUnreadCount &&
foundDialog[0].top_message <= maxID) {
if(!isOut && newUnreadCount && foundDialog[0].top_message <= maxID) {
newUnreadCount = foundDialog[0].unread_count = 0;
}
let dialogKey = isOut ? 'read_outbox_max_id' : 'read_inbox_max_id';
foundDialog[0][dialogKey] = maxID;
}

10
src/scss/partials/_chat.scss

@ -225,15 +225,15 @@ @@ -225,15 +225,15 @@
&.photo, &.video {
width: min-content;
.message {
/* .message {
width: min-content;
max-width: min-content;
/* .time {
max-width: min-content;
overflow: hidden;
} */
}
} */
.box.web {
width: min-content;
@ -241,6 +241,12 @@ @@ -241,6 +241,12 @@
}
}
&.webpage {
.time {
float: none;
}
}
img, video {
object-fit: contain;
}

Loading…
Cancel
Save