Commit 43cc7cac by Kim Peace

Seperate collaboration js

parent ac2f8381
......@@ -81,14 +81,6 @@
</div>
</main>
<div class="coview_share_photo_select_bubble none">
<button id="coviewSharePhotoCamera" class="coview_share_photo_select_bubble_in_button cam">
</button>
<BR>
<button id="coviewSharePhotoGallery" class="coview_share_photo_select_bubble_in_button gal">
</button>
</div>
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm"></div>
......@@ -161,6 +153,8 @@
<script src="./js/views/collaboration/collaboration-add-user.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/views/collaboration/share.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-message-handler.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-bridge.js"></script>
<script src="./js/views/collaboration/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
......@@ -200,7 +194,7 @@
}
}
initCollaborationUI(joinCollaborationType);
updateCollaborationUI(joinCollaborationType);
globalUserInfo.coWorkType = CHAT_UTIL.getCoviewTypeFromCollaborationType(joinCollaborationType);
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.initialJoin();
......
......@@ -45,14 +45,6 @@
</div>
</main>
<div class="coview_share_photo_select_bubble none">
<button id="coviewSharePhotoCamera" class="coview_share_photo_select_bubble_in_button cam">
</button>
<BR>
<button id="coviewSharePhotoGallery" class="coview_share_photo_select_bubble_in_button gal">
</button>
</div>
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm"></div>
......@@ -165,6 +157,8 @@
<script src="./js/views/collaboration/collaboration-add-user.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/views/collaboration/share.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-message-handler.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-bridge.js"></script>
<script src="./js/views/collaboration/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
......
......@@ -48,14 +48,6 @@
</div>
</main>
<div class="coview_share_photo_select_bubble none">
<button id="coviewSharePhotoCamera" class="coview_share_photo_select_bubble_in_button cam">
</button>
<BR>
<button id="coviewSharePhotoGallery" class="coview_share_photo_select_bubble_in_button gal">
</button>
</div>
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm"></div>
......@@ -154,6 +146,8 @@
<script src="./js/views/collaboration/collaboration-add-user.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/views/collaboration/share.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-message-handler.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-bridge.js"></script>
<script src="./js/views/collaboration/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
......
......@@ -99,6 +99,8 @@
<script src="./js/views/collaboration/collaboration-add-user.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/views/collaboration/share.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-message-handler.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-bridge.js"></script>
<script src="./js/views/collaboration/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
......
......@@ -44,14 +44,6 @@
</div>
</main>
<div class="coview_share_photo_select_bubble none">
<button id="coviewSharePhotoCamera" class="coview_share_photo_select_bubble_in_button cam">
</button>
<BR>
<button id="coviewSharePhotoGallery" class="coview_share_photo_select_bubble_in_button gal">
</button>
</div>
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm"></div>
......@@ -156,6 +148,8 @@
<script src="./js/views/collaboration/collaboration-add-user.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/views/collaboration/share.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-message-handler.js"></script>
<script src="./js/views/collaboration/fermi-web-socket-bridge.js"></script>
<script src="./js/views/collaboration/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
......
#coviewShareMainBtn{
padding-top: 9px;
}
.white_board #canvasRemote {
background-color: white !important;
......@@ -32,34 +30,6 @@
display: none !important;
}
.coview_share_dropdown_bar{
display: none;
list-style: none;
padding: unset;
margin: unset;
/* padding-top: 58px; */
background: #000;
position: absolute;
width: 100%;
top: 57px;
left: 0px;
padding-top: 10px;
}
.coview_share_dropdown_bar ul{
list-style: none;
padding: unset;
margin: unset;
}
.coview_share_dropdown_bar li{
display: inline-block;
width: 24%;
height: 75px;
line-height: 52px;
margin: unset;
padding: unset;
background: #000;
text-align: center;
}
.coview_share_dropdown_btn{
background: transparent;
border: none;
......@@ -92,51 +62,7 @@
margin-top: 4px;
color: #fff;
}
.coview_share_title_name{
display: inline-block;
height: 58px;
line-height: 58px;
padding: 0;
margin: 0;
color: #fff;
}
.coview_share_photo_select_bubble{
display: none;
position: absolute;
padding: 2px;
background: #3e3e3e;
border-radius: 5px;
margin-top: 156px;
margin-left: 117px;
font-size: 12px;
}
.coview_share_photo_select_bubble:after{
border-top: 0 solid transparent;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 10px solid #3e3e3e;
content: "";
position: absolute;
top: -10px;
left: 22px;
}
.coview_share_photo_select_bubble_in_button{
width: 106px;
height: 39px;
border: none;
text-align: left;
}
.coview_share_photo_select_bubble_in_button.cam{
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.coview_share_photo_select_bubble_in_button.gal{
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-top: solid 0.7px #000;
}
.coview_share_photo_select_bubble_in_button_img{
width: 27%;
}
......@@ -144,15 +70,6 @@
margin-left: 5px;
}
.coview_share_request{
width: 100%;
height: 4em;
background-image: linear-gradient(to top, #82b127, #30c8d2);
color: #fff;
border: none;
border-radius: 5px;
}
.coview_on_screen_btn_area {
display: none !important;
}
......
......@@ -110,6 +110,7 @@ const TemplateURL = {
"./template/template_add_user_group_path_in_collaboration.html",
COLLABORATION_PROFILE: "./modal_collabo_profile.html",
COLLABORATION_OVERLAY_USER_LIST: "collaboration_overlay_user_list.html",
MODAL_ADD_USER_CONFIRM: "./modal_add_user_confirm.html",
};
const SOCKET_KEY = {
......
......@@ -5,6 +5,7 @@ var bindOnNewMessage = function () {
const systemMessageTemplate = getTemplate(TemplateURL.SYSTEM_MESSAGE);
const unwrappedMessageInfo = decodeMessage(message.text);
if (
unwrappedMessageInfo ==
DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL
......@@ -34,10 +35,12 @@ var bindOnNewMessage = function () {
}
}
if (typeof ChatRoom !== "undefined") {
// 画像、動画の描画を待ってからスクロール
setTimeout(function () {
ChatRoom.scrollToBottom();
}, 300);
}
});
};
......
......@@ -193,6 +193,13 @@ CHAT_SOCKET.emitCreateMessage = function (sendData, offset) {
socket.emit(SOCKET_KEY.CREATE_MESSAGE, { text: sendData }, offset);
};
CHAT_SOCKET.emitCollaborationFinishMessage = function () {
if (socket != null && socket.connected) {
const sendData = DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL;
CHAT_SOCKET.emitCreateMessage(sendData, 0);
}
}
CHAT_SOCKET.emitGetGroupList = function (isInvite) {
socket.emit(SOCKET_KEY.GET_GROUP_LIST, isInvite);
};
......
CollaborationUI.bindAddUserButton = function () {
// ユーザー招待メンバー検索
$(".add_user_btn").click(function () {
enableScroll();
CollaborationUI.enableScroll();
Common.showLoadingIndicator();
ChatManagementCommon.selectedUserList = [];
CollaborationUI.refreshMyGroupForAddUserInCollaboration();
......@@ -36,22 +36,23 @@ CollaborationUI.refreshMyGroupForAddUserInCollaboration = function () {
$("#tabMyGroupOnAddUserInCollaboration").prop("checked", true);
// グループの様式を読み込む
const groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
NativeBridgeDelegate.updateContactInfo();
// ユーザの様式を読み込む
const userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
CollaborationUI.appendFavoriteGroupList();
const groupUserTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_USER_LIST_IN_COLLABORATION
);
CollaborationUI.appendFavoriteUserList();
NativeBridgeDelegate.updateContactInfo();
CollaborationUI.appendMyGroupList();
$("#addUserInCollaboration").modal("show");
Common.dismissLoadingIndicator();
};
CollaborationUI.appendFavoriteGroupList = function () {
// グループの様式を読み込む
const groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
//お気に入りグループ取得。
const favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups();
favoriteGroupList.forEach(function (favoriteGroup) {
......@@ -63,6 +64,13 @@ CollaborationUI.refreshMyGroupForAddUserInCollaboration = function () {
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#favoriteListForAddUserInCollaboration").append(obj);
});
};
CollaborationUI.appendFavoriteUserList = function () {
// ユーザの様式を読み込む
const userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
//お気に入りユーザ取得。
const favoriteUserList = NativeBridgeDataSource.getFavoriteUsersNotInRoom();
favoriteUserList.forEach(function (favoriteUser) {
......@@ -81,15 +89,20 @@ CollaborationUI.refreshMyGroupForAddUserInCollaboration = function () {
});
let obj = jQuery.parseHTML(html);
$("#favoriteListForAddUserInCollaboration").append(obj);
};
CollaborationUI.appendMyGroupList = function () {
const groupUserTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_USER_LIST_IN_COLLABORATION
);
const myGroupList = NativeBridgeDataSource.getMyGroupUsersNotInRoom();
myGroupList.forEach(function (myGroup) {
myGroup.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == groupUser.shopMemberId;
return shopMemberID == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
......@@ -103,19 +116,14 @@ CollaborationUI.refreshMyGroupForAddUserInCollaboration = function () {
$("#myGroupListForAddUserInCollaboration").append(obj);
});
$("#addUserInCollaboration").modal("show");
Common.dismissLoadingIndicator();
};
CollaborationUI.refreshAllGroupForAddUserInCollaboration = function (
paramGroupId
) {
var groupId = paramGroupId;
CollaborationUI.refreshAllGroupForAddUserInCollaboration = function (groupID) {
$(".content").removeClass("none");
$("#tabAllGroupOnAddUserInCollaboration").prop("checked", true);
NativeBridgeDelegate.updateGroupInfo(groupId);
NativeBridgeDelegate.updateGroupInfo(groupID);
//画面エリアを初期化。
$("#parentGroupBtnForAddUserInCollaboration").off();
......@@ -125,40 +133,62 @@ CollaborationUI.refreshAllGroupForAddUserInCollaboration = function (
$("#groupPathAreaForAddUserInCollaboration").html("");
//DBからグループ情報を取得。
var result = NativeBridgeDataSource.getGroupInfoForAddUser(groupId);
const result = NativeBridgeDataSource.getGroupInfoForAddUser(groupID);
//上位グループ、トップグループ遷移ボタンのイベント追加。
if (typeof result.parentGroupId !== "undefined") {
$("#parentGroupBtnForAddUserInCollaboration").on("click", function () {
CollaborationUI.refreshAllGroupForAddUserInCollaboration(
result.parentGroupId
CollaborationUI.appendRootGroupAndParentGroupIfNeeded(
result.rootGroupId,
result.parentGroupId,
groupID
);
//該当グループのパースを表示。
CollaborationUI.appendGroupPath(result.groupPathList);
//該当グループの下位グループ表示。
CollaborationUI.appendChildGroups(result.childGroupList);
//該当グループの所属ユーザを表示。
CollaborationUI.appendUsers();
};
CollaborationUI.bindOnClickParentGroup = function (parentGroupID) {
$("#parentGroupBtnForAddUserInCollaboration").on("click", function () {
CollaborationUI.refreshAllGroupForAddUserInCollaboration(parentGroupID);
});
}
if (typeof result.rootGroupId !== "undefined") {
if (paramGroupId == 0) {
groupId = result.rootGroupId;
}
};
CollaborationUI.bindOnClickRootGroup = function (rootGroupID) {
$("#rootGroupBtnForAddUserInCollaboration").on("click", function () {
CollaborationUI.refreshAllGroupForAddUserInCollaboration(
result.rootGroupId
);
CollaborationUI.refreshAllGroupForAddUserInCollaboration(rootGroupID);
});
};
CollaborationUI.displayRootGroupAndParentGroupIfNeeded = function (
rootGroupID,
groupID
) {
if (typeof rootGroupID !== "undefined" && paramGroupID == 0) {
groupID = rootGroupID;
}
if (groupId == result.rootGroupId || paramGroupId == "0") {
if (groupID == rootGroupID || groupID == "0") {
$("#rootGroupAreaInCollaboration").addClass("none");
$("#parentGroupAreaInCollaboration").addClass("none");
} else {
$("#rootGroupAreaInCollaboration").removeClass("none");
$("#parentGroupAreaInCollaboration").removeClass("none");
}
//該当グループのパースを表示。
var groupPathTemplate = getTemplate(
};
CollaborationUI.appendGroupPath = function (groupPathList) {
const groupPathTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_PATH_IN_COLLABORATION
);
var groupPathCount = 0;
result.groupPathList.forEach(function (groupPath) {
if (!(groupPathCount < result.groupPathList.length - 3)) {
let groupPathCount = 0;
groupPathList.forEach(function (groupPath) {
if (!(groupPathCount < groupPathList.length - 3)) {
let html = Mustache.render(groupPathTemplate, {
name: groupPath.groupName,
id: groupPath.groupId,
......@@ -168,13 +198,14 @@ CollaborationUI.refreshAllGroupForAddUserInCollaboration = function (
}
groupPathCount++;
});
};
//該当グループの下位グループ表示。
var groupTemplate = getTemplate(
CollaborationUI.appendChildGroups = function (chidGroups) {
const groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
result.childGroupList.forEach(function (childGroup) {
chidGroups.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, {
name: childGroup.groupName,
id: childGroup.groupId,
......@@ -183,30 +214,47 @@ CollaborationUI.refreshAllGroupForAddUserInCollaboration = function (
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#childGroupListAreaForAddUserInCollaboration").append(obj);
});
};
//該当グループの所属ユーザを表示。
var userTemplate = getTemplate(
CollaborationUI.appendUsers = function (userList) {
const userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
result.groupUserList.forEach(function (groupUser) {
userList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == groupUser.shopMemberId;
return shopMemberID == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
}
});
let html = Mustache.render(userTemplate, {
userList: result.groupUserList,
userList: userList,
});
let obj = jQuery.parseHTML(html);
$("#userInGroupListForAddUserInCollaboration").append(obj);
};
CollaborationUI.appendRootGroupAndParentGroupIfNeeded = function (
rootGroupID,
parentGroupID,
groupID
) {
if (typeof parentGroupID !== "undefined") {
CollaborationUI.bindOnClickParentGroup(parentGroupID);
}
if (typeof rootGroupID !== "undefined") {
CollaborationUI.bindOnClickRootGroup(rootGroupID);
}
CollaborationUI.displayRootGroupAndParentGroupIfNeeded(rootGroupID, groupID);
};
CollaborationUI.confirmInviteUserListInCollaboration = function () {
const selectedUsers = NativeBridgeDataSource.loadSelectedUsers();
if (selectedUsers != "") {
......@@ -216,14 +264,9 @@ CollaborationUI.confirmInviteUserListInCollaboration = function () {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
});
var modalTemplate;
$.get(
{ url: "./modal_add_user_confirm.html", async: false },
function (text) {
modalTemplate = text;
}
);
let html = Mustache.render(modalTemplate, {
const modalTemplate = getTemplate(TemplateURL.MODAL_ADD_USER_CONFIRM);
const html = Mustache.render(modalTemplate, {
userList: selectedUsers,
});
let obj = jQuery.parseHTML(html);
......@@ -231,21 +274,26 @@ CollaborationUI.confirmInviteUserListInCollaboration = function () {
$("#modalAddUserConfirm").modal("show");
}
CollaborationUI.bindCancelAddUserButton();
CollaborationUI.bindAddUserButton(selectedUsers);
};
CollaborationUI.bindCancelAddUserButton = function () {
$("#cancelAddUserBtn")
.off()
.on("click", function () {
$("#modalAddUserConfirm").modal("hide");
$("#addUserInCollaboration").modal("show");
});
};
CollaborationUI.bindAddUserButton = function (selectedUsers) {
$("#addUserBtn")
.off()
.on("click", function () {
Common.showLoadingIndicator();
let userIDList = selectedUsers.map((user) => user.shopMemberId);
selectedUsers.forEach(function (user) {
userIDList.push(user.shopMemberId);
});
const commaJoinedUserIDList = userIDList.join(",");
const collaborationType = CHAT_UTIL.getCollaborationType(
globalUserInfo.coWorkType
......
var CollaborationUI = {};
document.addEventListener("DOMContentLoaded", function () {
disableScroll();
CollaborationUI.disableScroll();
// メニューオーバーレイ表示
CollaborationUI.bindMenuButton();
// ユーザーリストオーバーレイ表示
CollaborationUI.bindDisplayUsersButton();
// モーダルonモーダル(前のモーダルを非表示に)
// ホスト変更ボタン押下イベント
CollaborationUI.bindChangeHostButton();
// 閉じるイベント
CollaborationUI.bindCloseButton();
// ユーザー追加イベント
CollaborationUI.bindInviteButton();
CollaborationUI.bindAddUserButton();
});
/*********************************
* Buttons binding events
********************************/
CollaborationUI.bindMenuButton = function () {
$(".menu_btn").click(function () {
var w = $(this).width();
$(this).toggleClass("hide");
$("#overlay_menu .item").toggleClass("hide");
});
};
// ユーザーリストオーバーレイ表示
CollaborationUI.bindDisplayUsersButton = function () {
$(".user_btn").click(function () {
var w = $(this).width();
......@@ -21,58 +44,65 @@ document.addEventListener("DOMContentLoaded", function () {
.css({ transform: "translateX(" & -w & ")" });
if ($(this).hasClass("hide")) {
enableScroll();
CollaborationUI.enableScroll();
} else {
scrollTo(0, 0);
disableScroll();
CollaborationUI.disableScroll();
}
});
};
// モーダルonモーダル(前のモーダルを非表示に)
// ホスト変更ボタン押下イベント
CollaborationUI.bindChangeHostButton = function () {
$(".ch_host_btn").click(function () {
const target = $(this).val();
changeModal(target, "changeHostModal");
});
const beforeModal = $(target);
const afterModal = $("#changeHostModal");
/* モーダルの切り替え */
function changeModal(beforeModal, afterModal) {
$(beforeModal).modal("hide");
$(afterModal).modal("show");
}
beforeModal.modal("hide");
afterModal.modal("show");
});
};
// 閉じるイベント
CollaborationUI.bindCloseButton = function () {
$(".close_btn").click(function () {
$("#overlay_add_user_list").addClass("none");
disableScroll();
CollaborationUI.disableScroll();
});
};
// ユーザー追加イベント
CollaborationUI.bindInviteButton = function () {
$(".inv_btn").click(function () {
$("#overlay_add_user_list").addClass("none");
});
};
CollaborationUI.bindAddUserButton();
});
function disableScroll() {
document.addEventListener("mousewheel", scrollControl, { passive: false });
document.addEventListener("touchmove", scrollControl, { passive: false });
}
/*********************************
* Scroll Controls
********************************/
CollaborationUI.disableScroll = function () {
document.addEventListener("mousewheel", CollaborationUI.scrollControl, {
passive: false,
});
document.addEventListener("touchmove", CollaborationUI.scrollControl, {
passive: false,
});
};
// スクロール禁止解除
function enableScroll() {
document.removeEventListener("mousewheel", scrollControl, {
CollaborationUI.enableScroll = function () {
document.removeEventListener("mousewheel", CollaborationUI.scrollControl, {
passive: false,
});
document.removeEventListener("touchmove", scrollControl, { passive: false });
}
document.removeEventListener("touchmove", CollaborationUI.scrollControl, {
passive: false,
});
};
function scrollControl(event) {
CollaborationUI.scrollControl = function (event) {
if (event.cancelable) {
event.preventDefault();
}
}
};
/*********************************
* NameCard in Collaboration
......@@ -126,48 +156,6 @@ CollaborationUI.insertFavoriteUserInCollaboration = function (shopMemberId) {
Common.dismissLoadingIndicator();
};
// Display User List
CollaborationUI.refreshJoinedCollaboration = function (loginIDList) {
for (var count = 0; count < loginIDList.length; count++) {
loginIDList[count] = loginIDList[count].replaceAll(
globalUserInfo.shopName + "_",
""
);
}
Common.showLoadingIndicator();
$("#collaboration_overlay_user_list").html("");
const joinedUserListTemplate = getTemplate(
TemplateURL.COLLABORATION_OVERLAY_USER_LIST
);
const joinedUserList =
NativeBridgeDataSource.getUserListByLoginId(loginIDList);
const sortedUserList = new Array();
loginIDList.forEach(function (userId) {
joinedUserList.forEach(function (user) {
if (userId == user.loginId) {
sortedUserList.push(user);
}
});
});
sortedUserList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
});
let html = Mustache.render(joinedUserListTemplate, {
joinedUserList: sortedUserList,
});
let obj = jQuery.parseHTML(html);
$("#collaboration_overlay_user_list").append(obj);
Common.dismissLoadingIndicator();
};
CollaborationUI.refreshForOffline = function () {
serverInfo.isOnline = "false";
if (typeof coview_api == "undefined") {
......@@ -184,3 +172,11 @@ CollaborationUI.refreshForOffline = function () {
NativeBridgeDelegate.openCommunicationHome();
}
};
CollaborationUI.showLoadingIndicator = function () {
$("#loadingIndicator").addClass("full_active");
};
CollaborationUI.hideLoadingIndicator = function () {
$("#loadingIndicator").removeClass("full_active");
};
var FermiWebSocketBridge = {};
// call from modal_collabo_profile.html
FermiWebSocketBridge.requestHostChange = function (loginID) {
fw.sendToMsg("others", "HOST_CHANGE_REQUEST", {
loginId: getFermiLoginId(loginID),
});
};
FermiWebSocketBridge.shareFileHost = function (collaborationType) {
fw.sendToMsg("others", "SHARE_FILE_HOST", {
collaborationType: collaborationType,
});
};
FermiWebSocketBridge.hostChangeResponse = function () {
fw.sendToMsg("others", "HOST_CHANGE_RESPONSE", {
isAndroid: deviceInfo.isAndroid(),
isAble: androidVersion >= ANDROID_SDK_VERSION.O,
loginId: currentUserInfo.loginID,
});
};
// PIP_END_REQUEST
FermiWebSocketBridge.pipEndRequest = function (loginID) {
fw.sendToMsg("others", "PIP_END_REQUEST", {
loginId: getFermiLoginId(loginID),
});
};
// HOST_REQUEST_REJECT
FermiWebSocketBridge.hostRequestReject = function (hostID) {
fw.sendToMsg("others", "HOST_REQUEST_REJECT", {
hostId: hostID,
});
};
// HOST_REQUEST_DONE
FermiWebSocketBridge.hostRequestDone = function (hostID) {
fw.sendToMsg("others", "HOST_REQUEST_DONE", {
hostId: hostID,
});
};
// GET_COLLABORATION_TYPE_RESPONSE
FermiWebSocketBridge.getCollaborationTypeResponse = function (loginID) {
fw.sendToMsg("others", "GET_COLLABORATION_TYPE_RESPONSE", {
loginId: loginID,
collaborationType: joinCollaborationType,
newMeetingId: meetingID,
});
};
// GET_COLLABORATION_TYPE
FermiWebSocketBridge.getCollaborationType = function () {
fw.sendToMsg("others", "GET_COLLABORATION_TYPE", {
loginId: globalUserInfo.loginId,
});
};
// CAPTURE_REQUEST
FermiWebSocketBridge.captureRequest = function () {
// todo: peacekim:: check if it's okay for loginID
// instead of globalUserInfo.loginId
fw.sendToMsg("others", "CAPTURE_REQUEST", {
name: currentUserInfo.loginID,
});
};
// CHANGE_COLLABORATION
FermiWebSocketBridge.changeCollaboration = function (
collaborationType,
newMeetingID
) {
fw.sendToMsg("others", "CHANGE_COLLABORATION", {
collaborationType: collaborationType,
newMeetingId: newMeetingID,
});
};
// CHANGE_HOST_APPLY
FermiWebSocketBridge.changeHostApply = function () {
fw.sendToMsg("others", "CHANGE_HOST_APPLY", {
hostId: currentUserInfo.loginID,
});
}
var FermiWebSocketMessageHandler = {};
FermiWebSocketMessageHandler.bindWebSocketMessage = function () {
fw.socket.on("message", async function (data) {
if (g_isMainMan) {
FermiWebSocketMessageHandler.handleMessagesToHost(data);
} else if (data.payload.loginId == globalUserInfo.loginId) {
// 自分自身の場合
FermiWebSocketMessageHandler.handleMessagesToSelf(data);
} else {
// global messages
FermiWebSocketMessageHandler.handleMessagesToAll(data);
}
});
};
FermiWebSocketMessageHandler.handleMessagesToHost = function (data) {
// HOSTの場合
switch (data.type) {
case "CAPTURE_REQUEST":
FermiWebSocketMessageHandler.captureRequest(data);
break;
case "HOST_CHANGE_RESPONSE":
FermiWebSocketMessageHandler.hostChangeResponse(data);
break;
case "GET_COLLABORATION_TYPE":
FermiWebSocketMessageHandler.getCollaborationType(data);
break;
case "SHARE_FILE_HOST":
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) {
FermiWebSocketMessageHandler.shareFileHost();
}
break;
default:
break;
}
};
FermiWebSocketMessageHandler.handleMessagesToSelf = function (data) {
// 自分自身の場合
switch (data.type) {
case "HOST_CHANGE_REQUEST":
FermiWebSocketMessageHandler.hostChangeRequest();
break;
case "PIP_END_REQUEST":
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
FermiWebSocketMessageHandler.pipEndRequest();
}
break;
case "GET_COLLABORATION_TYPE_RESPONSE":
FermiWebSocketMessageHandler.getCollaborationTypeResponse(data);
break;
default:
break;
}
};
FermiWebSocketMessageHandler.handleMessagesToAll = function () {
switch (data.type) {
case "CHANGE_COLLABORATION":
FermiWebSocketMessageHandler.changeCollaboration(data);
break;
case "SHARE_FILE":
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) {
FermiWebSocketMessageHandler.shareFile();
}
break;
case "API_SEND_OWNER_CHANGE_COMPLETE":
FermiWebSocketMessageHandler.apiSendOwnerChangeComplete();
break;
case "API_SEND_OWNER_CHANGE_CONFIRM":
if (joinCollaborationType == COLLABORATION_TYPE.CAMERA) {
FermiWebSocketMessageHandler.apiSendOwnerChangeConfirm();
}
break;
case "CHANGE_HOST_APPLY":
FermiWebSocketMessageHandler.changeHostApply(data);
break;
case "HOST_REQUEST_DONE":
FermiWebSocketMessageHandler.hostRequestDone();
break;
case "HOST_REQUEST_REJECT":
FermiWebSocketMessageHandler.hostRequestReject(data);
break;
case "API_WELCOME":
if (collaborationJoinFlg == "2") {
FermiWebSocketMessageHandler.apiWelcome();
}
break;
default:
break;
}
};
// CHANGE_COLLABORATION
FermiWebSocketMessageHandler.changeCollaboration = function (data) {
const newMeetingID = data.payload.newMeetingId;
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom();
NativeBridgeDelegate.finishPIPMode(true);
if (deviceInfo.isAndroid()) {
$(".pip_indicator").addClass("none");
}
waitMillisecond(500);
updateCanvasSize();
}
FermiWebSocketMessageHandler.updateJoinChangeCollaboration(
data.payload.collaborationType
);
joinMeetingId = newMeetingID;
updateCollaborationUI(joinCollaborationType);
NativeBridgeDelegate.joinChangedCollaboration(
joinCollaborationType,
newMeetingID
);
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.joinMeetingRoom(newMeetingID);
}
};
// SHARE_FILE
FermiWebSocketMessageHandler.shareFile = function () {
updateCollaborationUI(COLLABORATION_TYPE.CAMERA);
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
FermiWebSocketBridge.shareFileHost(COLLABORATION_TYPE.CAMERA);
};
// SHARE_FILE_HOST
FermiWebSocketMessageHandler.shareFileHost = function () {
updateCollaborationUI(COLLABORATION_TYPE.CAMERA);
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
};
// CAPTURE_REQUEST
FermiWebSocketMessageHandler.captureRequest = function (data) {
if (
confirm(data.payload.name + getLocalizedString("request_capture")) == false
) {
return;
}
if ($("#recordBtn .record").hasClass("disable")) {
screenLock();
recordStop(function () {
$("#screenLock").remove();
captureAndShareImage(
serverInfo.cmsURL + "/chatapi/file/uploadArchive",
data.payload.name
);
});
} else {
captureAndShareImage(
serverInfo.cmsURL + "/chatapi/file/uploadArchive",
data.payload.name
);
}
};
// HOST_CHANGE_REQUEST
FermiWebSocketMessageHandler.hostChangeRequest = function () {
FermiWebSocketBridge.hostChangeRequest();
};
// HOST_CHANGE_RESPONSE
FermiWebSocketMessageHandler.hostChangeResponse = function (data) {
const isAndroid = data.payload.isAndroid;
const isAble = data.payload.isAble;
if (
isAndroid &&
!isAble &&
joinCollaborationType == COLLABORATION_TYPE.DOCUMENT
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
// 対象ユーザの端末バージョンでは文書協業が利用できません。
alert(getLocalizedString("err_target_android_version_not_support"));
} else {
FermiWebSocketBridge.pipEndRequest(data.payload.loginId);
waitMillisecond(500);
CoviewBridge.changeHost(getFermiLoginId(data.payload.loginId));
}
};
// PIP_END_REQUEST
FermiWebSocketMessageHandler.pipEndRequest = function () {
NativeBridgeDelegate.finishPIPMode(true);
if (deviceInfo.isAndroid()) {
$(".pip_indicator").addClass("none");
}
};
// API_SEND_OWNER_CHANGE_COMPLETE
FermiWebSocketMessageHandler.apiSendOwnerChangeComplete = function () {
penOff();
if ($("#recordBtn .record").hasClass("disable")) {
recordStop(function () {});
}
if ($("#micBtn .voice").hasClass("disable")) {
micOff();
} else {
micOn();
}
};
// API_SEND_OWNER_CHANGE_CONFIRM
FermiWebSocketMessageHandler.apiSendOwnerChangeConfirm = function () {
waitMillisecond(500);
removeOldLocalVideo(g_localStream);
};
// CHANGE_HOST_APPLY
FermiWebSocketMessageHandler.changeHostApply = function (data) {
if (g_isMainMan) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
NativeBridgeDelegate.finishPIPMode(true);
if (deviceInfo.isAndroid()) {
$(".pip_indicator").addClass("none");
}
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DOING);
waitMillisecond(500);
if (
confirm(
getLocalizedString("norify_request_host_change", data.payload.hostId)
)
) {
CoviewBridge.changeHost(getFermiLoginId(data.payload.hostId));
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
} else {
FermiWebSocketBridge.hostRequestReject(data.payload.hostId);
}
FermiWebSocketBridge.hostRequestDone(data.payload.hostId);
} else {
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DOING);
waitMillisecond(500);
}
};
// HOST_REQUEST_DONE
FermiWebSocketMessageHandler.hostRequestDone = function () {
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
};
// HOST_REQUEST_REJECT
FermiWebSocketMessageHandler.hostRequestReject = function (data) {
if (data.payload.hostId == currentUserInfo.loginID) {
alert("REJECT for owner user");
}
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
};
// GET_COLLABORATION_TYPE
FermiWebSocketMessageHandler.getCollaborationType = function (data) {
FermiWebSocketBridge.getCollaborationTypeResponse(data.payload.loginId);
};
// GET_COLLABORATION_TYPE_RESPONSE
FermiWebSocketMessageHandler.getCollaborationTypeResponse = function (data) {
FermiWebSocketMessageHandler.updateJoinChangeCollaboration(
data.payload.collaborationType
);
joinMeetingId = data.payload.newMeetingId;
updateCollaborationUI(joinCollaborationType);
NativeBridgeDelegate.joinChangedCollaboration(
joinCollaborationType,
data.payload.newMeetingId
);
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.joinMeetingRoom(data.payload.newMeetingId);
}
};
// API_WELCOME
FermiWebSocketMessageHandler.apiWelcome = function () {
FermiWebSocketBridge.getCollaborationType();
collaborationJoinFlg = "1";
isInvited = InvitedFlag.INVITED;
};
FermiWebSocketMessageHandler.updateJoinChangeCollaboration = function (
collaborationType
) {
if (
deviceInfo.isAndroid() &&
collaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
alert(getLocalizedString("not_support_version"));
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
} else {
joinCollaborationType = collaborationType;
}
};
CollaborationUI.bindShareMainButton = function () {
$("#coviewShareMainBtn").on("click", function (e) {
e.stopPropagation();
if ($(".coview_share_dropdown_bar").is(":visible") == true) {
CollaborationUI.shareDropdownHide();
if ($(".coview_share_photo_select_bubble").is(":visible") == true) {
$(".coview_share_photo_select_bubble").slideUp();
}
} else {
$(".coview_share_dropdown_bar").slideDown();
}
});
};
CollaborationUI.bindShareCloseButton = function () {
$("#coviewShareCloseButton").on("click", function (e) {
coview_api.LeaveRoom();
$(".coview_share_area").hide();
});
};
CollaborationUI.bindBodyClockEvent = function () {
$("body").on("click", function () {
CollaborationUI.shareDropdownHide();
if ($(".coview_share_photo_select_bubble").is(":visible") == true) {
$(".coview_share_photo_select_bubble").slideUp();
} else {
$(".coview_share_dropdown_bar").slideDown();
}
});
};
CollaborationUI.bindShareRequestButton = function () {
$(document).on("click", ".coview_share_request", function () {
console.log("peacekim:: DOMContentLoaded - globalUserInfo", globalUserInfo);
if ($(this).hasClass(CollaborationTypeKey.VIDEO) == true) {
globalUserInfo.coWorkType = CollaborationTypeKey.VIDEO;
$(".coview_share_title_name").text("LIVE");
} else if ($(this).hasClass(CollaborationTypeKey.CAMERA) == true) {
globalUserInfo.coWorkType = CollaborationTypeKey.CAMERA;
$(".coview_share_title_name").text("ライブラリ");
} else if ($(this).hasClass(CollaborationTypeKey.AUDIO) == true) {
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
$(".coview_share_title_name").text("音声通話");
}
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
CollaborationUI.moveToVideoShareArea();
});
};
CollaborationUI.bindShareChat = function () {
$("#coviewShareChat").on("click", function () {
console.log("peacekim:: ON click coviewShareChat");
});
};
CollaborationUI.bindSharePhotoTapped = function () {
$("#coviewSharePhoto").on("click", function (e) {
e.stopPropagation();
console.log("peacekim:: ON click coviewSharePhoto");
if ($(".coview_share_photo_select_bubble").is(":visible") == true) {
$(".coview_share_photo_select_bubble").slideUp();
} else {
$(".coview_share_photo_select_bubble").slideDown();
}
});
};
CollaborationUI.bindSharePhotoCameraTapped = function () {
$("#coviewSharePhotoCamera").on("click", function () {
$(".coview_share_photo_select_bubble").hide();
globalUserInfo.coWorkType = CollaborationTypeKey.CAMERA;
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
CollaborationUI.moveToVideoShareArea();
$(".coview_share_title_name").text("カメラ");
});
};
CollaborationUI.bindSharePhotoLibraryTapped = function () {
$("#coviewSharePhotoGallery").on("click", function () {
$(".coview_share_photo_select_bubble").hide();
globalUserInfo.coWorkType = "gallery";
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
CollaborationUI.moveToVideoShareArea();
$(".coview_share_title_name").text("ライブラリ");
});
};
CollaborationUI.bindShareAudioTapped = function () {
$("#coviewShareAudio").on("click", function () {
CollaborationUI.connectAudioCollaboration();
});
};
CollaborationUI.bindShareLive = function () {
$("#coviewShareLive").on("click", function () {
console.log("peacekim:: ON click coviewShareLive");
globalUserInfo.coWorkType = "video";
console.log("peacekim:: globalUserInfo", globalUserInfo);
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
CollaborationUI.moveToVideoShareArea();
$(".coview_share_title_name").text("LIVE");
});
};
CollaborationUI.shareDropdownHide = function () {
$(".coview_share_dropdown_bar").slideUp();
$(".coview_share_photo_select_bubble").slideUp();
};
CollaborationUI.connectAudioCollaboration = function () {
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
coview_api.deleteRoom(globalUserInfo.roomId);
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
CollaborationUI.moveToVideoShareArea();
CollaborationUI.moveToAudioShareArea();
$(".coview_share_title_name").text("音声通話");
};
CollaborationUI.moveToVideoShareArea = function () {
$("#loadingIndicator").addClass("full_active");
$(".coview_share_area").show();
$("#collabo_main").removeClass("none");
};
CollaborationUI.moveToAudioShareArea = function () {
$(".coview_share_area").addClass("none");
$("#collabo_main").removeClass("none");
$(".talking_area").removeClass("none");
};
/**************************
* Toggle Feature Buttons
**************************/
function togglePen() {
$("#coviewPenCtrBtn").click();
if ($("#penBtn .pen").hasClass("disable")) {
......@@ -174,9 +38,7 @@ function toggleCapture() {
}
function toggleCaptureRequest() {
fw.sendToMsg("others", "CAPTURE_REQUEST", {
name: currentUserInfo.loginID,
});
FermiWebSocketBridge.captureRequest();
}
function micOn() {
......@@ -283,3 +145,12 @@ function mainManRecordWithCollaboration(action, url, callback) {
});
}, 1000);
}
function postRecords() {}
// div削除関数
function deleteDOMObject(id_name) {
const dom_obj = document.getElementById(id_name);
const dom_obj_parent = dom_obj.parentNode;
dom_obj_parent.removeChild(dom_obj);
}
var CoviewBridge = {};
var CollaborationFeature = {};
CoviewBridge.bindReadyEvent = function () {
coview_api.addEventListener("ready", function () {
console.log("peacekim:: =============> READY : ready for coview api");
Coview_addLoginId(globalUserInfo.loginId);
CoviewBridge.addLoginId(globalUserInfo.loginId);
coview_api.Login(globalUserInfo.loginId);
initCollaborationUI(joinCollaborationType);
updateCollaborationUI(joinCollaborationType);
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
fw.socket.on("message", async function (data) {
console.log("peacekim:: ====> message::data: ", data);
if (data.type === "CHANGE_COLLABORATION") {
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom();
NativeBridgeDelegate.finishPIPMode(true);
if (deviceInfo.isAndroid()) {
$(".pip_indicator").addClass("none");
}
await new Promise((done) => setTimeout(() => done(), 500));
updateCanvasSize();
}
if (
deviceInfo.isAndroid() &&
data.payload.collaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
alert(getLocalizedString("not_support_version"));
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
} else {
joinCollaborationType = data.payload.collaborationType;
}
joinMeetingId = data.payload.newMeetingId;
initCollaborationUI(joinCollaborationType);
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) {
initCollaborationUI(COLLABORATION_TYPE.CAMERA);
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
fw.sendToMsg("others", "SHARE_FILE_HOST", {
collaborationType: COLLABORATION_TYPE.CAMERA,
});
}
} else if (data.type === "SHARE_FILE_HOST") {
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA && g_isMainMan) {
initCollaborationUI(COLLABORATION_TYPE.CAMERA);
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
}
} else if (data.type === "CAPTURE_REQUEST" && g_isMainMan) {
if (
confirm(data.payload.name + getLocalizedString("request_capture"))
) {
if ($("#recordBtn .record").hasClass("disable")) {
screenLock();
recordStop(function () {
$("#screenLock").remove();
captureAndShareImage(
serverInfo.cmsURL + "/chatapi/file/uploadArchive",
data.payload.name
);
});
} else {
captureAndShareImage(
serverInfo.cmsURL + "/chatapi/file/uploadArchive",
data.payload.name
);
}
}
} else if (data.type === "HOST_CHANGE_REQUEST") {
if (data.payload.loginId == globalUserInfo.loginId) {
fw.sendToMsg("others", "HOST_CHANGE_RESPONSE", {
isAndroid: deviceInfo.isAndroid(),
isAble: androidVersion >= ANDROID_SDK_VERSION.O,
loginId: currentUserInfo.loginID,
FermiWebSocketMessageHandler.bindWebSocketMessage();
});
}
} else if (data.type === "HOST_CHANGE_RESPONSE") {
var isAndroid = data.payload.isAndroid;
var isAble = data.payload.isAble;
if (
g_isMainMan &&
isAndroid &&
!isAble &&
joinCollaborationType == COLLABORATION_TYPE.DOCUMENT
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
alert(getLocalizedString("err_target_android_version_not_support"));
} else if (g_isMainMan) {
fw.sendToMsg("others", "PIP_END_REQUEST", {
loginId: getFermiLoginId(data.payload.loginId),
});
await new Promise((done) => setTimeout(() => done(), 500));
Coview_changeHost(getFermiLoginId(data.payload.loginId));
}
} else if (data.type === "PIP_END_REQUEST") {
if (
data.payload.loginId == globalUserInfo.loginId &&
joinCollaborationType == COLLABORATION_TYPE.DOCUMENT
) {
NativeBridgeDelegate.finishPIPMode(true);
if (deviceInfo.isAndroid()) {
$(".pip_indicator").addClass("none");
}
}
} else if (data.type === "API_SEND_OWNER_CHANGE_COMPLETE") {
penOff();
if ($("#recordBtn .record").hasClass("disable")) {
recordStop(function () {
console.log("peacekim:: ホスト変更によりレコードを終了しました");
});
}
if ($("#micBtn .voice").hasClass("disable")) {
micOff();
} else {
micOn();
}
} else if (data.type === "API_SEND_OWNER_CHANGE_CONFIRM") {
if (joinCollaborationType == COLLABORATION_TYPE.CAMERA) {
await new Promise((done) => setTimeout(() => done(), 500));
removeOldLocalVideo(g_localStream);
}
} else if (data.type === "CHANGE_HOST_APPLY") {
if (g_isMainMan) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
NativeBridgeDelegate.finishPIPMode(true);
if (deviceInfo.isAndroid()) {
$(".pip_indicator").addClass("none");
}
}
};
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DOING);
CoviewBridge.bindStartEvent = function () {
coview_api.addEventListener("start", function () {
CollaborationFeature.enableScrollLock();
CollaborationUI.hideLoadingIndicator();
});
};
await new Promise((done) => setTimeout(() => done(), 500));
if (g_isMainMan) {
CollaborationFeature.scrollLock = function (e) {
if (deviceInfo.isiOS()) {
if (
confirm(
getLocalizedString(
"norify_request_host_change",
data.payload.hostId
)
)
$(e.target).closest(".add_user_modal").length > 0 ||
$(e.target).closest("#overlay_user_list").length > 0 ||
$(e.target).closest(".pip_indicator").length > 0
) {
Coview_changeHost(getFermiLoginId(data.payload.hostId));
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
e.stopPropagation();
} else {
fw.sendToMsg("others", "HOST_REQUEST_REJECT", {
hostId: data.payload.hostId,
});
}
fw.sendToMsg("others", "HOST_REQUEST_DONE", {
hostId: data.payload.hostId,
});
e.preventDefault();
}
} else if (data.type === "HOST_REQUEST_DONE") {
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
} else if (data.type === "HOST_REQUEST_REJECT") {
if (data.payload.hostId == currentUserInfo.loginID) {
alert("REJECT for owner user");
}
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
} else if (data.type === "GET_COLLABORATION_TYPE" && g_isMainMan) {
fw.sendToMsg("others", "GET_COLLABORATION_TYPE_RESPONSE", {
loginId: data.payload.loginId,
collaborationType: joinCollaborationType,
newMeetingId: joinMeetingId,
});
} else if (data.type === "GET_COLLABORATION_TYPE_RESPONSE") {
console.log("peacekim:: t1 " + data.payload.newMeetingId);
if (data.payload.loginId == globalUserInfo.loginId) {
if (
deviceInfo.isAndroid() &&
data.payload.collaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
alert(getLocalizedString("not_support_version"));
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
} else {
joinCollaborationType = data.payload.collaborationType;
}
joinMeetingId = data.payload.newMeetingId;
initCollaborationUI(joinCollaborationType);
NativeBridgeDelegate.joinChangedCollaboration(
joinCollaborationType,
data.payload.newMeetingId
);
};
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.joinMeetingRoom(data.payload.newMeetingId);
}
}
} else if (data.type === "API_WELCOME") {
if (collaborationJoinFlg == "2") {
fw.sendToMsg("others", "GET_COLLABORATION_TYPE", {
loginId: globalUserInfo.loginId,
});
collaborationJoinFlg = "1";
isInvited = InvitedFlag.INVITED;
}
}
});
CollaborationFeature.enableScrollLock = function () {
document
.getElementById("collabo_main")
.addEventListener("touchmove", CollaborationFeature.scrollLock, {
passive: false,
});
};
CoviewBridge.bindStartEvent = function () {
coview_api.addEventListener("start", function () {
console.log("peacekim:: =============> START : share start");
scrollLockON();
$("#loadingIndicator").removeClass("full_active");
CollaborationFeature.disableScrollLock = function () {
document
.getElementById("collabo_main")
.removeEventListener("touchmove", CollaborationFeature.scrollLock, {
passive: false,
});
};
CoviewBridge.bindAllByeEvent = function () {
coview_api.addEventListener("allbye", function () {
requestCollaborationFinish();
var isDocument = false;
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
isDocument = true;
}
CHAT_SOCKET.emitCollaborationFinishMessage();
if (deviceInfo.isAndroid()) {
android.setExitHostAlert();
}
if (isDocument) {
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom();
}
if (isInvited == InvitedFlag.NONE) {
......@@ -240,34 +62,27 @@ CoviewBridge.bindAllByeEvent = function () {
} else {
NativeBridgeDelegate.openCommunicationHome();
}
console.log("peacekim:: =============> HOST BYE : share hostbye");
// TODO: peacekim:: check not to need this method for android
if (deviceInfo.isiOS()) {
NativeBridgeDelegate.showExitHostAlert();
return;
}
$("#loadingIndicator").removeClass("full_active");
CollaborationUI.hideLoadingIndicator();
});
};
CoviewBridge.bindGuestByeEvent = function () {
coview_api.addEventListener("guestbye", function () {
console.log(" peacekim::=============> GUEST BYE : share guestbye");
$("#loadingIndicator").removeClass("full_active");
CollaborationUI.hideLoadingIndicator();
});
};
CoviewBridge.bindDestroyEvent = function () {
coview_api.addEventListener("destroy", function () {
requestCollaborationFinish();
console.log("peacekim:: =============> DESTROY : share destroy");
CHAT_SOCKET.emitCollaborationFinishMessage();
alert(getLocalizedString("inform_exit_host_collaboration"));
var isDocument = false;
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
isDocument = true;
}
Coview_exitCollaboration(isDocument);
$("#loadingIndicator").removeClass("full_active");
Coview_exitCollaboration();
CollaborationUI.hideLoadingIndicator();
});
};
......@@ -299,7 +114,7 @@ CoviewBridge.bindMessageEvent = function () {
await deleteRoomApi(globalUserInfo.roomId)
);
if (deleteRoomResult.resultCode == 200) {
await new Promise((done) => setTimeout(() => done(), 3000));
waitMillisecond(3000);
}
coview_api.CreateRoom(
globalUserInfo.roomId,
......@@ -313,7 +128,7 @@ CoviewBridge.bindMessageEvent = function () {
isInvited = InvitedFlag.INVITED;
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
}
CollaborationUI.moveToVideoShareArea();
moveToVideoShareArea();
break;
case "CreateRoomResponse":
......@@ -352,7 +167,7 @@ CoviewBridge.bindMessageEvent = function () {
alert(getLocalizedString("not_exist_sharing_call"));
coview_api.LeaveRoom();
$(".coview_share_area").hide();
$("#loadingIndicator").removeClass("full_active");
CollaborationUI.hideLoadingIndicator();
NativeBridgeDelegate.joinRoom(roomInfo.roomID, roomInfo.roomName);
}
break;
......@@ -406,31 +221,29 @@ CoviewBridge.bindMessageEvent = function () {
});
};
function Coview_changeHost(userId) {
console.log("peacekim:: Change Host To " + userId);
changeOwnerSend(userId);
}
CoviewBridge.changeHost = function (userID) {
// call in agent_app.js
changeOwnerSend(userID);
};
function Coview_addLoginId(loginId) {
console.log("peacekim:: addUser loginId = " + loginId);
CoviewBridge.addLoginId = function (loginID) {
const url = "https://biztaskyell.abookcloud.com/auth/getuser";
$.ajax({
url: url,
method: "post",
data: {
id: loginId,
id: loginID,
},
success: function (result) {
console.log("peacekim:: t3 result", result);
if (result.statusCode != 200) {
coview_api.addUser(loginId);
coview_api.addUser(loginID);
}
},
error: function (err) {
console.log(err.toString());
console.error(err.toString());
},
});
}
};
function hostSearchInterval() {
let hostName = "";
......@@ -581,7 +394,6 @@ function captureAndShareImage(urls, changeHostName) {
SendFileShare(uploadFileName);
$("#coviewCaptureCtrBtn").hide();
$("#coviewRecCtrBtn").hide();
$(".coview_share_title_name").text("LIVE(CAPTURE IMAGE)");
$(".coview_on_media_btn_back").show();
//アーカイブ保存。
ArchiveFileManage(blob, uploadFileName, urls);
......@@ -598,13 +410,12 @@ function getReplacedLoginId(loginId) {
return loginId.replaceAll(globalUserInfo.shopName + "_", "");
}
function Coview_exitCollaboration(isDocument = false) {
scrollLockOFF();
function Coview_exitCollaboration() {
CollaborationFeature.disableScrollLock();
if (g_isMainMan) {
requestCollaborationFinish();
CHAT_SOCKET.emitCollaborationFinishMessage();
}
if (isDocument) {
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom();
}
if ($("#recordBtn .record").hasClass("disable")) {
......@@ -628,3 +439,51 @@ function Coview_finishCollaboration() {
NativeBridgeDelegate.openCommunicationHome();
}
}
// Display User List
CollaborationUI.refreshJoinedCollaboration = function (loginIDList) {
for (var count = 0; count < loginIDList.length; count++) {
loginIDList[count] = loginIDList[count].replaceAll(
globalUserInfo.shopName + "_",
""
);
}
Common.showLoadingIndicator();
$("#collaboration_overlay_user_list").html("");
const joinedUserListTemplate = getTemplate(
TemplateURL.COLLABORATION_OVERLAY_USER_LIST
);
const joinedUserList =
NativeBridgeDataSource.getUserListByLoginId(loginIDList);
const sortedUserList = new Array();
loginIDList.forEach(function (userId) {
joinedUserList.forEach(function (user) {
if (userId == user.loginId) {
sortedUserList.push(user);
}
});
});
sortedUserList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
});
let html = Mustache.render(joinedUserListTemplate, {
joinedUserList: sortedUserList,
});
let obj = jQuery.parseHTML(html);
$("#collaboration_overlay_user_list").append(obj);
Common.dismissLoadingIndicator();
};
function moveToVideoShareArea() {
CollaborationUI.showLoadingIndicator();
$(".coview_share_area").show();
$("#collabo_main").removeClass("none");
}
......@@ -16,30 +16,6 @@ document.addEventListener("DOMContentLoaded", function () {
coview_api_key: "8dda7092c5820d663",
});
// special button IN Chat ui
CollaborationUI.bindShareMainButton();
CollaborationUI.bindShareCloseButton();
CollaborationUI.bindBodyClockEvent();
CollaborationUI.bindShareRequestButton();
/* --------------------------------------------------- */
/* Video, photo, chat, doc */
/* --------------------------------------------------- */
CollaborationUI.bindShareChat();
CollaborationUI.bindSharePhotoTapped();
CollaborationUI.bindSharePhotoCameraTapped();
CollaborationUI.bindSharePhotoLibraryTapped();
CollaborationUI.bindShareAudioTapped();
CollaborationUI.bindShareLive();
// todo: peacekim::
CoviewBridge.bindReadyEvent();
CoviewBridge.bindStartEvent();
......@@ -54,20 +30,20 @@ document.addEventListener("DOMContentLoaded", function () {
});
// call from collaboration_overlay_menu.html and collaboration.html
function changeCollaboration(changeCollaborationType) {
function changeCollaboration(collaborationType) {
recordStop(function () {
var newMeetingId = 0;
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom();
}
NativeBridgeDelegate.setJoinCollaborationType(
changeCollaborationType,
collaborationType,
androidVersion
);
joinCollaborationType = changeCollaborationType;
initCollaborationUI(changeCollaborationType);
switch (changeCollaborationType) {
joinCollaborationType = collaborationType;
updateCollaborationUI(collaborationType);
switch (collaborationType) {
case COLLABORATION_TYPE.AUDIO:
coview_api.ChangeCollaboration("audio");
break;
......@@ -93,46 +69,17 @@ function changeCollaboration(changeCollaborationType) {
micOn();
}
NativeBridgeDelegate.changeCollaboration(
changeCollaborationType,
newMeetingId
);
NativeBridgeDelegate.changeCollaboration(collaborationType, newMeetingId);
joinMeetingId = newMeetingId;
fw.sendToMsg("others", "CHANGE_COLLABORATION", {
collaborationType: changeCollaborationType,
newMeetingId: newMeetingId,
});
FermiWebSocketBridge.changeCollaboration();
});
}
var scrollLock = function (e) {
if (deviceInfo.isiOS()) {
if (
$(e.target).closest(".add_user_modal").length > 0 ||
$(e.target).closest("#overlay_user_list").length > 0 ||
$(e.target).closest(".pip_indicator").length > 0
) {
e.stopPropagation();
} else {
e.preventDefault();
}
}
};
let collaboScreen = document.getElementById("collabo_main");
function scrollLockON() {
collaboScreen.addEventListener("touchmove", scrollLock, { passive: false });
}
function scrollLockOFF() {
collaboScreen.removeEventListener("touchmove", scrollLock, {
passive: false,
});
}
async function initCollaborationUI(changeCollaborationType) {
async function updateCollaborationUI(collaborationType) {
$("#coviewEraserCtrBtn").click();
if ($(".user_btn").hasClass("hide")) {
$(".user_btn").click();
......@@ -140,6 +87,7 @@ async function initCollaborationUI(changeCollaborationType) {
if ($(".menu_btn").hasClass("hide")) {
$(".menu_btn").click();
}
const roomType = NativeBridgeDataSource.getRoomType();
if (roomType == ChatRoomType.DM) {
$(".add_user_btn").removeClass("none");
......@@ -147,7 +95,7 @@ async function initCollaborationUI(changeCollaborationType) {
$("link[href='./css/collaboration_board.css']").remove();
switch (changeCollaborationType) {
switch (collaborationType) {
case COLLABORATION_TYPE.AUDIO:
$(".collaboration_contents").addClass("none");
$(".voice_contents").removeClass("none");
......@@ -193,17 +141,7 @@ function applyForHostChange() {
}
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DOING);
fw.sendToMsg("others", "CHANGE_HOST_APPLY", {
hostId: currentUserInfo.loginID,
});
}
// call from modal_collabo_profile.html
function hostChangeRequest(loginId) {
fw.sendToMsg("others", "HOST_CHANGE_REQUEST", {
loginId: getFermiLoginId(loginId),
});
FermiWebSocketBridge.changeHostApply();
}
function getFermiLoginId(loginId) {
......@@ -228,20 +166,6 @@ function screenLock() {
objBody.appendChild(element);
}
// div削除関数
function deleteDOMObject(id_name) {
const dom_obj = document.getElementById(id_name);
const dom_obj_parent = dom_obj.parentNode;
dom_obj_parent.removeChild(dom_obj);
}
function requestCollaborationFinish() {
if (socket != null && socket.connected) {
const sendData = DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL;
CHAT_SOCKET.emitCreateMessage(sendData, 0);
}
}
async function waitMillisecond(millesecond) {
await new Promise((done) => setTimeout(() => done(), millesecond));
}
......@@ -15,7 +15,7 @@
<span>キャンセル</span>
</div>
</button>
<button type="button" onclick="Coview_changeHost({{shopMemberId}});" class="profile_chat_btn border-0 bg_blue text_white">
<button type="button" onclick="CoviewBridge.changeHost({{shopMemberId}});" class="profile_chat_btn border-0 bg_blue text_white">
<div class="d-flex flex-column">
<span>引き渡し</span>
</div>
......
......@@ -41,7 +41,7 @@
{{/isFavorite}}
{{#isHost}}
<button type="button" class="ch_host_btn border-0 bg_green text_white"
onclick="hostChangeRequest('{{loginId}}');">
onclick="FermiWebSocketBridge.requestHostChange('{{loginId}}');">
<div class="d-flex flex-column">
<div class="img_wrap">
<img src="icon/icon_change_host.png" alt="ホスト変更">
......
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