Commit cb5d0bbf by Kim Peace

Fixed for chat performance tunning

parent 2824234e
...@@ -51,7 +51,11 @@ CHAT_DB.getMessages = function (roomId) { ...@@ -51,7 +51,11 @@ CHAT_DB.getMessages = function (roomId) {
CHAT_DB.getMessagesWithMessageId = function (messageId) { CHAT_DB.getMessagesWithMessageId = function (messageId) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
//TODO メッセージ追加呼出。 return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessageListFromMessageId, {
messageId: messageId
})
);
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getMessageListFromMessageId(messageId)); return JSON.parse(android.getMessageListFromMessageId(messageId));
} }
...@@ -270,8 +274,8 @@ CHAT_DB.searchMessages = function (keyword, userList) { ...@@ -270,8 +274,8 @@ CHAT_DB.searchMessages = function (keyword, userList) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
return JSON.parse( return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.searchMessages, { callNativeApp(NATIVE_KEY_IOS.searchMessages, {
"keyWord": keyword, keyWord: keyword,
"userList": userList, userList: userList,
}) })
); );
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
...@@ -291,7 +295,9 @@ CHAT_DB.getMyGroupUsersNotInRoom = function () { ...@@ -291,7 +295,9 @@ CHAT_DB.getMyGroupUsersNotInRoom = function () {
}; };
CHAT_DB.getUserInfo = function (shopMemberId) { CHAT_DB.getUserInfo = function (shopMemberId) {
if (shopMemberId == "") { return; } if (shopMemberId == "") {
return;
}
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
return JSON.parse( return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUserInfo, { shopMemberId: shopMemberId }) callNativeApp(NATIVE_KEY_IOS.getUserInfo, { shopMemberId: shopMemberId })
......
var lastscrollvalue; var lastscrollvalue;
window.onscroll = function () { window.onscroll = function () {
beforeScroll = window.scrollY; beforeScroll = window.scrollY;
var beforeHeight = $(".room_container").height(); const beforeHeight = $(".room_container").height();
messageCount = $(".chat_message").length; messageCount = $(".chat_message").length;
if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) { if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) {
if (!$("#chatLoader").is(":visible")) { if (!$("#chatLoader").is(":visible")) {
...@@ -9,14 +9,15 @@ window.onscroll = function () { ...@@ -9,14 +9,15 @@ window.onscroll = function () {
'<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" /></div>'
); );
$("#messages").prepend(loader); $("#messages").prepend(loader);
var messageId = $($(".chat_message").get(0)).data("messageid"); const messageId = $($(".chat_message").get(0)).data("messageid");
var messages; let messages;
if (typeof android != "undefined") { if (typeof android != "undefined") {
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
android.updatePreMessage(messageId); android.updatePreMessage(messageId);
} }
} else { } else {
//TODO 追加メッセージUpdate、get // 追加メッセージUpdate、get
webkit.messageHandlers.updatePreMessage.postMessage({ messageId: messageId });
} }
messages = CHAT_DB.getMessagesWithMessageId(messageId); messages = CHAT_DB.getMessagesWithMessageId(messageId);
CHAT_UI.prependMessage(messages); CHAT_UI.prependMessage(messages);
......
...@@ -1407,7 +1407,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1407,7 +1407,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) {
$("#parentGroupArea").removeClass("none"); $("#parentGroupArea").removeClass("none");
} }
//該当グループのパースを表示。 //該当グループのパースを表示。
var groupPathTemplate = getTemplate(TemplateURL.GROUP_PATH); const groupPathTemplate = getTemplate(TemplateURL.GROUP_PATH);
result.groupPathList.forEach(function (groupPath) { result.groupPathList.forEach(function (groupPath) {
let html = Mustache.render(groupPathTemplate, { let html = Mustache.render(groupPathTemplate, {
name: groupPath.groupName, name: groupPath.groupName,
...@@ -1418,7 +1418,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1418,7 +1418,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) {
}); });
//該当グループの下位グループ表示。 //該当グループの下位グループ表示。
var groupTemplate = getTemplate(TemplateURL.GROUP_LIST); const groupTemplate = getTemplate(TemplateURL.GROUP_LIST);
result.childGroupList.forEach(function (childGroup) { result.childGroupList.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, { let html = Mustache.render(groupTemplate, {
name: childGroup.groupName, name: childGroup.groupName,
...@@ -1431,7 +1431,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1431,7 +1431,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) {
}); });
//該当グループの所属ユーザを表示。 //該当グループの所属ユーザを表示。
var userTemplate = getTemplate(TemplateURL.USER_LIST); const userTemplate = getTemplate(TemplateURL.USER_LIST);
result.groupUserList.forEach(function (groupUser) { result.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = CHAT.getProfileImgUrl(groupUser.profileUrl); groupUser.profileUrl = CHAT.getProfileImgUrl(groupUser.profileUrl);
...@@ -1639,7 +1639,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1639,7 +1639,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// loadingIndicatorを表示 // loadingIndicatorを表示
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
// 初期化 // 初期化
$("#archiveDetail").html(""); $("#archiveDetail").html("");
......
...@@ -152,4 +152,6 @@ const NATIVE_KEY_IOS = { ...@@ -152,4 +152,6 @@ const NATIVE_KEY_IOS = {
getMyGroupUsersNotInRoom: "getMyGroupUsersNotInRoom", getMyGroupUsersNotInRoom: "getMyGroupUsersNotInRoom",
getUserInfo: "getUserInfo", getUserInfo: "getUserInfo",
getUserListByLoginId: "getUserListByLoginId", getUserListByLoginId: "getUserListByLoginId",
getMessageListFromMessageId: "getMessageListFromMessageId",
updatePreMessage: "updatePreMessage",
}; };
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