Commit ac2f8381 by Kim Peace

WIP: fixing collaboration

parent 5ce6e415
......@@ -158,8 +158,11 @@
<!-- View -->
<script src="./js/views/chats/management/chat-management-common.js"></script>
<script src="./js/views/collaboration/collaboration.js"></script>
<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/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
<script>
......@@ -193,8 +196,6 @@
alert(getLocalizedString('not_support_version'));
if (typeof android != "undefined") {
NativeBridgeDelegate.openCommunicationHome();
NativeBridgeDelegate.openCommunicationHome();
NativeBridgeDelegate.openCommunicationHome();
}
}
}
......
......@@ -100,6 +100,7 @@
<!-- View -->
<script src="./js/views/chats/management/chat-management-common.js"></script>
<script src="./js/views/collaboration/collaboration.js"></script>
<script src="./js/views/collaboration/collaboration-add-user.js"></script>
<script src="./js/common/loading.js"></script>
<script src="./js/views/contact/namecard.js"></script>
......
......@@ -3,7 +3,7 @@
{{#joinedUserList}}
<div class="user_item " id="collaboration_user_{{loginId}}">
<a href="#" data-toggle="modal" data-target="#profileModal1"
onclick="Namecard.makeNameCardInCollaboration({{shopMemberId}})">
onclick="CollaborationUI.makeNameCard({{shopMemberId}})">
<div class="img_wrap"><img src="{{profileUrl}}" alt="this.src='./img/noImage.png'" /></div>
<span class="name">{{shopMemberName}}</span>
</a>
......
......@@ -162,8 +162,11 @@
<!-- View -->
<script src="./js/views/chats/management/chat-management-common.js"></script>
<script src="./js/views/collaboration/collaboration.js"></script>
<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/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
<script>
......
......@@ -151,8 +151,11 @@
<!-- View -->
<script src="./js/views/chats/management/chat-management-common.js"></script>
<script src="./js/views/collaboration/collaboration.js"></script>
<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/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
</body>
......
......@@ -96,8 +96,11 @@
<!-- View -->
<script src="./js/views/chats/management/chat-management-common.js"></script>
<script src="./js/views/collaboration/collaboration.js"></script>
<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/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
<script>
......
......@@ -153,8 +153,11 @@
<!-- View -->
<script src="./js/views/chats/management/chat-management-common.js"></script>
<script src="./js/views/collaboration/collaboration.js"></script>
<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/share-bind-button-action.js"></script>
<script src="./js/views/collaboration/share-event-listener.js"></script>
<script src="./js/views/contact/namecard.js"></script>
<script>
......
......@@ -2,7 +2,7 @@
<div class="footer-wrap">
<div class="d-flex justify-content-around h-100">
<div class="footer_item mx-md-3 photo_select_button collaboration_contents picture_contents">
<a href="javascript:photo_open_place_holderToggle();">
<a href="javascript:togglePhotoOpenPlaceHolder();">
<div class="d-flex flex-column justify-content-center" id="photo_open_place_holder">
<div class="t-icon picture my-0"></div>
<span class="text-white txt">ピクチャ</span>
......@@ -10,7 +10,7 @@
</a>
</div>
<div class="footer_item mx-md-3 collaboration_contents picture_contents video_contents document_contents board_contents">
<a href="javascript:penToggle();">
<a href="javascript:togglePen();">
<div class="d-flex flex-column justify-content-center" id="penBtn">
<div class="t-icon pen disable my-0"></div>
<span class="text-white txt">ペン</span>
......
......@@ -16,7 +16,7 @@ var CoviewUserInfo = class {
// variable name for legacy connection to agent_app.js in coview library
var globalUserInfo = new CoviewUserInfo(
currentUserInfo.sid,
currentUserInfo.loginId,
currentUserInfo.loginID,
roomInfo.roomID,
currentUserInfo.shopName,
""
......
......@@ -108,6 +108,8 @@ const TemplateURL = {
"./template/template_add_user_group_user_list_in_collaboration.html",
ADD_USER_GROUP_PATH_IN_COLLABORATION:
"./template/template_add_user_group_path_in_collaboration.html",
COLLABORATION_PROFILE: "./modal_collabo_profile.html",
COLLABORATION_OVERLAY_USER_LIST: "collaboration_overlay_user_list.html",
};
const SOCKET_KEY = {
......
CollaborationUI.bindAddUserButton = function () {
// ユーザー招待メンバー検索
$(".add_user_btn").click(function () {
enableScroll();
Common.showLoadingIndicator();
ChatManagementCommon.selectedUserList = [];
CollaborationUI.refreshMyGroupForAddUserInCollaboration();
$("#addUserConfirmBtnInCollaboration")
.off()
.on("click", function () {
$("#addUserInCollaboration").modal("hide");
const selectedUserList =
ChatManagementCommon.selectedUserList.join(",");
NativeBridgeDelegate.saveSelectedUserList(selectedUserList);
CollaborationUI.confirmInviteUserListInCollaboration();
});
});
};
$("#tabMyGroupOnAddUserInCollaboration").on("click", function (e) {
CollaborationUI.refreshMyGroupForAddUserInCollaboration();
});
$("#tabAllGroupOnAddUserInCollaboration").on("click", function (e) {
CollaborationUI.refreshAllGroupForAddUserInCollaboration("0");
});
CollaborationUI.refreshMyGroupForAddUserInCollaboration = function () {
if (ChatManagementCommon.selectedUserList.length > 0) {
$(".select_member_num").text(ChatManagementCommon.selectedUserList.length);
} else {
$(".select_member_num").text("0");
}
$("#favoriteListForAddUserInCollaboration").html("");
$("#myGroupListForAddUserInCollaboration").html("");
$("#tabMyGroupOnAddUserInCollaboration").prop("checked", true);
// グループの様式を読み込む
const groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
// ユーザの様式を読み込む
const userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
const groupUserTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_USER_LIST_IN_COLLABORATION
);
NativeBridgeDelegate.updateContactInfo();
//お気に入りグループ取得。
const favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups();
favoriteGroupList.forEach(function (favoriteGroup) {
let html = Mustache.render(groupTemplate, {
name: favoriteGroup.groupName,
id: favoriteGroup.groupId,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#favoriteListForAddUserInCollaboration").append(obj);
});
//お気に入りユーザ取得。
const favoriteUserList = NativeBridgeDataSource.getFavoriteUsersNotInRoom();
favoriteUserList.forEach(function (favoriteUser) {
favoriteUser.profileUrl = Common.getProfileImgUrl(favoriteUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
) {
return shopMemberId == favoriteUser.shopMemberId;
});
if (findObj) {
favoriteUser.checked = "checked";
}
});
let html = Mustache.render(userTemplate, {
userList: favoriteUserList,
});
let obj = jQuery.parseHTML(html);
$("#favoriteListForAddUserInCollaboration").append(obj);
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
) {
return shopMemberId == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
}
});
let html = Mustache.render(groupUserTemplate, {
groupName: myGroup.groupName,
groupUserList: myGroup.groupUserList,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#myGroupListForAddUserInCollaboration").append(obj);
});
$("#addUserInCollaboration").modal("show");
Common.dismissLoadingIndicator();
};
CollaborationUI.refreshAllGroupForAddUserInCollaboration = function (
paramGroupId
) {
var groupId = paramGroupId;
$(".content").removeClass("none");
$("#tabAllGroupOnAddUserInCollaboration").prop("checked", true);
NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。
$("#parentGroupBtnForAddUserInCollaboration").off();
$("#rootGroupBtnForAddUserInCollaboration").off();
$("#childGroupListAreaForAddUserInCollaboration").html("");
$("#userInGroupListForAddUserInCollaboration").html("");
$("#groupPathAreaForAddUserInCollaboration").html("");
//DBからグループ情報を取得。
var result = NativeBridgeDataSource.getGroupInfoForAddUser(groupId);
//上位グループ、トップグループ遷移ボタンのイベント追加。
if (typeof result.parentGroupId !== "undefined") {
$("#parentGroupBtnForAddUserInCollaboration").on("click", function () {
CollaborationUI.refreshAllGroupForAddUserInCollaboration(
result.parentGroupId
);
});
}
if (typeof result.rootGroupId !== "undefined") {
if (paramGroupId == 0) {
groupId = result.rootGroupId;
}
$("#rootGroupBtnForAddUserInCollaboration").on("click", function () {
CollaborationUI.refreshAllGroupForAddUserInCollaboration(
result.rootGroupId
);
});
}
if (groupId == result.rootGroupId || paramGroupId == "0") {
$("#rootGroupAreaInCollaboration").addClass("none");
$("#parentGroupAreaInCollaboration").addClass("none");
} else {
$("#rootGroupAreaInCollaboration").removeClass("none");
$("#parentGroupAreaInCollaboration").removeClass("none");
}
//該当グループのパースを表示。
var groupPathTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_PATH_IN_COLLABORATION
);
var groupPathCount = 0;
result.groupPathList.forEach(function (groupPath) {
if (!(groupPathCount < result.groupPathList.length - 3)) {
let html = Mustache.render(groupPathTemplate, {
name: groupPath.groupName,
id: groupPath.groupId,
});
let obj = jQuery.parseHTML(html);
$("#groupPathAreaForAddUserInCollaboration").append(obj);
}
groupPathCount++;
});
//該当グループの下位グループ表示。
var groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
result.childGroupList.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, {
name: childGroup.groupName,
id: childGroup.groupId,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#childGroupListAreaForAddUserInCollaboration").append(obj);
});
//該当グループの所属ユーザを表示。
var userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
result.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
) {
return shopMemberId == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
}
});
let html = Mustache.render(userTemplate, {
userList: result.groupUserList,
});
let obj = jQuery.parseHTML(html);
$("#userInGroupListForAddUserInCollaboration").append(obj);
};
CollaborationUI.confirmInviteUserListInCollaboration = function () {
const selectedUsers = NativeBridgeDataSource.loadSelectedUsers();
if (selectedUsers != "") {
$("#selectedUserListinCollaboration").html("");
selectedUsers.forEach(function (user) {
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, {
userList: selectedUsers,
});
let obj = jQuery.parseHTML(html);
$("#modal_add_user_confirm").html(obj);
$("#modalAddUserConfirm").modal("show");
}
$("#cancelAddUserBtn")
.off()
.on("click", function () {
$("#modalAddUserConfirm").modal("hide");
$("#addUserInCollaboration").modal("show");
});
$("#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
);
NativeBridgeDelegate.inviteCollaboration(
commaJoinedUserIDList,
collaborationType
);
Common.dismissLoadingIndicator();
$("#modalAddUserConfirm").modal("hide");
});
};
CollaborationUI.toggleCategory = function (category) {
$(category).toggleClass("open");
$(category).next().slideToggle();
};
\ No newline at end of file
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");
};
function togglePen() {
$("#coviewPenCtrBtn").click();
if ($("#penBtn .pen").hasClass("disable")) {
$("#penBtn .pen").removeClass("disable");
} else {
$("#penBtn .pen").addClass("disable");
}
}
function penOff() {
if (!$("#penBtn .pen").hasClass("disable")) {
$("#coviewPenCtrBtn").click();
$("#penBtn .pen").addClass("disable");
}
}
function togglePhotoOpenPlaceHolder() {
$("#open_file_upload").trigger("click");
}
function toggleEraser() {
$("#coviewEraserCtrBtn").click();
}
function toggleCapture() {
if ($("#recordBtn").hasClass("bg_red")) {
screenLock();
recordStop(function () {
$("#screenLock").remove();
coview_api.Capture(serverInfo.cmsURL + "/chatapi/file/uploadArchive");
});
} else {
coview_api.Capture(serverInfo.cmsURL + "/chatapi/file/uploadArchive");
}
}
function toggleCaptureRequest() {
fw.sendToMsg("others", "CAPTURE_REQUEST", {
name: currentUserInfo.loginID,
});
}
function micOn() {
coview_api.MicMuteControl("off");
$("#micBtn .voice").removeClass("disable");
}
function micOff() {
coview_api.MicMuteControl("on");
$("#micBtn .voice").addClass("disable");
}
function toggleMic() {
if ($("#micBtn .voice").hasClass("disable")) {
micOn();
} else {
micOff();
}
}
/*************
* レコード関連
*************/
function recordStart() {
console.log("peacekim:: レコードを開始しました");
MainManRecord("on");
$("#recordBtn .record").addClass("disable");
$(".flash-txt").addClass("on");
}
function recordFinished() {
$("#recordBtn .record").removeClass("disable");
$(".flash-txt").removeClass("on");
// ロック画面の削除
deleteDOMObject("screenLock");
}
function toggleRecord() {
if (!$("#recordBtn .record").hasClass("disable")) {
recordStart();
} else {
recordStop(function () {
console.log("peacekim:: レコードを終了しました");
});
}
}
function recordStop(callback) {
if (!$("#recordBtn .record").hasClass("disable")) {
callback();
return;
}
Common.showLoadingIndicator();
// アーカイブ保存中は画面操作不可(協業終了,協業切り替え防止)
screenLock();
// アーカイブ保存処理
mainManRecordWithCollaboration(
"stop",
serverInfo.cmsURL + "/chatapi/file/uploadArchive",
callback
);
}
function mainManRecordWithCollaboration(action, url, callback) {
try {
mediaRecorder.stop();
} catch (exeption) {
console.log("peacekim:: Record fail");
callback();
}
console.log("peacekim:: Recorded Blobs: ", recordedBlobs);
setTimeout(function () {
console.log("peacekim:: Recoding File upload..");
const blob = new Blob(recordedBlobs, { type: "video/webm" });
const uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++;
let formData = new FormData();
formData.append("fileData", blob, uploadFileName);
formData.append("sid", globalUserInfo.sid);
formData.append("roomId", globalUserInfo.roomId);
if (joinCollaborationType == COLLABORATION_TYPE.VIDEO) {
formData.append("archiveType", 1);
} else {
formData.append("archiveType", 2);
}
$.ajax({
type: "post",
url,
data: formData,
contentType: false,
processData: false,
success: function (res) {
recordFinished();
Common.dismissLoadingIndicator();
callback();
},
error: function (err) {
recordFinished();
Common.dismissLoadingIndicator();
callback();
},
});
}, 1000);
}
......@@ -108,10 +108,11 @@ Namecard.insertFavoriteUser = function (shopMemberID) {
Common.dismissLoadingIndicator();
};
Namecard.refreshForOnline = function () {
Namecard.refreshForOnline = function () {
$("#favoriteButton").prop("disabled", false);
};
Namecard.refreshForOffline = function () {
$("#favoriteButton").prop("disabled", true);
};
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