Skip to content

Commit

Permalink
PubNubSubscriptionObjC (receivePresenceEvents)
Browse files Browse the repository at this point in the history
  • Loading branch information
jguz-pubnub committed Sep 9, 2024
1 parent 34a21e6 commit 56e3444
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Sources/PubNub/KMM/Wrappers/PubNubSubscriptionObjC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Foundation
@objc
public class PubNubSubscriptionObjC: NSObject {
let subscription: Subscription
let receivePresenceEvents: Bool

@objc public var onMessage: ((PubNubMessageObjC) -> Void)?
@objc public var onPresence: (([PubNubPresenceChangeObjC]) -> Void)?
Expand All @@ -24,14 +23,15 @@ public class PubNubSubscriptionObjC: NSObject {

@objc
public init(entity: PubNubEntityRepresentableObjC, receivePresenceEvents: Bool) {
self.subscription = Subscription(entity: entity.entity)
self.receivePresenceEvents = receivePresenceEvents
self.subscription = Subscription(
entity: entity.entity,
options: receivePresenceEvents ? ReceivePresenceEvents() : .empty()
)
}

@objc
public init(entity: PubNubEntityRepresentableObjC) {
self.subscription = Subscription(entity: entity.entity)
self.receivePresenceEvents = false
}

@objc
Expand Down Expand Up @@ -89,8 +89,7 @@ public class PubNubSubscriptionObjC: NSObject {
@objc
public func append(subscription: PubNubSubscriptionObjC) -> PubNubSubscriptionSetObjC {
let underlyingSubscription = Subscription(
entity: subscription.subscription.entity,
options: receivePresenceEvents ? ReceivePresenceEvents() : .empty()
entity: subscription.subscription.entity
)

underlyingSubscription.onMessage = {
Expand Down

0 comments on commit 56e3444

Please sign in to comment.