Commit 859ef75a by Kim Peace

Merge branch 'feature/add_user_in_collaboration' into debug/console_logs

# Conflicts:
#	public_new/js/sockets/chat-websocket-message.js
parents c9e99c56 af6ab7c4
......@@ -10,7 +10,7 @@ CHAT_SOCKET.bindOnNewMessage = function () {
", roomName: " +
roomName
);
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_MESSAGE)
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_MESSAGE);
});
socket.on(SOCKET_KEY.NEW_COMMUNICATION, function (message, roomID, roomName) {
......@@ -22,7 +22,7 @@ CHAT_SOCKET.bindOnNewMessage = function () {
", roomName: " +
roomName
);
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_COMMUNICATION)
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_COMMUNICATION);
});
};
......@@ -42,9 +42,7 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey) {
const messageType = socketKey;
const messageText = unwrappedMessageInfo;
if (
messageType == SOCKET_KEY.NEW_COMMUNICATION
) {
if (messageType == SOCKET_KEY.NEW_COMMUNICATION) {
CHAT_SOCKET.addCollaborationMessage(
messageInfo,
message.userId,
......@@ -64,7 +62,7 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey) {
} else {
Common.dismissLoadingIndicator();
}
}
};
CHAT_SOCKET.decodeMessage = function (text) {
try {
......
......@@ -204,9 +204,9 @@ var bindOnRefreshUserListInGroup = function () {
};
var nextFibonacci = function (num) {
let nextNum = num * (1 + Math.sqrt(5)) / 2.0;
let nextNum = (num * (1 + Math.sqrt(5))) / 2.0;
return Math.round(nextNum);
}
};
CHAT_SOCKET.emitCreateMessage = function (socketKey, sendData) {
if (socket.connected == false) {
......@@ -228,30 +228,56 @@ CHAT_SOCKET.emitCreateVideo = function (sendData) {
CHAT_SOCKET.emitCreateMessage(SOCKET_KEY.CREATE_VIDEO, sendData);
};
CHAT_SOCKET.emitCreateCommunicationStart = function (sendData, collaborationType, meetingID) {
CHAT_SOCKET.emitCreateCommunicationStart = function (
sendData,
collaborationType,
meetingID
) {
if (socket.connected == false) {
CHAT_SOCKET.reconnectCreateMessage(SOCKET_KEY.COMMUNICATION, sendData, collaborationType, meetingID);
CHAT_SOCKET.reconnectCreateMessage(
SOCKET_KEY.COMMUNICATION,
sendData,
collaborationType,
meetingID
);
} else {
socket.emit(SOCKET_KEY.COMMUNICATION, { text: sendData }, collaborationType, meetingID);
socket.emit(
SOCKET_KEY.COMMUNICATION,
{ text: sendData },
collaborationType,
meetingID
);
}
};
CHAT_SOCKET.reconnectCreateMessage = function (socketKey, sendData, timeout = 100, collaborationType = null, meetingID = null) {
CHAT_SOCKET.reconnectCreateMessage = function (
socketKey,
sendData,
timeout = 100,
collaborationType = null,
meetingID = null
) {
if (socket.connected == false) {
console.log("socket disconnected, reconnect... " + timeout)
CHAT_SOCKET.initialJoin();
setTimeout(function() {
CHAT_SOCKET.reconnectCreateMessage(socketKey, sendData, nextFibonacci(timeout));
}, timeout);
console.info("socket disconnected, reconnect... " + timeout);
CHAT_SOCKET.initialJoin();
setTimeout(function () {
CHAT_SOCKET.reconnectCreateMessage(
socketKey,
sendData,
nextFibonacci(timeout)
);
}, timeout);
return;
}
console.info("socket reconnected");
if (collaborationType == null) {
socket.emit(socketKey, { text: sendData });
} else {
console.log("reconnected")
if (collaborationType == null) {
socket.emit(socketKey, { text: sendData });
} else {
socket.emit(socketKey, { text: sendData }, collaborationType, meetingID);
}
socket.emit(socketKey, { text: sendData }, collaborationType, meetingID);
}
}
};
CHAT_SOCKET.emitCollaborationFinishMessage = function () {
if (socket != null && socket.connected) {
......
......@@ -258,14 +258,20 @@ CollaborationFeature.didReceiveCreateRoomResponseMessage = function () {
);
let coviewInviteMessage = "";
let collaborationType = CHAT_UTIL.getCollaborationTypeNumber(globalUserInfo.collaborationType);
let meetingID = null
let collaborationType = CHAT_UTIL.getCollaborationTypeNumber(
globalUserInfo.collaborationType
);
let meetingID = null;
if (globalUserInfo.collaborationType == COLLABORATION_TYPE.DOCUMENT) {
meetingID = globalUserInfo.meetingID;
}
CHAT_SOCKET.emitCreateCommunicationStart(coviewInviteMessage, collaborationType, meetingID);
CHAT_SOCKET.emitCreateCommunicationStart(
coviewInviteMessage,
collaborationType,
meetingID
);
};
CollaborationFeature.didReceivedJoinRoomInfoResponseMessage = function () {
......
......@@ -55,9 +55,10 @@ function changeCollaboration(collaborationType) {
case COLLABORATION_TYPE.DOCUMENT:
coview_api.ChangeCollaboration("audio");
newMeetingID = NativeBridgeDataSource.createContentView();
if (newMeetingID == "-1") { //会議室作成失敗
CoviewBridge.finishCollaboration();
return;
if (newMeetingID == "-1") {
//会議室作成失敗
CoviewBridge.finishCollaboration();
return;
}
break;
case COLLABORATION_TYPE.BOARD:
......
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