Skip to content

Commit

Permalink
Add additional properties in the KMP layer (internal usage) (#195)
Browse files Browse the repository at this point in the history
feat(message): add support for `customMessageType` in the KMP layer
  • Loading branch information
jguz-pubnub authored Dec 9, 2024
1 parent 7b131fb commit 4ff9421
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
9 changes: 7 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---
name: swift
scm: github.com/pubnub/swift
version: "8.2.0"
version: "8.2.1"
schema: 1
changelog:
- date: 2024-12-09
version: 8.2.1
changes:
- type: feature
text: "Add support for `customMessageType` in the KMP layer (internal usage)."
- date: 2024-12-04
version: 8.2.0
changes:
Expand Down Expand Up @@ -619,7 +624,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: PubNub
location: https://github.com/pubnub/swift/archive/refs/tags/8.2.0.zip
location: https://github.com/pubnub/swift/archive/refs/tags/8.2.1.zip
supported-platforms:
supported-operating-systems:
macOS:
Expand Down
16 changes: 8 additions & 8 deletions PubNub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3995,7 +3995,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4046,7 +4046,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4154,7 +4154,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4207,7 +4207,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4328,7 +4328,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4380,7 +4380,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4860,7 +4860,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
Expand Down Expand Up @@ -4903,7 +4903,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.2.0;
MARKETING_VERSION = 8.2.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
Expand Down
2 changes: 1 addition & 1 deletion PubNubSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PubNubSwift'
s.version = '8.2.0'
s.version = '8.2.1'
s.homepage = 'https://github.com/pubnub/swift'
s.documentation_url = 'https://www.pubnub.com/docs/swift-native/pubnub-swift-sdk'
s.authors = { 'PubNub, Inc.' => '[email protected]' }
Expand Down
2 changes: 1 addition & 1 deletion Sources/PubNub/Helpers/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum Constant {

static let pubnubSwiftSDKName: String = "PubNubSwift"

static let pubnubSwiftSDKVersion: String = "8.2.0"
static let pubnubSwiftSDKVersion: String = "8.2.1"

static let appBundleId: String = {
if let info = Bundle.main.infoDictionary,
Expand Down
4 changes: 4 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 Expand Up @@ -176,6 +178,7 @@ public extension KMPPubNub {
meta: Any?,
ttl: NSNumber?,
shouldStore: NSNumber?,
customMessageType: String?,
onSuccess: @escaping ((KMPFile, Timetoken) -> Void),
onFailure: @escaping ((Error) -> Void)
) {
Expand All @@ -198,6 +201,7 @@ public extension KMPPubNub {
remoteFilename: fileName,
publishRequest: PubNub.PublishFileRequest(
additionalMessage: additionalMessage,
customMessageType: customMessageType,
store: shouldStore?.boolValue,
ttl: ttl?.intValue,
meta: meta
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 4ff9421

Please sign in to comment.