Commit 91c488ee by Kim Peace

Moved native bridge delegate for calling native method

parent 42fe068a
...@@ -155,8 +155,8 @@ ...@@ -155,8 +155,8 @@
$("#chatMenuModal").load("./modal_chat_menu.html"); $("#chatMenuModal").load("./modal_chat_menu.html");
$("#loadingArea").load("./loading.html"); $("#loadingArea").load("./loading.html");
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<script src="./js/languages/language_en.js" charset="UTF-8"></script> <script src="./js/languages/language_en.js" charset="UTF-8"></script>
<!-- Common --> <!-- Common -->
<script src="./js/common/constant.js"></script> <script src="./js/common/constant.js"></script>
<script src="./js/common/NativeBridge.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/chat-util.js"></script>
<!-- Model --> <!-- Model -->
...@@ -203,8 +203,8 @@ ...@@ -203,8 +203,8 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -135,14 +135,10 @@ ...@@ -135,14 +135,10 @@
let IS_ONLINE = false; let IS_ONLINE = false;
$("#loadingArea").load("./loading.html"); $("#loadingArea").load("./loading.html");
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
NativeBridgeDelegate.saveSelectedUserList("");
if (typeof (android) != "undefined") {
android.saveSelectedUserList("");
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage("");
}
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
CMS_SERVER_URL = cmsServerUrl; CMS_SERVER_URL = cmsServerUrl;
......
...@@ -165,8 +165,8 @@ ...@@ -165,8 +165,8 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -93,8 +93,8 @@ ...@@ -93,8 +93,8 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -93,8 +93,8 @@ ...@@ -93,8 +93,8 @@
let IS_ONLINE = false; let IS_ONLINE = false;
let roomId = 0; let roomId = 0;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -166,8 +166,8 @@ ...@@ -166,8 +166,8 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
......
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -198,15 +198,12 @@ ...@@ -198,15 +198,12 @@
$("#chatMenuModal").load("./modal_chat_menu.html"); $("#chatMenuModal").load("./modal_chat_menu.html");
$("#loadingArea").load("./loading.html"); $("#loadingArea").load("./loading.html");
NativeBridgeDelegate.getLoginParameter();
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getGlobalParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.saveSelectedUserList("");
if (typeof (android) != "undefined") { if (typeof (android) != "undefined") {
android.saveSelectedUserList("");
androidVersion = android.getAndroidVersion(); androidVersion = android.getAndroidVersion();
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage("");
} }
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<div <div
class="start_pip_area d-flex flex-column justify-content-center align-items-center h-100 collaboration_contents document_contents none"> class="start_pip_area d-flex flex-column justify-content-center align-items-center h-100 collaboration_contents document_contents none">
<div class="start_pip_img_wrap"> <div class="start_pip_img_wrap">
<a href="javascript:startPipMode();"> <a href="javascript:NativeBridgeDelegate.startPIPMode();">
<img src="icon/icon_start_pip.png" alt="文書共有"> <img src="icon/icon_start_pip.png" alt="文書共有">
</a> </a>
</div> </div>
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<!-- フッター --> <!-- フッター -->
<div id="footer_collabo"></div> <div id="footer_collabo"></div>
<div id="loadingArea"></div> <div id="loadingArea"></div>
<div class="pip_indicator none" onclick="finishPipMode();"> <div class="pip_indicator none" onclick="NativeBridgeDelegate.finishPIPMode();">
<div style="vertical-align: middle;display: table-cell;"> <div style="vertical-align: middle;display: table-cell;">
<img src="icon/icon_end_pip.png" alt="文書共有" style="width: 30px;height: 30px;"> <img src="icon/icon_end_pip.png" alt="文書共有" style="width: 30px;height: 30px;">
<span style="font-size: 20px;vertical-align: middle;">戻る</span> <span style="font-size: 20px;vertical-align: middle;">戻る</span>
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
<script src="./js/collaboration.js"></script> <script src="./js/collaboration.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script> <script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script> <script src="./js/share.js"></script>
<script> <script>
$("#footer_collabo").load("./footer_collabo.html"); $("#footer_collabo").load("./footer_collabo.html");
$("#modal_collabo_host_request").load("./modal_collabo_host_request.html"); $("#modal_collabo_host_request").load("./modal_collabo_host_request.html");
...@@ -176,36 +176,21 @@ ...@@ -176,36 +176,21 @@
let IS_ONLINE = false; let IS_ONLINE = false;
let collaborationJoinFlg = 0; let collaborationJoinFlg = 0;
let isInvited = 0; let isInvited = 0;
let roomType;
let joinCollaborationType = 0; let joinCollaborationType = 0;
let joinMeetingId = 0; let joinMeetingId = 0;
let androidVersion = 0; let androidVersion = 0;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
if (typeof (android) != "undefined") {
roomType = android.getRoomType();
} else {
roomType = CHAT_DB.getRoomType();
}
const roomType = NativeBridgeDataSource.getRoomType();
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none'); $('.add_user_btn').removeClass('none');
} }
function startPipMode() { function startPipMode() {
if (typeof (android) != "undefined") { NativeBridgeDelegate.startPIPMode();
android.startPipMode();
} else {
webkit.messageHandlers.startPipMode.postMessage({});
}
}
function finishPipMode() {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.finishPipMode.postMessage({});
}
} }
String.prototype.replaceAll = function (org, dest) { String.prototype.replaceAll = function (org, dest) {
...@@ -228,7 +213,7 @@ ...@@ -228,7 +213,7 @@
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT && androidVersion < ANDROID_SDK_VERSION.O) { if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT && androidVersion < ANDROID_SDK_VERSION.O) {
alert(getLocalizedString('not_support_version')); alert(getLocalizedString('not_support_version'));
if (typeof android != "undefined") { if (typeof android != "undefined") {
NativeBridge.openCommunicationHome(); NativeBridgeDelegate.openCommunicationHome();
} }
} }
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<div class="text-right d-flex align-items-center"> <div class="text-right d-flex align-items-center">
<button type="button" name="button" class="btn add_user_btn"></button> <button type="button" name="button" class="btn add_user_btn"></button>
<button type="button" name="button" class="btn menu_btn"></button> <button type="button" name="button" class="btn menu_btn"></button>
<button type="button" name="button" class="btn start_pip_btn" onclick="startPipMode();"></button> <button type="button" name="button" class="btn start_pip_btn" onclick="NativeBridgeDelegate.startPIPMode();"></button>
</div> </div>
</div> </div>
</div> </div>
...@@ -64,9 +64,8 @@ ...@@ -64,9 +64,8 @@
<!-- フッター --> <!-- フッター -->
<div id="footer_collabo"></div> <div id="footer_collabo"></div>
<div id="loadingArea"></div> <div id="loadingArea"></div>
<div class="pip_indicator none" onclick="finishPipMode();"> <div class="pip_indicator none" onclick="NativeBridgeDelegate.finishPIPMode();">
<div style="vertical-align: middle;display: table-cell;">協業中 <div style="vertical-align: middle;display: table-cell;">協業中</div>
</div>
</div> </div>
<!-- Library --> <!-- Library -->
...@@ -119,21 +118,11 @@ ...@@ -119,21 +118,11 @@
let IS_ONLINE = false; let IS_ONLINE = false;
let collaborationJoinFlg = 0; let collaborationJoinFlg = 0;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function startPipMode() {
if (typeof (android) != "undefined") {
android.startPipMode();
} else if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startPipMode.postMessage({});
}
}
function finishPipMode() { function finishPipMode() {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.finishPIPMode();
webkit.messageHandlers.finishPipMode.postMessage({});
}
} }
async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
......
...@@ -179,17 +179,11 @@ ...@@ -179,17 +179,11 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
let collaborationJoinFlg = 0; let collaborationJoinFlg = 0;
let roomType;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
if (typeof (android) != "undefined") {
roomType = android.getRoomType();
} else {
roomType = CHAT_DB.getRoomType();
}
const roomType = NativeBridgeDataSource.getRoomType();
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none'); $('.add_user_btn').removeClass('none');
} }
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<script src="./js/collaboration.js"></script> <script src="./js/collaboration.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script> <script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script> <script src="./js/share.js"></script>
</body> </body>
<script> <script>
$("#footer_collabo").load("./footer_collabo.html"); $("#footer_collabo").load("./footer_collabo.html");
...@@ -170,17 +170,11 @@ ...@@ -170,17 +170,11 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
let collaborationJoinFlg = 0; let collaborationJoinFlg = 0;
let roomType;
NativeBridge.getLoginParameter();
NativeBridge.getGlobalParameter();
if (typeof (android) != "undefined") { NativeBridgeDelegate.getLoginParameter();
roomType = android.getRoomType(); NativeBridgeDelegate.getGlobalParameter();
} else {
roomType = CHAT_DB.getRoomType();
}
const roomType = NativeBridgeDataSource.getRoomType();
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none'); $('.add_user_btn').removeClass('none');
} }
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<script src="./js/collaboration.js"></script> <script src="./js/collaboration.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script> <script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script> <script src="./js/share.js"></script>
<script> <script>
$("#footer_collabo").load("./footer_collabo.html"); $("#footer_collabo").load("./footer_collabo.html");
$("#modal_collabo_host_request").load("./modal_collabo_host_request.html"); $("#modal_collabo_host_request").load("./modal_collabo_host_request.html");
...@@ -113,17 +113,12 @@ ...@@ -113,17 +113,12 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
let collaborationJoinFlg = 0; let collaborationJoinFlg = 0;
let roomType;
NativeBridge.getLoginParameter();
NativeBridge.getGlobalParameter();
if (typeof (android) != "undefined") { NativeBridgeDelegate.getLoginParameter();
roomType = android.getRoomType(); NativeBridgeDelegate.getGlobalParameter();
} else {
roomType = CHAT_DB.getRoomType();
}
const roomType = NativeBridgeDataSource.getRoomType();
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none'); $('.add_user_btn').removeClass('none');
} }
......
...@@ -171,17 +171,12 @@ ...@@ -171,17 +171,12 @@
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = false; let IS_ONLINE = false;
let collaborationJoinFlg = 0; let collaborationJoinFlg = 0;
let roomType;
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
if (typeof (android) != "undefined") {
roomType = android.getRoomType();
} else {
roomType = CHAT_DB.getRoomType();
}
const roomType = NativeBridgeDataSource.getRoomType();
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none'); $('.add_user_btn').removeClass('none');
} }
......
...@@ -215,8 +215,8 @@ ...@@ -215,8 +215,8 @@
let IS_ONLINE = false; let IS_ONLINE = false;
$("#loadingArea").load("./loading.html"); $("#loadingArea").load("./loading.html");
NativeBridge.getLoginParameter(); NativeBridgeDelegate.getLoginParameter();
NativeBridge.getGlobalParameter(); NativeBridgeDelegate.getGlobalParameter();
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
...@@ -233,11 +233,7 @@ ...@@ -233,11 +233,7 @@
} }
if (groupId != "" && groupId != undefined) { if (groupId != "" && groupId != undefined) {
CHAT_UI.refreshAllGroupSearch(groupId); CHAT_UI.refreshAllGroupSearch(groupId);
if (typeof (android) != "undefined") { NativeBridgeDelegate.setToMoveGroupId("");
android.setToMoveGroupId("");
} else {
webkit.messageHandlers.setToMoveGroupId.postMessage("");
}
} else { } else {
CHAT_UI.refreshContactScreen(); CHAT_UI.refreshContactScreen();
} }
......
...@@ -228,14 +228,6 @@ CHAT_DB.getArchiveList = function () { ...@@ -228,14 +228,6 @@ CHAT_DB.getArchiveList = function () {
} }
}; };
CHAT_DB.updateArchiveList = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveList.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveList();
}
};
// アーカイブ一覧検索 // アーカイブ一覧検索
CHAT_DB.getArchiveByName = function (archiveName) { CHAT_DB.getArchiveByName = function (archiveName) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
...@@ -260,13 +252,7 @@ CHAT_DB.getArchiveDetail = function (archiveId) { ...@@ -260,13 +252,7 @@ CHAT_DB.getArchiveDetail = function (archiveId) {
} }
}; };
CHAT_DB.updateArchiveDetail = function (archiveId) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveDetail.postMessage(archiveId);
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveDetail(archiveId);
}
};
CHAT_DB.searchMessages = function (keyword, userList) { CHAT_DB.searchMessages = function (keyword, userList) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
......
jQuery("#homeButton").on("click", function () { jQuery("#homeButton").on("click", function () {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.goHome();
webkit.messageHandlers.goHome.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.goHome();
}
}); });
jQuery("#reloadButton").on("click", function () { jQuery("#reloadButton").on("click", function () {
......
...@@ -13,16 +13,8 @@ window.onscroll = function () { ...@@ -13,16 +13,8 @@ window.onscroll = function () {
); );
$("#messages").prepend(loader); $("#messages").prepend(loader);
const messageId = $($(".chat_message").get(0)).data("messageid"); const messageId = $($(".chat_message").get(0)).data("messageid");
let messages; NativeBridgeDelegate.updatePreMessage(messageId);
if (typeof android != "undefined") { let messages = CHAT_DB.getMessagesWithMessageId(messageId);
if (IS_ONLINE == "true") {
android.updatePreMessage(messageId);
}
} else {
// 追加メッセージUpdate、get
webkit.messageHandlers.updatePreMessage.postMessage({ messageId: messageId });
}
messages = CHAT_DB.getMessagesWithMessageId(messageId);
CHAT_UI.prependMessage(messages); CHAT_UI.prependMessage(messages);
loader.remove(); loader.remove();
var afterHeight = $(".room_container").height(); var afterHeight = $(".room_container").height();
...@@ -38,27 +30,5 @@ $("#roomNameChangeBtn").click(function () { ...@@ -38,27 +30,5 @@ $("#roomNameChangeBtn").click(function () {
alert(getLocalizedString("error_empty_room_name")); alert(getLocalizedString("error_empty_room_name"));
return; return;
} }
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.changeRoomName(changeRoomName);
webkit.messageHandlers.changeRoomName.postMessage(changeRoomName);
} else if (CHAT_UTIL.isAndroid()) {
android.changeRoomName(changeRoomName);
}
}); });
/*
$('#messages').scroll(function() {
console.log('messagescroll');
if ($(this).scrollTop() === 0) {
if (!$('#chatLoader').is(':visible')) {
// 現在、メッセージの個数以前をメッセージを読み込む
// ローディングアイコンを追加する
let loader = $('<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>')
$('#messages').prepend(loader)
loader.remove();
// socket.emit('getMessages', $(this).children().length, function() {
// // ローディングアイコンを削除する
// loader.remove();
// });
}
}
});*/
...@@ -95,7 +95,7 @@ $("#room-search").on("input", function (event) { ...@@ -95,7 +95,7 @@ $("#room-search").on("input", function (event) {
socket.emit("roomSearch", encodeURIComponent($("#room-search").val())); socket.emit("roomSearch", encodeURIComponent($("#room-search").val()));
} else { } else {
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
NativeBridge.updateRoomList(); NativeBridgeDelegate.updateRoomList();
CHAT_UI.refreshRoomList(ChatRoomType.DM); CHAT_UI.refreshRoomList(ChatRoomType.DM);
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
} }
...@@ -338,23 +338,13 @@ $("#tabAllGroupOnAddUserInCollaboration").on("click", function (e) { ...@@ -338,23 +338,13 @@ $("#tabAllGroupOnAddUserInCollaboration").on("click", function (e) {
}); });
$("#makeRoomConfirmBtn").on("click", function (e) { $("#makeRoomConfirmBtn").on("click", function (e) {
if (typeof android != "undefined") { const selectedUserList = CHAT.globalSelectedUserList.join(",");
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(",")); NativeBridgeDelegate.saveSelectedUserList(selectedUserList);
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(
CHAT.globalSelectedUserList.join(",")
);
}
$("#makeRoomForm").submit(); $("#makeRoomForm").submit();
}); });
$("#addUserConfirmBtn").on("click", function (e) { $("#addUserConfirmBtn").on("click", function (e) {
if (typeof android != "undefined") { const selectedUserList = CHAT.globalSelectedUserList.join(",");
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(",")); NativeBridgeDelegate.saveSelectedUserList(selectedUserList);
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(
CHAT.globalSelectedUserList.join(",")
);
}
$("#addUserForm").submit(); $("#addUserForm").submit();
}); });
...@@ -21,18 +21,9 @@ CHAT_UI.startCollaboration = function (collaborationType) { ...@@ -21,18 +21,9 @@ CHAT_UI.startCollaboration = function (collaborationType) {
}, },
0 0
); );
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.finishAllCollaboration();
webkit.messageHandlers.finishAllCollaboration.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.finishAllCollaboration();
}
}
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startCollaboration.postMessage(collaborationType);
} else if (CHAT_UTIL.isAndroid()) {
android.startCollaboration(collaborationType);
} }
NativeBridgeDelegate.startCollaboration(collaborationType);
}; };
CHAT_UI.refreshJoinedCollaboration = function (loginIdList) { CHAT_UI.refreshJoinedCollaboration = function (loginIdList) {
...@@ -104,7 +95,7 @@ CHAT_UI.refreshMyGroupForAddUserInCollaboration = function () { ...@@ -104,7 +95,7 @@ CHAT_UI.refreshMyGroupForAddUserInCollaboration = function () {
TemplateURL.ADD_USER_GROUP_USER_LIST_IN_COLLABORATION TemplateURL.ADD_USER_GROUP_USER_LIST_IN_COLLABORATION
); );
NativeBridge.updateContactInfo(); NativeBridgeDelegate.updateContactInfo();
//お気に入りグループ取得。 //お気に入りグループ取得。
var favoriteGroupList = CHAT_DB.getFavoriteGroups(); var favoriteGroupList = CHAT_DB.getFavoriteGroups();
...@@ -163,7 +154,7 @@ CHAT_UI.refreshAllGroupForAddUserInCollaboration = function (paramGroupId) { ...@@ -163,7 +154,7 @@ CHAT_UI.refreshAllGroupForAddUserInCollaboration = function (paramGroupId) {
$("#tabAllGroupOnAddUserInCollaboration").prop("checked", true); $("#tabAllGroupOnAddUserInCollaboration").prop("checked", true);
NativeBridge.updateGroupInfo(groupId); NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。 //画面エリアを初期化。
$("#parentGroupBtnForAddUserInCollaboration").off(); $("#parentGroupBtnForAddUserInCollaboration").off();
...@@ -350,19 +341,16 @@ CHAT_UI.confirmInviteUserListInCollaboration = function () { ...@@ -350,19 +341,16 @@ CHAT_UI.confirmInviteUserListInCollaboration = function () {
selectedUserList.forEach(function (user) { selectedUserList.forEach(function (user) {
userIdList.push(user.shopMemberId); userIdList.push(user.shopMemberId);
}); });
if (typeof android != "undefined") { const commaJoinedUserIDList = userIdList.join(",");
android.inviteCollaboration( const collaborationType = CHAT_UTIL.getCollaborationType(
userIdList.join(","), globalUserInfo.coWorkType
CHAT_UTIL.getCollaborationType(globalUserInfo.coWorkType) );
);
} else { NativeBridgeDelegate.inviteCollaboration(
webkit.messageHandlers.inviteCollaboration.postMessage({ commaJoinedUserIDList,
userIdList: userIdList.join(","), collaborationType
collaborationType: CHAT_UTIL.getCollaborationType( );
globalUserInfo.coWorkType
),
});
}
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
$("#modalAddUserConfirm").modal("hide"); $("#modalAddUserConfirm").modal("hide");
}); });
......
...@@ -139,7 +139,7 @@ $('a[data-toggle="pill"]').on("show.bs.tab", function (e) { ...@@ -139,7 +139,7 @@ $('a[data-toggle="pill"]').on("show.bs.tab", function (e) {
CHAT.saveRoomInfo(); CHAT.saveRoomInfo();
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
socket.emit("leaveRoom", function () { socket.emit("leaveRoom", function () {
NativeBridge.updateRoomList(); NativeBridgeDelegate.updateRoomList();
}); });
} }
CHAT_UI.refreshRoomList(ChatRoomType.DM); CHAT_UI.refreshRoomList(ChatRoomType.DM);
...@@ -438,7 +438,7 @@ CHAT_UI.showConfirmView = function (isInvite) { ...@@ -438,7 +438,7 @@ CHAT_UI.showConfirmView = function (isInvite) {
// ルーム名のURIencodingを行う // ルーム名のURIencodingを行う
//const encodedRoomName = encodeURIComponent(newRoomName); //const encodedRoomName = encodeURIComponent(newRoomName);
NativeBridge.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIdList.join(","),
newRoomName, newRoomName,
...@@ -514,7 +514,7 @@ CHAT_UI.showConfirmView = function (isInvite) { ...@@ -514,7 +514,7 @@ CHAT_UI.showConfirmView = function (isInvite) {
// ルーム名のtrimmingした後、URIencodingを行う // ルーム名のtrimmingした後、URIencodingを行う
const encodedRoomName = encodeURIComponent(trimmedRoomName); const encodedRoomName = encodeURIComponent(trimmedRoomName);
NativeBridge.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIdList.join(","),
encodedRoomName, encodedRoomName,
...@@ -808,7 +808,7 @@ CHAT_UI.refreshContactScreen = function () { ...@@ -808,7 +808,7 @@ CHAT_UI.refreshContactScreen = function () {
var myNamecardTemplate = getTemplate(TemplateURL.MY_NAME_CARD); var myNamecardTemplate = getTemplate(TemplateURL.MY_NAME_CARD);
var groupUserTemplate = getTemplate(TemplateURL.GROUP_USER_LIST); var groupUserTemplate = getTemplate(TemplateURL.GROUP_USER_LIST);
NativeBridge.updateContactInfo(); NativeBridgeDelegate.updateContactInfo();
var myInfo = CHAT_DB.getMyInfo(); var myInfo = CHAT_DB.getMyInfo();
myInfo.profileImagePath = CHAT.getProfileImgUrl(myInfo.profileUrl); myInfo.profileImagePath = CHAT.getProfileImgUrl(myInfo.profileUrl);
...@@ -882,11 +882,7 @@ CHAT_UI.refreshRoomList = function (roomType) { ...@@ -882,11 +882,7 @@ CHAT_UI.refreshRoomList = function (roomType) {
} }
if (beforeRoomType != null) { if (beforeRoomType != null) {
roomType = beforeRoomType; roomType = beforeRoomType;
if (typeof android != "undefined") { NativeBridgeDelegate.clearBeforeRoomType();
android.clearBeforeRoomType();
} else {
webkit.messageHandlers.clearBeforeRoomType.postMessage({});
}
} }
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
...@@ -896,7 +892,7 @@ CHAT_UI.refreshRoomList = function (roomType) { ...@@ -896,7 +892,7 @@ CHAT_UI.refreshRoomList = function (roomType) {
} }
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
NativeBridge.updateRoomList(); NativeBridgeDelegate.updateRoomList();
} }
var rooms = CHAT_DB.getRoomList(roomType, null); var rooms = CHAT_DB.getRoomList(roomType, null);
CHAT.globalIsInvite = false; CHAT.globalIsInvite = false;
...@@ -1003,23 +999,13 @@ CHAT_UI.refreshRoomList = function (roomType) { ...@@ -1003,23 +999,13 @@ CHAT_UI.refreshRoomList = function (roomType) {
CHAT_UI.loadMessages = function (roomId, joinRoomName) { CHAT_UI.loadMessages = function (roomId, joinRoomName) {
roomName = joinRoomName; roomName = joinRoomName;
var now = new Date();
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
CHAT_UI.refreshForOnline(); CHAT_UI.refreshForOnline();
if (typeof android != "undefined") { NativeBridgeDelegate.updateMessages(roomId);
android.updateMessages(roomId);
} else {
webkit.messageHandlers.updateMessages.postMessage(roomId);
}
} else { } else {
CHAT_UI.refreshForOffline(); CHAT_UI.refreshForOffline();
} }
var roomType; const roomType = NativeBridgeDataSource.getRoomType();
if (typeof android != "undefined") {
roomType = android.getRoomType();
} else {
roomType = CHAT_DB.getRoomType();
}
if (roomType == ChatRoomType.DM) { if (roomType == ChatRoomType.DM) {
$("#roomMenu").removeClass("none"); $("#roomMenu").removeClass("none");
} }
...@@ -1278,7 +1264,7 @@ CHAT_UI.insertFavoriteUser = function (shopMemberId) { ...@@ -1278,7 +1264,7 @@ CHAT_UI.insertFavoriteUser = function (shopMemberId) {
CHAT_UI.removeFavoriteGroup = function (groupId) { CHAT_UI.removeFavoriteGroup = function (groupId) {
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
var result = NativeBridge.removeFavoriteGroup(groupId); var result = NativeBridgeDataSource.removeFavoriteGroup(groupId);
if (result) { if (result) {
$(".group_" + groupId).removeClass("active"); $(".group_" + groupId).removeClass("active");
$(".group_" + groupId).addClass("disable"); $(".group_" + groupId).addClass("disable");
...@@ -1291,7 +1277,7 @@ CHAT_UI.removeFavoriteGroup = function (groupId) { ...@@ -1291,7 +1277,7 @@ CHAT_UI.removeFavoriteGroup = function (groupId) {
CHAT_UI.insertFavoriteGroup = function (groupId) { CHAT_UI.insertFavoriteGroup = function (groupId) {
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
const result = NativeBridge.addFavoriteGroup(groupID); const result = NativeBridgeDataSource.addFavoriteGroup(groupID);
if (result) { if (result) {
$(".group_" + groupId).removeClass("disable"); $(".group_" + groupId).removeClass("disable");
$(".group_" + groupId).addClass("active"); $(".group_" + groupId).addClass("active");
...@@ -1307,11 +1293,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1307,11 +1293,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) {
var groupId = paramGroupId; var groupId = paramGroupId;
if (window.location.pathname.includes("chat_room")) { if (window.location.pathname.includes("chat_room")) {
if (groupId == "") return; if (groupId == "") return;
if (typeof android != "undefined") { NativeBridgeDelegate.setToMoveGroupId(groupId);
android.setToMoveGroupId(groupId);
} else {
webkit.messageHandlers.setToMoveGroupId.postMessage(groupId);
}
window.location.href = "contact.html"; window.location.href = "contact.html";
} }
...@@ -1330,7 +1312,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) { ...@@ -1330,7 +1312,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) {
$("#tabAllGroup").prop("checked", true); $("#tabAllGroup").prop("checked", true);
//オンライン状態であればサーバから情報更新。 //オンライン状態であればサーバから情報更新。
NativeBridge.updateGroupInfo(groupId); NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。 //画面エリアを初期化。
$("#rootGroupBtn").off(); $("#rootGroupBtn").off();
...@@ -1408,7 +1390,7 @@ CHAT_UI.startChat = function (userShopMemberId, userName) { ...@@ -1408,7 +1390,7 @@ CHAT_UI.startChat = function (userShopMemberId, userName) {
// 参加ユーザ名でルーム名を生成 // 参加ユーザ名でルーム名を生成
let newRoomName = CHAT.globalLoginParameter.loginId + "," + userName; let newRoomName = CHAT.globalLoginParameter.loginId + "," + userName;
NativeBridge.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIdList.join(","),
newRoomName, newRoomName,
...@@ -1424,7 +1406,7 @@ CHAT_UI.startVoice = function (userShopMemberId, userName) { ...@@ -1424,7 +1406,7 @@ CHAT_UI.startVoice = function (userShopMemberId, userName) {
// 参加ユーザ名でルーム名を生成 // 参加ユーザ名でルーム名を生成
let newRoomName = CHAT.globalLoginParameter.loginId + "," + userName; let newRoomName = CHAT.globalLoginParameter.loginId + "," + userName;
NativeBridge.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIdList.join(","),
newRoomName, newRoomName,
...@@ -1477,7 +1459,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1477,7 +1459,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// アーカイブ詳細の様式を読み込む // アーカイブ詳細の様式を読み込む
const archiveDetailTemplate = $("#archive-detail-template").html(); const archiveDetailTemplate = $("#archive-detail-template").html();
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
CHAT_DB.updateArchiveDetail(archiveId); NativeBridgeDelegate.updateArchiveDetail(archiveId);
} }
// アーカイブ詳細取得 // アーカイブ詳細取得
const archive = CHAT_DB.getArchiveDetail(archiveId); const archive = CHAT_DB.getArchiveDetail(archiveId);
...@@ -1595,7 +1577,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) { ...@@ -1595,7 +1577,7 @@ CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// チャットルームへのリンク付け // チャットルームへのリンク付け
document.getElementById("joinChatRoom").onclick = function () { document.getElementById("joinChatRoom").onclick = function () {
NativeBridge.joinRoom(archive.roomId, archive.roomName); NativeBridgeDelegate.joinRoom(archive.roomId, archive.roomName);
}; };
// loadingIndicatorを非表示 // loadingIndicatorを非表示
...@@ -1618,7 +1600,7 @@ CHAT_UI.refreshMyGroupForMakeRoom = function () { ...@@ -1618,7 +1600,7 @@ CHAT_UI.refreshMyGroupForMakeRoom = function () {
var groupUserTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_USER_LIST); var groupUserTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_USER_LIST);
NativeBridge.updateContactInfo(); NativeBridgeDelegate.updateContactInfo();
//お気に入りグループ取得。 //お気に入りグループ取得。
var favoriteGroupList = CHAT_DB.getFavoriteGroups(); var favoriteGroupList = CHAT_DB.getFavoriteGroups();
...@@ -1681,7 +1663,7 @@ CHAT_UI.refreshAllGroupForMakeRoom = function (paramGroupId) { ...@@ -1681,7 +1663,7 @@ CHAT_UI.refreshAllGroupForMakeRoom = function (paramGroupId) {
$("#tabAllGroupOnMakeRoom").prop("checked", true); $("#tabAllGroupOnMakeRoom").prop("checked", true);
//オンライン状態であればサーバから情報更新。 //オンライン状態であればサーバから情報更新。
NativeBridge.updateGroupInfo(groupId); NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。 //画面エリアを初期化。
$("#parentGroupBtnForMakeRoom").off(); $("#parentGroupBtnForMakeRoom").off();
...@@ -1805,7 +1787,7 @@ CHAT_UI.refreshArchiveScreen = function () { ...@@ -1805,7 +1787,7 @@ CHAT_UI.refreshArchiveScreen = function () {
// アーカイブ一覧取得 // アーカイブ一覧取得
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
CHAT_DB.updateArchiveList(); NativeBridgeDelegate.updateArchiveList();
} }
// ローカルDBのデータを表示 // ローカルDBのデータを表示
...@@ -1883,7 +1865,7 @@ CHAT_UI.showMakeRoomConfirmView = function () { ...@@ -1883,7 +1865,7 @@ CHAT_UI.showMakeRoomConfirmView = function () {
// 参加ユーザ名でルーム名を生成 // 参加ユーザ名でルーム名を生成
let newRoomName = let newRoomName =
CHAT.globalLoginParameter.loginId + "," + userNameList.join(","); CHAT.globalLoginParameter.loginId + "," + userNameList.join(",");
NativeBridge.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIdList.join(","),
newRoomName, newRoomName,
...@@ -1958,7 +1940,7 @@ CHAT_UI.showMakeRoomConfirmView = function () { ...@@ -1958,7 +1940,7 @@ CHAT_UI.showMakeRoomConfirmView = function () {
// TODO: check why here using trimmedroomname instead of encodedRoomName // TODO: check why here using trimmedroomname instead of encodedRoomName
// ルーム名のtrimmingした後、URIencodingを行う // ルーム名のtrimmingした後、URIencodingを行う
const encodedRoomName = encodeURIComponent(trimmedRoomName); const encodedRoomName = encodeURIComponent(trimmedRoomName);
NativeBridge.createChatRoom( NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM, ChatRoomType.DM,
userIdList.join(","), userIdList.join(","),
trimmedRoomName, trimmedRoomName,
...@@ -1993,7 +1975,7 @@ CHAT_UI.showAddUserConfirmView = function () { ...@@ -1993,7 +1975,7 @@ CHAT_UI.showAddUserConfirmView = function () {
selectedUserList.forEach(function (user) { selectedUserList.forEach(function (user) {
userIdList.push(user.shopMemberId); userIdList.push(user.shopMemberId);
}); });
NativeBridge.inviteUsers(userIdList.join(",")); NativeBridgeDelegate.inviteUsers(userIdList.join(","));
}); });
}; };
...@@ -2012,7 +1994,7 @@ CHAT_UI.refreshMyGroupForAddUser = function () { ...@@ -2012,7 +1994,7 @@ CHAT_UI.refreshMyGroupForAddUser = function () {
var userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST); var userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST);
var groupUserTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_USER_LIST); var groupUserTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_USER_LIST);
NativeBridge.updateContactInfo(); NativeBridgeDelegate.updateContactInfo();
//お気に入りグループ取得。 //お気に入りグループ取得。
var favoriteGroupList = CHAT_DB.getFavoriteGroups(); var favoriteGroupList = CHAT_DB.getFavoriteGroups();
...@@ -2075,7 +2057,7 @@ CHAT_UI.refreshAllGroupForAddUser = function (paramGroupId) { ...@@ -2075,7 +2057,7 @@ CHAT_UI.refreshAllGroupForAddUser = function (paramGroupId) {
$("#tabAllGroupOnAddUser").prop("checked", true); $("#tabAllGroupOnAddUser").prop("checked", true);
//オンライン状態であればサーバから情報更新。 //オンライン状態であればサーバから情報更新。
NativeBridge.updateGroupInfo(groupId); NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。 //画面エリアを初期化。
$("#parentGroupBtnForAddUser").off(); $("#parentGroupBtnForAddUser").off();
...@@ -2198,16 +2180,16 @@ CHAT_UI.refreshForOffline = function () { ...@@ -2198,16 +2180,16 @@ CHAT_UI.refreshForOffline = function () {
alertString = getLocalizedString("err_weak_network_exit_collaboration"); alertString = getLocalizedString("err_weak_network_exit_collaboration");
} }
alert(alertString); alert(alertString);
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.finishCollaboration.postMessage({}); NativeBridgeDelegate.finishCollaboration();
}
if (collaborationJoinFlg != "2") { if (collaborationJoinFlg != "2") {
NativeBridge.joinRoom( NativeBridgeDelegate.joinRoom(
CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomId,
CHAT.globalLoginParameter.name CHAT.globalLoginParameter.name
); );
} else { } else {
NativeBridge.openCommunicationHome(); NativeBridgeDelegate.openCommunicationHome();
} }
}; };
...@@ -2217,7 +2199,7 @@ CHAT_UI.offlineHandler = function (e) { ...@@ -2217,7 +2199,7 @@ CHAT_UI.offlineHandler = function (e) {
CHAT_UI.displayExistRoom = function (roomId) { CHAT_UI.displayExistRoom = function (roomId) {
if (confirm("error_already_exist_same_user")) { if (confirm("error_already_exist_same_user")) {
NativeBridge.joinRoom(roomId); NativeBridgeDelegate.joinRoom(roomId);
} }
return; return;
}; };
\ No newline at end of file
...@@ -15,21 +15,10 @@ var beforeHeight = window.innerHeight; ...@@ -15,21 +15,10 @@ var beforeHeight = window.innerHeight;
var beforeWidth = window.innerWidth; var beforeWidth = window.innerWidth;
var beforeScroll; var beforeScroll;
CHAT.saveRoomInfo = function (roomId, roomName) { CHAT.saveRoomInfo = function (roomID, roomName) {
CHAT.globalLoginParameter.roomId = roomId; CHAT.globalLoginParameter.roomId = roomID;
CHAT.globalLoginParameter.roomName = roomName; CHAT.globalLoginParameter.roomName = roomName;
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.saveVisitRoomInfo(roomID, roomName)
webkit.messageHandlers.roomInfosaveMessageHandlerId.postMessage({
roomId: roomId,
roomName: roomName,
});
} else if (CHAT_UTIL.isAndroid()) {
if (roomId == undefined && roomName == undefined) {
android.saveVisitRoomInfo("", "");
} else {
android.saveVisitRoomInfo(roomId, roomName);
}
}
}; };
// #36170 画像パスが存在しない場合はデフォルトの画像を返す // #36170 画像パスが存在しない場合はデフォルトの画像を返す
......
...@@ -60,13 +60,8 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -60,13 +60,8 @@ document.addEventListener("DOMContentLoaded", function () {
.off() .off()
.on("click", function () { .on("click", function () {
$("#addUserInCollaboration").modal("hide"); $("#addUserInCollaboration").modal("hide");
if (typeof android != "undefined") { const selectedUserList = CHAT.globalSelectedUserList.join(",");
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(",")); NativeBridgeDelegate.saveSelectedUserList(selectedUserList);
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(
CHAT.globalSelectedUserList.join(",")
);
}
CHAT_UI.confirmInviteUserListInCollaboration(); CHAT_UI.confirmInviteUserListInCollaboration();
}); });
}); });
......
...@@ -31,11 +31,7 @@ $(".category").on("click", function () { ...@@ -31,11 +31,7 @@ $(".category").on("click", function () {
}); });
$(".home_btn").on("click", function () { $(".home_btn").on("click", function () {
if (CHAT_UTIL.isAndroid()) { NativeBridgeDelegate.goHome();
android.goHome();
} else if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.goHome.postMessage({});
}
}); });
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
......
var NativeBridgeDataSource = {};
// todo: peacekim:: it should be datasource
NativeBridgeDataSource.removeFavoriteGroup = function (groupID) {
if (CHAT_UTIL.isIOS()) {
const result = callNativeApp(NATIVE_KEY_IOS.removeFavoriteGroup, {
groupId: groupID,
});
return result == "true" ? true : false;
} else {
return android.removeFavoriteGroup(groupID);
}
};
NativeBridgeDataSource.addFavoriteGroup = function (groupID) {
if (typeof android != "undefined") {
return android.addFavoriteGroup(groupID);
} else {
const result = callNativeApp(NATIVE_KEY_IOS.addFavoriteGroup, {
groupId: groupId,
});
if (result == "true") {
return true;
} else {
return false;
}
}
};
NativeBridgeDataSource.getRoomType = function () {
if (typeof android != "undefined") {
return android.getRoomType();
} else {
return parseInt(callNativeApp(NATIVE_KEY_IOS.getRoomType, {}), 10);
}
};
var NativeBridge = {}; var NativeBridgeDelegate = {};
NativeBridge.updateRoomList = function () { NativeBridgeDelegate.updateRoomList = function () {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.updateRoomList(); android.updateRoomList();
} else { } else {
...@@ -8,7 +8,7 @@ NativeBridge.updateRoomList = function () { ...@@ -8,7 +8,7 @@ NativeBridge.updateRoomList = function () {
} }
}; };
NativeBridge.roomDisplayOff = function () { NativeBridgeDelegate.roomDisplayOff = function () {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.roomDisplayOff(); android.roomDisplayOff();
} else { } else {
...@@ -16,7 +16,7 @@ NativeBridge.roomDisplayOff = function () { ...@@ -16,7 +16,7 @@ NativeBridge.roomDisplayOff = function () {
} }
}; };
NativeBridge.openCommunicationHome = function () { NativeBridgeDelegate.openCommunicationHome = function () {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.openCommunicationHome(); android.openCommunicationHome();
} else { } else {
...@@ -24,7 +24,7 @@ NativeBridge.openCommunicationHome = function () { ...@@ -24,7 +24,7 @@ NativeBridge.openCommunicationHome = function () {
} }
}; };
NativeBridge.joinRoom = function (roomID, roomName = "") { NativeBridgeDelegate.joinRoom = function (roomID, roomName = "") {
if (typeof android != "undefined") { if (typeof android != "undefined") {
try { try {
android.joinRoom(roomID, roomName); android.joinRoom(roomID, roomName);
...@@ -39,7 +39,7 @@ NativeBridge.joinRoom = function (roomID, roomName = "") { ...@@ -39,7 +39,7 @@ NativeBridge.joinRoom = function (roomID, roomName = "") {
} }
}; };
NativeBridge.createChatRoom = function ( NativeBridgeDelegate.createChatRoom = function (
chatRoomType, chatRoomType,
userIDList, userIDList,
newRoomName, newRoomName,
...@@ -66,11 +66,11 @@ NativeBridge.createChatRoom = function ( ...@@ -66,11 +66,11 @@ NativeBridge.createChatRoom = function (
} }
}; };
NativeBridge.updateContactInfo = function () { NativeBridgeDelegate.updateContactInfo = function () {
if (IS_ONLINE != "true") { if (IS_ONLINE != "true") {
return; return;
} }
NativeBridge.updateGroupInfo("0"); NativeBridgeDelegate.updateGroupInfo("0");
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.updateMyInfo(); android.updateMyInfo();
// android.updateGroupUser(); ? is this method included in update group info? // android.updateGroupUser(); ? is this method included in update group info?
...@@ -82,7 +82,7 @@ NativeBridge.updateContactInfo = function () { ...@@ -82,7 +82,7 @@ NativeBridge.updateContactInfo = function () {
} }
}; };
NativeBridge.updateGroupInfo = function (groupID) { NativeBridgeDelegate.updateGroupInfo = function (groupID) {
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
if (typeof android != "undefined") { if (typeof android != "undefined") {
// TODO: peacekim:: check this method is right or not // TODO: peacekim:: check this method is right or not
...@@ -93,34 +93,10 @@ NativeBridge.updateGroupInfo = function (groupID) { ...@@ -93,34 +93,10 @@ NativeBridge.updateGroupInfo = function (groupID) {
} }
}; };
// todo: peacekim:: it should be datasource NativeBridgeDelegate.joinCollaboration = function (
NativeBridge.removeFavoriteGroup = function (groupID) { collaborationType,
if (CHAT_UTIL.isIOS()) { meetingId = 0
const result = callNativeApp(NATIVE_KEY_IOS.removeFavoriteGroup, { ) {
groupId: groupID,
});
return result == "true" ? true : false;
} else {
return android.removeFavoriteGroup(groupID);
}
};
NativeBridge.addFavoriteGroup = function (groupID) {
if (typeof android != "undefined") {
return android.addFavoriteGroup(groupID);
} else {
const result = callNativeApp(NATIVE_KEY_IOS.addFavoriteGroup, {
groupId: groupId,
});
if (result == "true") {
return true;
} else {
return false;
}
}
};
NativeBridge.joinCollaboration = function (collaborationType, meetingId = 0) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinCollaboration.postMessage({ webkit.messageHandlers.joinCollaboration.postMessage({
collaborationType: collaborationType, collaborationType: collaborationType,
...@@ -138,7 +114,7 @@ NativeBridge.joinCollaboration = function (collaborationType, meetingId = 0) { ...@@ -138,7 +114,7 @@ NativeBridge.joinCollaboration = function (collaborationType, meetingId = 0) {
} }
}; };
NativeBridge.inviteUsers = function (userIDList) { NativeBridgeDelegate.inviteUsers = function (userIDList) {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.inviteUsers(userIDList, false); android.inviteUsers(userIDList, false);
} else { } else {
...@@ -148,7 +124,7 @@ NativeBridge.inviteUsers = function (userIDList) { ...@@ -148,7 +124,7 @@ NativeBridge.inviteUsers = function (userIDList) {
} }
}; };
NativeBridge.getLoginParameter = function () { NativeBridgeDelegate.getLoginParameter = function () {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.getLoginParameter(); android.getLoginParameter();
} else { } else {
...@@ -156,7 +132,7 @@ NativeBridge.getLoginParameter = function () { ...@@ -156,7 +132,7 @@ NativeBridge.getLoginParameter = function () {
} }
}; };
NativeBridge.getGlobalParameter = function () { NativeBridgeDelegate.getGlobalParameter = function () {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.getGlobalParameter(); android.getGlobalParameter();
} else { } else {
...@@ -164,10 +140,231 @@ NativeBridge.getGlobalParameter = function () { ...@@ -164,10 +140,231 @@ NativeBridge.getGlobalParameter = function () {
} }
}; };
NativeBridge.saveSelectedUserList = function (selectedUserList) { NativeBridgeDelegate.saveSelectedUserList = function (selectedUserList) {
if (typeof android != "undefined") { if (typeof android != "undefined") {
android.saveSelectedUserList(selectedUserList); android.saveSelectedUserList(selectedUserList);
} else { } else {
webkit.messageHandlers.saveSelectedUserList.postMessage(selectedUserList); webkit.messageHandlers.saveSelectedUserList.postMessage(selectedUserList);
} }
}; };
NativeBridgeDelegate.startPIPMode = function () {
if (typeof android != "undefined") {
android.startPipMode();
} else if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startPipMode.postMessage({});
}
};
NativeBridgeDelegate.finishPIPMode = function (needsAndroid = false) {
// not for android
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.finishPipMode.postMessage({});
} else if (needsAndroid && typeof android != "undefined") {
android.finishPip();
}
};
NativeBridgeDelegate.setHostRequestFlg = function (hostRequestFlag) {
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(hostRequestFlag);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(hostRequestFlag);
}
};
NativeBridgeDelegate.setToMoveGroupId = function (groupID) {
if (typeof android != "undefined") {
android.setToMoveGroupId(groupID);
} else {
webkit.messageHandlers.setToMoveGroupId.postMessage(groupID);
}
};
NativeBridgeDelegate.updateArchiveList = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveList.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveList();
}
};
NativeBridgeDelegate.updateArchiveDetail = function (archiveId) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveDetail.postMessage(archiveId);
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveDetail(archiveId);
}
};
NativeBridgeDelegate.goHome = function () {
if (CHAT_UTIL.isAndroid()) {
android.goHome();
} else if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.goHome.postMessage({});
}
};
NativeBridgeDelegate.updatePreMessage = function (messageId) {
if (typeof android != "undefined") {
if (IS_ONLINE == "true") {
android.updatePreMessage(messageId);
}
} else {
// 追加メッセージUpdate、get
webkit.messageHandlers.updatePreMessage.postMessage({
messageId: messageId,
});
}
};
NativeBridgeDelegate.changeRoomName = function (newRoomName) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.changeRoomName.postMessage(newRoomName);
} else if (CHAT_UTIL.isAndroid()) {
android.changeRoomName(newRoomName);
}
};
NativeBridgeDelegate.startCollaboration = function (type) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startCollaboration.postMessage(type);
} else if (CHAT_UTIL.isAndroid()) {
android.startCollaboration(type);
}
};
NativeBridgeDelegate.finishCollaboration = function (needsAndroid = false) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.finishCollaboration.postMessage({});
} else if (needsAndroid) {
android.finishCollaboration();
}
};
NativeBridgeDelegate.finishAllCollaboration = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.finishAllCollaboration.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.finishAllCollaboration();
}
};
NativeBridgeDelegate.inviteCollaboration = function (
userIDList,
collaborationType
) {
if (typeof android != "undefined") {
android.inviteCollaboration(userIDList, collaborationType);
} else {
webkit.messageHandlers.inviteCollaboration.postMessage({
userIdList: userIDList,
collaborationType: collaborationType,
});
}
};
NativeBridgeDelegate.clearBeforeRoomType = function () {
if (typeof android != "undefined") {
android.clearBeforeRoomType();
} else {
webkit.messageHandlers.clearBeforeRoomType.postMessage({});
}
};
NativeBridgeDelegate.updateMessages = function (roomID) {
if (typeof android != "undefined") {
android.updateMessages(roomID);
} else {
webkit.messageHandlers.updateMessages.postMessage(roomID);
}
};
NativeBridgeDelegate.saveVisitRoomInfo = function (roomID = "", roomName = "") {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.roomInfosaveMessageHandlerId.postMessage({
roomId: roomID,
roomName: roomName,
});
} else if (CHAT_UTIL.isAndroid()) {
if (roomId == undefined && roomName == undefined) {
android.saveVisitRoomInfo("", "");
} else {
android.saveVisitRoomInfo(roomID, roomName);
}
}
};
NativeBridgeDelegate.exitMeetingRoom = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.exitMeetingRoom.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom();
}
};
NativeBridgeDelegate.joinChangedCollaboration = function (
joinCollaborationType,
meetingID
) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinChangedCollaboration.postMessage({
joinCollaborationType: joinCollaborationType,
meetingId: meetingID,
});
} else if (CHAT_UTIL.isAndroid()) {
android.joinChangedCollaboration(joinCollaborationType, meetingID);
}
};
NativeBridgeDelegate.joinMeetingRoom = function (meetingID) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinMeetingRoom.postMessage(meetingID);
} else if (CHAT_UTIL.isAndroid()) {
android.joinMeetingRoom(meetingID);
}
};
NativeBridgeDelegate.setJoinCollaborationType = function (
type,
androidVersion
) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.setJoinCollaborationType.postMessage(type);
} else if (CHAT_UTIL.isAndroid()) {
if (
type == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
alert(getLocalizedString("not_support_version"));
return;
}
android.setJoinCollaborationType(type);
}
};
NativeBridgeDelegate.showExitHostAlert = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.showExitHostAlert.postMessage({});
}
// TODO: peacekim:: check not to need this method for android
};
NativeBridgeDelegate.startContentView = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startContentView.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.startContentView();
}
};
NativeBridgeDelegate.changeCollaboration = function (type, meetingID) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.changeCollaboration.postMessage({
changeCollaborationType: type,
meetingId: meetingID,
});
} else if (CHAT_UTIL.isAndroid()) {
android.changeCollaboration(type, meetingID);
}
};
...@@ -120,25 +120,18 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -120,25 +120,18 @@ document.addEventListener("DOMContentLoaded", function () {
Coview_addLoginId(globalUserInfo.loginId); Coview_addLoginId(globalUserInfo.loginId);
coview_api.Login(globalUserInfo.loginId); coview_api.Login(globalUserInfo.loginId);
initCollaborationUI(joinCollaborationType); initCollaborationUI(joinCollaborationType);
if (CHAT_UTIL.isAndroid()) { NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
fw.socket.on("message", async function (data) { fw.socket.on("message", async function (data) {
console.log("====> message::data: ", data); console.log("====> message::data: ", data);
if (data.type === "CHANGE_COLLABORATION") { if (data.type === "CHANGE_COLLABORATION") {
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) { if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.exitMeetingRoom();
webkit.messageHandlers.exitMeetingRoom.postMessage({}); NativeBridgeDelegate.finishPIPMode(true);
webkit.messageHandlers.finishPipMode.postMessage({});
} else if (CHAT_UTIL.isAndroid()) { if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom();
android.finishPip();
$(".pip_indicator").addClass("none"); $(".pip_indicator").addClass("none");
} }
await new Promise((done) => setTimeout(() => done(), 500)); await new Promise((done) => setTimeout(() => done(), 500));
updateCanvasSize(); updateCanvasSize();
} }
...@@ -157,24 +150,13 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -157,24 +150,13 @@ document.addEventListener("DOMContentLoaded", function () {
joinMeetingId = data.payload.newMeetingId; joinMeetingId = data.payload.newMeetingId;
initCollaborationUI(joinCollaborationType); initCollaborationUI(joinCollaborationType);
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.joinChangedCollaboration(
webkit.messageHandlers.joinChangedCollaboration.postMessage({ joinCollaborationType,
joinCollaborationType: joinCollaborationType, data.payload.newMeetingId
meetingId: data.payload.newMeetingId, );
});
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) { if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
webkit.messageHandlers.joinMeetingRoom.postMessage( NativeBridgeDelegate.joinMeetingRoom(data.payload.newMeetingId);
data.payload.newMeetingId
);
}
} else if (CHAT_UTIL.isAndroid()) {
android.joinChangedCollaboration(
joinCollaborationType,
data.payload.newMeetingId
);
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
android.joinMeetingRoom(data.payload.newMeetingId);
}
} }
} else if (data.type === "SHARE_FILE") { } else if (data.type === "SHARE_FILE") {
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) { if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) {
...@@ -240,11 +222,9 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -240,11 +222,9 @@ document.addEventListener("DOMContentLoaded", function () {
data.payload.loginId == globalUserInfo.loginId && data.payload.loginId == globalUserInfo.loginId &&
joinCollaborationType == COLLABORATION_TYPE.DOCUMENT joinCollaborationType == COLLABORATION_TYPE.DOCUMENT
) { ) {
NativeBridgeDelegate.finishPIPMode(true);
if (CHAT_UTIL.isAndroid()) { if (CHAT_UTIL.isAndroid()) {
android.finishPip();
$(".pip_indicator").addClass("none"); $(".pip_indicator").addClass("none");
} else {
webkit.messageHandlers.finishPipMode.postMessage({});
} }
} }
} else if (data.type === "API_SEND_OWNER_CHANGE_COMPLETE") { } else if (data.type === "API_SEND_OWNER_CHANGE_COMPLETE") {
...@@ -267,20 +247,14 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -267,20 +247,14 @@ document.addEventListener("DOMContentLoaded", function () {
} else if (data.type === "CHANGE_HOST_APPLY") { } else if (data.type === "CHANGE_HOST_APPLY") {
if (g_isMainMan) { if (g_isMainMan) {
coview_api.HeartBeatUser(globalUserInfo.loginId); coview_api.HeartBeatUser(globalUserInfo.loginId);
NativeBridgeDelegate.finishPIPMode(true);
if (CHAT_UTIL.isAndroid()) { if (CHAT_UTIL.isAndroid()) {
$(".pip_indicator").addClass("none"); $(".pip_indicator").addClass("none");
android.finishPip();
} else {
webkit.messageHandlers.finishPipMode.postMessage({});
} }
} }
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HostRequestFlag.DOING); NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DOING);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DOING
);
}
await new Promise((done) => setTimeout(() => done(), 500)); await new Promise((done) => setTimeout(() => done(), 500));
if (g_isMainMan) { if (g_isMainMan) {
if ( if (
...@@ -292,13 +266,7 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -292,13 +266,7 @@ document.addEventListener("DOMContentLoaded", function () {
) )
) { ) {
Coview_changeHost(getFermiLoginId(data.payload.hostId)); Coview_changeHost(getFermiLoginId(data.payload.hostId));
if (CHAT_UTIL.isAndroid()) { NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
} else { } else {
fw.sendToMsg("others", "HOST_REQUEST_REJECT", { fw.sendToMsg("others", "HOST_REQUEST_REJECT", {
hostId: data.payload.hostId, hostId: data.payload.hostId,
...@@ -309,24 +277,12 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -309,24 +277,12 @@ document.addEventListener("DOMContentLoaded", function () {
}); });
} }
} else if (data.type === "HOST_REQUEST_DONE") { } else if (data.type === "HOST_REQUEST_DONE") {
if (CHAT_UTIL.isAndroid()) { NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
} else if (data.type === "HOST_REQUEST_REJECT") { } else if (data.type === "HOST_REQUEST_REJECT") {
if (data.payload.hostId == CHAT.globalLoginParameter.loginId) { if (data.payload.hostId == CHAT.globalLoginParameter.loginId) {
alert("REJECT for owner user"); alert("REJECT for owner user");
} }
if (CHAT_UTIL.isAndroid()) { NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
} else if (data.type === "GET_COLLABORATION_TYPE" && g_isMainMan) { } else if (data.type === "GET_COLLABORATION_TYPE" && g_isMainMan) {
fw.sendToMsg("others", "GET_COLLABORATION_TYPE_RESPONSE", { fw.sendToMsg("others", "GET_COLLABORATION_TYPE_RESPONSE", {
loginId: data.payload.loginId, loginId: data.payload.loginId,
...@@ -349,24 +305,14 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -349,24 +305,14 @@ document.addEventListener("DOMContentLoaded", function () {
} }
joinMeetingId = data.payload.newMeetingId; joinMeetingId = data.payload.newMeetingId;
initCollaborationUI(joinCollaborationType); initCollaborationUI(joinCollaborationType);
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinChangedCollaboration.postMessage({ NativeBridgeDelegate.joinChangedCollaboration(
joinCollaborationType: joinCollaborationType, joinCollaborationType,
meetingId: data.payload.newMeetingId, data.payload.newMeetingId
}); );
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
webkit.messageHandlers.joinMeetingRoom.postMessage( if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
data.payload.newMeetingId NativeBridgeDelegate.joinMeetingRoom(data.payload.newMeetingId);
);
}
} else if (CHAT_UTIL.isAndroid()) {
android.joinChangedCollaboration(
joinCollaborationType,
data.payload.newMeetingId
);
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
android.joinMeetingRoom(data.payload.newMeetingId);
}
} }
} }
} else if (data.type === "API_WELCOME") { } else if (data.type === "API_WELCOME") {
...@@ -397,23 +343,20 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -397,23 +343,20 @@ document.addEventListener("DOMContentLoaded", function () {
android.setExitHostAlert(); android.setExitHostAlert();
} }
if (isDocument) { if (isDocument) {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.exitMeetingRoom();
webkit.messageHandlers.exitMeetingRoom.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom();
}
} }
if (isInvited == InvitedFlag.NONE) { if (isInvited == InvitedFlag.NONE) {
NativeBridge.joinRoom( NativeBridgeDelegate.joinRoom(
CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomId,
CHAT.globalLoginParameter.name CHAT.globalLoginParameter.name
); );
} else { } else {
NativeBridge.openCommunicationHome(); NativeBridgeDelegate.openCommunicationHome();
} }
console.log("=============> HOST BYE : share hostbye"); console.log("=============> HOST BYE : share hostbye");
// TODO: peacekim:: check not to need this method for android
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.showExitHostAlert.postMessage({}); NativeBridgeDelegate.showExitHostAlert();
return; return;
} }
$("#loadingIndicator").removeClass("full_active"); $("#loadingIndicator").removeClass("full_active");
...@@ -457,11 +400,7 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -457,11 +400,7 @@ document.addEventListener("DOMContentLoaded", function () {
if (collaborationJoinFlg == "1") { if (collaborationJoinFlg == "1") {
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
if (isDocument) { if (isDocument) {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.startContentView();
webkit.messageHandlers.startContentView.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.startContentView();
}
} }
} else if (collaborationJoinFlg == "0") { } else if (collaborationJoinFlg == "0") {
let deleteRoomResult = JSON.parse( let deleteRoomResult = JSON.parse(
...@@ -533,7 +472,7 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -533,7 +472,7 @@ document.addEventListener("DOMContentLoaded", function () {
coview_api.LeaveRoom(); coview_api.LeaveRoom();
$(".coview_share_area").hide(); $(".coview_share_area").hide();
$("#loadingIndicator").removeClass("full_active"); $("#loadingIndicator").removeClass("full_active");
NativeBridge.joinRoom( NativeBridgeDelegate.joinRoom(
CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomId,
CHAT.globalLoginParameter.name CHAT.globalLoginParameter.name
); );
...@@ -610,26 +549,13 @@ function changeCollaboration(changeCollaborationType) { ...@@ -610,26 +549,13 @@ function changeCollaboration(changeCollaborationType) {
recordStop(function () { recordStop(function () {
var newMeetingId = 0; var newMeetingId = 0;
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) { if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.exitMeetingRoom();
webkit.messageHandlers.exitMeetingRoom.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom();
}
}
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.setJoinCollaborationType.postMessage(
changeCollaborationType
);
} else if (CHAT_UTIL.isAndroid()) {
if (
changeCollaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
alert(getLocalizedString("not_support_version"));
return;
}
android.setJoinCollaborationType(changeCollaborationType);
} }
NativeBridgeDelegate.setJoinCollaborationType(
changeCollaborationType,
androidVersion
);
joinCollaborationType = changeCollaborationType; joinCollaborationType = changeCollaborationType;
initCollaborationUI(changeCollaborationType); initCollaborationUI(changeCollaborationType);
switch (changeCollaborationType) { switch (changeCollaborationType) {
...@@ -662,14 +588,10 @@ function changeCollaboration(changeCollaborationType) { ...@@ -662,14 +588,10 @@ function changeCollaboration(changeCollaborationType) {
micOn(); micOn();
} }
penOff(); penOff();
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.changeCollaboration(
webkit.messageHandlers.changeCollaboration.postMessage({ changeCollaborationType,
changeCollaborationType: changeCollaborationType, newMeetingId
meetingId: newMeetingId, );
});
} else if (CHAT_UTIL.isAndroid()) {
android.changeCollaboration(changeCollaborationType, newMeetingId);
}
joinMeetingId = newMeetingId; joinMeetingId = newMeetingId;
fw.sendToMsg("others", "CHANGE_COLLABORATION", { fw.sendToMsg("others", "CHANGE_COLLABORATION", {
collaborationType: changeCollaborationType, collaborationType: changeCollaborationType,
...@@ -712,12 +634,11 @@ async function initCollaborationUI(changeCollaborationType) { ...@@ -712,12 +634,11 @@ async function initCollaborationUI(changeCollaborationType) {
if ($(".menu_btn").hasClass("hide")) { if ($(".menu_btn").hasClass("hide")) {
$(".menu_btn").click(); $(".menu_btn").click();
} }
if (CHAT_UTIL.isIOS) { const roomType = NativeBridgeDataSource.getRoomType();
roomType = CHAT_DB.getRoomType(); if (roomType == ChatRoomType.DM) {
if (roomType == ChatRoomType.DM) { $(".add_user_btn").removeClass("none");
$(".add_user_btn").removeClass("none");
}
} }
$("link[href='./css/collaboration_board.css']").remove(); $("link[href='./css/collaboration_board.css']").remove();
penOff(); penOff();
switch (changeCollaborationType) { switch (changeCollaborationType) {
...@@ -759,11 +680,7 @@ function Coview_exitCollaboration(isDocument = false) { ...@@ -759,11 +680,7 @@ function Coview_exitCollaboration(isDocument = false) {
requestCollaborationFinish(); requestCollaborationFinish();
} }
if (isDocument) { if (isDocument) {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.exitMeetingRoom();
webkit.messageHandlers.exitMeetingRoom.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom();
}
} }
if ($("#recordBtn .record").hasClass("disable")) { if ($("#recordBtn .record").hasClass("disable")) {
recordStop(Coview_finishCollaboration); recordStop(Coview_finishCollaboration);
...@@ -775,21 +692,18 @@ function Coview_exitCollaboration(isDocument = false) { ...@@ -775,21 +692,18 @@ function Coview_exitCollaboration(isDocument = false) {
function Coview_finishCollaboration() { function Coview_finishCollaboration() {
clearInterval(timeInterval); clearInterval(timeInterval);
coview_api.LeaveRoom(); coview_api.LeaveRoom();
NativeBridgeDelegate.finishCollaboration(true);
if (coview_api.getRoomUsers()) { if (coview_api.getRoomUsers()) {
if (CHAT_UTIL.isIOS()) { NativeBridgeDelegate.finishCollaboration();
webkit.messageHandlers.finishCollaboration.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.finishCollaboration();
}
} }
isLeaved = true; isLeaved = true;
if (isInvited == InvitedFlag.NONE) { if (isInvited == InvitedFlag.NONE) {
NativeBridge.joinRoom( NativeBridgeDelegate.joinRoom(
CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomId,
CHAT.globalLoginParameter.name CHAT.globalLoginParameter.name
); );
} else { } else {
NativeBridge.openCommunicationHome(); NativeBridgeDelegate.openCommunicationHome();
} }
} }
...@@ -838,11 +752,9 @@ function applyForHostChange() { ...@@ -838,11 +752,9 @@ function applyForHostChange() {
alert(getLocalizedString("already_processing_host_request")); alert(getLocalizedString("already_processing_host_request"));
return; return;
} }
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HostRequestFlag.DOING); NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DOING);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HostRequestFlag.DOING);
}
fw.sendToMsg("others", "CHANGE_HOST_APPLY", { fw.sendToMsg("others", "CHANGE_HOST_APPLY", {
hostId: CHAT.globalLoginParameter.loginId, hostId: CHAT.globalLoginParameter.loginId,
}); });
......
...@@ -64,7 +64,7 @@ var setupBackButton = function () { ...@@ -64,7 +64,7 @@ var setupBackButton = function () {
} else { } else {
if (IS_ONLINE == "true") { if (IS_ONLINE == "true") {
// todo: peacekim:: needs to check it only needs for android or not. // todo: peacekim:: needs to check it only needs for android or not.
NativeBridge.updateRoomList(); NativeBridgeDelegate.updateRoomList();
CHAT_UI.refreshRoomList(ChatRoomType.DM); CHAT_UI.refreshRoomList(ChatRoomType.DM);
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
} }
......
...@@ -51,16 +51,11 @@ var bindOnConnect = function () { ...@@ -51,16 +51,11 @@ var bindOnConnect = function () {
$(".overlay").removeClass("active undismissable"); $(".overlay").removeClass("active undismissable");
// loadingIndicatorを表示 // loadingIndicatorを表示
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
requestLoginInfo(); NativeBridgeDelegate.getLoginParameter();
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}); });
}; };
var requestLoginInfo = function () {
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
NativeBridge.getLoginParameter();
};
var bindOnDisconnect = function () { var bindOnDisconnect = function () {
socket.on(SOCKET_KEY.DISCONNECT, function () { socket.on(SOCKET_KEY.DISCONNECT, function () {
//socketが切断されたら黒画面で画面を更新する //socketが切断されたら黒画面で画面を更新する
...@@ -122,9 +117,8 @@ var bindOnShowServerError = function () { ...@@ -122,9 +117,8 @@ var bindOnShowServerError = function () {
var bindOnRetryJoinProcess = function () { var bindOnRetryJoinProcess = function () {
socket.on(SOCKET_KEY.RETRY_JOIN_PROCESS, function () { socket.on(SOCKET_KEY.RETRY_JOIN_PROCESS, function () {
var ua = window.navigator.userAgent.toLowerCase();
if (CHAT_UTIL.isIOS() || CHAT_UTIL.isAndroid()) { if (CHAT_UTIL.isIOS() || CHAT_UTIL.isAndroid()) {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({}); NativeBridgeDelegate.getLoginParameter();
} else { } else {
CHAT_UI.htmlElementTextInitialize("ko"); CHAT_UI.htmlElementTextInitialize("ko");
// webでのsocket connect // webでのsocket connect
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<li><a id="room_name_change_button" href="chat_change_room_name.html"><img src="icon/icon_change_room_name.png" alt="ルーム名変更">ルーム名変更</a> <li><a id="room_name_change_button" href="chat_change_room_name.html"><img src="icon/icon_change_room_name.png" alt="ルーム名変更">ルーム名変更</a>
</li> </li>
<li><a id="add_user_button" href="chat_add_user.html"><img src="icon/icon_add_user.png" alt="ユーザー招待">ユーザー招待</a></li> <li><a id="add_user_button" href="chat_add_user.html"><img src="icon/icon_add_user.png" alt="ユーザー招待">ユーザー招待</a></li>
<li ><a id="display_off_button" href="javascript:return false;" onclick="NativeBridge.roomDisplayOff();"><img src="icon/icon_display_off_chatroom.png" alt="ユーザー招待">部屋非表示</a></li> <li ><a id="display_off_button" href="javascript:return false;" onclick="NativeBridgeDelegate.roomDisplayOff();"><img src="icon/icon_display_off_chatroom.png" alt="ユーザー招待">部屋非表示</a></li>
</ul> </ul>
</div> </div>
</div> </div>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</div> </div>
</div> </div>
<div class="collabo_btn"> <div class="collabo_btn">
<button class="collaboation_join_button" type="button" name="button" onclick="NativeBridge.joinCollaboration({{collaborationType}}, {{meetingId}})" {{#isEnded}} disabled {{/isEnded}}> <button class="collaboation_join_button" type="button" name="button" onclick="NativeBridgeDelegate.joinCollaboration({{collaborationType}}, {{meetingId}})" {{#isEnded}} disabled {{/isEnded}}>
<img src="icon/icon_profile_phone.png" alt="通話"> <img src="icon/icon_profile_phone.png" alt="通話">
{{#isEnded}} {{#isEnded}}
<span class="collaboration_join_message">終了しました</span> <span class="collaboration_join_message">終了しました</span>
......
<ul class="m-0"> <ul class="m-0">
<li class="d-flex align-items-center"> <li class="d-flex align-items-center">
<a href="#" class="w-100" onclick="NativeBridge.joinRoom({{roomId}},'{{roomName}}');"> <a href="#" class="w-100" onclick="NativeBridgeDelegate.joinRoom({{roomId}},'{{roomName}}');">
<div class="chat_item d-flex flex-row align-items-center"> <div class="chat_item d-flex flex-row align-items-center">
<div class="chat_item_l"> <div class="chat_item_l">
<div class="thumbnail{{thumbnailCount}} thumbnail"> <div class="thumbnail{{thumbnailCount}} thumbnail">
......
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