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
000922d1
Commit
000922d1
authored
Jul 30, 2021
by
Kim Eunchul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#43695 ウェブソケットの送信方式変更
parent
a5080415
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
24 deletions
+28
-24
public_new/js/sockets/chat-websocket-message.js
+28
-24
No files found.
public_new/js/sockets/chat-websocket-message.js
View file @
000922d1
var
bindOnNewMessage
=
function
()
{
CHAT_SOCKET
.
bindOnNewMessage
=
function
()
{
// New Message
// New Message
// #36170
// #36170
socket
.
on
(
SOCKET_KEY
.
NEW_MESSAGE
,
function
(
message
,
roomID
,
roomName
)
{
socket
.
on
(
SOCKET_KEY
.
NEW_MESSAGE
,
function
(
message
,
roomID
,
roomName
)
{
...
@@ -10,15 +10,15 @@ var bindOnNewMessage = function () {
...
@@ -10,15 +10,15 @@ var bindOnNewMessage = function () {
});
});
};
};
var
handleMessage
=
function
(
message
,
roomName
,
socketKey
)
{
CHAT_SOCKET
.
handleMessage
=
function
(
message
,
roomName
,
socketKey
)
{
const
systemMessageTemplate
=
getTemplate
(
TemplateURL
.
SYSTEM_MESSAGE
);
const
systemMessageTemplate
=
getTemplate
(
TemplateURL
.
SYSTEM_MESSAGE
);
const
unwrappedMessageInfo
=
decodeMessage
(
message
.
text
);
const
unwrappedMessageInfo
=
CHAT_SOCKET
.
decodeMessage
(
message
.
text
);
if
(
if
(
unwrappedMessageInfo
==
unwrappedMessageInfo
==
DATA_MESSAGE_SCHEME
+
FINISH_ALL_COLLABORATION_SIGNAL
DATA_MESSAGE_SCHEME
+
FINISH_ALL_COLLABORATION_SIGNAL
)
{
)
{
cleanUpCollaborationMessage
();
CHAT_SOCKET
.
cleanUpCollaborationMessage
();
return
;
return
;
}
}
...
@@ -29,7 +29,7 @@ var handleMessage = function (message, roomName, socketKey) {
...
@@ -29,7 +29,7 @@ var handleMessage = function (message, roomName, socketKey) {
if
(
if
(
messageType
==
SOCKET_KEY
.
NEW_COMMUNICATION
messageType
==
SOCKET_KEY
.
NEW_COMMUNICATION
)
{
)
{
addCollaborationMessage
(
CHAT_SOCKET
.
addCollaborationMessage
(
messageInfo
,
messageInfo
,
message
.
userId
,
message
.
userId
,
roomName
,
roomName
,
...
@@ -37,7 +37,7 @@ var handleMessage = function (message, roomName, socketKey) {
...
@@ -37,7 +37,7 @@ var handleMessage = function (message, roomName, socketKey) {
message
.
createdAt
message
.
createdAt
);
);
}
else
{
}
else
{
addTextMessage
(
messageText
,
message
,
socket
.
id
);
CHAT_SOCKET
.
addTextMessage
(
messageText
,
message
,
socket
.
id
);
}
}
if
(
typeof
ChatRoom
!==
"undefined"
)
{
if
(
typeof
ChatRoom
!==
"undefined"
)
{
...
@@ -45,10 +45,12 @@ var handleMessage = function (message, roomName, socketKey) {
...
@@ -45,10 +45,12 @@ var handleMessage = function (message, roomName, socketKey) {
setTimeout
(
function
()
{
setTimeout
(
function
()
{
ChatRoom
.
scrollToBottom
();
ChatRoom
.
scrollToBottom
();
},
300
);
},
300
);
}
else
{
Common
.
dismissLoadingIndicator
();
}
}
}
}
var
decodeMessage
=
function
(
text
)
{
CHAT_SOCKET
.
decodeMessage
=
function
(
text
)
{
try
{
try
{
return
decodeURIComponent
(
text
);
return
decodeURIComponent
(
text
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -56,7 +58,7 @@ var decodeMessage = function (text) {
...
@@ -56,7 +58,7 @@ var decodeMessage = function (text) {
}
}
};
};
var
addCollaborationMessage
=
function
(
CHAT_SOCKET
.
addCollaborationMessage
=
function
(
messageInfo
,
messageInfo
,
userID
,
userID
,
roomName
,
roomName
,
...
@@ -64,7 +66,7 @@ var addCollaborationMessage = function (
...
@@ -64,7 +66,7 @@ var addCollaborationMessage = function (
createdAt
createdAt
)
{
)
{
const
collaborationType
=
CHAT_UTIL
.
getCollaborationType
(
messageInfo
[
2
]);
const
collaborationType
=
CHAT_UTIL
.
getCollaborationType
(
messageInfo
[
2
]);
const
meetingID
=
getMeetingID
(
collaborationType
,
messageInfo
);
const
meetingID
=
CHAT_SOCKET
.
getMeetingID
(
collaborationType
,
messageInfo
);
const
userInCollaboration
=
JSON
.
parse
(
const
userInCollaboration
=
JSON
.
parse
(
NativeBridgeDataSource
.
getUserInfoList
(
userID
)
NativeBridgeDataSource
.
getUserInfoList
(
userID
)
);
);
...
@@ -77,7 +79,7 @@ var addCollaborationMessage = function (
...
@@ -77,7 +79,7 @@ var addCollaborationMessage = function (
TemplateURL
.
OPEN_COLLABORATION_MESSAGE
TemplateURL
.
OPEN_COLLABORATION_MESSAGE
);
);
const
html
=
renderCollaborationMessage
(
const
html
=
CHAT_SOCKET
.
renderCollaborationMessage
(
openCollaborationMessageTemplate
,
openCollaborationMessageTemplate
,
roomName
,
roomName
,
userInCollaboration
,
userInCollaboration
,
...
@@ -87,10 +89,10 @@ var addCollaborationMessage = function (
...
@@ -87,10 +89,10 @@ var addCollaborationMessage = function (
createdAt
createdAt
);
);
$
(
"#messages"
).
ap
pend
(
html
);
$
(
"#messages"
).
pre
pend
(
html
);
};
};
var
getMeetingID
=
function
(
collaborationType
,
messageInfo
)
{
CHAT_SOCKET
.
getMeetingID
=
function
(
collaborationType
,
messageInfo
)
{
if
(
collaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
if
(
collaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
return
messageInfo
[
3
];
return
messageInfo
[
3
];
}
else
{
}
else
{
...
@@ -98,7 +100,7 @@ var getMeetingID = function (collaborationType, messageInfo) {
...
@@ -98,7 +100,7 @@ var getMeetingID = function (collaborationType, messageInfo) {
}
}
};
};
var
renderCollaborationMessage
=
function
(
CHAT_SOCKET
.
renderCollaborationMessage
=
function
(
template
,
template
,
roomName
,
roomName
,
userList
,
userList
,
...
@@ -123,15 +125,17 @@ var renderCollaborationMessage = function (
...
@@ -123,15 +125,17 @@ var renderCollaborationMessage = function (
});
});
};
};
var
addTextMessage
=
function
(
messageText
,
message
,
socketID
)
{
CHAT_SOCKET
.
addTextMessage
=
function
(
messageText
,
message
,
socketID
)
{
const
messageTextWithSID
=
insertSID
(
messageText
);
const
messageTextWithSID
=
CHAT_SOCKET
.
insertSID
(
messageText
);
const
messageSender
=
JSON
.
parse
(
const
messageSender
=
JSON
.
parse
(
NativeBridgeDataSource
.
getUserInfoList
(
message
.
userId
)
NativeBridgeDataSource
.
getUserInfoList
(
message
.
userId
)
);
);
const
shopMemberName
=
messageSender
[
0
].
shopMemberName
;
const
shopMemberName
=
messageSender
[
0
].
shopMemberName
;
const
textMessageTemplate
=
getTextMessageTemplate
(
message
.
id
===
socketID
);
const
textMessageTemplate
=
CHAT_SOCKET
.
getTextMessageTemplate
(
message
.
id
===
socketID
);
const
profileImagePath
=
Common
.
getProfileImgUrl
(
message
.
profileImagePath
);
const
profileImagePath
=
Common
.
getProfileImgUrl
(
message
.
profileImagePath
);
const
html
=
renderTextMessage
(
const
html
=
CHAT_SOCKET
.
renderTextMessage
(
textMessageTemplate
,
textMessageTemplate
,
messageTextWithSID
,
messageTextWithSID
,
shopMemberName
,
shopMemberName
,
...
@@ -139,10 +143,10 @@ var addTextMessage = function (messageText, message, socketID) {
...
@@ -139,10 +143,10 @@ var addTextMessage = function (messageText, message, socketID) {
message
.
userId
,
message
.
userId
,
message
.
createdAt
message
.
createdAt
);
);
$
(
"#messages"
).
ap
pend
(
html
);
$
(
"#messages"
).
pre
pend
(
html
);
};
};
var
renderTextMessage
=
function
(
CHAT_SOCKET
.
renderTextMessage
=
function
(
template
,
template
,
text
,
text
,
from
,
from
,
...
@@ -170,11 +174,11 @@ var renderTextMessage = function (
...
@@ -170,11 +174,11 @@ var renderTextMessage = function (
}
}
};
};
var
getUserInfoList
=
function
(
userID
)
{
CHAT_SOCKET
.
getUserInfoList
=
function
(
userID
)
{
return
JSON
.
parse
(
NativeBridgeDataSource
.
getUserInfoList
(
userID
));
return
JSON
.
parse
(
NativeBridgeDataSource
.
getUserInfoList
(
userID
));
};
};
var
cleanUpCollaborationMessage
=
function
()
{
CHAT_SOCKET
.
cleanUpCollaborationMessage
=
function
()
{
$
(
".collabo_area.start"
).
each
(
function
(
index
,
collaborationMessage
)
{
$
(
".collabo_area.start"
).
each
(
function
(
index
,
collaborationMessage
)
{
$
(
collaborationMessage
).
removeClass
(
"start"
);
$
(
collaborationMessage
).
removeClass
(
"start"
);
$
(
collaborationMessage
).
addClass
(
"end"
);
$
(
collaborationMessage
).
addClass
(
"end"
);
...
@@ -184,11 +188,11 @@ var cleanUpCollaborationMessage = function () {
...
@@ -184,11 +188,11 @@ var cleanUpCollaborationMessage = function () {
.
attr
(
"disabled"
,
"disabled"
);
.
attr
(
"disabled"
,
"disabled"
);
$
(
collaborationMessage
)
$
(
collaborationMessage
)
.
find
(
".collaboration_join_message"
)
.
find
(
".collaboration_join_message"
)
.
text
(
getLocalizedString
(
"message_ended"
));
.
text
(
getLocalizedString
(
"
flex-direction
message_ended"
));
});
});
};
};
var
insertSID
=
function
(
text
)
{
CHAT_SOCKET
.
insertSID
=
function
(
text
)
{
let
replacePath
=
text
;
let
replacePath
=
text
;
replacePath
=
replacePath
.
replaceAll
(
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?fileName="
,
...
@@ -197,7 +201,7 @@ var insertSID = function (text) {
...
@@ -197,7 +201,7 @@ var insertSID = function (text) {
return
replacePath
;
return
replacePath
;
};
};
var
getTextMessageTemplate
=
function
(
isSenderMySelf
)
{
CHAT_SOCKET
.
getTextMessageTemplate
=
function
(
isSenderMySelf
)
{
return
getTemplate
(
return
getTemplate
(
isSenderMySelf
isSenderMySelf
?
TemplateURL
.
MY_MESSAGE
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
?
TemplateURL
.
MY_MESSAGE
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
...
...
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