Commit 0d0213e3 by Kim Peace

Fixed to load 100 over messages

parent 91ad8f0f
...@@ -183,7 +183,7 @@ CHAT_SOCKET.cleanUpCollaborationMessage = function () { ...@@ -183,7 +183,7 @@ CHAT_SOCKET.cleanUpCollaborationMessage = function () {
.attr("disabled", "disabled"); .attr("disabled", "disabled");
$(collaborationMessage) $(collaborationMessage)
.find(".collaboration_join_message") .find(".collaboration_join_message")
.text(getLocalizedString("flex-directionmessage_ended")); .text(getLocalizedString("message_ended"));
}); });
}; };
......
...@@ -14,28 +14,38 @@ window.onscroll = function () { ...@@ -14,28 +14,38 @@ window.onscroll = function () {
messageCount = $(".chat_message").length; messageCount = $(".chat_message").length;
// TODO: peacekim :: check this condition // TODO: peacekim :: check this condition
if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) { if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) {
setTimeout(function () { setTimeout(() => {
if (!$("#chatLoader").is(":visible")) { if (!$("#chatLoader").is(":visible")) {
// display loading indicator in chat message // display loading indicator in chat message
let loader = $( let loader = $(
'<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>' '<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" />'
); );
$("#messages").append(loader); $("#messages").append(loader);
// get lastest message id and update message from server via native }
const messageID = $($(".chat_message").last()).data("messageid"); ChatRoom.loadNewMessage().then((messages) => {
NativeBridgeDelegate.updatePreMessage(messageID);
let messages = NativeBridgeDataSource.getMessagesByMessageID(messageID);
// prepend message // prepend message
ChatRoom.prependMessage(messages); ChatRoom.prependMessage(messages);
// hide loading indicator // hide loading indicator
if (typeof loader !== "undefined") {
loader.remove(); loader.remove();
var afterHeight = $(".room_container").height();
window.scroll(0, afterHeight - beforeHeight);
} }
const afterHeight = $(".room_container").height();
window.scroll(0, afterHeight - beforeHeight);
});
}, 0); }, 0);
} }
}; };
ChatRoom.loadNewMessage = async function () {
return new Promise(function (done) {
// get lastest message id and update message from server via native
const messageID = $($(".chat_message").last()).data("messageid");
NativeBridgeDelegate.updatePreMessage(messageID);
let messages = NativeBridgeDataSource.getMessagesByMessageID(messageID);
done(messages);
});
};
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
// 検索イベントバインディング // 検索イベントバインディング
ChatRoom.bindSearchUI(); ChatRoom.bindSearchUI();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment