Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
3e8115cf
Commit
3e8115cf
authored
Dec 08, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement "readMessages"
parent
ab1987be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+8
-0
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+11
-0
No files found.
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
3e8115cf
...
@@ -305,4 +305,12 @@ public class MethodCallHelper {
...
@@ -305,4 +305,12 @@ public class MethodCallHelper {
.
onSuccessTask
(
CONVERT_TO_JSON_OBJECT
)
.
onSuccessTask
(
CONVERT_TO_JSON_OBJECT
)
.
onSuccessTask
(
task
->
Task
.
forResult
(
Message
.
customizeJson
(
task
.
getResult
())));
.
onSuccessTask
(
task
->
Task
.
forResult
(
Message
.
customizeJson
(
task
.
getResult
())));
}
}
/**
* mark all messages are read in the room.
*/
public
Task
<
Void
>
readMessages
(
final
String
roomId
)
{
return
call
(
"readMessages"
,
TIMEOUT_MS
,
()
->
new
JSONArray
().
put
(
roomId
))
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
}
}
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
3e8115cf
...
@@ -11,6 +11,7 @@ import android.support.v7.widget.LinearLayoutManager;
...
@@ -11,6 +11,7 @@ import android.support.v7.widget.LinearLayoutManager;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
android.view.View
;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.fragment.chatroom.dialog.UsersOfRoomDialogFragment
;
import
chat.rocket.android.fragment.chatroom.dialog.UsersOfRoomDialogFragment
;
import
chat.rocket.android.helper.LoadMoreScrollListener
;
import
chat.rocket.android.helper.LoadMoreScrollListener
;
import
chat.rocket.android.helper.LogcatIfError
;
import
chat.rocket.android.helper.LogcatIfError
;
...
@@ -269,11 +270,21 @@ public class RoomFragment extends AbstractChatRoomFragment
...
@@ -269,11 +270,21 @@ public class RoomFragment extends AbstractChatRoomFragment
}).
continueWith
(
new
LogcatIfError
());
}).
continueWith
(
new
LogcatIfError
());
}
}
private
void
markAsReadIfNeeded
()
{
RoomSubscription
room
=
realmHelper
.
executeTransactionForRead
(
realm
->
realm
.
where
(
RoomSubscription
.
class
).
equalTo
(
"rid"
,
roomId
).
findFirst
());
if
(
room
!=
null
&&
room
.
isAlert
())
{
new
MethodCallHelper
(
getContext
(),
serverConfigId
).
readMessages
(
roomId
)
.
continueWith
(
new
LogcatIfError
());
}
}
@Override
public
void
onResume
()
{
@Override
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
roomObserver
.
sub
();
roomObserver
.
sub
();
procedureObserver
.
sub
();
procedureObserver
.
sub
();
closeSideMenuIfNeeded
();
closeSideMenuIfNeeded
();
markAsReadIfNeeded
();
}
}
@Override
public
void
onPause
()
{
@Override
public
void
onPause
()
{
...
...
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