diff --git a/pubnub/lib/src/subscribe/envelope.dart b/pubnub/lib/src/subscribe/envelope.dart index 0b617a4..a21f152 100644 --- a/pubnub/lib/src/subscribe/envelope.dart +++ b/pubnub/lib/src/subscribe/envelope.dart @@ -120,23 +120,6 @@ class PresenceEvent { .map((uuid) => UUID(uuid)) .toList(); - static bool isValidPresenceEvent(Envelope envelope) { - final payload = envelope.payload; - if (payload is! Map) return false; - - final action = payload['action']; - final occupancy = payload['occupancy']; - - if (action is! String || - PresenceActionExtension.fromString(action) == PresenceAction.unknown) { - return false; - } - if (occupancy is! int) { - return false; - } - return true; - } - PresenceEvent.fromEnvelope(this.envelope) : action = PresenceActionExtension.fromString( envelope.payload['action'] as String), diff --git a/pubnub/lib/src/subscribe/subscription.dart b/pubnub/lib/src/subscribe/subscription.dart index 8024572..0daf9cd 100644 --- a/pubnub/lib/src/subscribe/subscription.dart +++ b/pubnub/lib/src/subscribe/subscription.dart @@ -62,7 +62,7 @@ class Subscription { /// Will only emit when [withPresence] is true. Stream get presence => _envelopesController.stream .where((envelope) => - PresenceEvent.isValidPresenceEvent(envelope) && + envelope.userMeta != null && (presenceChannels.contains(envelope.channel) || presenceChannels.contains(envelope.subscriptionPattern) || presenceChannelGroups.contains(envelope.subscriptionPattern)))