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 {
} else if(document.type == 'voice') { } else if(document.type == 'voice') {
lastMessageText += '<i>Voice message</i>'; lastMessageText += '<i>Voice message</i>';
found = true; found = true;
} else if(document.type == 'gif') {
lastMessageText += '<i>GIF</i>';
found = true;
} }
if(found) { if(found) {

3
src/lib/appManagers/appImManager.ts

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

10
src/scss/partials/_chat.scss

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

Loading…
Cancel
Save