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
86adbe67
Commit
86adbe67
authored
Jan 31, 2017
by
Tiago Cunha
Committed by
GitHub
Jan 31, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #193 from RocketChat/fix/sync-failure-error
Fix incorrect behavior
parents
d6380c71
a78c1b6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+3
-4
NewMessageObserver.java
...t/rocket/android/service/observer/NewMessageObserver.java
+2
-8
No files found.
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
86adbe67
...
...
@@ -301,7 +301,7 @@ public class MethodCallHelper {
/**
* send message.
*/
public
Task
<
JSONObject
>
sendMessage
(
String
messageId
,
String
roomId
,
String
msg
)
{
public
Task
<
Void
>
sendMessage
(
String
messageId
,
String
roomId
,
String
msg
)
{
try
{
return
sendMessage
(
new
JSONObject
()
.
put
(
"_id"
,
messageId
)
...
...
@@ -315,10 +315,9 @@ public class MethodCallHelper {
/**
* Send message object.
*/
private
Task
<
JSONObject
>
sendMessage
(
final
JSONObject
messageJson
)
{
private
Task
<
Void
>
sendMessage
(
final
JSONObject
messageJson
)
{
return
call
(
"sendMessage"
,
TIMEOUT_MS
,
()
->
new
JSONArray
().
put
(
messageJson
))
.
onSuccessTask
(
CONVERT_TO_JSON_OBJECT
)
.
onSuccessTask
(
task
->
Task
.
forResult
(
Message
.
customizeJson
(
task
.
getResult
())));
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
/**
...
...
app/src/main/java/chat/rocket/android/service/observer/NewMessageObserver.java
View file @
86adbe67
...
...
@@ -53,7 +53,7 @@ public class NewMessageObserver extends AbstractModelObserver<Message> {
return
;
}
Message
message
=
results
.
get
(
0
);
final
Message
message
=
results
.
get
(
0
);
final
String
messageId
=
message
.
getId
();
final
String
roomId
=
message
.
getRoomId
();
final
String
msg
=
message
.
getMessage
();
...
...
@@ -63,13 +63,7 @@ public class NewMessageObserver extends AbstractModelObserver<Message> {
.
put
(
Message
.
ID
,
messageId
)
.
put
(
Message
.
SYNC_STATE
,
SyncState
.
SYNCING
)
)
).
onSuccessTask
(
task
->
methodCall
.
sendMessage
(
messageId
,
roomId
,
msg
).
onSuccessTask
(
_task
->
{
JSONObject
messageJson
=
_task
.
getResult
();
messageJson
.
put
(
"syncstate"
,
SyncState
.
SYNCED
);
return
realmHelper
.
executeTransaction
(
realm
->
realm
.
createOrUpdateObjectFromJson
(
Message
.
class
,
messageJson
));
})
).
onSuccessTask
(
task
->
methodCall
.
sendMessage
(
messageId
,
roomId
,
msg
)
).
continueWith
(
task
->
{
if
(
task
.
isFaulted
())
{
RCLog
.
w
(
task
.
getError
());
...
...
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