Compare commits

..

No commits in common. "61a04b034a009f0eee50bca993dd608c931b6ccb" and "400cda8dcdfed42a2bda4dd32de2973e015cf313" have entirely different histories.

3 changed files with 4 additions and 13 deletions

View file

@ -1,7 +1,6 @@
import QtQuick 2.6 import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import WerkWolf.Fernschreiber 1.0 import WerkWolf.Fernschreiber 1.0
import "../js/functions.js" as Functions
ListItem { ListItem {
id: chatListViewItem id: chatListViewItem
@ -104,7 +103,7 @@ ListItem {
anchors.centerIn: chatUnreadMessagesCountBackground anchors.centerIn: chatUnreadMessagesCountBackground
visible: chatListViewItem.unreadCount > 0 visible: chatListViewItem.unreadCount > 0
opacity: isMuted ? Theme.opacityHigh : 1.0 opacity: isMuted ? Theme.opacityHigh : 1.0
text: Functions.formatUnreadCount(chatListViewItem.unreadCount) text: chatListViewItem.unreadCount > 99 ? "99+" : chatListViewItem.unreadCount
} }
Rectangle { Rectangle {

View file

@ -27,14 +27,6 @@ function setGlobals(globals) {
tdLibWrapper = globals.tdLibWrapper; tdLibWrapper = globals.tdLibWrapper;
appNotification = globals.appNotification; appNotification = globals.appNotification;
} }
function formatUnreadCount(value) {
if(value < 1000) {
return value;
} else if(value > 9000) {
return '9k+';
}
return ''+Math.floor(value / 1000)+'k'+((value % 1000)>0 ? '+' : '');
}
function getUserName(userInformation) { function getUserName(userInformation) {
return ((userInformation.first_name || "") + " " + (userInformation.last_name || "")).trim(); return ((userInformation.first_name || "") + " " + (userInformation.last_name || "")).trim();

View file

@ -618,8 +618,8 @@ Page {
onUnreadCountUpdated: { onUnreadCountUpdated: {
Debug.log("[ChatPage] Unread count updated, new count: ", unreadCount); Debug.log("[ChatPage] Unread count updated, new count: ", unreadCount);
chatInformation.unread_count = unreadCount; chatInformation.unread_count = unreadCount;
chatUnreadMessagesItem.visible = ( !chatPage.loading && unreadCount > 0 && chatOverviewItem.visible ); chatUnreadMessagesItem.visible = ( !chatPage.loading && chatInformation.unread_count > 0 && chatOverviewItem.visible );
chatUnreadMessagesCount.text = Functions.formatUnreadCount(unreadCount) chatUnreadMessagesCount.text = unreadCount > 99 ? "99+" : unreadCount;
} }
onLastReadSentMessageUpdated: { onLastReadSentMessageUpdated: {
Debug.log("[ChatPage] Updating last read sent index, new index: ", lastReadSentIndex); Debug.log("[ChatPage] Updating last read sent index, new index: ", lastReadSentIndex);
@ -1427,7 +1427,7 @@ Page {
color: Theme.primaryColor color: Theme.primaryColor
anchors.centerIn: chatUnreadMessagesCountBackground anchors.centerIn: chatUnreadMessagesCountBackground
visible: chatUnreadMessagesItem.visible visible: chatUnreadMessagesItem.visible
text: Functions.formatUnreadCount(chatInformation.unread_count) text: chatInformation.unread_count > 99 ? "99+" : chatInformation.unread_count
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent