Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chat_webview
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abookCommunication
chat_webview
Commits
ac2f8381
Commit
ac2f8381
authored
Jul 14, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: fixing collaboration
parent
5ce6e415
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1261 additions
and
1173 deletions
+1261
-1173
public_new/collaboration.html
+3
-2
public_new/collaboration_documents.html
+1
-0
public_new/collaboration_overlay_user_list.html
+1
-1
public_new/collaboration_picture.html
+3
-0
public_new/collaboration_video.html
+3
-0
public_new/collaboration_voice.html
+3
-0
public_new/collaboration_whiteboard.html
+3
-0
public_new/footer_collabo.html
+2
-2
public_new/js/Models/coview-userinfo.js
+1
-1
public_new/js/common/constant.js
+2
-0
public_new/js/views/collaboration/collaboration-add-user.js
+268
-0
public_new/js/views/collaboration/collaboration.js
+29
-299
public_new/js/views/collaboration/share-bind-button-action.js
+285
-0
public_new/js/views/collaboration/share-event-listener.js
+630
-0
public_new/js/views/collaboration/share.js
+26
-868
public_new/js/views/contact/namecard.js
+1
-0
No files found.
public_new/collaboration.html
View file @
ac2f8381
...
...
@@ -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
();
}
}
}
...
...
public_new/collaboration_documents.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/collaboration_overlay_user_list.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/collaboration_picture.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/collaboration_video.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/collaboration_voice.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/collaboration_whiteboard.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/footer_collabo.html
View file @
ac2f8381
...
...
@@ -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>
...
...
public_new/js/Models/coview-userinfo.js
View file @
ac2f8381
...
...
@@ -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
.
loginI
d
,
currentUserInfo
.
loginI
D
,
roomInfo
.
roomID
,
currentUserInfo
.
shopName
,
""
...
...
public_new/js/common/constant.js
View file @
ac2f8381
...
...
@@ -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
=
{
...
...
public_new/js/views/collaboration/collaboration-add-user.js
0 → 100644
View file @
ac2f8381
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
public_new/js/views/collaboration/collaboration.js
View file @
ac2f8381
...
...
@@ -52,310 +52,47 @@ document.addEventListener("DOMContentLoaded", function () {
$
(
"#overlay_add_user_list"
).
addClass
(
"none"
);
});
// ユーザー招待メンバー検索
$
(
".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
();
});
});
CollaborationUI
.
bindAddUserButton
();
});
function
penOff
()
{
if
(
!
$
(
"#penBtn .pen"
).
hasClass
(
"disable"
))
{
$
(
"#coviewPenCtrBtn"
).
click
();
$
(
"#penBtn .pen"
).
addClass
(
"disable"
);
}
}
function
disableScroll
()
{
document
.
addEventListener
(
"mousewheel"
,
scroll
_c
ontrol
,
{
passive
:
false
});
document
.
addEventListener
(
"touchmove"
,
scroll
_c
ontrol
,
{
passive
:
false
});
document
.
addEventListener
(
"mousewheel"
,
scroll
C
ontrol
,
{
passive
:
false
});
document
.
addEventListener
(
"touchmove"
,
scroll
C
ontrol
,
{
passive
:
false
});
}
// スクロール禁止解除
function
enableScroll
()
{
document
.
removeEventListener
(
"mousewheel"
,
scroll
_c
ontrol
,
{
document
.
removeEventListener
(
"mousewheel"
,
scroll
C
ontrol
,
{
passive
:
false
,
});
document
.
removeEventListener
(
"touchmove"
,
scroll
_c
ontrol
,
{
passive
:
false
});
document
.
removeEventListener
(
"touchmove"
,
scroll
C
ontrol
,
{
passive
:
false
});
}
function
scroll_control
(
event
)
{
function
scrollControl
(
event
)
{
if
(
event
.
cancelable
)
{
event
.
preventDefault
();
}
}
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
()
{
console
.
log
(
"cancelClick"
);
$
(
"#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"
);
});
};
$
(
"#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
);
// グループの様式を読み込む
var
groupTemplate
=
getTemplate
(
TemplateURL
.
ADD_USER_GROUP_LIST_IN_COLLABORATION
);
// ユーザの様式を読み込む
var
userTemplate
=
getTemplate
(
TemplateURL
.
ADD_USER_USER_LIST_IN_COLLABORATION
);
var
groupUserTemplate
=
getTemplate
(
TemplateURL
.
ADD_USER_GROUP_USER_LIST_IN_COLLABORATION
);
NativeBridgeDelegate
.
updateContactInfo
();
//お気に入りグループ取得。
var
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
);
});
//お気に入りユーザ取得。
var
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
);
var
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
);
};
Namecard
.
makeNameCardInCollaboration
=
function
(
shopMemberId
)
{
/*********************************
* NameCard in Collaboration
********************************/
CollaborationUI
.
makeNameCard
=
function
(
shopMemberId
)
{
if
(
currentUserInfo
.
shopMemberID
==
shopMemberId
)
{
return
;
}
var
nameCardInfo
=
NativeBridgeDataSource
.
getNameCardData
(
shopMemberId
);
var
namecardTemplate
;
var
changeHostTemplate
;
$
.
get
({
url
:
"./modal_collabo_profile.html"
,
async
:
false
},
function
(
text
)
{
namecardTemplate
=
text
;
});
const
namecardTemplate
=
getTemplate
(
TemplateURL
.
COLLABORATION_PROFILE
);
let
isCollaborationHost
=
coview_api
.
getRoomUsers
(
);
const
nameCardInfo
=
NativeBridgeDataSource
.
getNameCardData
(
shopMemberId
);
nameCardInfo
.
profileUrl
=
Common
.
getProfileImgUrl
(
nameCardInfo
.
profileUrl
);
let
whosHost
=
$
(
"#collaboration_user_"
+
nameCardInfo
.
loginId
).
hasClass
(
let
isCollaborationHost
=
coview_api
.
getRoomUsers
();
const
whosHost
=
$
(
"#collaboration_user_"
+
nameCardInfo
.
loginId
).
hasClass
(
"host"
);
let
namecardHtml
=
Mustache
.
render
(
namecardTemplate
,
{
shopMemberId
:
nameCardInfo
.
shopMemberId
,
profileUrl
:
nameCardInfo
.
profileUrl
,
...
...
@@ -389,9 +126,10 @@ CollaborationUI.insertFavoriteUserInCollaboration = function (shopMemberId) {
Common
.
dismissLoadingIndicator
();
};
CollaborationUI
.
refreshJoinedCollaboration
=
function
(
loginIdList
)
{
for
(
var
count
=
0
;
count
<
loginIdList
.
length
;
count
++
)
{
loginIdList
[
count
]
=
loginIdList
[
count
].
replaceAll
(
// Display User List
CollaborationUI
.
refreshJoinedCollaboration
=
function
(
loginIDList
)
{
for
(
var
count
=
0
;
count
<
loginIDList
.
length
;
count
++
)
{
loginIDList
[
count
]
=
loginIDList
[
count
].
replaceAll
(
globalUserInfo
.
shopName
+
"_"
,
""
);
...
...
@@ -400,18 +138,15 @@ CollaborationUI.refreshJoinedCollaboration = function (loginIdList) {
Common
.
showLoadingIndicator
();
$
(
"#collaboration_overlay_user_list"
).
html
(
""
);
var
joinedUserListTemplate
;
$
.
get
(
{
url
:
"./collaboration_overlay_user_list.html"
,
async
:
false
},
function
(
text
)
{
joinedUserListTemplate
=
text
;
}
const
joinedUserListTemplate
=
getTemplate
(
TemplateURL
.
COLLABORATION_OVERLAY_USER_LIST
);
var
joinedUserList
=
NativeBridgeDataSource
.
getUserListByLoginId
(
loginIdList
);
var
sortedUserList
=
new
Array
();
const
joinedUserList
=
NativeBridgeDataSource
.
getUserListByLoginId
(
loginIDList
);
const
sortedUserList
=
new
Array
();
loginI
d
List
.
forEach
(
function
(
userId
)
{
loginI
D
List
.
forEach
(
function
(
userId
)
{
joinedUserList
.
forEach
(
function
(
user
)
{
if
(
userId
==
user
.
loginId
)
{
sortedUserList
.
push
(
user
);
...
...
@@ -433,11 +168,6 @@ CollaborationUI.refreshJoinedCollaboration = function (loginIdList) {
Common
.
dismissLoadingIndicator
();
};
CollaborationUI
.
toggleCategory
=
function
(
category
)
{
$
(
category
).
toggleClass
(
"open"
);
$
(
category
).
next
().
slideToggle
();
};
CollaborationUI
.
refreshForOffline
=
function
()
{
serverInfo
.
isOnline
=
"false"
;
if
(
typeof
coview_api
==
"undefined"
)
{
...
...
public_new/js/views/collaboration/share-bind-button-action.js
0 → 100644
View file @
ac2f8381
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
);
}
public_new/js/views/collaboration/share-event-listener.js
0 → 100644
View file @
ac2f8381
var
CoviewBridge
=
{};
CoviewBridge
.
bindReadyEvent
=
function
()
{
coview_api
.
addEventListener
(
"ready"
,
function
()
{
console
.
log
(
"peacekim:: =============> READY : ready for coview api"
);
Coview_addLoginId
(
globalUserInfo
.
loginId
);
coview_api
.
Login
(
globalUserInfo
.
loginId
);
initCollaborationUI
(
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
,
});
}
}
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
);
await
new
Promise
((
done
)
=>
setTimeout
(()
=>
done
(),
500
));
if
(
g_isMainMan
)
{
if
(
confirm
(
getLocalizedString
(
"norify_request_host_change"
,
data
.
payload
.
hostId
)
)
)
{
Coview_changeHost
(
getFermiLoginId
(
data
.
payload
.
hostId
));
NativeBridgeDelegate
.
setHostRequestFlg
(
HostRequestFlag
.
DONE
);
}
else
{
fw
.
sendToMsg
(
"others"
,
"HOST_REQUEST_REJECT"
,
{
hostId
:
data
.
payload
.
hostId
,
});
}
fw
.
sendToMsg
(
"others"
,
"HOST_REQUEST_DONE"
,
{
hostId
:
data
.
payload
.
hostId
,
});
}
}
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
;
}
}
});
});
};
CoviewBridge
.
bindStartEvent
=
function
()
{
coview_api
.
addEventListener
(
"start"
,
function
()
{
console
.
log
(
"peacekim:: =============> START : share start"
);
scrollLockON
();
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
};
CoviewBridge
.
bindAllByeEvent
=
function
()
{
coview_api
.
addEventListener
(
"allbye"
,
function
()
{
requestCollaborationFinish
();
var
isDocument
=
false
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
isDocument
=
true
;
}
if
(
deviceInfo
.
isAndroid
())
{
android
.
setExitHostAlert
();
}
if
(
isDocument
)
{
NativeBridgeDelegate
.
exitMeetingRoom
();
}
if
(
isInvited
==
InvitedFlag
.
NONE
)
{
NativeBridgeDelegate
.
joinRoom
(
roomInfo
.
roomID
,
roomInfo
.
roomName
);
}
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"
);
});
};
CoviewBridge
.
bindGuestByeEvent
=
function
()
{
coview_api
.
addEventListener
(
"guestbye"
,
function
()
{
console
.
log
(
" peacekim::=============> GUEST BYE : share guestbye"
);
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
};
CoviewBridge
.
bindDestroyEvent
=
function
()
{
coview_api
.
addEventListener
(
"destroy"
,
function
()
{
requestCollaborationFinish
();
console
.
log
(
"peacekim:: =============> DESTROY : share destroy"
);
alert
(
getLocalizedString
(
"inform_exit_host_collaboration"
));
var
isDocument
=
false
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
isDocument
=
true
;
}
Coview_exitCollaboration
(
isDocument
);
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
};
CoviewBridge
.
bindMessageEvent
=
function
()
{
let
meetingId
;
coview_api
.
addEventListener
(
"message"
,
async
function
(
event
,
json
)
{
console
.
log
(
"peacekim:: +++ addEventListener"
,
json
);
console
.
log
(
"peacekim:: processMessage api = "
,
json
.
api
);
if
(
isLeaved
)
return
;
let
loginIdList
=
new
Array
();
switch
(
json
.
api
)
{
case
"LoginResponse"
:
if
(
globalUserInfo
.
coWorkType
==
CollaborationTypeKey
.
DOCUMENT
)
{
isDocument
=
true
;
globalUserInfo
.
coWorkType
=
CollaborationTypeKey
.
AUDIO
;
}
if
(
globalUserInfo
.
coWorkType
==
CollaborationTypeKey
.
BOARD
)
{
isBoard
=
true
;
globalUserInfo
.
coWorkType
=
CollaborationTypeKey
.
AUDIO
;
}
hostSearchInterval
();
if
(
collaborationJoinFlg
==
"1"
)
{
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
if
(
isDocument
)
{
NativeBridgeDelegate
.
startContentView
();
}
}
else
if
(
collaborationJoinFlg
==
"0"
)
{
let
deleteRoomResult
=
JSON
.
parse
(
await
deleteRoomApi
(
globalUserInfo
.
roomId
)
);
if
(
deleteRoomResult
.
resultCode
==
200
)
{
await
new
Promise
((
done
)
=>
setTimeout
(()
=>
done
(),
3000
));
}
coview_api
.
CreateRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
if
(
isDocument
)
{
meetingId
=
NativeBridgeDataSource
.
createContentView
();
joinMeetingId
=
meetingId
;
}
}
else
if
(
collaborationJoinFlg
==
"2"
)
{
isInvited
=
InvitedFlag
.
INVITED
;
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
}
CollaborationUI
.
moveToVideoShareArea
();
break
;
case
"CreateRoomResponse"
:
if
(
json
.
resultCode
==
200
)
{
var
coviewInviteMessage
;
if
(
isDocument
)
{
coviewInviteMessage
=
""
+
messageSeperator
+
MessageType
.
COMMUNICATIONSTART
+
messageSeperator
+
CHAT_UTIL
.
getCollaborationType
(
CollaborationTypeKey
.
DOCUMENT
)
+
messageSeperator
+
meetingId
;
}
else
if
(
isBoard
)
{
coviewInviteMessage
=
""
+
messageSeperator
+
MessageType
.
COMMUNICATIONSTART
+
messageSeperator
+
COLLABORATION_TYPE
.
BOARD
;
}
else
{
coviewInviteMessage
=
""
+
messageSeperator
+
MessageType
.
COMMUNICATIONSTART
+
messageSeperator
+
CHAT_UTIL
.
getCollaborationType
(
globalUserInfo
.
coWorkType
);
}
CHAT_SOCKET
.
emitCreateMessage
(
coviewInviteMessage
,
0
);
}
break
;
case
"joinRoomInfoResponse"
:
if
(
json
.
resultCode
==
200
)
{
}
else
{
alert
(
getLocalizedString
(
"not_exist_sharing_call"
));
coview_api
.
LeaveRoom
();
$
(
".coview_share_area"
).
hide
();
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
NativeBridgeDelegate
.
joinRoom
(
roomInfo
.
roomID
,
roomInfo
.
roomName
);
}
break
;
case
"JoinRoomResponse"
:
if
(
json
.
resultCode
==
200
)
{
hostSearchInterval
();
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
}
CollaborationUI
.
refreshJoinedCollaboration
(
loginIdList
);
}
else
{
}
break
;
case
"RoomMemberJoinedEvent"
:
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
}
CollaborationUI
.
refreshJoinedCollaboration
(
loginIdList
);
break
;
case
"RoomMemberLeavedEvent"
:
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
}
CollaborationUI
.
refreshJoinedCollaboration
(
loginIdList
);
break
;
case
"HostRequest"
:
// to be called by
// wc_api.dispatchEvent (new Event ("message"), {"HostRequest":"userID"});
console
.
log
(
"peacekim:: t2 consoleLog"
,
json
);
break
;
case
"fileChange"
:
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
)
{
break
;
}
LoadMobileShareFile
(
json
.
fileName
);
backgroundFileName
=
json
.
fileName
;
console
.
log
(
"peacekim:: fileChange"
,
json
);
break
;
case
"ReceiveMediaResponse"
:
if
(
isBoard
&&
g_isMainMan
)
{
wc_api
.
dispatchEvent
(
new
Event
(
"message"
),
{
api
:
"fileChange"
,
fileName
:
backgroundFileName
,
});
}
break
;
default
:
console
.
log
(
"peacekim:: Unrecognized api"
,
json
);
break
;
}
});
};
function
Coview_changeHost
(
userId
)
{
console
.
log
(
"peacekim:: Change Host To "
+
userId
);
changeOwnerSend
(
userId
);
}
function
Coview_addLoginId
(
loginId
)
{
console
.
log
(
"peacekim:: addUser loginId = "
+
loginId
);
const
url
=
"https://biztaskyell.abookcloud.com/auth/getuser"
;
$
.
ajax
({
url
:
url
,
method
:
"post"
,
data
:
{
id
:
loginId
,
},
success
:
function
(
result
)
{
console
.
log
(
"peacekim:: t3 result"
,
result
);
if
(
result
.
statusCode
!=
200
)
{
coview_api
.
addUser
(
loginId
);
}
},
error
:
function
(
err
)
{
console
.
log
(
err
.
toString
());
},
});
}
function
hostSearchInterval
()
{
let
hostName
=
""
;
function
hostSearch
()
{
if
(
g_isMainMan
)
{
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
addClass
(
"host"
);
$
(
".host_contents"
).
removeClass
(
"none"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
".photo_select_button"
).
removeClass
(
"none"
);
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
".video_contents_host"
).
removeClass
(
"none"
);
$
(
".video_contents_user"
).
addClass
(
"none"
);
}
if
(
deviceInfo
.
isiOS
())
isIos
=
true
;
}
else
{
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
removeClass
(
"host"
);
$
(
".host_contents"
).
addClass
(
"none"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
".photo_select_button"
).
addClass
(
"none"
);
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
".video_contents_user"
).
removeClass
(
"none"
);
$
(
".video_contents_host"
).
addClass
(
"none"
);
}
}
if
(
hostName
!=
g_isMainManUsername
)
{
if
(
hostName
!=
""
)
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
removeClass
(
"host"
);
}
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
g_isMainManUsername
)
).
addClass
(
"host"
);
hostName
=
g_isMainManUsername
;
}
else
{
if
(
hostName
==
""
)
{
if
(
!
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
hasClass
(
"host"
)
&&
coview_api
.
getRoomUsers
()
)
{
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
addClass
(
"host"
);
}
}
else
{
if
(
!
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
hasClass
(
"host"
)
)
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
addClass
(
"host"
);
}
}
}
}
timeInterval
=
setInterval
(
hostSearch
,
2000
);
}
function
captureAndShareImage
(
urls
,
changeHostName
)
{
addCaptureEffect
();
$
(
this
).
removeClass
(
"on"
);
var
w
,
h
;
const
video
=
document
.
getElementById
(
"localVideo"
);
const
canvas
=
document
.
createElement
(
"canvas"
);
if
(
clientOrientaionState
==
1
)
{
canvas
.
width
=
w
=
680
;
canvas
.
height
=
h
=
515
;
}
else
{
canvas
.
width
=
w
=
386
;
canvas
.
height
=
h
=
515
;
}
if
(
canvas
.
getContext
)
{
const
ctx
=
canvas
.
getContext
(
"2d"
);
ctx
.
drawImage
(
video
,
0
,
0
,
w
,
h
);
ctx
.
drawImage
(
document
.
getElementById
(
"canvasRemote"
),
0
,
0
,
w
,
h
);
}
canvas
.
toBlob
(
function
(
blob
)
{
var
newImg
=
document
.
createElement
(
"img"
);
var
url
=
URL
.
createObjectURL
(
blob
);
canvasRemote
.
style
.
backgroundImage
=
"url('"
+
URL
.
createObjectURL
(
blob
)
+
"')"
;
canvasRemote
.
style
.
backgroundSize
=
"contain"
;
$
(
canvasRemote
).
attr
(
"height"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"height"
)
);
$
(
canvasRemote
).
attr
(
"width"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"width"
));
console
.
log
(
"peacekim:: t5 url"
,
URL
.
createObjectURL
(
blob
));
if
(
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
/
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
<
$
(
canvas
).
attr
(
"width"
)
/
$
(
canvas
).
attr
(
"height"
)
)
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
*
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
var
w
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
);
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
-
h
/
2
);
$
(
canvasRemote
).
css
(
"margin-left"
,
-
w
/
2
);
}
else
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
);
var
w
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
/
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
-
h
/
2
);
$
(
canvasRemote
).
css
(
"margin-left"
,
-
w
/
2
);
}
$
(
".canvas_wrap"
).
css
(
"background-color"
,
"#000"
);
$
(
".clear_img"
).
show
();
SetShareMenuState
(
"on"
);
WithImageShareBtnState
(
"on"
);
//Fermi側にイメージ保存。
var
formData
=
new
FormData
();
var
uploadFileName
=
"capture_share_"
+
g_webroom
+
"_"
+
g_shareCount
+
".png"
;
g_shareCount
++
;
formData
.
append
(
"imgFile"
,
blob
,
uploadFileName
);
var
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
":"
+
location
.
port
+
"/upload/create"
;
if
(
!
location
.
port
)
{
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
"/upload/create"
;
}
$
.
ajax
({
type
:
"post"
,
url
:
g_coviewapiserverADDR
+
"/upload/create"
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
res
)
{
setTimeout
(
function
()
{
SendFileShare
(
uploadFileName
);
$
(
"#coviewCaptureCtrBtn"
).
hide
();
$
(
"#coviewRecCtrBtn"
).
hide
();
$
(
".coview_share_title_name"
).
text
(
"LIVE(CAPTURE IMAGE)"
);
$
(
".coview_on_media_btn_back"
).
show
();
//アーカイブ保存。
ArchiveFileManage
(
blob
,
uploadFileName
,
urls
);
},
1500
);
},
error
:
function
(
err
)
{
console
.
log
(
err
);
},
});
});
}
function
getReplacedLoginId
(
loginId
)
{
return
loginId
.
replaceAll
(
globalUserInfo
.
shopName
+
"_"
,
""
);
}
function
Coview_exitCollaboration
(
isDocument
=
false
)
{
scrollLockOFF
();
if
(
g_isMainMan
)
{
requestCollaborationFinish
();
}
if
(
isDocument
)
{
NativeBridgeDelegate
.
exitMeetingRoom
();
}
if
(
$
(
"#recordBtn .record"
).
hasClass
(
"disable"
))
{
recordStop
(
Coview_finishCollaboration
);
}
else
{
Coview_finishCollaboration
();
}
}
function
Coview_finishCollaboration
()
{
clearInterval
(
timeInterval
);
coview_api
.
LeaveRoom
();
NativeBridgeDelegate
.
finishCollaboration
(
true
);
if
(
coview_api
.
getRoomUsers
())
{
NativeBridgeDelegate
.
finishCollaboration
();
}
isLeaved
=
true
;
if
(
isInvited
==
InvitedFlag
.
NONE
)
{
NativeBridgeDelegate
.
joinRoom
(
roomInfo
.
roomID
,
roomInfo
.
roomName
);
}
else
{
NativeBridgeDelegate
.
openCommunicationHome
();
}
}
public_new/js/views/collaboration/share.js
View file @
ac2f8381
...
...
@@ -10,524 +10,50 @@ var backgroundFileName;
var
isIos
;
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
var
coviewApiActive
=
coview_api
.
Init
({
testSTRParam
:
"param1"
,
testNUMParam
:
77
,
testBOOLParam
:
false
,
coview_api
.
Init
({
coview_api_srv_addr
:
"https://biztaskyell.abookcloud.com"
,
coview_wrap_id
:
"coviewShare"
,
coview_api_key
:
"8dda7092c5820d663"
,
});
// special button IN Chat ui
$
(
"#coviewShareMainBtn"
).
on
(
"click"
,
function
(
e
)
{
e
.
stopPropagation
();
if
(
$
(
".coview_share_dropdown_bar"
).
is
(
":visible"
)
==
true
)
{
Coview_shareDropdownHide
();
if
(
$
(
".coview_share_photo_select_bubble"
).
is
(
":visible"
)
==
true
)
{
$
(
".coview_share_photo_select_bubble"
).
slideUp
();
}
}
else
{
$
(
".coview_share_dropdown_bar"
).
slideDown
();
}
});
$
(
"#coviewShareCloseButton"
).
on
(
"click"
,
function
(
e
)
{
coview_api
.
LeaveRoom
();
$
(
".coview_share_area"
).
hide
();
});
$
(
"body"
).
on
(
"click"
,
function
()
{
Coview_shareDropdownHide
();
CollaborationUI
.
bindShareMainButton
();
if
(
$
(
".coview_share_photo_select_bubble"
).
is
(
":visible"
)
==
true
)
{
$
(
".coview_share_photo_select_bubble"
).
slideUp
();
}
else
{
$
(
".coview_share_dropdown_bar"
).
slideDown
();
}
});
CollaborationUI
.
bindShareCloseButton
();
$
(
document
).
on
(
"click"
,
".coview_share_request"
,
function
()
{
console
.
log
(
"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
(
"音声通話"
);
}
CollaborationUI
.
bindBodyClockEvent
();
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
Coview_moveToVideoShareArea
();
});
CollaborationUI
.
bindShareRequestButton
();
/* --------------------------------------------------- */
/* Video, photo, chat, doc */
/* --------------------------------------------------- */
$
(
"#coviewShareChat"
).
on
(
"click"
,
function
()
{
console
.
log
(
"ON click coviewShareChat"
);
});
$
(
"#coviewSharePhoto"
).
on
(
"click"
,
function
(
e
)
{
e
.
stopPropagation
();
console
.
log
(
"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
.
bindShareChat
();
$
(
"#coviewSharePhotoCamera"
).
on
(
"click"
,
function
()
{
$
(
".coview_share_photo_select_bubble"
).
hide
();
globalUserInfo
.
coWorkType
=
CollaborationTypeKey
.
CAMERA
;
coview_api
.
CreateRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
Coview_moveToVideoShareArea
();
CollaborationUI
.
bindSharePhotoTapped
();
$
(
".coview_share_title_name"
).
text
(
"カメラ"
);
});
$
(
"#coviewSharePhotoGallery"
).
on
(
"click"
,
function
()
{
$
(
".coview_share_photo_select_bubble"
).
hide
();
globalUserInfo
.
coWorkType
=
"gallery"
;
coview_api
.
CreateRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
Coview_moveToVideoShareArea
();
CollaborationUI
.
bindSharePhotoCameraTapped
();
$
(
".coview_share_title_name"
).
text
(
"ライブラリ"
);
});
CollaborationUI
.
bindSharePhotoLibraryTapped
();
$
(
"#coviewShareAudio"
).
on
(
"click"
,
function
()
{
Coview_connect_audio_collaboration
();
});
$
(
"#coviewShareLive"
).
on
(
"click"
,
function
()
{
console
.
log
(
"ON click coviewShareLive"
);
globalUserInfo
.
coWorkType
=
"video"
;
console
.
log
(
"globalUserInfo"
,
globalUserInfo
);
CollaborationUI
.
bindShareAudioTapped
();
coview_api
.
CreateRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
Coview_moveToVideoShareArea
();
$
(
".coview_share_title_name"
).
text
(
"LIVE"
);
});
CollaborationUI
.
bindShareLive
();
// todo: peacekim::
CoviewBridge
.
bindReadyEvent
();
coview_api
.
addEventListener
(
"ready"
,
function
()
{
console
.
log
(
"=============> READY : ready for coview api"
);
Coview_addLoginId
(
globalUserInfo
.
loginId
);
coview_api
.
Login
(
globalUserInfo
.
loginId
);
initCollaborationUI
(
joinCollaborationType
);
NativeBridgeDelegate
.
setHostRequestFlg
(
HostRequestFlag
.
DONE
);
fw
.
socket
.
on
(
"message"
,
async
function
(
data
)
{
console
.
log
(
"====> message::data: "
,
data
);
if
(
data
.
type
===
"CHANGE_COLLABORATION"
)
{
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
NativeBridgeDelegate
.
exitMeetingRoom
();
NativeBridgeDelegate
.
finishPIPMode
(
true
);
CoviewBridge
.
bindStartEvent
();
if
(
deviceInfo
.
isAndroid
())
{
$
(
".pip_indicator"
).
addClass
(
"none"
);
}
CoviewBridge
.
bindAllByeEvent
();
await
new
Promise
((
done
)
=>
setTimeout
(()
=>
done
(),
500
));
updateCanvasSize
();
}
CoviewBridge
.
bindGuestByeEvent
();
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
);
CoviewBridge
.
bindDestroyEvent
();
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
,
});
}
}
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
(
"ホスト変更によりレコードを終了しました"
);
});
}
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
);
await
new
Promise
((
done
)
=>
setTimeout
(()
=>
done
(),
500
));
if
(
g_isMainMan
)
{
if
(
confirm
(
getLocalizedString
(
"norify_request_host_change"
,
data
.
payload
.
hostId
)
)
)
{
Coview_changeHost
(
getFermiLoginId
(
data
.
payload
.
hostId
));
NativeBridgeDelegate
.
setHostRequestFlg
(
HostRequestFlag
.
DONE
);
}
else
{
fw
.
sendToMsg
(
"others"
,
"HOST_REQUEST_REJECT"
,
{
hostId
:
data
.
payload
.
hostId
,
});
}
fw
.
sendToMsg
(
"others"
,
"HOST_REQUEST_DONE"
,
{
hostId
:
data
.
payload
.
hostId
,
});
}
}
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
(
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
;
}
}
});
});
coview_api
.
addEventListener
(
"start"
,
function
()
{
console
.
log
(
"=============> START : share start"
);
scrollLockON
();
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
coview_api
.
addEventListener
(
"allbye"
,
function
()
{
requestCollaborationFinish
();
var
isDocument
=
false
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
isDocument
=
true
;
}
if
(
deviceInfo
.
isAndroid
())
{
android
.
setExitHostAlert
();
}
if
(
isDocument
)
{
NativeBridgeDelegate
.
exitMeetingRoom
();
}
if
(
isInvited
==
InvitedFlag
.
NONE
)
{
NativeBridgeDelegate
.
joinRoom
(
roomInfo
.
roomID
,
roomInfo
.
roomName
);
}
else
{
NativeBridgeDelegate
.
openCommunicationHome
();
}
console
.
log
(
"=============> HOST BYE : share hostbye"
);
// TODO: peacekim:: check not to need this method for android
if
(
deviceInfo
.
isiOS
())
{
NativeBridgeDelegate
.
showExitHostAlert
();
return
;
}
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
coview_api
.
addEventListener
(
"guestbye"
,
function
()
{
console
.
log
(
"=============> GUEST BYE : share guestbye"
);
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
coview_api
.
addEventListener
(
"destroy"
,
function
()
{
requestCollaborationFinish
();
console
.
log
(
"=============> DESTROY : share destroy"
);
alert
(
getLocalizedString
(
"inform_exit_host_collaboration"
));
var
isDocument
=
false
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
isDocument
=
true
;
}
Coview_exitCollaboration
(
isDocument
);
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
var
meetingId
;
coview_api
.
addEventListener
(
"message"
,
async
function
(
event
,
json
)
{
console
.
log
(
"+++ addEventListener"
,
json
);
console
.
log
(
"processMessage api = "
,
json
.
api
);
if
(
isLeaved
)
return
;
let
loginIdList
=
new
Array
();
switch
(
json
.
api
)
{
case
"LoginResponse"
:
if
(
globalUserInfo
.
coWorkType
==
CollaborationTypeKey
.
DOCUMENT
)
{
isDocument
=
true
;
globalUserInfo
.
coWorkType
=
CollaborationTypeKey
.
AUDIO
;
}
if
(
globalUserInfo
.
coWorkType
==
CollaborationTypeKey
.
BOARD
)
{
isBoard
=
true
;
globalUserInfo
.
coWorkType
=
CollaborationTypeKey
.
AUDIO
;
}
hostSearchInterval
();
if
(
collaborationJoinFlg
==
"1"
)
{
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
if
(
isDocument
)
{
NativeBridgeDelegate
.
startContentView
();
}
}
else
if
(
collaborationJoinFlg
==
"0"
)
{
let
deleteRoomResult
=
JSON
.
parse
(
await
deleteRoomApi
(
globalUserInfo
.
roomId
)
);
if
(
deleteRoomResult
.
resultCode
==
200
)
{
await
new
Promise
((
done
)
=>
setTimeout
(()
=>
done
(),
3000
));
}
coview_api
.
CreateRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
if
(
isDocument
)
{
meetingId
=
NativeBridgeDataSource
.
createContentView
();
joinMeetingId
=
meetingId
;
}
}
else
if
(
collaborationJoinFlg
==
"2"
)
{
isInvited
=
InvitedFlag
.
INVITED
;
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
}
Coview_moveToVideoShareArea
();
break
;
case
"CreateRoomResponse"
:
if
(
json
.
resultCode
==
200
)
{
var
coviewInviteMessage
;
if
(
isDocument
)
{
coviewInviteMessage
=
""
+
messageSeperator
+
MessageType
.
COMMUNICATIONSTART
+
messageSeperator
+
CHAT_UTIL
.
getCollaborationType
(
CollaborationTypeKey
.
DOCUMENT
)
+
messageSeperator
+
meetingId
;
}
else
if
(
isBoard
)
{
coviewInviteMessage
=
""
+
messageSeperator
+
MessageType
.
COMMUNICATIONSTART
+
messageSeperator
+
COLLABORATION_TYPE
.
BOARD
;
}
else
{
coviewInviteMessage
=
""
+
messageSeperator
+
MessageType
.
COMMUNICATIONSTART
+
messageSeperator
+
CHAT_UTIL
.
getCollaborationType
(
globalUserInfo
.
coWorkType
);
}
CHAT_SOCKET
.
emitCreateMessage
(
coviewInviteMessage
,
0
);
}
break
;
case
"joinRoomInfoResponse"
:
if
(
json
.
resultCode
==
200
)
{
}
else
{
alert
(
getLocalizedString
(
"not_exist_sharing_call"
));
coview_api
.
LeaveRoom
();
$
(
".coview_share_area"
).
hide
();
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
NativeBridgeDelegate
.
joinRoom
(
roomInfo
.
roomID
,
roomInfo
.
roomName
);
}
break
;
case
"JoinRoomResponse"
:
if
(
json
.
resultCode
==
200
)
{
hostSearchInterval
();
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
}
CollaborationUI
.
refreshJoinedCollaboration
(
loginIdList
);
}
else
{
}
break
;
case
"RoomMemberJoinedEvent"
:
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
}
CollaborationUI
.
refreshJoinedCollaboration
(
loginIdList
);
break
;
case
"RoomMemberLeavedEvent"
:
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
}
CollaborationUI
.
refreshJoinedCollaboration
(
loginIdList
);
break
;
case
"HostRequest"
:
// to be called by
// wc_api.dispatchEvent (new Event ("message"), {"HostRequest":"userID"});
console
.
log
(
"consoleLog"
,
json
);
break
;
case
"fileChange"
:
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
)
{
break
;
}
LoadMobileShareFile
(
json
.
fileName
);
backgroundFileName
=
json
.
fileName
;
console
.
log
(
"fileChange"
,
json
);
break
;
case
"ReceiveMediaResponse"
:
if
(
isBoard
&&
g_isMainMan
)
{
wc_api
.
dispatchEvent
(
new
Event
(
"message"
),
{
api
:
"fileChange"
,
fileName
:
backgroundFileName
,
});
}
break
;
default
:
console
.
log
(
"Unrecognized api"
,
json
);
break
;
}
});
CoviewBridge
.
bindMessageEvent
();
});
function
Coview_shareDropdownHide
()
{
$
(
".coview_share_dropdown_bar"
).
slideUp
();
$
(
".coview_share_photo_select_bubble"
).
slideUp
();
}
function
Coview_moveToVideoShareArea
()
{
$
(
"#loadingIndicator"
).
addClass
(
"full_active"
);
$
(
".coview_share_area"
).
show
();
$
(
"#collabo_main"
).
removeClass
(
"none"
);
}
function
Coview_moveToAudioShareArea
()
{
$
(
".coview_share_area"
).
addClass
(
"none"
);
$
(
"#collabo_main"
).
removeClass
(
"none"
);
$
(
".talking_area"
).
removeClass
(
"none"
);
}
// call from collaboration_overlay_menu.html and collaboration.html
function
changeCollaboration
(
changeCollaborationType
)
{
recordStop
(
function
()
{
var
newMeetingId
=
0
;
...
...
@@ -560,16 +86,18 @@ function changeCollaboration(changeCollaborationType) {
coview_api
.
ChangeCollaboration
(
"audio"
);
break
;
}
if
(
$
(
"#micBtn .voice"
).
hasClass
(
"disable"
))
{
micOff
();
}
else
{
micOn
();
}
penOff
();
NativeBridgeDelegate
.
changeCollaboration
(
changeCollaborationType
,
newMeetingId
);
joinMeetingId
=
newMeetingId
;
fw
.
sendToMsg
(
"others"
,
"CHANGE_COLLABORATION"
,
{
collaborationType
:
changeCollaborationType
,
...
...
@@ -618,7 +146,7 @@ async function initCollaborationUI(changeCollaborationType) {
}
$
(
"link[href='./css/collaboration_board.css']"
).
remove
();
penOff
();
switch
(
changeCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
$
(
".collaboration_contents"
).
addClass
(
"none"
);
...
...
@@ -648,62 +176,7 @@ async function initCollaborationUI(changeCollaborationType) {
$
(
".before_loading_indicator"
).
addClass
(
"none"
);
}
function
Coview_exitCollaboration
(
isDocument
=
false
)
{
scrollLockOFF
();
if
(
g_isMainMan
)
{
requestCollaborationFinish
();
}
if
(
isDocument
)
{
NativeBridgeDelegate
.
exitMeetingRoom
();
}
if
(
$
(
"#recordBtn .record"
).
hasClass
(
"disable"
))
{
recordStop
(
Coview_finishCollaboration
);
}
else
{
Coview_finishCollaboration
();
}
}
function
Coview_finishCollaboration
()
{
clearInterval
(
timeInterval
);
coview_api
.
LeaveRoom
();
NativeBridgeDelegate
.
finishCollaboration
(
true
);
if
(
coview_api
.
getRoomUsers
())
{
NativeBridgeDelegate
.
finishCollaboration
();
}
isLeaved
=
true
;
if
(
isInvited
==
InvitedFlag
.
NONE
)
{
NativeBridgeDelegate
.
joinRoom
(
roomInfo
.
roomID
,
roomInfo
.
roomName
);
}
else
{
NativeBridgeDelegate
.
openCommunicationHome
();
}
}
function
Coview_changeHost
(
userId
)
{
console
.
log
(
"Change Host To "
+
userId
);
changeOwnerSend
(
userId
);
}
function
Coview_addLoginId
(
loginId
)
{
console
.
log
(
"addUser loginId = "
+
loginId
);
const
url
=
"https://biztaskyell.abookcloud.com/auth/getuser"
;
$
.
ajax
({
url
:
url
,
method
:
"post"
,
data
:
{
id
:
loginId
,
},
success
:
function
(
result
)
{
console
.
log
(
"result"
,
result
);
if
(
result
.
statusCode
!=
200
)
{
coview_api
.
addUser
(
loginId
);
}
},
error
:
function
(
err
)
{
console
.
log
(
err
.
toString
());
},
});
}
// call from modal_collabo_host_request.html
function
applyForHostChange
()
{
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
...
...
@@ -726,76 +199,7 @@ function applyForHostChange() {
});
}
function
Coview_connect_audio_collaboration
()
{
globalUserInfo
.
coWorkType
=
CollaborationTypeKey
.
AUDIO
;
coview_api
.
deleteRoom
(
globalUserInfo
.
roomId
);
coview_api
.
CreateRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
Coview_moveToVideoShareArea
();
Coview_moveToAudioShareArea
();
$
(
".coview_share_title_name"
).
text
(
"音声通話"
);
}
function
hostSearchInterval
()
{
let
hostName
=
""
;
function
hostSearch
()
{
if
(
g_isMainMan
)
{
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
addClass
(
"host"
);
$
(
".host_contents"
).
removeClass
(
"none"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
".photo_select_button"
).
removeClass
(
"none"
);
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
".video_contents_host"
).
removeClass
(
"none"
);
$
(
".video_contents_user"
).
addClass
(
"none"
);
}
if
(
deviceInfo
.
isiOS
())
isIos
=
true
;
}
else
{
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
removeClass
(
"host"
);
$
(
".host_contents"
).
addClass
(
"none"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
".photo_select_button"
).
addClass
(
"none"
);
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
".video_contents_user"
).
removeClass
(
"none"
);
$
(
".video_contents_host"
).
addClass
(
"none"
);
}
}
if
(
hostName
!=
g_isMainManUsername
)
{
if
(
hostName
!=
""
)
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
removeClass
(
"host"
);
}
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
g_isMainManUsername
)
).
addClass
(
"host"
);
hostName
=
g_isMainManUsername
;
}
else
{
if
(
hostName
==
""
)
{
if
(
!
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
hasClass
(
"host"
)
&&
coview_api
.
getRoomUsers
()
)
{
$
(
"#collaboration_user_"
+
currentUserInfo
.
loginID
).
addClass
(
"host"
);
}
}
else
{
if
(
!
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
hasClass
(
"host"
)
)
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
addClass
(
"host"
);
}
}
}
}
timeInterval
=
setInterval
(
hostSearch
,
2000
);
}
// call from modal_collabo_profile.html
function
hostChangeRequest
(
loginId
)
{
fw
.
sendToMsg
(
"others"
,
"HOST_CHANGE_REQUEST"
,
{
loginId
:
getFermiLoginId
(
loginId
),
...
...
@@ -806,217 +210,6 @@ function getFermiLoginId(loginId) {
return
globalUserInfo
.
shopName
+
"_"
+
loginId
;
}
function
getReplacedLoginId
(
loginId
)
{
return
loginId
.
replaceAll
(
globalUserInfo
.
shopName
+
"_"
,
""
);
}
function
captureAndShareImage
(
urls
,
changeHostName
)
{
addCaptureEffect
();
$
(
this
).
removeClass
(
"on"
);
var
w
,
h
;
const
video
=
document
.
getElementById
(
"localVideo"
);
const
canvas
=
document
.
createElement
(
"canvas"
);
if
(
clientOrientaionState
==
1
)
{
canvas
.
width
=
w
=
680
;
canvas
.
height
=
h
=
515
;
}
else
{
canvas
.
width
=
w
=
386
;
canvas
.
height
=
h
=
515
;
}
if
(
canvas
.
getContext
)
{
const
ctx
=
canvas
.
getContext
(
"2d"
);
ctx
.
drawImage
(
video
,
0
,
0
,
w
,
h
);
ctx
.
drawImage
(
document
.
getElementById
(
"canvasRemote"
),
0
,
0
,
w
,
h
);
}
canvas
.
toBlob
(
function
(
blob
)
{
var
newImg
=
document
.
createElement
(
"img"
);
var
url
=
URL
.
createObjectURL
(
blob
);
canvasRemote
.
style
.
backgroundImage
=
"url('"
+
URL
.
createObjectURL
(
blob
)
+
"')"
;
canvasRemote
.
style
.
backgroundSize
=
"contain"
;
$
(
canvasRemote
).
attr
(
"height"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"height"
)
);
$
(
canvasRemote
).
attr
(
"width"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"width"
));
console
.
log
(
"url"
,
URL
.
createObjectURL
(
blob
));
if
(
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
/
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
<
$
(
canvas
).
attr
(
"width"
)
/
$
(
canvas
).
attr
(
"height"
)
)
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
*
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
var
w
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
);
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
-
h
/
2
);
$
(
canvasRemote
).
css
(
"margin-left"
,
-
w
/
2
);
}
else
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
);
var
w
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
/
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
-
h
/
2
);
$
(
canvasRemote
).
css
(
"margin-left"
,
-
w
/
2
);
}
$
(
".canvas_wrap"
).
css
(
"background-color"
,
"#000"
);
$
(
".clear_img"
).
show
();
SetShareMenuState
(
"on"
);
WithImageShareBtnState
(
"on"
);
//Fermi側にイメージ保存。
var
formData
=
new
FormData
();
var
uploadFileName
=
"capture_share_"
+
g_webroom
+
"_"
+
g_shareCount
+
".png"
;
g_shareCount
++
;
formData
.
append
(
"imgFile"
,
blob
,
uploadFileName
);
var
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
":"
+
location
.
port
+
"/upload/create"
;
if
(
!
location
.
port
)
{
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
"/upload/create"
;
}
$
.
ajax
({
type
:
"post"
,
url
:
g_coviewapiserverADDR
+
"/upload/create"
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
res
)
{
setTimeout
(
function
()
{
SendFileShare
(
uploadFileName
);
$
(
"#coviewCaptureCtrBtn"
).
hide
();
$
(
"#coviewRecCtrBtn"
).
hide
();
$
(
".coview_share_title_name"
).
text
(
"LIVE(CAPTURE IMAGE)"
);
$
(
".coview_on_media_btn_back"
).
show
();
//アーカイブ保存。
ArchiveFileManage
(
blob
,
uploadFileName
,
urls
);
},
1500
);
},
error
:
function
(
err
)
{
console
.
log
(
err
);
},
});
});
}
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
(
"レコードを開始しました"
);
MainManRecord
(
"on"
);
$
(
"#recordBtn .record"
).
addClass
(
"disable"
);
$
(
".flash-txt"
).
addClass
(
"on"
);
}
function
recordFinished
()
{
$
(
"#recordBtn .record"
).
removeClass
(
"disable"
);
$
(
".flash-txt"
).
removeClass
(
"on"
);
// ロック画面の削除
delete_dom_obj
(
"screenLock"
);
}
function
toggleRecord
()
{
if
(
!
$
(
"#recordBtn .record"
).
hasClass
(
"disable"
))
{
recordStart
();
}
else
{
recordStop
(
function
()
{
console
.
log
(
"レコードを終了しました"
);
});
}
}
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
(
"Record fail"
);
callback
();
}
console
.
log
(
"Recorded Blobs: "
,
recordedBlobs
);
setTimeout
(
function
()
{
console
.
log
(
"Recoding File upload.."
);
const
blob
=
new
Blob
(
recordedBlobs
,
{
type
:
"video/webm"
});
console
.
log
(
blob
);
const
uploadFileName
=
"record_"
+
g_webroom
+
"_"
+
g_shareCount
+
".webm"
;
g_shareCount
++
;
var
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
);
}
console
.
log
(
uploadFileName
);
$
.
ajax
({
type
:
"post"
,
url
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
success
:
function
(
res
)
{
recordFinished
();
Common
.
dismissLoadingIndicator
();
console
.
log
(
res
);
callback
();
},
error
:
function
(
err
)
{
recordFinished
();
Common
.
dismissLoadingIndicator
();
console
.
log
(
err
);
callback
();
},
});
},
1000
);
}
function
screenLock
()
{
// ロック用のdivを生成
const
element
=
document
.
createElement
(
"div"
);
...
...
@@ -1036,7 +229,7 @@ function screenLock() {
}
// div削除関数
function
delete
_dom_obj
(
id_name
)
{
function
delete
DOMObject
(
id_name
)
{
const
dom_obj
=
document
.
getElementById
(
id_name
);
const
dom_obj_parent
=
dom_obj
.
parentNode
;
dom_obj_parent
.
removeChild
(
dom_obj
);
...
...
@@ -1052,38 +245,3 @@ function requestCollaborationFinish() {
async
function
waitMillisecond
(
millesecond
)
{
await
new
Promise
((
done
)
=>
setTimeout
(()
=>
done
(),
millesecond
));
}
function
penToggle
()
{
$
(
"#coviewPenCtrBtn"
).
click
();
if
(
$
(
"#penBtn .pen"
).
hasClass
(
"disable"
))
{
$
(
"#penBtn .pen"
).
removeClass
(
"disable"
);
}
else
{
$
(
"#penBtn .pen"
).
addClass
(
"disable"
);
}
}
function
photo_open_place_holderToggle
()
{
$
(
"#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
,
});
}
public_new/js/views/contact/namecard.js
View file @
ac2f8381
...
...
@@ -115,3 +115,4 @@ Namecard.refreshForOnline = function () {
Namecard
.
refreshForOffline
=
function
()
{
$
(
"#favoriteButton"
).
prop
(
"disabled"
,
true
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment