Skip to content

Commit

Permalink
Add missing customMessageType parameter for the KMP layer
Browse files Browse the repository at this point in the history
  • Loading branch information
jguz-pubnub committed Dec 4, 2024
1 parent 7b131fb commit 52f7086
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Sources/PubNub/KMP/KMPPubNub+Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public extension KMPPubNub {
meta: Any?,
ttl: NSNumber?,
shouldStore: NSNumber?,
customMessageType: String?,
onSuccess: @escaping ((Timetoken) -> Void),
onFailure: @escaping ((Error) -> Void)
) {
Expand All @@ -130,6 +131,7 @@ public extension KMPPubNub {
),
request: PubNub.PublishFileRequest(
additionalMessage: messageCodable,
customMessageType: customMessageType,
store: shouldStore?.boolValue,
ttl: ttl?.intValue,
meta: metaCodable
Expand Down
9 changes: 8 additions & 1 deletion Sources/PubNub/KMP/KMPPubNub+Publish.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit 52f7086

Please sign in to comment.