From 52f7086275e136c42875988b1e592a3d3687e4a3 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Wed, 4 Dec 2024 16:08:22 +0100 Subject: [PATCH] Add missing customMessageType parameter for the KMP layer --- Sources/PubNub/KMP/KMPPubNub+Files.swift | 2 ++ Sources/PubNub/KMP/KMPPubNub+Publish.swift | 9 ++++++++- .../PubNub/KMP/Wrappers/KMPAppContextEventResult.swift | 8 ++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Sources/PubNub/KMP/KMPPubNub+Files.swift b/Sources/PubNub/KMP/KMPPubNub+Files.swift index 06c836ad..be3f48bd 100644 --- a/Sources/PubNub/KMP/KMPPubNub+Files.swift +++ b/Sources/PubNub/KMP/KMPPubNub+Files.swift @@ -107,6 +107,7 @@ public extension KMPPubNub { meta: Any?, ttl: NSNumber?, shouldStore: NSNumber?, + customMessageType: String?, onSuccess: @escaping ((Timetoken) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -130,6 +131,7 @@ public extension KMPPubNub { ), request: PubNub.PublishFileRequest( additionalMessage: messageCodable, + customMessageType: customMessageType, store: shouldStore?.boolValue, ttl: ttl?.intValue, meta: metaCodable diff --git a/Sources/PubNub/KMP/KMPPubNub+Publish.swift b/Sources/PubNub/KMP/KMPPubNub+Publish.swift index 0809a141..1b268d5e 100644 --- a/Sources/PubNub/KMP/KMPPubNub+Publish.swift +++ b/Sources/PubNub/KMP/KMPPubNub+Publish.swift @@ -45,12 +45,14 @@ public extension KMPPubNub { meta: Any?, shouldStore: NSNumber?, ttl: NSNumber?, + customMessageType: String?, onSuccess: @escaping ((Timetoken) -> Void), onFailure: @escaping ((Error) -> Void) ) { pubnub.publish( channel: channel, message: asCodable(message), + customMessageType: customMessageType, shouldStore: shouldStore?.boolValue, storeTTL: shouldStore?.intValue, meta: asOptionalCodable(meta) @@ -72,10 +74,15 @@ public extension KMPPubNub { func signal( channel: String, message: Any, + customMessageType: String?, onSuccess: @escaping ((Timetoken) -> Void), onFailure: @escaping ((Error) -> Void) ) { - pubnub.signal(channel: channel, message: asCodable(message)) { + pubnub.signal( + channel: channel, + message: asCodable(message), + customMessageType: customMessageType + ) { switch $0 { case .success(let timetoken): onSuccess(timetoken) diff --git a/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift b/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift index 0b68b4e4..895216a8 100644 --- a/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift +++ b/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift @@ -124,11 +124,11 @@ public class KMPSetMembershipResult: KMPAppContextEventResult { @objc public class KMPRemoveMembershipResult: KMPAppContextEventResult { @objc public let channelId: String - @objc public let uuid: String + @objc public let userId: String - init(channelId: String, uuid: String) { + init(channelId: String, userId: String) { self.channelId = channelId - self.uuid = uuid + self.userId = userId super.init(channel: channelId) } } @@ -149,7 +149,7 @@ extension KMPAppContextEventResult { case .membershipMetadataSet(let metadata): return KMPSetMembershipResult(metadata: KMPMembershipMetadata(from: metadata)) case .membershipMetadataRemoved(let metadata): - return KMPRemoveMembershipResult(channelId: metadata.channelMetadataId, uuid: metadata.userMetadataId) + return KMPRemoveMembershipResult(channelId: metadata.channelMetadataId, userId: metadata.userMetadataId) } } }