Commit 750f11f0 by Kim Peace

Merge branch 'refactoring/performance_increase_ios' into 'develop'

Refactoring/performance increase ios

See merge request !181
parents 5d16ab1e cb5d0bbf
...@@ -18,19 +18,20 @@ ...@@ -18,19 +18,20 @@
</head> </head>
<script> <script>
var archiveId; var archiveId;
window.addEventListener('DOMContentLoaded', function(){ window.addEventListener('DOMContentLoaded', function () {
var urlPrm = new Object; var urlPrm = new Object;
var urlSearch = location.search.substring(1).split('&'); var urlSearch = location.search.substring(1).split('&');
var kv = urlSearch[0].split('='); var kv = urlSearch[0].split('=');
urlPrm[kv[0]]=kv[1]; urlPrm[kv[0]] = kv[1];
archiveId = urlPrm.archiveId archiveId = urlPrm.archiveId
if (typeof(android) != "undefined") { if (typeof (android) != "undefined") {
} else {
CHAT_UI.refreshArchiveDetailScreen(urlPrm.archiveId); } else {
} CHAT_UI.refreshArchiveDetailScreen(urlPrm.archiveId);
}); }
</script> });
</script>
<body> <body>
<!-- ナビメニュー --> <!-- ナビメニュー -->
...@@ -126,7 +127,7 @@ ...@@ -126,7 +127,7 @@
<p>{{userName}}</p> <p>{{userName}}</p>
</li> </li>
</script> </script>
<script id="archive-namecard-template" type="text/template"> <script id="archive-namecard-template" type="text/template">
<div class="modal fade profile_modal" id="userNameCard" tabindex="-1" role="dialog" aria-labelledby="userNameCard" aria-hidden="true"> <div class="modal fade profile_modal" id="userNameCard" tabindex="-1" role="dialog" aria-labelledby="userNameCard" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
...@@ -195,7 +196,7 @@ ...@@ -195,7 +196,7 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
if (typeof(android) != "undefined") { if (typeof (android) != "undefined") {
android.getLoginParameter(); android.getLoginParameter();
android.getGlobalParameter(); android.getGlobalParameter();
} else { } else {
......
...@@ -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,6 +295,9 @@ CHAT_DB.getMyGroupUsersNotInRoom = function () { ...@@ -291,6 +295,9 @@ CHAT_DB.getMyGroupUsersNotInRoom = function () {
}; };
CHAT_DB.getUserInfo = function (shopMemberId) { CHAT_DB.getUserInfo = function (shopMemberId) {
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);
......
...@@ -1413,7 +1413,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1413,7 +1413,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,
...@@ -1424,7 +1424,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1424,7 +1424,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,
...@@ -1437,7 +1437,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1437,7 +1437,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);
...@@ -1531,9 +1531,6 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1531,9 +1531,6 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// アーカイブ詳細取得 // アーカイブ詳細取得
var archive = CHAT_DB.getArchiveDetail(archiveId); var archive = CHAT_DB.getArchiveDetail(archiveId);
// チャットルーム情報を取得
var roomId = archive.roomId;
//保存ユーザ情報を取得 //保存ユーザ情報を取得
var userInfo = CHAT_DB.getUserInfo(archive.saveUserId); var userInfo = CHAT_DB.getUserInfo(archive.saveUserId);
userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl); userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl);
...@@ -1651,24 +1648,21 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1651,24 +1648,21 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// 初期化 // 初期化
$("#archiveDetail").html(""); $("#archiveDetail").html("");
// アーカイブ詳細の様式を読み込む // アーカイブ詳細の様式を読み込む
const archiveDetailTemplate = $("#archive-detail-template").html(); const archiveDetailTemplate = $("#archive-detail-template").html();
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
CHAT_DB.updateArchiveDetail(archiveId); CHAT_DB.updateArchiveDetail(archiveId);
} }
// アーカイブ詳細取得 // アーカイブ詳細取得
var archive = CHAT_DB.getArchiveDetail(archiveId); const archive = CHAT_DB.getArchiveDetail(archiveId);
// チャットルーム情報を取得
var roomId = archive.roomId;
//保存ユーザ情報を取得 // 保存ユーザ情報を取得
var userInfo = CHAT_DB.getUserInfo(archive.saveUserId); const userInfo = CHAT_DB.getUserInfo(archive.saveUserId);
userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl); userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl);
// アーカイブ情報を表示 // アーカイブ情報を表示
var html = Mustache.render(archiveDetailTemplate, { const html = Mustache.render(archiveDetailTemplate, {
fileName: archive.archiveName, fileName: archive.archiveName,
insertDate: archive.archiveDate, insertDate: archive.archiveDate,
chatRoomName: archive.roomName, chatRoomName: archive.roomName,
...@@ -1678,11 +1672,12 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1678,11 +1672,12 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
userId: userInfo.shopMemberId, userId: userInfo.shopMemberId,
}); });
var obj = $(jQuery.parseHTML(html)).on("click", function () {}); var obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#archiveDetail").append(obj); $("#archiveDetail").append(obj);
// プレイヤーの切り替え // プレイヤーの切り替え
var archiveFilePath = CHAT.createGetDataUrl(archive.filePath, archive.roomId); const archiveFilePath = CHAT.createGetDataUrl(archive.filePath, archive.roomId);
switch (archive.archiveType) { switch (archive.archiveType) {
case "0": // 画像 case "0": // 画像
...@@ -1753,14 +1748,15 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1753,14 +1748,15 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
} }
attendUserList.forEach(function (user) { attendUserList.forEach(function (user) {
if (user == "") { return; }
var userInfo = CHAT_DB.getUserInfo(user); var userInfo = CHAT_DB.getUserInfo(user);
userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl); userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl);
var html = Mustache.render(archiveUserTemplate, { const html = Mustache.render(archiveUserTemplate, {
profileImage: userInfo.profileUrl, profileImage: userInfo.profileUrl,
userName: userInfo.shopMemberName, userName: userInfo.shopMemberName,
}); });
var obj = $(jQuery.parseHTML(html)).on("click", function () { const obj = $(jQuery.parseHTML(html)).on("click", function () {
// ネームカード表示 // ネームカード表示
CHAT_UI.makeNameCard(user); CHAT_UI.makeNameCard(user);
}); });
......
...@@ -157,4 +157,6 @@ const NATIVE_KEY_IOS = { ...@@ -157,4 +157,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