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
14ddab86
Commit
14ddab86
authored
Aug 18, 2017
by
Rafael Kellermann Streit
Committed by
GitHub
Aug 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into iss321
parents
eab27aba
b9d36651
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
64 deletions
+7
-64
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-8
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+7
-10
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+0
-25
TaskService.java
...rc/main/java/chat/rocket/android/service/TaskService.java
+0
-21
No files found.
app/src/main/AndroidManifest.xml
View file @
14ddab86
...
...
@@ -70,14 +70,6 @@
</intent-filter>
</service>
<service
android:name=
".service.TaskService"
android:permission=
"com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"com.google.android.gms.gcm.ACTION_TASK_READY"
/>
</intent-filter>
</service>
<meta-data
android:name=
"io.fabric.ApiKey"
android:value=
"12ac6e94f850aaffcdff52001af77ca415d06a43"
/>
...
...
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
14ddab86
...
...
@@ -8,26 +8,27 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
java.util.UUID
;
import
bolts.Continuation
;
import
bolts.Task
;
import
chat.rocket.android.helper.CheckSum
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.DDPClientRef
;
import
chat.rocket.android_ddp.DDPClientCallback
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.models.ServerInfo
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.models.ddp.RealmMessage
;
import
chat.rocket.persistence.realm.models.ddp.RealmPermission
;
import
chat.rocket.persistence.realm.models.ddp.RealmPublicSetting
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.persistence.realm.models.ddp.RealmMessage
;
import
chat.rocket.persistence.realm.models.ddp.RealmRoom
;
import
chat.rocket.persistence.realm.models.ddp.RealmRoomRole
;
import
chat.rocket.persistence.realm.models.ddp.RealmSpotlightRoom
;
import
chat.rocket.persistence.realm.models.ddp.RealmSpotlightUser
;
import
chat.rocket.persistence.realm.models.internal.MethodCall
;
import
chat.rocket.persistence.realm.models.internal.RealmSession
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.android.service.DDPClientRef
;
import
chat.rocket.android_ddp.DDPClientCallback
;
import
hugo.weaving.DebugLog
;
/**
...
...
@@ -83,10 +84,6 @@ public class MethodCallHelper {
return
task
.
continueWithTask
(
_task
->
{
if
(
_task
.
isFaulted
())
{
Exception
exception
=
_task
.
getError
();
// If wet get any error, close the socket to let the RocketChatWebSocketThread aware of it.
// FIXME: when rewriting the network layer we should get rid of this MethodCallHelper
// monolith concept. It decouples a lot the socket from the rest of the app.
ddpClientRef
.
get
().
close
();
if
(
exception
instanceof
MethodCall
.
Error
)
{
String
errMessageJson
=
exception
.
getMessage
();
if
(
TextUtils
.
isEmpty
(
errMessageJson
))
{
...
...
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
14ddab86
...
...
@@ -4,9 +4,6 @@ import android.content.Context;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
com.google.android.gms.gcm.GcmNetworkManager
;
import
com.google.android.gms.gcm.PeriodicTask
;
import
org.json.JSONObject
;
import
java.lang.reflect.Constructor
;
...
...
@@ -418,28 +415,6 @@ public class RocketChatWebSocketThread extends HandlerThread {
}
private
void
startHeartBeat
()
{
// This task is scheduled to guarantee that RocketChatService is still bound at the application
// process. This is necessary due to the way the keep-alive assertions are currently architectured.
// By doing those keep-alives periodically we try to ensure that we have the app alive
// if for some reason its process gets killed (for any reason).
// TODO: should set this at another point; we should specify a reasonable time-window.
// TODO: should check and handle the case Google Play Services isn't available.
// TODO: consider on using https://github.com/evernote/android-job for this as it allows much more
// customisation like running at exponential backoff and others. We should alos use it more
// extensively throughout the app on all the common tasks, like i.e. sending a message
GcmNetworkManager
gcmNetworkManager
=
GcmNetworkManager
.
getInstance
(
appContext
);
gcmNetworkManager
.
schedule
(
new
PeriodicTask
.
Builder
()
.
setRequiresCharging
(
false
)
.
setUpdateCurrent
(
true
)
.
setRequiredNetwork
(
com
.
google
.
android
.
gms
.
gcm
.
Task
.
NETWORK_STATE_ANY
)
.
setTag
(
TaskService
.
TAG_KEEP_ALIVE
)
.
setService
(
TaskService
.
class
)
.
setPeriod
(
30
)
.
setFlex
(
15
)
.
build
()
);
hearbeatDisposable
.
clear
();
hearbeatDisposable
.
add
(
heartbeat
(
HEARTBEAT_PERIOD_MS
)
...
...
app/src/main/java/chat/rocket/android/service/TaskService.java
deleted
100644 → 0
View file @
eab27aba
package
chat
.
rocket
.
android
.
service
;
import
com.google.android.gms.gcm.GcmNetworkManager
;
import
com.google.android.gms.gcm.GcmTaskService
;
import
com.google.android.gms.gcm.TaskParams
;
public
class
TaskService
extends
GcmTaskService
{
public
static
final
String
TAG_KEEP_ALIVE
=
"TAG_KEEP_ALIVE"
;
@Override
public
int
onRunTask
(
TaskParams
taskParams
)
{
switch
(
taskParams
.
getTag
())
{
case
TAG_KEEP_ALIVE:
ConnectivityManager
.
getInstance
(
getApplicationContext
()).
keepAliveServer
();
return
GcmNetworkManager
.
RESULT_SUCCESS
;
default
:
return
GcmNetworkManager
.
RESULT_FAILURE
;
}
}
}
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