Skip to content

Commit aed74ae

Browse files
Merge pull request #28 from JoaoCaixinha/master
fix disconnect callback
2 parents 38477cb + 42e972c commit aed74ae

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordovapush",
3-
"version": "0.1.30",
3+
"version": "0.1.31",
44
"description": "This Cordova plugin should be used with the iOS/Android platforms together with the Realtime Messaging library (ORTC) for Push Notifications support.",
55
"main": "index.js",
66
"scripts": {

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
33
id="co.realtime.plugins.CordovaPush"
4-
version="0.1.30">
4+
version="0.1.31">
55

66
<name>cordovapush</name>
77
<author>Reatime</author>

src/android/OrtcPushPlugin.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public void run(OrtcClient ortcClient) {
8888
client.onUnsubscribed = new OnUnsubscribed() {
8989
@Override
9090
public void run(OrtcClient ortcClient, String channel) {
91-
Log.i(TAG,"Unsubscribed from:" + channel);
9291
CallbackContext call = (CallbackContext)commands.get(ACTION_UNSUBSCRIBE);
9392
if (call != null)
9493
call.success();
@@ -186,6 +185,7 @@ public void run() {
186185
return true;
187186
}
188187
else if(ACTION_DISCONNECT.equals(action)){
188+
commands.put(ACTION_DISCONNECT, callbackContext);
189189
client.disconnect();
190190
return true;
191191
}
@@ -267,13 +267,23 @@ else if(ACTION_SET_ICON.equals(action)){
267267
return true;
268268
}
269269
else if(ACTION_ENABLE_HEADS_UP_NOTIFICATIONS.equals(action)){
270-
Context context = cordova.getActivity().getApplicationContext();
271-
GcmReceiver.setAppPriority(context, 1);
270+
cordova.getThreadPool().execute(new Runnable() {
271+
@Override
272+
public void run() {
273+
Context context = cordova.getActivity().getApplicationContext();
274+
GcmReceiver.setAppPriority(context, 1);
275+
}
276+
});
272277
return true;
273278
}
274279
else if(ACTION_DISABLE_HEADS_UP_NOTIFICATIONS.equals(action)){
275-
Context context = cordova.getActivity().getApplicationContext();
276-
GcmReceiver.setAppPriority(context, 0);
280+
cordova.getThreadPool().execute(new Runnable() {
281+
@Override
282+
public void run() {
283+
Context context = cordova.getActivity().getApplicationContext();
284+
GcmReceiver.setAppPriority(context, 0);
285+
}
286+
});
277287
return true;
278288
}
279289
callbackContext.error("Invalid action");

0 commit comments

Comments
 (0)