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
d9834a6c
Commit
d9834a6c
authored
Dec 06, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEBUG] rpc
parent
2d743c93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
DDPClientWraper.java
...rc/main/java/chat/rocket/android/api/DDPClientWraper.java
+19
-2
No files found.
app/src/main/java/chat/rocket/android/api/DDPClientWraper.java
View file @
d9834a6c
...
@@ -11,6 +11,7 @@ import java.util.UUID;
...
@@ -11,6 +11,7 @@ import java.util.UUID;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
rx.Observable
;
import
rx.Observable
;
import
timber.log.Timber
;
/**
/**
* DDP client wrapper.
* DDP client wrapper.
...
@@ -82,12 +83,28 @@ public class DDPClientWraper {
...
@@ -82,12 +83,28 @@ public class DDPClientWraper {
*/
*/
public
Task
<
DDPClientCallback
.
RPC
>
rpc
(
String
methodCallId
,
String
methodName
,
String
params
,
public
Task
<
DDPClientCallback
.
RPC
>
rpc
(
String
methodCallId
,
String
methodName
,
String
params
,
long
timeoutMs
)
{
long
timeoutMs
)
{
Timber
.
d
(
"rpc:[%s]> %s(%s) timeout=%d"
,
methodCallId
,
methodName
,
params
,
timeoutMs
);
if
(
TextUtils
.
isEmpty
(
params
))
{
if
(
TextUtils
.
isEmpty
(
params
))
{
return
ddpClient
.
rpc
(
methodName
,
null
,
methodCallId
,
timeoutMs
);
return
ddpClient
.
rpc
(
methodName
,
null
,
methodCallId
,
timeoutMs
).
continueWithTask
(
task
->
{
if
(
task
.
isFaulted
())
{
Timber
.
d
(
"rpc:[%s]< error = %s"
,
methodCallId
,
task
.
getError
());
}
else
{
Timber
.
d
(
"rpc:[%s]< result = %s"
,
methodCallId
,
task
.
getResult
().
result
);
}
return
task
;
});
}
}
try
{
try
{
return
ddpClient
.
rpc
(
methodName
,
new
JSONArray
(
params
),
methodCallId
,
timeoutMs
);
return
ddpClient
.
rpc
(
methodName
,
new
JSONArray
(
params
),
methodCallId
,
timeoutMs
)
.
continueWithTask
(
task
->
{
if
(
task
.
isFaulted
())
{
Timber
.
d
(
"rpc:[%s]< error = %s"
,
methodCallId
,
task
.
getError
());
}
else
{
Timber
.
d
(
"rpc:[%s]< result = %s"
,
methodCallId
,
task
.
getResult
().
result
);
}
return
task
;
});
}
catch
(
JSONException
exception
)
{
}
catch
(
JSONException
exception
)
{
return
Task
.
forError
(
exception
);
return
Task
.
forError
(
exception
);
}
}
...
...
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