Skip to content

Commit

Permalink
Swapping checks for private and private-encrypted channels (#72)
Browse files Browse the repository at this point in the history
* Swapping checks for private and private-encrypted channels

* Remove whitespace

* Bump to version 2.0.2

Co-authored-by: Pusher CI <[email protected]>
  • Loading branch information
fbenevides and pusher-ci authored Sep 15, 2022
1 parent 186d02d commit ec5bd50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.2

* [FIXED] Fix private-encrypted channels subscriptions

## 2.0.1
* [FIXED] Change `getSocketId` function to return a `Future<String>`
* [FIXED] Replace `FlutterActivity` with general Activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ class PusherChannelsFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAw

private fun subscribe(channelName: String, result: Result) {
val channel = when {
channelName.startsWith("private-") -> pusher!!.subscribePrivate(channelName, this)
channelName.startsWith("private-encrypted-") -> pusher!!.subscribePrivateEncrypted(
channelName, this
)
channelName.startsWith("private-") -> pusher!!.subscribePrivate(channelName, this)
channelName.startsWith("presence-") -> pusher!!.subscribePresence(
channelName, this
)
Expand All @@ -160,9 +160,9 @@ class PusherChannelsFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAw

private fun trigger(channelName: String, eventName: String, data: String, result: Result) {
when {
channelName.startsWith("private-encrypted-") -> throw Exception("It's not currently possible to send a message using private encrypted channels.")
channelName.startsWith("private-") -> pusher!!.getPrivateChannel(channelName)
.trigger(eventName, data)
channelName.startsWith("private-encrypted-") -> throw Exception("It's not currently possible to send a message using private encrypted channels.")
channelName.startsWith("presence-") -> pusher!!.getPresenceChannel(channelName)
.trigger(eventName, data)
else -> throw Exception("Messages can only be sent to private and presence channels.")
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pusher_channels_flutter
description: Pusher Channels Flutter Plugin
version: 2.0.1
version: 2.0.2
homepage: https://github.com/pusher/pusher-channels-flutter
repository: https://github.com/pusher/pusher-channels-flutter
issue_tracker: https://github.com/pusher/pusher-channels-flutter/issues
Expand Down

0 comments on commit ec5bd50

Please sign in to comment.