Commit 4b4ba6b6 by Kim Peace

Merge branch 'develop' into refactoring/prettier

# Conflicts:
#	public_new/js/chat-db.js
#	public_new/js/chat-ui.js
#	public_new/js/chat.js
parents c886b040 5ab391a4
......@@ -7,7 +7,10 @@ var CHAT_DB = {};
CHAT_DB.getRoomList = function (roomType, keyWord) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getRoomList, { roomType: roomType, keyWord: keyWord })
callNativeApp(NATIVE_KEY_IOS.getRoomList, {
roomType: roomType,
keyWord: keyWord,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getRoomList(roomType, keyWord));
......@@ -16,7 +19,9 @@ CHAT_DB.getRoomList = function (roomType, keyWord) {
CHAT_DB.callGetRoomList = function (roomType) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getRoomList, { roomType: roomType }));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getRoomList, { roomType: roomType })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList(roomType));
......@@ -35,7 +40,9 @@ CHAT_DB.getMyInfo = function () {
CHAT_DB.getMessages = function (roomId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomId }));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMessageList(roomId));
......@@ -44,7 +51,9 @@ CHAT_DB.getMessages = function (roomId) {
CHAT_DB.getFavoriteUsersNotInRoom = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getFavoriteUsersNotInRoom, {}));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getFavoriteUsersNotInRoom, {})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteUsersNotInRoom());
......@@ -80,7 +89,9 @@ CHAT_DB.getMyGroupUsers = function () {
CHAT_DB.getGroupInfo = function (groupId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getGroupInfo, { groupId: groupId }));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getGroupInfo, { groupId: groupId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupInfo(groupId));
......@@ -111,7 +122,9 @@ CHAT_DB.loadSelectedUsers = function () {
CHAT_DB.getNameCardData = function (shopMemberId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getNameCardData, { shopMemberId: shopMemberId })
callNativeApp(NATIVE_KEY_IOS.getNameCardData, {
shopMemberId: shopMemberId,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getNameCardData(shopMemberId));
......@@ -187,7 +200,9 @@ CHAT_DB.getGroupByName = function (groupName) {
CHAT_DB.getUsersInRoom = function (roomId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getUsersInRoom, { roomId: roomId }));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUsersInRoom, { roomId: roomId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getUsersInRoom(roomId));
......@@ -215,7 +230,9 @@ CHAT_DB.updateArchiveList = function () {
CHAT_DB.getArchiveByName = function (archiveName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getArchiveByName, { archiveName: archiveName })
callNativeApp(NATIVE_KEY_IOS.getArchiveByName, {
archiveName: archiveName,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveListByName(archiveName));
......@@ -244,7 +261,10 @@ CHAT_DB.updateArchiveDetail = function (archiveId) {
CHAT_DB.searchMessages = function (keyword, userList) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.searchMessages, { keyWord: keyword, userList: userList })
callNativeApp(NATIVE_KEY_IOS.searchMessages, {
keyWord: keyword,
userList: userList,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.searchMessages(keyword, userList));
......@@ -253,7 +273,9 @@ CHAT_DB.searchMessages = function (keyword, userList) {
CHAT_DB.getMyGroupUsersNotInRoom = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getMyGroupUsersNotInRoom, {}));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMyGroupUsersNotInRoom, {})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupUsersNotInRoom());
......@@ -271,14 +293,6 @@ CHAT_DB.getUserInfo = function (shopMemberId) {
}
};
CHAT_DB.getContentList = function () {
if (CHAT_UTIL.isIOS()) {
//TODO ローカルDBからダウンロード済のコンテンツを取得
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getContentList());
}
};
CHAT_DB.getUserListByLoginId = function (loginIdList) {
console.log(loginIdList);
if (CHAT_UTIL.isIOS()) {
......
......@@ -2032,6 +2032,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
//保存ユーザ情報を取得
var userInfo = CHAT_DB.getUserInfo(archive.saveUserId);
userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl);
// アーカイブ情報を表示
var html = Mustache.render(archiveDetailTemplate, {
fileName: archive.archiveName,
......@@ -2048,6 +2049,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// プレイヤーの切り替え
var archiveFilePath = CHAT.createGetDataUrl(archive.filePath, archive.roomId);
switch (archive.archiveType) {
case "0": // 画像
case 0:
......@@ -2077,11 +2079,23 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
break;
case "2": // 音声
case 2:
$("#archive_player").prepend(
'<audio class="archive_audio_player" src=' +
archiveFilePath +
' controls controlsList="nodownload"></audio>'
);
if (CHAT_UTIL.isIOS()) {
$("#archive_player").prepend(
'<audio class="archive_audio_player" controls controlsList="nodownload"><source src="' +
archiveFilePath +
'" type="audio/mp3"><source src="' +
archiveFilePath +
'" type="audio/wav"><source src="' +
archiveFilePath +
'" type="audio/ogg"></audio>'
);
} else {
$("#archive_player").prepend(
'<audio class="archive_audio_player" src=' +
archiveFilePath +
' controls controlsList="nodownload"></audio>'
);
}
$("#archive_player").prepend(
'<img class="archive_player" src=' + "./img/capture.png" + " />"
);
......
......@@ -380,7 +380,7 @@ CHAT.leaveRoom = function () {
socket.emit("leaveRoom", function () {});
};
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener("DOMContentLoaded", function () {
// ルーム名変更イベント
$(".change_room_name_btn button").click(function () {
$("form").submit();
......@@ -495,7 +495,9 @@ document.addEventListener('DOMContentLoaded', function() {
var afterWidth = window.innerWidth;
var moreScroll = beforeHeight - afterHeight;
if (beforeHeight > afterHeight && beforeHeight - afterHeight > 50) {
if (beforeWidth == afterWidth) {
if (CHAT_UTIL.isIOS()) {
window.scrollTo(0, beforeScroll + moreScroll);
} else if (beforeWidth == afterWidth) {
//キーボード表示時
$(".room_container").css("margin-bottom", 0);
window.scrollTo(
......@@ -511,7 +513,9 @@ document.addEventListener('DOMContentLoaded', function() {
}
} else if (beforeHeight < afterHeight) {
$(".room_container").css("margin-bottom", footerHeight);
if (beforeWidth == afterWidth) {
if (CHAT_UTIL.isIOS()) {
window.scrollTo(0, beforeScroll + moreScroll);
} else if (beforeWidth == afterWidth) {
//キーボード非表示
window.scrollTo(
0,
......@@ -534,7 +538,6 @@ document.addEventListener('DOMContentLoaded', function() {
beforeWidth = window.innerWidth;
beforeScroll = window.scrollY;
});
// チャットルーム
// メッセージ検索イベント
$('.chat_room_src_form input[type="search"]').keyup(function (e) {
......@@ -549,7 +552,6 @@ document.addEventListener('DOMContentLoaded', function() {
$(".overlay_src_msg").empty();
return;
}
CHAT.searchMessage(keyword, workVal);
if (e.key == "Enter" || e.KeyCode == 13) {
$("#searchMessage").removeClass("onfocus");
......@@ -585,7 +587,6 @@ document.addEventListener('DOMContentLoaded', function() {
var userMessageTemplate = getTemplate(TemplateURL.USER_MESSAGE);
var myMessageTemplate = getTemplate(TemplateURL.MY_MESSAGE);
let jQueryMessages = $(".overlay_src_msg");
messages.forEach(function (message) {
let template = userMessageTemplate;
......
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