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
67de70b1
Commit
67de70b1
authored
Dec 16, 2016
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added calls for setting the away presence
parent
8876ac1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+30
-0
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+9
-0
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
67de70b1
...
...
@@ -7,9 +7,11 @@ import android.support.v7.widget.Toolbar;
import
android.view.View
;
import
chat.rocket.android.LaunchUtil
;
import
chat.rocket.android.R
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.fragment.chatroom.HomeFragment
;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.helper.LogcatIfError
;
import
chat.rocket.android.model.internal.Session
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.realm_helper.RealmObjectObserver
;
...
...
@@ -37,6 +39,34 @@ public class MainActivity extends AbstractAuthedActivity {
}
}
@Override
protected
void
onStart
()
{
super
.
onStart
();
setUserOnlineIfServerAvailable
();
}
@Override
protected
void
onStop
()
{
setUserAwayIfServerAvailable
();
super
.
onStop
();
}
private
void
setUserOnlineIfServerAvailable
()
{
if
(
serverConfigId
!=
null
)
{
new
MethodCallHelper
(
this
,
serverConfigId
).
setUserOnline
()
.
continueWith
(
new
LogcatIfError
());
}
}
private
void
setUserAwayIfServerAvailable
()
{
if
(
serverConfigId
!=
null
)
{
new
MethodCallHelper
(
this
,
serverConfigId
).
setUserAway
()
.
continueWith
(
new
LogcatIfError
());
}
}
private
void
setupSidebar
()
{
SlidingPaneLayout
pane
=
(
SlidingPaneLayout
)
findViewById
(
R
.
id
.
sliding_pane
);
if
(
pane
!=
null
)
{
...
...
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
67de70b1
...
...
@@ -278,6 +278,15 @@ public class MethodCallHelper {
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
public
Task
<
Void
>
setUserAway
()
{
return
call
(
"UserPresence:away"
,
TIMEOUT_MS
,
JSONArray:
:
new
)
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
public
Task
<
Void
>
setUserOnline
()
{
return
call
(
"UserPresence:online"
,
TIMEOUT_MS
,
JSONArray:
:
new
)
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
public
Task
<
JSONObject
>
getUsersOfRoom
(
final
String
roomId
,
final
boolean
showAll
)
{
return
call
(
"getUsersOfRoom"
,
TIMEOUT_MS
,
()
->
new
JSONArray
().
put
(
roomId
).
put
(
showAll
))
...
...
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