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
0d0213e3
Commit
0d0213e3
authored
Aug 02, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed to load 100 over messages
parent
91ad8f0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
public_new/js/sockets/chat-websocket-message.js
+1
-1
public_new/js/views/chats/chat-room.js
+19
-9
No files found.
public_new/js/sockets/chat-websocket-message.js
View file @
0d0213e3
...
@@ -183,7 +183,7 @@ CHAT_SOCKET.cleanUpCollaborationMessage = function () {
...
@@ -183,7 +183,7 @@ CHAT_SOCKET.cleanUpCollaborationMessage = function () {
.
attr
(
"disabled"
,
"disabled"
);
.
attr
(
"disabled"
,
"disabled"
);
$
(
collaborationMessage
)
$
(
collaborationMessage
)
.
find
(
".collaboration_join_message"
)
.
find
(
".collaboration_join_message"
)
.
text
(
getLocalizedString
(
"
flex-direction
message_ended"
));
.
text
(
getLocalizedString
(
"message_ended"
));
});
});
};
};
...
...
public_new/js/views/chats/chat-room.js
View file @
0d0213e3
...
@@ -14,28 +14,38 @@ window.onscroll = function () {
...
@@ -14,28 +14,38 @@ window.onscroll = function () {
messageCount
=
$
(
".chat_message"
).
length
;
messageCount
=
$
(
".chat_message"
).
length
;
// TODO: peacekim :: check this condition
// TODO: peacekim :: check this condition
if
(
$
(
this
).
scrollTop
()
===
0
&&
messageCount
>=
PagingSize
.
MESSAGE
)
{
if
(
$
(
this
).
scrollTop
()
===
0
&&
messageCount
>=
PagingSize
.
MESSAGE
)
{
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
// display loading indicator in chat message
// 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" />'
);
);
$
(
"#messages"
).
append
(
loader
);
$
(
"#messages"
).
append
(
loader
);
// get lastest message id and update message from server via native
}
const
messageID
=
$
(
$
(
".chat_message"
).
last
()).
data
(
"messageid"
);
ChatRoom
.
loadNewMessage
().
then
((
messages
)
=>
{
NativeBridgeDelegate
.
updatePreMessage
(
messageID
);
let
messages
=
NativeBridgeDataSource
.
getMessagesByMessageID
(
messageID
);
// prepend message
// prepend message
ChatRoom
.
prependMessage
(
messages
);
ChatRoom
.
prependMessage
(
messages
);
// hide loading indicator
// hide loading indicator
loader
.
remove
();
if
(
typeof
loader
!==
"undefined"
)
{
var
afterHeight
=
$
(
".room_container"
).
height
();
loader
.
remove
();
}
const
afterHeight
=
$
(
".room_container"
).
height
();
window
.
scroll
(
0
,
afterHeight
-
beforeHeight
);
window
.
scroll
(
0
,
afterHeight
-
beforeHeight
);
}
}
);
},
0
);
},
0
);
}
}
};
};
ChatRoom
.
loadNewMessage
=
async
function
()
{
return
new
Promise
(
function
(
done
)
{
// get lastest message id and update message from server via native
const
messageID
=
$
(
$
(
".chat_message"
).
last
()).
data
(
"messageid"
);
NativeBridgeDelegate
.
updatePreMessage
(
messageID
);
let
messages
=
NativeBridgeDataSource
.
getMessagesByMessageID
(
messageID
);
done
(
messages
);
});
};
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
// 検索イベントバインディング
// 検索イベントバインディング
ChatRoom
.
bindSearchUI
();
ChatRoom
.
bindSearchUI
();
...
...
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