Commit 00a8e77e by Kim Peace

Fixed host mark display logics

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