Commit 91c488ee by Kim Peace

Moved native bridge delegate for calling native method

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