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
71bcbbc2
Commit
71bcbbc2
authored
Jul 28, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed chat room loading indicator timing
parent
1de8bd84
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
public_new/js/common/common.js
+3
-0
public_new/js/common/native-bridge-delegate.js
+2
-2
public_new/js/views/chats/chat-room.js
+9
-2
No files found.
public_new/js/common/common.js
View file @
71bcbbc2
...
@@ -78,6 +78,9 @@ document.addEventListener("readystatechange", () => {
...
@@ -78,6 +78,9 @@ document.addEventListener("readystatechange", () => {
case
"interactive"
:
case
"interactive"
:
break
;
break
;
case
"complete"
:
case
"complete"
:
if
(
typeof
initialLoading
!=
"undefined"
&&
initialLoading
)
{
break
;
}
Common
.
dismissLoadingIndicator
();
Common
.
dismissLoadingIndicator
();
break
;
break
;
}
}
...
...
public_new/js/common/native-bridge-delegate.js
View file @
71bcbbc2
...
@@ -388,9 +388,9 @@ ReverseDelegate.leaveRoom = function () {
...
@@ -388,9 +388,9 @@ ReverseDelegate.leaveRoom = function () {
};
};
// for android call
// for android call
ReverseDelegate
.
displayExistRoom
=
function
(
roomI
d
)
{
ReverseDelegate
.
displayExistRoom
=
function
(
roomI
D
)
{
if
(
confirm
(
"error_already_exist_same_user"
))
{
if
(
confirm
(
"error_already_exist_same_user"
))
{
NativeBridgeDelegate
.
joinRoom
(
roomI
d
);
NativeBridgeDelegate
.
joinRoom
(
roomI
D
);
}
}
return
;
return
;
};
};
public_new/js/views/chats/chat-room.js
View file @
71bcbbc2
...
@@ -2,6 +2,7 @@ var beforeHeight = window.innerHeight;
...
@@ -2,6 +2,7 @@ var beforeHeight = window.innerHeight;
var
beforeWidth
=
window
.
innerWidth
;
var
beforeWidth
=
window
.
innerWidth
;
var
beforeScroll
;
var
beforeScroll
;
var
roomName
=
""
;
var
roomName
=
""
;
var
initialLoading
=
true
;
var
ChatRoom
=
{};
var
ChatRoom
=
{};
window
.
onscroll
=
function
()
{
window
.
onscroll
=
function
()
{
...
@@ -13,6 +14,7 @@ window.onscroll = function () {
...
@@ -13,6 +14,7 @@ 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
()
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
if
(
!
$
(
"#chatLoader"
).
is
(
":visible"
))
{
// display loading indicator in chat message
// display loading indicator in chat message
let
loader
=
$
(
let
loader
=
$
(
...
@@ -20,7 +22,7 @@ window.onscroll = function () {
...
@@ -20,7 +22,7 @@ window.onscroll = function () {
);
);
$
(
"#messages"
).
append
(
loader
);
$
(
"#messages"
).
append
(
loader
);
// get lastest message id and update message from server via native
// get lastest message id and update message from server via native
const
messageID
=
$
(
$
(
".chat_message"
).
get
(
0
)).
data
(
"messageid"
);
const
messageID
=
$
(
$
(
".chat_message"
).
last
(
)).
data
(
"messageid"
);
NativeBridgeDelegate
.
updatePreMessage
(
messageID
);
NativeBridgeDelegate
.
updatePreMessage
(
messageID
);
let
messages
=
NativeBridgeDataSource
.
getMessagesByMessageID
(
messageID
);
let
messages
=
NativeBridgeDataSource
.
getMessagesByMessageID
(
messageID
);
// prepend message
// prepend message
...
@@ -30,6 +32,7 @@ window.onscroll = function () {
...
@@ -30,6 +32,7 @@ window.onscroll = function () {
var
afterHeight
=
$
(
".room_container"
).
height
();
var
afterHeight
=
$
(
".room_container"
).
height
();
window
.
scroll
(
0
,
afterHeight
-
beforeHeight
);
window
.
scroll
(
0
,
afterHeight
-
beforeHeight
);
}
}
},
0
);
}
}
};
};
...
@@ -176,7 +179,11 @@ ChatRoom.scrollToBottom = function (animated = true) {
...
@@ -176,7 +179,11 @@ ChatRoom.scrollToBottom = function (animated = true) {
{
{
scrollTop
:
scrollHeight
,
scrollTop
:
scrollHeight
,
},
},
animated
?
100
:
0
animated
?
100
:
0
,
function
()
{
initialLoading
=
false
;
Common
.
dismissLoadingIndicator
();
}
);
);
};
};
...
...
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