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 () {
}
}
// 画像、動画の描画を待ってからスクロール
setTimeout(function () {
ChatRoom.scrollToBottom();
}, 300);
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);
};
......
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");
/* モーダルの切り替え */
beforeModal.modal("hide");
afterModal.modal("show");
});
};
/* モーダルの切り替え */
function changeModal(beforeModal, afterModal) {
$(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", CollaborationUI.scrollControl, {
passive: false,
});
document.removeEventListener("touchmove", 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);
}
......@@ -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