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
f4cbe1ba
Commit
f4cbe1ba
authored
Dec 17, 2016
by
Yusuke Iwaki
Committed by
GitHub
Dec 17, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #89 from RocketChat/feature/user-presence
Added calls for setting the away presence
parents
8876ac1e
d8a73536
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
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
ViewDataCache.java
...c/main/java/chat/rocket/android/helper/ViewDataCache.java
+0
-1
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
f4cbe1ba
...
...
@@ -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 @
f4cbe1ba
...
...
@@ -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
))
...
...
app/src/main/java/chat/rocket/android/helper/ViewDataCache.java
View file @
f4cbe1ba
package
chat
.
rocket
.
android
.
helper
;
import
android.view.View
;
import
hugo.weaving.DebugLog
;
/**
* save String to setTag.
...
...
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