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
b62277c9
Commit
b62277c9
authored
Dec 17, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor method serUserPresence
parent
f4cbe1ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+3
-2
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+2
-7
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
b62277c9
...
@@ -12,6 +12,7 @@ import chat.rocket.android.fragment.chatroom.HomeFragment;
...
@@ -12,6 +12,7 @@ import chat.rocket.android.fragment.chatroom.HomeFragment;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.helper.LogcatIfError
;
import
chat.rocket.android.helper.LogcatIfError
;
import
chat.rocket.android.model.ddp.User
;
import
chat.rocket.android.model.internal.Session
;
import
chat.rocket.android.model.internal.Session
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.realm_helper.RealmObjectObserver
;
import
chat.rocket.android.realm_helper.RealmObjectObserver
;
...
@@ -55,14 +56,14 @@ public class MainActivity extends AbstractAuthedActivity {
...
@@ -55,14 +56,14 @@ public class MainActivity extends AbstractAuthedActivity {
private
void
setUserOnlineIfServerAvailable
()
{
private
void
setUserOnlineIfServerAvailable
()
{
if
(
serverConfigId
!=
null
)
{
if
(
serverConfigId
!=
null
)
{
new
MethodCallHelper
(
this
,
serverConfigId
).
setUser
Online
(
)
new
MethodCallHelper
(
this
,
serverConfigId
).
setUser
Presence
(
User
.
STATUS_ONLINE
)
.
continueWith
(
new
LogcatIfError
());
.
continueWith
(
new
LogcatIfError
());
}
}
}
}
private
void
setUserAwayIfServerAvailable
()
{
private
void
setUserAwayIfServerAvailable
()
{
if
(
serverConfigId
!=
null
)
{
if
(
serverConfigId
!=
null
)
{
new
MethodCallHelper
(
this
,
serverConfigId
).
setUser
Away
(
)
new
MethodCallHelper
(
this
,
serverConfigId
).
setUser
Presence
(
User
.
STATUS_AWAY
)
.
continueWith
(
new
LogcatIfError
());
.
continueWith
(
new
LogcatIfError
());
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
b62277c9
...
@@ -278,13 +278,8 @@ public class MethodCallHelper {
...
@@ -278,13 +278,8 @@ public class MethodCallHelper {
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
}
public
Task
<
Void
>
setUserAway
()
{
public
Task
<
Void
>
setUserPresence
(
final
String
status
)
{
return
call
(
"UserPresence:away"
,
TIMEOUT_MS
,
JSONArray:
:
new
)
return
call
(
"UserPresence:"
+
status
,
TIMEOUT_MS
)
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
public
Task
<
Void
>
setUserOnline
()
{
return
call
(
"UserPresence:online"
,
TIMEOUT_MS
,
JSONArray:
:
new
)
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
}
...
...
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