Commit 37bc4f94 by Kim Peace

Fixed var to const and let

parent ab1b8a92
...@@ -81,9 +81,9 @@ ...@@ -81,9 +81,9 @@
var archiveId; var archiveId;
window.addEventListener('DOMContentLoaded', function () { window.addEventListener('DOMContentLoaded', function () {
var urlPrm = new Object; let urlPrm = new Object;
var urlSearch = location.search.substring(1).split('&'); const urlSearch = location.search.substring(1).split('&');
var kv = urlSearch[0].split('='); const kv = urlSearch[0].split('=');
urlPrm[kv[0]] = kv[1]; urlPrm[kv[0]] = kv[1];
archiveId = urlPrm.archiveId archiveId = urlPrm.archiveId
ArchiveUI.refreshArchiveDetailScreen(urlPrm.archiveId); ArchiveUI.refreshArchiveDetailScreen(urlPrm.archiveId);
......
...@@ -69,6 +69,13 @@ const COLLABORATION_JOIN_TYPE = { ...@@ -69,6 +69,13 @@ const COLLABORATION_JOIN_TYPE = {
INVITED: "2", INVITED: "2",
}; };
const ARCHIVE_TYPE = {
PICTURE: 0,
VIDEO: 1,
VOICE: 2,
DOCUMENT: 3,
};
const messageSeperator = "<::split>"; const messageSeperator = "<::split>";
const DATA_MESSAGE_SCHEME = "::NOT_MESSAGE"; const DATA_MESSAGE_SCHEME = "::NOT_MESSAGE";
const FINISH_ALL_COLLABORATION_SIGNAL = "::ALL_COLLABORATION_END"; const FINISH_ALL_COLLABORATION_SIGNAL = "::ALL_COLLABORATION_END";
......
// ios用 // ios用
function callNativeApp(iosKey, jsonData) { function callNativeApp(iosKey, jsonData) {
console.log("callNativeApp called: " + iosKey); console.debug("callNativeApp called: " + iosKey);
var result; var result;
try { try {
var key = iosKey; var key = iosKey;
...@@ -10,7 +10,7 @@ function callNativeApp(iosKey, jsonData) { ...@@ -10,7 +10,7 @@ function callNativeApp(iosKey, jsonData) {
// resにObjective-cからのレスポンスが返る // resにObjective-cからのレスポンスが返る
result = prompt(JSON.stringify(payload)); result = prompt(JSON.stringify(payload));
} catch (err) { } catch (err) {
console.log("The native context does not exist yet"); console.debug("The native context does not exist yet");
} }
return result; return result;
} }
...@@ -75,26 +75,26 @@ NativeBridgeDataSource.getMyInfo = function () { ...@@ -75,26 +75,26 @@ NativeBridgeDataSource.getMyInfo = function () {
} }
}; };
NativeBridgeDataSource.getMessages = function (roomId) { NativeBridgeDataSource.getMessagesByRoomID = function (roomID) {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
return JSON.parse( return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomId }) callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomID })
); );
} else if (deviceInfo.isAndroid()) { } else if (deviceInfo.isAndroid()) {
//String形式をJsonに変更してReturn //String形式をJsonに変更してReturn
return JSON.parse(android.getMessageList(roomId)); return JSON.parse(android.getMessageList(roomID));
} }
}; };
NativeBridgeDataSource.getMessagesWithMessageId = function (messageId) { NativeBridgeDataSource.getMessagesByMessageID = function (messageID) {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
return JSON.parse( return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessageListFromMessageId, { callNativeApp(NATIVE_KEY_IOS.getMessageListFromMessageId, {
messageId: messageId, messageId: messageID,
}) })
); );
} else if (deviceInfo.isAndroid()) { } else if (deviceInfo.isAndroid()) {
return JSON.parse(android.getMessageListFromMessageId(messageId)); return JSON.parse(android.getMessageListFromMessageId(messageID));
} }
}; };
...@@ -153,7 +153,6 @@ NativeBridgeDataSource.getGroupInfoForAddUser = function (groupId) { ...@@ -153,7 +153,6 @@ NativeBridgeDataSource.getGroupInfoForAddUser = function (groupId) {
callNativeApp(NATIVE_KEY_IOS.getGroupInfoForAddUser, { groupId: groupId }) callNativeApp(NATIVE_KEY_IOS.getGroupInfoForAddUser, { groupId: groupId })
); );
} else if (deviceInfo.isAndroid()) { } else if (deviceInfo.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupInfoForAddUser(groupId)); return JSON.parse(android.getGroupInfoForAddUser(groupId));
} }
}; };
...@@ -162,8 +161,6 @@ NativeBridgeDataSource.loadSelectedUsers = function () { ...@@ -162,8 +161,6 @@ NativeBridgeDataSource.loadSelectedUsers = function () {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getSelectedUserList, {})); return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getSelectedUserList, {}));
} else if (deviceInfo.isAndroid()) { } else if (deviceInfo.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(JSON.parse(android.getSelectedUserList()));
return JSON.parse(android.getSelectedUserList()); return JSON.parse(android.getSelectedUserList());
} }
}; };
...@@ -334,7 +331,6 @@ NativeBridgeDataSource.getUserInfo = function (shopMemberId) { ...@@ -334,7 +331,6 @@ NativeBridgeDataSource.getUserInfo = function (shopMemberId) {
}; };
NativeBridgeDataSource.getUserListByLoginId = function (loginIdList) { NativeBridgeDataSource.getUserListByLoginId = function (loginIdList) {
console.log(loginIdList);
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
return JSON.parse( return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUserListByLoginId, { callNativeApp(NATIVE_KEY_IOS.getUserListByLoginId, {
......
...@@ -190,15 +190,15 @@ NativeBridgeDelegate.goHome = function () { ...@@ -190,15 +190,15 @@ NativeBridgeDelegate.goHome = function () {
} }
}; };
NativeBridgeDelegate.updatePreMessage = function (messageId) { NativeBridgeDelegate.updatePreMessage = function (messageID) {
if (typeof android != "undefined") { if (typeof android != "undefined") {
if (serverInfo.isOnline == "true") { if (serverInfo.isOnline == "true") {
android.updatePreMessage(messageId); android.updatePreMessage(messageID);
} }
} else { } else {
// 追加メッセージUpdate、get // 追加メッセージUpdate、get
webkit.messageHandlers.updatePreMessage.postMessage({ webkit.messageHandlers.updatePreMessage.postMessage({
messageId: messageId, messageId: messageID,
}); });
} }
}; };
......
var bindOnNewMessage = function () { var bindOnNewMessage = function () {
// New Message // New Message
// #36170 // #36170
socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomId, roomName) { socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomID, roomName) {
const systemMessageTemplate = getTemplate(TemplateURL.SYSTEM_MESSAGE); const systemMessageTemplate = getTemplate(TemplateURL.SYSTEM_MESSAGE);
const unwrappedMessageInfo = decodeMessage(message.text); const unwrappedMessageInfo = decodeMessage(message.text);
......
...@@ -181,7 +181,7 @@ var bindOnRefreshUserListInGroup = function () { ...@@ -181,7 +181,7 @@ var bindOnRefreshUserListInGroup = function () {
socket.on( socket.on(
SOCKET_KEY.REFRESH_USERLIST_INGROUP, SOCKET_KEY.REFRESH_USERLIST_INGROUP,
function (users, groupId, isInvite) { function (users, groupId, isInvite) {
console.log( console.debug(
SOCKET_KEY.REFRESH_USERLIST_INGROUP + SOCKET_KEY.REFRESH_USERLIST_INGROUP +
"message received but it does nothing." "message received but it does nothing."
); );
......
...@@ -22,8 +22,7 @@ $("#image-form").on("submit", function (e) { ...@@ -22,8 +22,7 @@ $("#image-form").on("submit", function (e) {
$(".overlay").addClass("active undismissable"); $(".overlay").addClass("active undismissable");
$(".loader").addClass("active"); $(".loader").addClass("active");
Common.showLoadingIndicator(); Common.showLoadingIndicator();
var fd = new FormData($(this)[0]); let fd = new FormData($(this)[0]);
console.log($(this)[0]);
//画像の大きさが500pixelより大きかったら、thumbnailを生成 //画像の大きさが500pixelより大きかったら、thumbnailを生成
ChatMediaHandler.createThumbnailAndUpload( ChatMediaHandler.createThumbnailAndUpload(
file, file,
...@@ -180,9 +179,11 @@ ChatMediaHandler.videoEncodeEnd = function (encodedUri) { ...@@ -180,9 +179,11 @@ ChatMediaHandler.videoEncodeEnd = function (encodedUri) {
xhr.send(); xhr.send();
}; };
// Video のサムネイルファイル生成する // Video のサムネイルファイル生成する
ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback) { ChatMediaHandler.createVideoThumbnailAndUpload = function (
sourceImage,
callback
) {
var fileReader = new FileReader(); var fileReader = new FileReader();
fileReader.onload = function () { fileReader.onload = function () {
...@@ -223,7 +224,7 @@ ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback ...@@ -223,7 +224,7 @@ ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback
.catch((error) => { .catch((error) => {
// fetch Error catch Block // fetch Error catch Block
if (error) { if (error) {
console.log(error); console.error(error);
} }
}); });
return true; return true;
...@@ -239,7 +240,6 @@ ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback ...@@ -239,7 +240,6 @@ ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback
fileReader.readAsArrayBuffer(sourceImage); fileReader.readAsArrayBuffer(sourceImage);
}; };
// Ajaxでイメージをアップロードする // Ajaxでイメージをアップロードする
ChatMediaHandler.uploadImage = function (formData) { ChatMediaHandler.uploadImage = function (formData) {
formData.append("roomId", roomInfo.roomID); formData.append("roomId", roomInfo.roomID);
...@@ -379,7 +379,6 @@ ChatMediaHandler.uploadImage = function (formData) { ...@@ -379,7 +379,6 @@ ChatMediaHandler.uploadImage = function (formData) {
}); });
}; };
// Thumbnailのファイルを生成する。 // Thumbnailのファイルを生成する。
ChatMediaHandler.createThumbnailAndUpload = function (sourceImage, callback) { ChatMediaHandler.createThumbnailAndUpload = function (sourceImage, callback) {
const fileReader = new FileReader(); const fileReader = new FileReader();
...@@ -435,10 +434,10 @@ ChatMediaHandler.createThumbnailAndUpload = function (sourceImage, callback) { ...@@ -435,10 +434,10 @@ ChatMediaHandler.createThumbnailAndUpload = function (sourceImage, callback) {
.catch((error) => { .catch((error) => {
// fetch Error catch Block // fetch Error catch Block
if (error) { if (error) {
console.log(error); console.error(error);
} }
}); });
}; };
fileReader.readAsDataURL(sourceImage); fileReader.readAsDataURL(sourceImage);
}; };
\ No newline at end of file
...@@ -3,18 +3,18 @@ var ArchiveUI = {}; ...@@ -3,18 +3,18 @@ var ArchiveUI = {};
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
// アーカイブ検索 // アーカイブ検索
bindArchiveSearch(); ArchiveUI.bindArchiveSearch();
// iOSキーボード変換検知用 // iOSキーボード変換検知用
bindiOSKeyBoardEvent(); ArchiveUI.bindiOSKeyBoardEvent();
}); });
ArchiveUI.refreshSearchScreen = function (keyword) { ArchiveUI.refreshSearchScreen = function (keyword) {
const archiveList = NativeBridgeDataSource.getArchiveByName(keyword); const archiveList = NativeBridgeDataSource.getArchiveByName(keyword);
const typeImage = getArchiveTypeIconURL(archive.archiveType); const typeImage = ArchiveUI.getArchiveTypeIconURL(archive.archiveType);
getArchiveTemplate().then(function (archiveTemplate) { ArchiveUI.getArchiveTemplate().then(function (archiveTemplate) {
archiveList.forEach(function (archive) { archiveList.forEach(function (archive) {
let html = renderArchiveTemplate( let html = ArchiveUI.renderArchiveTemplate(
archiveTemplate, archiveTemplate,
archive.archiveId, archive.archiveId,
archive.archiveName, archive.archiveName,
...@@ -28,15 +28,7 @@ ArchiveUI.refreshSearchScreen = function (keyword) { ...@@ -28,15 +28,7 @@ ArchiveUI.refreshSearchScreen = function (keyword) {
}); });
}; };
//* UTILS *// ArchiveUI.getArchiveTypeIconURL = function (type) {
const ARCHIVE_TYPE = {
PICTURE: 0,
VIDEO: 1,
VOICE: 2,
DOCUMENT: 3,
};
var getArchiveTypeIconURL = function (type) {
switch (type) { switch (type) {
case ARCHIVE_TYPE.PICTURE: case ARCHIVE_TYPE.PICTURE:
return "icon/icon_collabo_picture.png"; return "icon/icon_collabo_picture.png";
...@@ -51,7 +43,7 @@ var getArchiveTypeIconURL = function (type) { ...@@ -51,7 +43,7 @@ var getArchiveTypeIconURL = function (type) {
} }
}; };
var getArchiveTemplate = function () { ArchiveUI.getArchiveTemplate = function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
$.get({ url: TemplateURL.ARCHIVE_LIST, async: false }, function (text) { $.get({ url: TemplateURL.ARCHIVE_LIST, async: false }, function (text) {
resolve(text); resolve(text);
...@@ -59,10 +51,10 @@ var getArchiveTemplate = function () { ...@@ -59,10 +51,10 @@ var getArchiveTemplate = function () {
}); });
}; };
var bindArchiveSearch = function () { ArchiveUI.bindArchiveSearch = function () {
const searchInput = $('#archive .search_form input[type="search"]'); const searchInput = $('#archive .search_form input[type="search"]');
searchInput.keyup(function (e) { searchInput.keyup(function (e) {
var keyword = searchInput.val(); const keyword = searchInput.val();
const enterKeyPressed = e.KeyCode == 13 || e.key == "Enter"; const enterKeyPressed = e.KeyCode == 13 || e.key == "Enter";
const keywordEmpty = keyword == "" || keyword.length < 2; const keywordEmpty = keyword == "" || keyword.length < 2;
const keywordNotEmpty = keyword.length != 0 && keyword != ""; const keywordNotEmpty = keyword.length != 0 && keyword != "";
...@@ -87,18 +79,18 @@ var bindArchiveSearch = function () { ...@@ -87,18 +79,18 @@ var bindArchiveSearch = function () {
}); });
}; };
var bindiOSKeyBoardEvent = function () { ArchiveUI.bindiOSKeyBoardEvent = function () {
const searchInput = $('#archive .search_form input[type="search"]'); const searchInput = $('#archive .search_form input[type="search"]');
searchInput.on("compositionend", function () { searchInput.on("compositionend", function () {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
var keyword = searchInput.val(); const keyword = searchInput.val();
$(".overlay_src_msg").empty(); $(".overlay_src_msg").empty();
ArchiveUI.refreshSearchScreen(keyword); ArchiveUI.refreshSearchScreen(keyword);
} }
}); });
}; };
var renderArchiveTemplate = function ( ArchiveUI.renderArchiveTemplate = function (
html, html,
archiveId, archiveId,
archiveName, archiveName,
...@@ -131,13 +123,13 @@ ArchiveUI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -131,13 +123,13 @@ ArchiveUI.refreshArchiveDetailScreen = function (archiveId) {
const archive = NativeBridgeDataSource.getArchiveDetail(archiveId); const archive = NativeBridgeDataSource.getArchiveDetail(archiveId);
// template archive detail // template archive detail
appendArchiveDetailScreen(archive); ArchiveUI.appendArchiveDetailScreen(archive);
// setup player // setup player
appendPlayer(archive); ArchiveUI.appendPlayer(archive);
// append attended users // append attended users
appendAttendUsers(archive.attendUserIds); ArchiveUI.appendAttendUsers(archive.attendUserIds);
// set languages // set languages
currentUserInfo.configureLanguage(); currentUserInfo.configureLanguage();
...@@ -159,7 +151,7 @@ ArchiveUI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -159,7 +151,7 @@ ArchiveUI.refreshArchiveDetailScreen = function (archiveId) {
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
}; };
var appendArchiveDetailScreen = function (archive) { ArchiveUI.appendArchiveDetailScreen = function (archive) {
// 保存ユーザ情報を取得 // 保存ユーザ情報を取得
const userInfo = NativeBridgeDataSource.getUserInfo(archive.saveUserId); const userInfo = NativeBridgeDataSource.getUserInfo(archive.saveUserId);
userInfo.profileUrl = Common.getProfileImgUrl(userInfo.profileUrl); userInfo.profileUrl = Common.getProfileImgUrl(userInfo.profileUrl);
...@@ -182,7 +174,7 @@ var appendArchiveDetailScreen = function (archive) { ...@@ -182,7 +174,7 @@ var appendArchiveDetailScreen = function (archive) {
$("#archiveDetail").append(obj); $("#archiveDetail").append(obj);
}; };
var appendPlayer = function (archive) { ArchiveUI.appendPlayer = function (archive) {
// プレイヤーの切り替え // プレイヤーの切り替え
const archiveFilePath = ArchiveUI.createGetDataUrl( const archiveFilePath = ArchiveUI.createGetDataUrl(
archive.filePath, archive.filePath,
...@@ -192,15 +184,15 @@ var appendPlayer = function (archive) { ...@@ -192,15 +184,15 @@ var appendPlayer = function (archive) {
switch (archive.archiveType) { switch (archive.archiveType) {
case "0": // 画像 case "0": // 画像
case 0: case 0:
appendImageTypePlayer(archiveFilePath); ArchiveUI.appendImageTypePlayer(archiveFilePath);
break; break;
case "1": // 動画 case "1": // 動画
case 1: case 1:
appendVideoTypePlayer(archiveFilePath); ArchiveUI.appendVideoTypePlayer(archiveFilePath);
break; break;
case "2": // 音声 case "2": // 音声
case 2: case 2:
appendVoiceTypePlayer(archiveFilePath); ArchiveUI.appendVoiceTypePlayer(archiveFilePath);
break; break;
case "3": // 文書 case "3": // 文書
case 3: case 3:
...@@ -211,13 +203,13 @@ var appendPlayer = function (archive) { ...@@ -211,13 +203,13 @@ var appendPlayer = function (archive) {
} }
}; };
var appendImageTypePlayer = function (filePath) { ArchiveUI.appendImageTypePlayer = function (filePath) {
$("#archive_player").prepend( $("#archive_player").prepend(
'<img class="archive_player" src="' + filePath + '" />' '<img class="archive_player" src="' + filePath + '" />'
); );
}; };
var appendVideoTypePlayer = function (filePath) { ArchiveUI.appendVideoTypePlayer = function (filePath) {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
$("#archive_player").prepend( $("#archive_player").prepend(
'<video class="archive_player" controls autoplay muted playsinline controlsList="nodownload"><source src="' + '<video class="archive_player" controls autoplay muted playsinline controlsList="nodownload"><source src="' +
...@@ -237,7 +229,7 @@ var appendVideoTypePlayer = function (filePath) { ...@@ -237,7 +229,7 @@ var appendVideoTypePlayer = function (filePath) {
} }
}; };
var appendVoiceTypePlayer = function (filePath) { ArchiveUI.appendVoiceTypePlayer = function (filePath) {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
$("#archive_player").prepend( $("#archive_player").prepend(
'<audio class="archive_audio_player" controls controlsList="nodownload"><source src="' + '<audio class="archive_audio_player" controls controlsList="nodownload"><source src="' +
...@@ -258,7 +250,7 @@ var appendVoiceTypePlayer = function (filePath) { ...@@ -258,7 +250,7 @@ var appendVoiceTypePlayer = function (filePath) {
); );
}; };
var appendAttendUsers = function (attendedUserList) { ArchiveUI.appendAttendUsers = function (attendedUserList) {
// ユーザの様式を読み込む // ユーザの様式を読み込む
const archiveUserTemplate = getTemplate(TemplateURL.ARCHIVE_USER); const archiveUserTemplate = getTemplate(TemplateURL.ARCHIVE_USER);
...@@ -271,7 +263,7 @@ var appendAttendUsers = function (attendedUserList) { ...@@ -271,7 +263,7 @@ var appendAttendUsers = function (attendedUserList) {
if (user == "") { if (user == "") {
return; return;
} }
var userInfo = NativeBridgeDataSource.getUserInfo(user); const userInfo = NativeBridgeDataSource.getUserInfo(user);
userInfo.profileUrl = Common.getProfileImgUrl(userInfo.profileUrl); userInfo.profileUrl = Common.getProfileImgUrl(userInfo.profileUrl);
const html = Mustache.render(archiveUserTemplate, { const html = Mustache.render(archiveUserTemplate, {
profileImage: userInfo.profileUrl, profileImage: userInfo.profileUrl,
...@@ -288,15 +280,15 @@ var appendAttendUsers = function (attendedUserList) { ...@@ -288,15 +280,15 @@ var appendAttendUsers = function (attendedUserList) {
}; };
ArchiveUI.createGetDataUrl = function (fileName, roomId) { ArchiveUI.createGetDataUrl = function (fileName, roomId) {
var filePath = return (
serverInfo.cmsURL + serverInfo.cmsURL +
"/chatapi/file/getImage?sid=" + "/chatapi/file/getImage?sid=" +
currentUserInfo.sid + currentUserInfo.sid +
"&fileName=" + "&fileName=" +
fileName + fileName +
"&roomId=" + "&roomId=" +
roomId; roomId
return filePath; );
}; };
// アーカイブ一覧 // アーカイブ一覧
...@@ -316,7 +308,7 @@ ArchiveUI.refreshArchiveScreen = function () { ...@@ -316,7 +308,7 @@ ArchiveUI.refreshArchiveScreen = function () {
} }
// ローカルDBのデータを表示 // ローカルDBのデータを表示
var archiveList = NativeBridgeDataSource.getArchiveList(); const archiveList = NativeBridgeDataSource.getArchiveList();
if (typeof archiveList == "undefined") { if (typeof archiveList == "undefined") {
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
return; return;
...@@ -340,13 +332,13 @@ ArchiveUI.refreshArchiveScreen = function () { ...@@ -340,13 +332,13 @@ ArchiveUI.refreshArchiveScreen = function () {
// その他 // その他
typeImage = ""; typeImage = "";
} }
let html = Mustache.render(archiveTemplate, { const html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId, archiveId: archive.archiveId,
fileName: archive.archiveName, fileName: archive.archiveName,
insertDate: archive.archiveDate, insertDate: archive.archiveDate,
typeImage: typeImage, typeImage: typeImage,
}); });
let obj = $(jQuery.parseHTML(html)).on("click", function () {}); const obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#archiveList").append(obj); $("#archiveList").append(obj);
}); });
......
...@@ -95,7 +95,8 @@ ChatRoom.loadMessages = function (joinRoomID, joinRoomName) { ...@@ -95,7 +95,8 @@ ChatRoom.loadMessages = function (joinRoomID, joinRoomName) {
ChatRoom.appendAttendedUsers(roomID); ChatRoom.appendAttendedUsers(roomID);
// メッセージ表示 // メッセージ表示
ChatRoom.prependMessage(roomID); let messages = NativeBridgeDataSource.getMessagesByRoomID(roomID);
ChatRoom.prependMessage(messages);
// スクロール調整 // スクロール調整
let jQueryMessages = $("#messages"); let jQueryMessages = $("#messages");
...@@ -144,8 +145,7 @@ ChatRoom.appendAttendedUsers = function (roomID) { ...@@ -144,8 +145,7 @@ ChatRoom.appendAttendedUsers = function (roomID) {
$("#filter").append(filterObj); $("#filter").append(filterObj);
}; };
ChatRoom.prependMessage = function (roomID) { ChatRoom.prependMessage = function (messages) {
const messages = NativeBridgeDataSource.getMessages(roomID);
const now = new Date(); const now = new Date();
// メッセージ文字列の生成 // メッセージ文字列の生成
let workVal = ""; let workVal = "";
......
...@@ -17,9 +17,9 @@ window.onscroll = function () { ...@@ -17,9 +17,9 @@ 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);
const messageId = $($(".chat_message").get(0)).data("messageid"); const messageID = $($(".chat_message").get(0)).data("messageid");
NativeBridgeDelegate.updatePreMessage(messageId); NativeBridgeDelegate.updatePreMessage(messageID);
let messages = NativeBridgeDataSource.getMessagesWithMessageId(messageId); let messages = NativeBridgeDataSource.getMessagesByMessageID(messageID);
ChatRoom.prependMessage(messages); ChatRoom.prependMessage(messages);
loader.remove(); loader.remove();
var afterHeight = $(".room_container").height(); var afterHeight = $(".room_container").height();
......
...@@ -3,9 +3,9 @@ var ChatAddUser = {}; ...@@ -3,9 +3,9 @@ var ChatAddUser = {};
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
// メンバー検索 // メンバー検索
bindMemberSearch(); ChatAddUser.bindMemberSearch();
// iOSキーボード変換検知用 // iOSキーボード変換検知用
bindiOSKeyBoardEvent(); ChatAddUser.bindiOSKeyBoardEvent();
$("#chat_add_user .search_form .cancel").click(function () { $("#chat_add_user .search_form .cancel").click(function () {
let roomListTitle = getLocalizedString("inviteUsersSubtitle"); let roomListTitle = getLocalizedString("inviteUsersSubtitle");
...@@ -24,17 +24,17 @@ ChatAddUser.searchUser = function (keyword) { ...@@ -24,17 +24,17 @@ ChatAddUser.searchUser = function (keyword) {
if (isAllGroup) { if (isAllGroup) {
//グループデータ検索 //グループデータ検索
const groupList = NativeBridgeDataSource.getGroupByName(keyword); const groupList = NativeBridgeDataSource.getGroupByName(keyword);
searchGroupData(groupList, overlayMessage); ChatAddUser.searchGroupData(groupList, overlayMessage);
//ユーザデータ検索 //ユーザデータ検索
var userList = const userList =
NativeBridgeDataSource.getAllGroupShopMemberNotInRoomByName(keyword); NativeBridgeDataSource.getAllGroupShopMemberNotInRoomByName(keyword);
searchUserData(userList, overlayMessage); ChatAddUser.searchUserData(userList, overlayMessage);
hasNoData = userList.length == 0 && groupList.length == 0; hasNoData = userList.length == 0 && groupList.length == 0;
//連絡先画面 //連絡先画面
} else { } else {
var userList = const userList =
NativeBridgeDataSource.getMyGroupShopMemberNotInRoomByName(keyword); NativeBridgeDataSource.getMyGroupShopMemberNotInRoomByName(keyword);
searchUserData(userList, overlayMessage); searchUserData(userList, overlayMessage);
hasNoData = userList.length == 0; hasNoData = userList.length == 0;
...@@ -48,7 +48,7 @@ ChatAddUser.searchUser = function (keyword) { ...@@ -48,7 +48,7 @@ ChatAddUser.searchUser = function (keyword) {
/** UTILS */ /** UTILS */
var bindMemberSearch = function () { ChatAddUser.bindMemberSearch = function () {
const searchInput = $('#chat_add_user .search_form input[type="search"]'); const searchInput = $('#chat_add_user .search_form input[type="search"]');
searchInput.click(function (e) { searchInput.click(function (e) {
//画面タイトル設定 //画面タイトル設定
...@@ -81,7 +81,7 @@ var bindMemberSearch = function () { ...@@ -81,7 +81,7 @@ var bindMemberSearch = function () {
}); });
}; };
var bindiOSKeyBoardEvent = function () { ChatAddUser.bindiOSKeyBoardEvent = function () {
const searchInput = $('#chat_add_user .search_form input[type="search"]'); const searchInput = $('#chat_add_user .search_form input[type="search"]');
searchInput.on("compositionend", function () { searchInput.on("compositionend", function () {
if (deviceInfo.isiOS()) { if (deviceInfo.isiOS()) {
...@@ -91,7 +91,7 @@ var bindiOSKeyBoardEvent = function () { ...@@ -91,7 +91,7 @@ var bindiOSKeyBoardEvent = function () {
}); });
}; };
var searchGroupData = function (groupList, overlayMessage) { ChatAddUser.searchGroupData = function (groupList, overlayMessage) {
const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST); const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
groupList.forEach(function (group) { groupList.forEach(function (group) {
...@@ -106,40 +106,40 @@ var searchGroupData = function (groupList, overlayMessage) { ...@@ -106,40 +106,40 @@ var searchGroupData = function (groupList, overlayMessage) {
}); });
}; };
var renderGroupTemplate = function (groupTemplate, groupName, groupID) { ChatAddUser.renderGroupTemplate = function (groupTemplate, groupName, groupID) {
return Mustache.render(groupTemplate, { return Mustache.render(groupTemplate, {
name: groupName, name: groupName,
id: groupID, id: groupID,
}); });
}; };
var searchUserData = function (userList, overlayMessage) { ChatAddUser.searchUserData = function (userList, overlayMessage) {
const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST); const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
userList.forEach(function (user) { userList.forEach(function (user) {
setUserProfile(user); ChatAddUser.setUserProfile(user);
checkUser(user); ChatAddUser.checkUser(user);
}); });
let html = renderUserTemplate(userTemplate, userList); let html = ChatAddUser.renderUserTemplate(userTemplate, userList);
let obj = jQuery.parseHTML(html); let obj = jQuery.parseHTML(html);
overlayMessage.append(obj); overlayMessage.append(obj);
}; };
var setUserProfile = function (user) { ChatAddUser.setUserProfile = function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl); user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
}; };
var checkUser = function (user) { ChatAddUser.checkUser = function (user) {
let findObj = ChatManagementCommon.selectedUserList.find(function ( let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId shopMemberID
) { ) {
return shopMemberId == user.shopMemberId; return shopMemberID == user.shopMemberId;
}); });
if (findObj) { if (findObj) {
user.checked = "checked"; user.checked = "checked";
} }
}; };
var renderUserTemplate = function (userTemplate, userList) { ChatAddUser.renderUserTemplate = function (userTemplate, userList) {
return Mustache.render(userTemplate, { return Mustache.render(userTemplate, {
userList: userList, userList: userList,
}); });
...@@ -254,7 +254,7 @@ ChatAddUser.refreshAllGroupForAddUser = function (paramGroupId) { ...@@ -254,7 +254,7 @@ ChatAddUser.refreshAllGroupForAddUser = function (paramGroupId) {
NativeBridgeDelegate.updateGroupInfo(groupId); NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。 //画面エリアを初期化。
initialzScreen(); ChatAddUser.initialzScreen();
//DBからグループ情報を取得。 //DBからグループ情報を取得。
const result = NativeBridgeDataSource.getGroupInfoForAddUser(groupId); const result = NativeBridgeDataSource.getGroupInfoForAddUser(groupId);
...@@ -284,16 +284,16 @@ ChatAddUser.refreshAllGroupForAddUser = function (paramGroupId) { ...@@ -284,16 +284,16 @@ ChatAddUser.refreshAllGroupForAddUser = function (paramGroupId) {
} }
//該当グループのパースを表示。 //該当グループのパースを表示。
appendGroupPath(result.groupPathList); ChatAddUser.appendGroupPath(result.groupPathList);
//該当グループの下位グループ表示。 //該当グループの下位グループ表示。
appendGroupInGroup(result.childGroupList); ChatAddUser.appendGroupInGroup(result.childGroupList);
//該当グループの所属ユーザを表示。 //該当グループの所属ユーザを表示。
appendUserInGroup(result.groupUserList); ChatAddUser.appendUserInGroup(result.groupUserList);
}; };
var initialzScreen = function () { ChatAddUser.initialzScreen = function () {
$("#parentGroupBtnForAddUser").off(); $("#parentGroupBtnForAddUser").off();
$("#rootGroupBtnForAddUser").off(); $("#rootGroupBtnForAddUser").off();
$("#childGroupListAreaForAddUser").html(""); $("#childGroupListAreaForAddUser").html("");
...@@ -301,7 +301,7 @@ var initialzScreen = function () { ...@@ -301,7 +301,7 @@ var initialzScreen = function () {
$("#groupPathAreaForAddUser").html(""); $("#groupPathAreaForAddUser").html("");
}; };
var appendGroupPath = function (groupPathList) { ChatAddUser.appendGroupPath = function (groupPathList) {
const groupPathTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_PATH); const groupPathTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_PATH);
let groupPathCount = 0; let groupPathCount = 0;
groupPathList.forEach(function (groupPath) { groupPathList.forEach(function (groupPath) {
...@@ -317,7 +317,7 @@ var appendGroupPath = function (groupPathList) { ...@@ -317,7 +317,7 @@ var appendGroupPath = function (groupPathList) {
}); });
}; };
var appendGroupInGroup = function (childGroupList) { ChatAddUser.appendGroupInGroup = function (childGroupList) {
const groupTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_LIST); const groupTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_LIST);
childGroupList.forEach(function (childGroup) { childGroupList.forEach(function (childGroup) {
...@@ -331,14 +331,14 @@ var appendGroupInGroup = function (childGroupList) { ...@@ -331,14 +331,14 @@ var appendGroupInGroup = function (childGroupList) {
}); });
}; };
var appendUserInGroup = function (groupUserList) { ChatAddUser.appendUserInGroup = function (groupUserList) {
const userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST); const userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST);
groupUserList.forEach(function (groupUser) { groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl); groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function ( let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId shopMemberID
) { ) {
return shopMemberId == groupUser.shopMemberId; return shopMemberID == groupUser.shopMemberId;
}); });
if (findObj) { if (findObj) {
groupUser.checked = "checked"; groupUser.checked = "checked";
......
...@@ -6,17 +6,17 @@ ChatManagementCommon.selectedUserList = new Array(); ...@@ -6,17 +6,17 @@ ChatManagementCommon.selectedUserList = new Array();
ChatManagementCommon.showMakeRoomConfirmView = function () { ChatManagementCommon.showMakeRoomConfirmView = function () {
$("#selectedUserList").html(""); $("#selectedUserList").html("");
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_CONFIRM_USER_LIST); const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_CONFIRM_USER_LIST);
var selectedUserList = NativeBridgeDataSource.loadSelectedUsers(); const selectedUserList = NativeBridgeDataSource.loadSelectedUsers();
selectedUserList.forEach(function (user) { selectedUserList.forEach(function (user) {
let html = Mustache.render(userTemplate, { const html = Mustache.render(userTemplate, {
id: user.shopMemberId, id: user.shopMemberId,
profileImage: Common.getProfileImgUrl(user.profileUrl), profileImage: Common.getProfileImgUrl(user.profileUrl),
name: user.shopMemberName, name: user.shopMemberName,
}); });
let obj = jQuery.parseHTML(html); const obj = jQuery.parseHTML(html);
$("#selectedUserList").append(obj); $("#selectedUserList").append(obj);
}); });
...@@ -28,11 +28,11 @@ ChatManagementCommon.showMakeRoomConfirmView = function () { ...@@ -28,11 +28,11 @@ ChatManagementCommon.showMakeRoomConfirmView = function () {
if (trimmedRoomName.length == 0) { if (trimmedRoomName.length == 0) {
// loadingIndicatorを表示 // loadingIndicatorを表示
Common.showLoadingIndicator(); Common.showLoadingIndicator();
let userIdList = new Array(); let userIDList = new Array();
let userNameList = new Array(); let userNameList = new Array();
selectedUserList.forEach(function (user) { selectedUserList.forEach(function (user) {
userIdList.push(user.shopMemberId); userIDList.push(user.shopMemberId);
userNameList.push(user.shopMemberName); userNameList.push(user.shopMemberName);
}); });
...@@ -41,7 +41,7 @@ ChatManagementCommon.showMakeRoomConfirmView = function () { ...@@ -41,7 +41,7 @@ ChatManagementCommon.showMakeRoomConfirmView = function () {
currentUserInfo.loginID + "," + userNameList.join(","); currentUserInfo.loginID + "," + userNameList.join(",");
NativeBridgeDelegate.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIDList.join(","),
newRoomName, newRoomName,
MakeRoomFlag.MAKE_ROOM, MakeRoomFlag.MAKE_ROOM,
false false
...@@ -130,8 +130,8 @@ ChatManagementCommon.showMakeRoomConfirmView = function () { ...@@ -130,8 +130,8 @@ ChatManagementCommon.showMakeRoomConfirmView = function () {
ChatManagementCommon.showAddUserConfirmView = function () { ChatManagementCommon.showAddUserConfirmView = function () {
$("#selectedUserList").html(""); $("#selectedUserList").html("");
var userTemplate = getTemplate(TemplateURL.ADD_USER_CONFIRM_USER_LIST); const userTemplate = getTemplate(TemplateURL.ADD_USER_CONFIRM_USER_LIST);
var selectedUserList = NativeBridgeDataSource.loadSelectedUsers(); const selectedUserList = NativeBridgeDataSource.loadSelectedUsers();
selectedUserList.forEach(function (user) { selectedUserList.forEach(function (user) {
let html = Mustache.render(userTemplate, { let html = Mustache.render(userTemplate, {
...@@ -155,35 +155,36 @@ ChatManagementCommon.showAddUserConfirmView = function () { ...@@ -155,35 +155,36 @@ ChatManagementCommon.showAddUserConfirmView = function () {
}); });
}; };
ChatManagementCommon.checkForMakeChat = function (checkMemberId) { ChatManagementCommon.checkForMakeChat = function (checkMemberID) {
let findObj = ChatManagementCommon.selectedUserList.find(function ( let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId shopMemberID
) { ) {
return shopMemberId == checkMemberId; return shopMemberID == checkMemberID;
}); });
if (findObj) { if (findObj) {
// remove // remove
ChatManagementCommon.selectedUserList = ChatManagementCommon.selectedUserList =
ChatManagementCommon.selectedUserList.filter(function ( ChatManagementCommon.selectedUserList.filter(function (shopMemberID) {
shopMemberId return checkMemberID != shopMemberID;
) {
return checkMemberId != shopMemberId;
}); });
$(".checkbox" + checkMemberId) ChatManagementCommon.updateCheckBox(checkMemberID, false);
.prop("checked", false)
.trigger("change");
} else { } else {
// add // add
ChatManagementCommon.selectedUserList.push(checkMemberId); ChatManagementCommon.selectedUserList.push(checkMemberID);
$(".checkbox" + checkMemberId) ChatManagementCommon.updateCheckBox(checkMemberID, true);
.prop("checked", true)
.trigger("change");
} }
let cnt = ChatManagementCommon.selectedUserList.length; const cnt = ChatManagementCommon.selectedUserList.length;
if (ChatManagementCommon.selectedUserList.length > 0) { if (ChatManagementCommon.selectedUserList.length > 0) {
$(".select_member_num").text(cnt); $(".select_member_num").text(cnt);
} else { } else {
$(".select_member_num").text("0"); $(".select_member_num").text("0");
} }
}; };
ChatManagementCommon.updateCheckBox = function (checkMemberID, checked) {
$(".checkbox" + checkMemberID)
.prop("checked", checked)
.trigger("change");
};
...@@ -63,7 +63,6 @@ function toggleMic() { ...@@ -63,7 +63,6 @@ function toggleMic() {
* レコード関連 * レコード関連
*************/ *************/
function recordStart() { function recordStart() {
console.log("peacekim:: レコードを開始しました");
MainManRecord("on"); MainManRecord("on");
$("#recordBtn .record").addClass("disable"); $("#recordBtn .record").addClass("disable");
$(".flash-txt").addClass("on"); $(".flash-txt").addClass("on");
...@@ -81,7 +80,7 @@ function toggleRecord() { ...@@ -81,7 +80,7 @@ function toggleRecord() {
recordStart(); recordStart();
} else { } else {
recordStop(function () { recordStop(function () {
console.log("peacekim:: レコードを終了しました"); console.info("Did record stop");
}); });
} }
} }
...@@ -107,13 +106,11 @@ function mainManRecordWithCollaboration(action, url, callback) { ...@@ -107,13 +106,11 @@ function mainManRecordWithCollaboration(action, url, callback) {
try { try {
mediaRecorder.stop(); mediaRecorder.stop();
} catch (exeption) { } catch (exeption) {
console.log("peacekim:: Record fail"); console.error("Record failed");
callback(); callback();
} }
console.log("peacekim:: Recorded Blobs: ", recordedBlobs);
setTimeout(function () { setTimeout(function () {
console.log("peacekim:: Recoding File upload..");
const blob = new Blob(recordedBlobs, { type: "video/webm" }); const blob = new Blob(recordedBlobs, { type: "video/webm" });
const uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm"; const uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++; g_shareCount++;
......
...@@ -209,7 +209,6 @@ CoviewBridge.bindMessageEvent = function () { ...@@ -209,7 +209,6 @@ CoviewBridge.bindMessageEvent = function () {
case "HostRequest": case "HostRequest":
// to be called by // to be called by
// wc_api.dispatchEvent (new Event ("message"), {"HostRequest":"userID"}); // wc_api.dispatchEvent (new Event ("message"), {"HostRequest":"userID"});
console.log("peacekim:: t2 consoleLog", json);
break; break;
case "fileChange": case "fileChange":
if (globalUserInfo.collaborationType != COLLABORATION_TYPE.CAMERA) { if (globalUserInfo.collaborationType != COLLABORATION_TYPE.CAMERA) {
...@@ -227,7 +226,7 @@ CoviewBridge.bindMessageEvent = function () { ...@@ -227,7 +226,7 @@ CoviewBridge.bindMessageEvent = function () {
} }
break; break;
default: default:
console.log("peacekim:: Unrecognized api", json); console.debug("Unrecognized api", json);
break; break;
} }
}); });
...@@ -348,7 +347,6 @@ function captureAndShareImage(urls, changeHostName) { ...@@ -348,7 +347,6 @@ function captureAndShareImage(urls, changeHostName) {
$(snapshots[cpatureViewIndex]).attr("height") $(snapshots[cpatureViewIndex]).attr("height")
); );
$(canvasRemote).attr("width", $(snapshots[cpatureViewIndex]).attr("width")); $(canvasRemote).attr("width", $(snapshots[cpatureViewIndex]).attr("width"));
console.log("peacekim:: t5 url", URL.createObjectURL(blob));
if ( if (
$(".canvas_wrap").css("width").replace("px", "") / $(".canvas_wrap").css("width").replace("px", "") /
$(".canvas_wrap").css("height").replace("px", "") < $(".canvas_wrap").css("height").replace("px", "") <
...@@ -412,7 +410,7 @@ function captureAndShareImage(urls, changeHostName) { ...@@ -412,7 +410,7 @@ function captureAndShareImage(urls, changeHostName) {
}, 1500); }, 1500);
}, },
error: function (err) { error: function (err) {
console.log(err); console.error(err);
}, },
}); });
}); });
......
...@@ -45,13 +45,13 @@ Contact.searchUser = function (keyword) { ...@@ -45,13 +45,13 @@ Contact.searchUser = function (keyword) {
/** UTILS */ /** UTILS */
Contact.bindiOSKeyBoardEvent = function () { Contact.bindiOSKeyBoardEvent = function () {
const searchInput = $('#contact .search_form input[type="search"]'); if (deviceInfo.isiOS()) {
searchInput.on("compositionend", function () { const searchInput = $('#contact .search_form input[type="search"]');
if (deviceInfo.isiOS()) { searchInput.on("compositionend", function () {
var keyword = searchInput.val(); const keyword = searchInput.val();
Contact.searchUser(keyword); Contact.searchUser(keyword);
} });
}); }
}; };
Contact.bindMemeberSearch = function () { Contact.bindMemeberSearch = function () {
...@@ -83,14 +83,14 @@ Contact.appendGroupList = function (groupList) { ...@@ -83,14 +83,14 @@ Contact.appendGroupList = function (groupList) {
const groupTemplate = getTemplate(TemplateURL.GROUP_LIST); const groupTemplate = getTemplate(TemplateURL.GROUP_LIST);
groupList.forEach(function (group) { groupList.forEach(function (group) {
let html = renderGroupList( const html = renderGroupList(
groupTemplate, groupTemplate,
group.groupName, group.groupName,
group.groupId, group.groupId,
group.isFavorite group.isFavorite
); );
let obj = jQuery.parseHTML(html); const obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj); $(".overlay_src_msg").append(obj);
}); });
}; };
...@@ -107,9 +107,9 @@ Contact.appendUserList = function (userList) { ...@@ -107,9 +107,9 @@ Contact.appendUserList = function (userList) {
userList.forEach(function (user) { userList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl); user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
}); });
var userTemplate = getTemplate(TemplateURL.USER_LIST); const userTemplate = getTemplate(TemplateURL.USER_LIST);
let html = Contact.renderUserList(userTemplate, userList); const html = Contact.renderUserList(userTemplate, userList);
let obj = jQuery.parseHTML(html); const obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj); $(".overlay_src_msg").append(obj);
}; };
...@@ -179,13 +179,13 @@ Contact.appendFavoritGroupList = function () { ...@@ -179,13 +179,13 @@ Contact.appendFavoritGroupList = function () {
//お気に入りグループ取得。 //お気に入りグループ取得。
const favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups(); const favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups();
favoriteGroupList.forEach(function (favoriteGroup) { favoriteGroupList.forEach(function (favoriteGroup) {
let html = Mustache.render(groupTemplate, { const html = Mustache.render(groupTemplate, {
name: favoriteGroup.groupName, name: favoriteGroup.groupName,
id: favoriteGroup.groupId, id: favoriteGroup.groupId,
isFavorite: true, isFavorite: true,
}); });
let obj = $(jQuery.parseHTML(html)).on("click", function () {}); const obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#favoriteList").append(obj); $("#favoriteList").append(obj);
}); });
}; };
...@@ -197,10 +197,10 @@ Contact.appendFavoritUsers = function () { ...@@ -197,10 +197,10 @@ Contact.appendFavoritUsers = function () {
favoriteUser.profileUrl = Common.getProfileImgUrl(favoriteUser.profileUrl); favoriteUser.profileUrl = Common.getProfileImgUrl(favoriteUser.profileUrl);
favoriteUser.isFavorite = true; favoriteUser.isFavorite = true;
}); });
let html = Mustache.render(userTemplate, { const html = Mustache.render(userTemplate, {
userList: favoriteUserList, userList: favoriteUserList,
}); });
let obj = jQuery.parseHTML(html); const obj = jQuery.parseHTML(html);
$("#favoriteList").append(obj); $("#favoriteList").append(obj);
}; };
...@@ -254,20 +254,12 @@ Contact.insertFavoriteGroup = function (groupID) { ...@@ -254,20 +254,12 @@ Contact.insertFavoriteGroup = function (groupID) {
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
}; };
// contact.html
// contact.js
// template_group_list.html (GROUP_LIST)
// >> contact.js
// template_group_path.html (GROUP_PATH)
// >> self
// template_user_name_card.html(USER_NAME_CARD)
// >> Namecard.makeNameCard
//全グループ検索画面表示。 //全グループ検索画面表示。
Contact.refreshAllGroupSearch = function (paramGroupId) { Contact.refreshAllGroupSearch = function (paramGroupID) {
var groupId = paramGroupId; const groupID = paramGroupID;
if (window.location.pathname.includes("chat_room")) { if (window.location.pathname.includes("chat_room")) {
if (groupId == "") return; if (groupID == "") return;
NativeBridgeDelegate.setToMoveGroupId(groupId); NativeBridgeDelegate.setToMoveGroupId(groupID);
window.location.href = "contact.html"; window.location.href = "contact.html";
} }
...@@ -276,16 +268,16 @@ Contact.refreshAllGroupSearch = function (paramGroupId) { ...@@ -276,16 +268,16 @@ Contact.refreshAllGroupSearch = function (paramGroupId) {
Contact.initialzeForAllGroupSearch(); Contact.initialzeForAllGroupSearch();
//オンライン状態であればサーバから情報更新。 //オンライン状態であればサーバから情報更新。
NativeBridgeDelegate.updateGroupInfo(groupId); NativeBridgeDelegate.updateGroupInfo(groupID);
//DBからグループ情報を取得。 //DBからグループ情報を取得。
const result = NativeBridgeDataSource.getGroupInfo(groupId); const result = NativeBridgeDataSource.getGroupInfo(groupID);
Contact.bindGroupCellClick( Contact.bindGroupCellClick(
result.parentGroupId, result.parentGroupId,
result.rootGroupId, result.rootGroupId,
paramGroupId, paramGroupID,
groupId groupID
); );
Contact.appendGroupPathList(result.groupPathList); Contact.appendGroupPathList(result.groupPathList);
...@@ -367,13 +359,13 @@ Contact.appendSubGroupsInGroup = function (groupList) { ...@@ -367,13 +359,13 @@ Contact.appendSubGroupsInGroup = function (groupList) {
//該当グループの下位グループ表示。 //該当グループの下位グループ表示。
const groupTemplate = getTemplate(TemplateURL.GROUP_LIST); const groupTemplate = getTemplate(TemplateURL.GROUP_LIST);
groupList.forEach(function (childGroup) { groupList.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, { const html = Mustache.render(groupTemplate, {
name: childGroup.groupName, name: childGroup.groupName,
id: childGroup.groupId, id: childGroup.groupId,
isFavorite: childGroup.isFavorite, isFavorite: childGroup.isFavorite,
}); });
let obj = $(jQuery.parseHTML(html)).on("click", function () {}); const obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#childGroupListArea").append(obj); $("#childGroupListArea").append(obj);
}); });
}; };
...@@ -385,9 +377,9 @@ Contact.appendUsersInGroup = function (userList) { ...@@ -385,9 +377,9 @@ Contact.appendUsersInGroup = function (userList) {
userList.forEach(function (user) { userList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl); user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
}); });
let html = Mustache.render(userTemplate, { const html = Mustache.render(userTemplate, {
userList: userList, userList: userList,
}); });
let obj = jQuery.parseHTML(html); const obj = jQuery.parseHTML(html);
$("#userInGroupList").append(obj); $("#userInGroupList").append(obj);
}; };
...@@ -31,11 +31,11 @@ Namecard.makeNameCard = function (shopMemberID) { ...@@ -31,11 +31,11 @@ Namecard.makeNameCard = function (shopMemberID) {
// template_user_name_card.html // template_user_name_card.html
Namecard.startChat = function (userShopMemberID, userName) { Namecard.startChat = function (userShopMemberID, userName) {
Common.showLoadingIndicator(); Common.showLoadingIndicator();
var userIDList = []; let userIDList = [];
userIDList.push(userShopMemberID); userIDList.push(userShopMemberID);
// 参加ユーザ名でルーム名を生成 // 参加ユーザ名でルーム名を生成
let newRoomName = currentUserInfo.loginID + "," + userName; const newRoomName = currentUserInfo.loginID + "," + userName;
NativeBridgeDelegate.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIDList.join(","), userIDList.join(","),
...@@ -52,7 +52,7 @@ Namecard.startVoice = function (userShopMemberID, userName) { ...@@ -52,7 +52,7 @@ Namecard.startVoice = function (userShopMemberID, userName) {
userIDList.push(userShopMemberID); userIDList.push(userShopMemberID);
// 参加ユーザ名でルーム名を生成 // 参加ユーザ名でルーム名を生成
let newRoomName = currentUserInfo.loginID + "," + userName; const newRoomName = currentUserInfo.loginID + "," + userName;
NativeBridgeDelegate.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIDList.join(","), userIDList.join(","),
...@@ -62,10 +62,6 @@ Namecard.startVoice = function (userShopMemberID, userName) { ...@@ -62,10 +62,6 @@ Namecard.startVoice = function (userShopMemberID, userName) {
); );
}; };
// template_group_user_list.html (GROUP_USER_LIST)
// >> chat-room.js
// >> contact.js
// template_user_list.html
Namecard.favoriteUserChange = function (shopMemberID, star) { Namecard.favoriteUserChange = function (shopMemberID, star) {
if ($(star).hasClass("active")) { if ($(star).hasClass("active")) {
Namecard.removeFavoriteUser(shopMemberID); Namecard.removeFavoriteUser(shopMemberID);
...@@ -74,9 +70,6 @@ Namecard.favoriteUserChange = function (shopMemberID, star) { ...@@ -74,9 +70,6 @@ Namecard.favoriteUserChange = function (shopMemberID, star) {
} }
}; };
// modal_collabo_profile.html
// collaboration.js
// template_user_name_card.html
Namecard.removeFavoriteUser = function (shopMemberID) { Namecard.removeFavoriteUser = function (shopMemberID) {
Common.showLoadingIndicator(); Common.showLoadingIndicator();
$("#userNameCard").modal("hide"); $("#userNameCard").modal("hide");
...@@ -92,8 +85,6 @@ Namecard.removeFavoriteUser = function (shopMemberID) { ...@@ -92,8 +85,6 @@ Namecard.removeFavoriteUser = function (shopMemberID) {
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
}; };
// template_user_name_card.html (USER_NAME_CARD)
// >> Namecard.makeNameCard()
Namecard.insertFavoriteUser = function (shopMemberID) { Namecard.insertFavoriteUser = function (shopMemberID) {
$("#userNameCard").modal("hide"); $("#userNameCard").modal("hide");
$("#myNameCard").modal("hide"); $("#myNameCard").modal("hide");
...@@ -115,4 +106,3 @@ Namecard.refreshForOnline = function () { ...@@ -115,4 +106,3 @@ Namecard.refreshForOnline = function () {
Namecard.refreshForOffline = function () { Namecard.refreshForOffline = function () {
$("#favoriteButton").prop("disabled", true); $("#favoriteButton").prop("disabled", true);
}; };
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