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
1de8bd84
Commit
1de8bd84
authored
Jul 28, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed message display order to colomn reversed
parent
24a59d1f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
29 deletions
+23
-29
public_new/chat_room.html
+1
-1
public_new/css/chat.css
+8
-1
public_new/js/sockets/chat-websocket-message.js
+2
-2
public_new/js/views/chats/chat-room-message.js
+5
-9
public_new/js/views/chats/chat-room.js
+6
-16
public_new/js/views/collaboration/fermi-web-socket-bridge.js
+1
-0
No files found.
public_new/chat_room.html
View file @
1de8bd84
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
<!-- チャット内容 -->
<!-- チャット内容 -->
<div
class=
"room_container"
>
<div
class=
"room_container"
>
<div
class=
"room_contents scroll"
>
<div
class=
"room_contents scroll"
>
<div
id=
"messages"
></div>
<div
id=
"messages"
class=
"message_container"
></div>
</div>
</div>
</div>
</div>
</main>
</main>
...
...
public_new/css/chat.css
View file @
1de8bd84
...
@@ -478,23 +478,30 @@ input[name="tab_item"] {
...
@@ -478,23 +478,30 @@ input[name="tab_item"] {
margin
:
0
auto
;
margin
:
0
auto
;
}
}
.message_container
{
display
:
flex
;
flex-direction
:
column-reverse
;
}
.room_container
{
.room_container
{
padding
:
0
;
padding
:
0
;
background
:
#f3f3f3
;
background
:
#f3f3f3
;
overflow
:
hidden
;
overflow
:
hidden
;
margin
:
20px
auto
;
margin
:
20px
auto
;
margin-bottom
:
140px
;
margin-bottom
:
140px
;
flex-direction
:
column-reverse
;
}
}
/* 会話部分 */
/* 会話部分 */
.room_contents
{
.room_contents
{
padding
:
10px
;
padding
:
10px
;
overflow
:
hidden
;
overflow
:
hidden
;
line-height
:
150%
;
line-height
:
150%
;
}
}
.scroll
{
.scroll
{
overflow-y
:
scroll
;
overflow-y
:
scroll
;
}
}
/* 相手の会話 */
/* 相手の会話 */
.room_left
{
.room_left
{
width
:
fit-content
;
width
:
fit-content
;
...
...
public_new/js/sockets/chat-websocket-message.js
View file @
1de8bd84
...
@@ -102,7 +102,7 @@ CHAT_SOCKET.addCollaborationMessage = function (
...
@@ -102,7 +102,7 @@ CHAT_SOCKET.addCollaborationMessage = function (
createdAt
createdAt
);
);
$
(
"#messages"
).
ap
pend
(
html
);
$
(
"#messages"
).
pre
pend
(
html
);
};
};
CHAT_SOCKET
.
getMeetingID
=
function
(
collaborationType
,
messageInfo
)
{
CHAT_SOCKET
.
getMeetingID
=
function
(
collaborationType
,
messageInfo
)
{
...
@@ -177,7 +177,7 @@ CHAT_SOCKET.addTextMessage = function (messageText, message, socketID) {
...
@@ -177,7 +177,7 @@ CHAT_SOCKET.addTextMessage = function (messageText, message, socketID) {
message
.
userId
,
message
.
userId
,
message
.
createdAt
message
.
createdAt
);
);
$
(
"#messages"
).
ap
pend
(
html
);
$
(
"#messages"
).
pre
pend
(
html
);
};
};
CHAT_SOCKET
.
renderTextMessage
=
function
(
CHAT_SOCKET
.
renderTextMessage
=
function
(
...
...
public_new/js/views/chats/chat-room-message.js
View file @
1de8bd84
...
@@ -13,7 +13,7 @@ ChatRoom.appendSearchMessages = function (messages, unwrappedWorkVal = "") {
...
@@ -13,7 +13,7 @@ ChatRoom.appendSearchMessages = function (messages, unwrappedWorkVal = "") {
let
html
=
ChatRoom
.
renderMessageForSearchMessage
(
message
);
let
html
=
ChatRoom
.
renderMessageForSearchMessage
(
message
);
workVal
=
html
+
workVal
;
workVal
=
html
+
workVal
;
});
});
$
(
".overlay_src_msg"
).
pre
pend
(
workVal
);
$
(
".overlay_src_msg"
).
ap
pend
(
workVal
);
};
};
ChatRoom
.
renderMessageForSearchMessage
=
function
(
message
)
{
ChatRoom
.
renderMessageForSearchMessage
=
function
(
message
)
{
...
@@ -147,9 +147,8 @@ ChatRoom.appendAttendedUsers = function (roomID) {
...
@@ -147,9 +147,8 @@ ChatRoom.appendAttendedUsers = function (roomID) {
ChatRoom
.
prependMessage
=
function
(
messages
)
{
ChatRoom
.
prependMessage
=
function
(
messages
)
{
const
now
=
new
Date
();
const
now
=
new
Date
();
// メッセージ文字列の生成
let
workVal
=
""
;
const
messageElement
=
$
(
"#messages"
);
let
checkBeforeDate
=
""
;
let
checkBeforeDate
=
""
;
let
beforeDate
=
""
;
let
beforeDate
=
""
;
messages
.
forEach
(
function
(
message
)
{
messages
.
forEach
(
function
(
message
)
{
...
@@ -176,19 +175,16 @@ ChatRoom.prependMessage = function (messages) {
...
@@ -176,19 +175,16 @@ ChatRoom.prependMessage = function (messages) {
&&
!
isToday
&&
!
isToday
)
{
)
{
const
html
=
ChatRoom
.
renderDateLabelMessage
(
beforeDate
);
const
html
=
ChatRoom
.
renderDateLabelMessage
(
beforeDate
);
workVal
=
html
+
workVal
;
messageElement
.
append
(
html
)
;
}
}
checkBeforeDate
=
messageCreatedTime
;
checkBeforeDate
=
messageCreatedTime
;
beforeDate
=
message
.
insertDate
;
beforeDate
=
message
.
insertDate
;
const
html
=
ChatRoom
.
renderMessage
(
message
,
isToday
,
isOtherYear
);
const
html
=
ChatRoom
.
renderMessage
(
message
,
isToday
,
isOtherYear
);
workVal
=
html
+
workVal
;
messageElement
.
append
(
html
)
;
});
});
// メッセージの画面描画
$
(
"#messages"
).
prepend
(
workVal
);
// messageが存在する場合、最上段にそのメッセージの日付を表示
// messageが存在する場合、最上段にそのメッセージの日付を表示
ChatRoom
.
appendInitialDateMessage
(
messages
);
ChatRoom
.
appendInitialDateMessage
(
messages
);
};
};
...
@@ -200,7 +196,7 @@ ChatRoom.appendInitialDateMessage = function (messages) {
...
@@ -200,7 +196,7 @@ ChatRoom.appendInitialDateMessage = function (messages) {
messages
[
messages
.
length
-
1
].
insertDate
,
messages
[
messages
.
length
-
1
].
insertDate
,
true
true
);
);
$
(
"#messages"
).
pre
pend
(
html
);
$
(
"#messages"
).
ap
pend
(
html
);
}
}
};
};
...
...
public_new/js/views/chats/chat-room.js
View file @
1de8bd84
...
@@ -11,16 +11,21 @@ window.onscroll = function () {
...
@@ -11,16 +11,21 @@ window.onscroll = function () {
beforeScroll
=
window
.
scrollY
;
beforeScroll
=
window
.
scrollY
;
const
beforeHeight
=
$
(
".room_container"
).
height
();
const
beforeHeight
=
$
(
".room_container"
).
height
();
messageCount
=
$
(
".chat_message"
).
length
;
messageCount
=
$
(
".chat_message"
).
length
;
// TODO: peacekim :: check this condition
if
(
$
(
this
).
scrollTop
()
===
0
&&
messageCount
>=
PagingSize
.
MESSAGE
)
{
if
(
$
(
this
).
scrollTop
()
===
0
&&
messageCount
>=
PagingSize
.
MESSAGE
)
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
// display loading indicator in chat message
let
loader
=
$
(
let
loader
=
$
(
'<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>'
'<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>'
);
);
$
(
"#messages"
).
prepend
(
loader
);
$
(
"#messages"
).
append
(
loader
);
// get lastest message id and update message from server via native
const
messageID
=
$
(
$
(
".chat_message"
).
get
(
0
)).
data
(
"messageid"
);
const
messageID
=
$
(
$
(
".chat_message"
).
get
(
0
)).
data
(
"messageid"
);
NativeBridgeDelegate
.
updatePreMessage
(
messageID
);
NativeBridgeDelegate
.
updatePreMessage
(
messageID
);
let
messages
=
NativeBridgeDataSource
.
getMessagesByMessageID
(
messageID
);
let
messages
=
NativeBridgeDataSource
.
getMessagesByMessageID
(
messageID
);
// prepend message
ChatRoom
.
prependMessage
(
messages
);
ChatRoom
.
prependMessage
(
messages
);
// hide loading indicator
loader
.
remove
();
loader
.
remove
();
var
afterHeight
=
$
(
".room_container"
).
height
();
var
afterHeight
=
$
(
".room_container"
).
height
();
window
.
scroll
(
0
,
afterHeight
-
beforeHeight
);
window
.
scroll
(
0
,
afterHeight
-
beforeHeight
);
...
@@ -123,21 +128,6 @@ ChatRoom.bindUserListDisplayToggle = function () {
...
@@ -123,21 +128,6 @@ ChatRoom.bindUserListDisplayToggle = function () {
});
});
};
};
//上にスクロールすると新しいメッセージを呼ぶ処理。
$
(
"#messages"
).
scroll
(
function
()
{
if
(
$
(
this
).
scrollTop
()
===
0
)
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
// 現在、メッセージの個数以前をメッセージを読み込む
// ローディングアイコンを追加する
let
loader
=
$
(
'<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>'
);
$
(
"#messages"
).
prepend
(
loader
);
loader
.
remove
();
}
}
});
// 画像の読み込みが全て終わったタイミングでコールバック実行
// 画像の読み込みが全て終わったタイミングでコールバック実行
// FIXME 追加読み込みの場合は差分の画像のみ監視すべきだが、現状新規入室時にしか対応出来ていない。
// FIXME 追加読み込みの場合は差分の画像のみ監視すべきだが、現状新規入室時にしか対応出来ていない。
ChatRoom
.
waitForLoadingVideo
=
function
(
div
,
callback
)
{
ChatRoom
.
waitForLoadingVideo
=
function
(
div
,
callback
)
{
...
...
public_new/js/views/collaboration/fermi-web-socket-bridge.js
View file @
1de8bd84
...
@@ -15,6 +15,7 @@ FermiWebSocketBridge.shareFileHost = function (collaborationType) {
...
@@ -15,6 +15,7 @@ FermiWebSocketBridge.shareFileHost = function (collaborationType) {
};
};
FermiWebSocketBridge
.
hostChangeResponse
=
function
()
{
FermiWebSocketBridge
.
hostChangeResponse
=
function
()
{
// TODO: peacekim:: check loginID is for fw or not
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
,
...
...
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