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);
}
};
......@@ -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