Commit 00a8e77e by Kim Peace

Fixed host mark display logics

parent f6859950
...@@ -90,7 +90,7 @@ var CoviewUserInfo = class { ...@@ -90,7 +90,7 @@ var CoviewUserInfo = class {
// variable name for legacy connection to agent_app.js in coview library // variable name for legacy connection to agent_app.js in coview library
var globalUserInfo = new CoviewUserInfo( var globalUserInfo = new CoviewUserInfo(
currentUserInfo.sid, currentUserInfo.sid,
currentUserInfo.loginID, currentUserInfo.shopName + "_" + currentUserInfo.loginID,
roomInfo.roomID, roomInfo.roomID,
currentUserInfo.shopName currentUserInfo.shopName
); );
...@@ -3,7 +3,7 @@ var FermiWebSocketBridge = {}; ...@@ -3,7 +3,7 @@ var FermiWebSocketBridge = {};
// call from modal_collabo_profile.html // call from modal_collabo_profile.html
FermiWebSocketBridge.requestHostChange = function (loginID) { FermiWebSocketBridge.requestHostChange = function (loginID) {
fw.sendToMsg("others", "HOST_CHANGE_REQUEST", { fw.sendToMsg("others", "HOST_CHANGE_REQUEST", {
loginId: getFermiLoginId(loginID), loginId: loginID,
}); });
}; };
...@@ -19,14 +19,14 @@ FermiWebSocketBridge.hostChangeResponse = function () { ...@@ -19,14 +19,14 @@ FermiWebSocketBridge.hostChangeResponse = function () {
fw.sendToMsg("others", "HOST_CHANGE_RESPONSE", { fw.sendToMsg("others", "HOST_CHANGE_RESPONSE", {
isAndroid: deviceInfo.isAndroid(), isAndroid: deviceInfo.isAndroid(),
isAble: deviceInfo.androidVersion >= ANDROID_SDK_VERSION.O, isAble: deviceInfo.androidVersion >= ANDROID_SDK_VERSION.O,
loginId: currentUserInfo.loginID, loginId: globalUserInfo.loginId,
}); });
}; };
// PIP_END_REQUEST // PIP_END_REQUEST
FermiWebSocketBridge.pipEndRequest = function (loginID) { FermiWebSocketBridge.pipEndRequest = function (loginID) {
fw.sendToMsg("others", "PIP_END_REQUEST", { fw.sendToMsg("others", "PIP_END_REQUEST", {
loginId: getFermiLoginId(loginID), loginId: loginID,
}); });
}; };
...@@ -65,7 +65,7 @@ FermiWebSocketBridge.captureRequest = function () { ...@@ -65,7 +65,7 @@ FermiWebSocketBridge.captureRequest = function () {
// todo: peacekim:: check if it's okay for loginID // todo: peacekim:: check if it's okay for loginID
// instead of globalUserInfo.loginId // instead of globalUserInfo.loginId
fw.sendToMsg("others", "CAPTURE_REQUEST", { fw.sendToMsg("others", "CAPTURE_REQUEST", {
name: currentUserInfo.loginID, name: globalUserInfo.loginId,
}); });
}; };
...@@ -83,6 +83,6 @@ FermiWebSocketBridge.changeCollaboration = function ( ...@@ -83,6 +83,6 @@ FermiWebSocketBridge.changeCollaboration = function (
// CHANGE_HOST_APPLY // CHANGE_HOST_APPLY
FermiWebSocketBridge.changeHostApply = function () { FermiWebSocketBridge.changeHostApply = function () {
fw.sendToMsg("others", "CHANGE_HOST_APPLY", { fw.sendToMsg("others", "CHANGE_HOST_APPLY", {
hostId: currentUserInfo.loginID, hostId: globalUserInfo.loginId,
}); });
}; };
...@@ -7,10 +7,9 @@ FermiWebSocketMessageHandler.bindWebSocketMessage = function () { ...@@ -7,10 +7,9 @@ FermiWebSocketMessageHandler.bindWebSocketMessage = function () {
} else if (data.payload.loginId == globalUserInfo.loginId) { } else if (data.payload.loginId == globalUserInfo.loginId) {
// 自分自身の場合 // 自分自身の場合
FermiWebSocketMessageHandler.handleMessagesToSelf(data); FermiWebSocketMessageHandler.handleMessagesToSelf(data);
} else { }
// global messages // global messages
FermiWebSocketMessageHandler.handleMessagesToAll(data); FermiWebSocketMessageHandler.handleMessagesToAll(data);
}
}); });
}; };
...@@ -70,6 +69,7 @@ FermiWebSocketMessageHandler.handleMessagesToAll = function (data) { ...@@ -70,6 +69,7 @@ FermiWebSocketMessageHandler.handleMessagesToAll = function (data) {
break; break;
case "API_SEND_OWNER_CHANGE_COMPLETE": case "API_SEND_OWNER_CHANGE_COMPLETE":
FermiWebSocketMessageHandler.apiSendOwnerChangeComplete(data); FermiWebSocketMessageHandler.apiSendOwnerChangeComplete(data);
CollaborationFeature.updateHost();
break; break;
case "API_SEND_OWNER_CHANGE_CONFIRM": case "API_SEND_OWNER_CHANGE_CONFIRM":
if (globalUserInfo.collaborationType == COLLABORATION_TYPE.CAMERA) { if (globalUserInfo.collaborationType == COLLABORATION_TYPE.CAMERA) {
...@@ -81,6 +81,7 @@ FermiWebSocketMessageHandler.handleMessagesToAll = function (data) { ...@@ -81,6 +81,7 @@ FermiWebSocketMessageHandler.handleMessagesToAll = function (data) {
break; break;
case "HOST_REQUEST_DONE": case "HOST_REQUEST_DONE":
FermiWebSocketMessageHandler.hostRequestDone(); FermiWebSocketMessageHandler.hostRequestDone();
CollaborationFeature.updateHost();
break; break;
case "HOST_REQUEST_REJECT": case "HOST_REQUEST_REJECT":
FermiWebSocketMessageHandler.hostRequestReject(data); FermiWebSocketMessageHandler.hostRequestReject(data);
...@@ -89,6 +90,7 @@ FermiWebSocketMessageHandler.handleMessagesToAll = function (data) { ...@@ -89,6 +90,7 @@ FermiWebSocketMessageHandler.handleMessagesToAll = function (data) {
if (globalUserInfo.joinType != COLLABORATION_JOIN_TYPE.INVITED) { if (globalUserInfo.joinType != COLLABORATION_JOIN_TYPE.INVITED) {
FermiWebSocketMessageHandler.apiWelcome(); FermiWebSocketMessageHandler.apiWelcome();
} }
CollaborationFeature.updateHost();
break; break;
default: default:
break; break;
...@@ -167,7 +169,7 @@ FermiWebSocketMessageHandler.captureRequest = function (data) { ...@@ -167,7 +169,7 @@ FermiWebSocketMessageHandler.captureRequest = function (data) {
// HOST_CHANGE_REQUEST // HOST_CHANGE_REQUEST
FermiWebSocketMessageHandler.hostChangeRequest = function () { FermiWebSocketMessageHandler.hostChangeRequest = function () {
FermiWebSocketBridge.hostChangeRequest(); FermiWebSocketBridge.requestHostChange();
}; };
// HOST_CHANGE_RESPONSE // HOST_CHANGE_RESPONSE
...@@ -185,7 +187,7 @@ FermiWebSocketMessageHandler.hostChangeResponse = function (data) { ...@@ -185,7 +187,7 @@ FermiWebSocketMessageHandler.hostChangeResponse = function (data) {
} else { } else {
FermiWebSocketBridge.pipEndRequest(data.payload.loginId); FermiWebSocketBridge.pipEndRequest(data.payload.loginId);
waitMillisecond(500); waitMillisecond(500);
CoviewBridge.changeHost(getFermiLoginId(data.payload.loginId)); CoviewBridge.changeHost(data.payload.loginId);
} }
}; };
...@@ -236,7 +238,7 @@ FermiWebSocketMessageHandler.changeHostApplyForHost = function (data) { ...@@ -236,7 +238,7 @@ FermiWebSocketMessageHandler.changeHostApplyForHost = function (data) {
waitMillisecond(500); waitMillisecond(500);
if (confirm(getLocalizedString("norify_request_host_change", hostID))) { if (confirm(getLocalizedString("norify_request_host_change", hostID))) {
CoviewBridge.changeHost(getFermiLoginId(hostID)); CoviewBridge.changeHost(hostID);
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE); NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
} else { } else {
FermiWebSocketBridge.hostRequestReject(hostID); FermiWebSocketBridge.hostRequestReject(hostID);
...@@ -251,7 +253,7 @@ FermiWebSocketMessageHandler.hostRequestDone = function () { ...@@ -251,7 +253,7 @@ FermiWebSocketMessageHandler.hostRequestDone = function () {
// HOST_REQUEST_REJECT // HOST_REQUEST_REJECT
FermiWebSocketMessageHandler.hostRequestReject = function (data) { FermiWebSocketMessageHandler.hostRequestReject = function (data) {
if (data.payload.hostId == currentUserInfo.loginID) { if (data.payload.hostId == globalUserInfo.loginId) {
alert("REJECT for owner user"); alert("REJECT for owner user");
} }
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE); NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
......
...@@ -102,7 +102,6 @@ CoviewBridge.bindMessageEvent = function () { ...@@ -102,7 +102,6 @@ CoviewBridge.bindMessageEvent = function () {
if (globalUserInfo.isLeaved) { if (globalUserInfo.isLeaved) {
return; return;
} }
let loginIDList = new Array();
switch (json.api) { switch (json.api) {
case "LoginResponse": case "LoginResponse":
CollaborationFeature.didReceiveLoginResponseMessage(); CollaborationFeature.didReceiveLoginResponseMessage();
...@@ -126,10 +125,11 @@ CoviewBridge.bindMessageEvent = function () { ...@@ -126,10 +125,11 @@ CoviewBridge.bindMessageEvent = function () {
case "RoomMemberJoinedEvent": case "RoomMemberJoinedEvent":
// fall through // fall through
case "RoomMemberLeavedEvent": case "RoomMemberLeavedEvent":
attendingUsers = new Array();
for (let key in g_participants) { for (let key in g_participants) {
loginIDList.push(key); attendingUsers.push(key);
} }
CollaborationUI.refreshJoinedCollaboration(loginIDList); CollaborationUI.refreshJoinedCollaboration(attendingUsers);
break; break;
case "HostRequest": case "HostRequest":
// to be called by // to be called by
...@@ -230,7 +230,7 @@ CollaborationFeature.didReceivedJoinRoomInfoResponseMessage = function () { ...@@ -230,7 +230,7 @@ CollaborationFeature.didReceivedJoinRoomInfoResponseMessage = function () {
CoviewBridge.changeHost = function (userID) { CoviewBridge.changeHost = function (userID) {
// call in agent_app.js // call in agent_app.js
changeOwnerSend(userID); coview_api.HostChange(userID);
}; };
CoviewBridge.addLoginID = function (loginID) { CoviewBridge.addLoginID = function (loginID) {
...@@ -260,6 +260,8 @@ CollaborationFeature.updateHost = function () { ...@@ -260,6 +260,8 @@ CollaborationFeature.updateHost = function () {
} }
CollaborationUI.showHostMark(g_isMainManUsername); CollaborationUI.showHostMark(g_isMainManUsername);
$("#remoteVideoNameSpan").addClass("hide");
}; };
CollaborationUI.showHostButtons = function () { CollaborationUI.showHostButtons = function () {
...@@ -287,24 +289,23 @@ CollaborationUI.hideHostButtons = function () { ...@@ -287,24 +289,23 @@ CollaborationUI.hideHostButtons = function () {
}; };
CollaborationUI.showHostMark = function (hostName) { CollaborationUI.showHostMark = function (hostName) {
const currentUserLoginIDDiv = $( // remove all host mark
"#collaboration_user_" + currentUserInfo.loginID attendingUsers.forEach(function (userName) {
); const user = "#collaboration_user_" + getReplacedLoginId(userName);
const replaceHostIDDiv = $( $(user).removeClass("host");
"#collaboration_user_" + getReplacedLoginId(hostName) })
);
const replacedMainManUserID = $(
"#collaboration_user_" + getReplacedLoginId(g_isMainManUsername)
);
// set host name as current user if host name is not set
if (hostName == "") { if (hostName == "") {
if (!currentUserLoginIDDiv.hasClass("host") && coview_api.getRoomUsers()) { hostName = getReplacedLoginId(globalUserInfo.loginId);
currentUserLoginIDDiv.addClass("host");
}
} else {
if (!replaceHostIDDiv.hasClass("host")) {
replaceHostIDDiv.addClass("host");
} }
// find host named div
const hostUserDiv = $("#collaboration_user_" + getReplacedLoginId(hostName));
// add host mark
if (!hostUserDiv.hasClass("host")) {
hostUserDiv.addClass("host");
} }
}; };
...@@ -457,9 +458,9 @@ CollaborationUI.refreshJoinedCollaboration = function (loginIDList) { ...@@ -457,9 +458,9 @@ CollaborationUI.refreshJoinedCollaboration = function (loginIDList) {
NativeBridgeDataSource.getUserListByLoginId(loginIDList); NativeBridgeDataSource.getUserListByLoginId(loginIDList);
const sortedUserList = new Array(); const sortedUserList = new Array();
loginIDList.forEach(function (userId) { loginIDList.forEach(function (userID) {
joinedUserList.forEach(function (user) { joinedUserList.forEach(function (user) {
if (userId == user.loginId) { if (userID == user.loginId) {
sortedUserList.push(user); sortedUserList.push(user);
} }
}); });
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Functions */ /* Functions */
/* --------------------------------------------------- */ /* --------------------------------------------------- */
let coview_api = new CoviewApi(); let coview_api = new CoviewApi();
var attendingUsers = new Array();
var isBoard = false; var isBoard = false;
var backgroundFileName; var backgroundFileName;
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<div class="collabo_btn"> <div class="collabo_btn">
<button class="collaboation_join_button" type="button" name="button" <button class="collaboation_join_button" type="button" name="button"
class="d-flex flex-row justify-content-center align-items-center" class="d-flex flex-row justify-content-center align-items-center"
onclick="NativeBridgeDelegate.joinCollaboration('{{collaborationType}}', {{meetingId}})" {{#isEnded}} disabled onclick="NativeBridgeDelegate.joinCollaboration('{{collaborationType}}', {{meetingId}})" {{#isEnded}}
{{/isEnded}}> disabled {{/isEnded}}>
<img src="icon/icon_profile_phone_white.svg" alt="通話"> <img src="icon/icon_profile_phone_white.svg" alt="通話">
{{#isEnded}} {{#isEnded}}
<span class="collaboration_join_message">終了しました</span> <span class="collaboration_join_message">終了しました</span>
Please register or sign in to reply
......
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