diff --git a/android/build.gradle b/android/build.gradle index 43c2a34..88b9c02 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.5.3' } } @@ -32,6 +32,6 @@ android { disable 'InvalidPackage' } dependencies { - implementation 'com.pusher:pusher-java-client:2.0.0' + implementation 'com.pusher:pusher-java-client:2.0.2' } } diff --git a/android/src/main/java/com/ninjasolutions/pusher/PusherPlugin.java b/android/src/main/java/com/ninjasolutions/pusher/PusherPlugin.java index 4319c63..c4c9534 100644 --- a/android/src/main/java/com/ninjasolutions/pusher/PusherPlugin.java +++ b/android/src/main/java/com/ninjasolutions/pusher/PusherPlugin.java @@ -13,6 +13,7 @@ import com.pusher.client.channel.Channel; import com.pusher.client.channel.ChannelEventListener; import com.pusher.client.channel.PresenceChannelEventListener; +import com.pusher.client.channel.PrivateChannel; import com.pusher.client.channel.PrivateChannelEventListener; import com.pusher.client.channel.PusherEvent; import com.pusher.client.channel.User; @@ -377,9 +378,18 @@ private void trigger(MethodCall call, Result result) { final String channelName = json.getString("channelName"); final String eventName = json.getString("eventName"); - Channel channel = channels.get(channelName); + String data = "{}"; + if (json.has("data")) { + data = json.getString("data"); + } - channel.trigger(eventName, "{}"); + Channel channel = channels.get(channelName); + if (channel instanceof PrivateChannel) { + if (isLoggingEnabled) { + Log.d(TAG, String.format("Trigger event: %s with data: %s", eventName, data)); + } + ((PrivateChannel) channel).trigger(eventName, data); + } } catch (Exception e) { if (isLoggingEnabled) { Log.d(TAG, String.format("unbind exception: %s", e.getMessage())); diff --git a/example/pubspec.lock b/example/pubspec.lock index 43ec0cf..96eb21f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -116,13 +116,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" petitparser: dependency: transitive description: @@ -183,7 +176,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" typed_data: dependency: transitive description: diff --git a/pubspec.lock b/pubspec.lock index c72b05a..a06243f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -421,7 +421,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" timing: dependency: transitive description: