From 2279f1d3302e10fb0abe4bcde897a79c4ce94fb7 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Thu, 2 Jan 2025 13:23:14 +0100 Subject: [PATCH 1/5] Introduce include fields classes (KMP)(AppContext) --- PubNub.xcodeproj/project.pbxproj | 4 + Sources/PubNub/KMP/KMPPubNub+AppContext.swift | 170 ++++++++++-------- Sources/PubNub/KMP/KMPPubNub.swift | 2 +- .../Wrappers/KMPAppContextIncludeFields.swift | 131 ++++++++++++++ 4 files changed, 229 insertions(+), 78 deletions(-) create mode 100644 Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift diff --git a/PubNub.xcodeproj/project.pbxproj b/PubNub.xcodeproj/project.pbxproj index 0deb79bf..5d743514 100644 --- a/PubNub.xcodeproj/project.pbxproj +++ b/PubNub.xcodeproj/project.pbxproj @@ -425,6 +425,7 @@ 3D4ED42F2B519FC500FE58C7 /* SubscriptionSessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D4ED42E2B519FC500FE58C7 /* SubscriptionSessionTests.swift */; }; 3D5BE9AE2BCEA5B50091ACA7 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3D34160A2BB5832E008558A0 /* PrivacyInfo.xcprivacy */; }; 3D6265D72ABCA79100FDD5E6 /* CryptorUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D6265D62ABCA79100FDD5E6 /* CryptorUtils.swift */; }; + 3D7062C42D26AA20000729E1 /* KMPAppContextIncludeFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D7062C32D26AA20000729E1 /* KMPAppContextIncludeFields.swift */; }; 3D7411A32C171F2B002267B8 /* Int+NSNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D7411A22C171F2B002267B8 /* Int+NSNumber.swift */; }; 3D758DBF2AAA1C49005D2B36 /* CryptoModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D758DBE2AAA1C49005D2B36 /* CryptoModule.swift */; }; 3D758DC82AB06A12005D2B36 /* CryptoInputStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D758DC62AB06A12005D2B36 /* CryptoInputStream.swift */; }; @@ -1046,6 +1047,7 @@ 3D452B242C05DF6D008987D4 /* KMPHereNowResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPHereNowResult.swift; sourceTree = ""; }; 3D4ED42E2B519FC500FE58C7 /* SubscriptionSessionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionSessionTests.swift; sourceTree = ""; }; 3D6265D62ABCA79100FDD5E6 /* CryptorUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptorUtils.swift; sourceTree = ""; }; + 3D7062C32D26AA20000729E1 /* KMPAppContextIncludeFields.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPAppContextIncludeFields.swift; sourceTree = ""; }; 3D7411A22C171F2B002267B8 /* Int+NSNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+NSNumber.swift"; sourceTree = ""; }; 3D758DBE2AAA1C49005D2B36 /* CryptoModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoModule.swift; sourceTree = ""; }; 3D758DC62AB06A12005D2B36 /* CryptoInputStream.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CryptoInputStream.swift; sourceTree = ""; }; @@ -2079,6 +2081,7 @@ 3DBFF2BE2C22F21200142985 /* KMPEntity.swift */, 3DBFF2C22C2300F500142985 /* KMPSubscription.swift */, 3D3C38822C47D62700E782E7 /* KMPError.swift */, + 3D7062C32D26AA20000729E1 /* KMPAppContextIncludeFields.swift */, ); path = Wrappers; sourceTree = ""; @@ -3720,6 +3723,7 @@ 35EE358C22E26A4D00E3F081 /* HTTPURLResponse+PubNub.swift in Sources */, 3D389FEE2B35AF4A006928E7 /* SubscribeTransition.swift in Sources */, 3DB925822B7AA75F001B7E90 /* Subscribable.swift in Sources */, + 3D7062C42D26AA20000729E1 /* KMPAppContextIncludeFields.swift in Sources */, 3DB9257E2B7AA75F001B7E90 /* PubNubEntityEvent.swift in Sources */, 3D389FE32B35AF4A006928E7 /* EffectHandler.swift in Sources */, 350EFBE022C9573F00FA33AA /* NSLocking+PubNub.swift in Sources */, diff --git a/Sources/PubNub/KMP/KMPPubNub+AppContext.swift b/Sources/PubNub/KMP/KMPPubNub+AppContext.swift index f48f3da5..069258f9 100644 --- a/Sources/PubNub/KMP/KMPPubNub+AppContext.swift +++ b/Sources/PubNub/KMP/KMPPubNub+AppContext.swift @@ -81,6 +81,33 @@ extension KMPPubNub { } } } + + private func mapToPubNubIncludeFields(from includeFields: KMPAppContextIncludeFields) -> PubNub.IncludeFields { + PubNub.IncludeFields( + custom: includeFields.includeCustom, + type: includeFields.includeType, + status: includeFields.includeStatus, + totalCount: includeFields.includeTotalCount + ) + } + + private func mapToChannelIncludeFields(from includeFields: KMPChannelIncludeFields) -> PubNub.ChannelIncludeFields { + PubNub.ChannelIncludeFields( + custom: includeFields.includeCustom, + type: includeFields.includeType, + status: includeFields.includeStatus, + totalCount: includeFields.includeTotalCount + ) + } + + private func mapToPubNubUserIncludeFields(from includeFields: KMPUserIncludeFields) -> PubNub.UserIncludeFields { + PubNub.UserIncludeFields( + custom: includeFields.includeCustom, + type: includeFields.includeType, + status: includeFields.includeStatus, + totalCount: includeFields.includeTotalCount + ) + } } @objc @@ -90,13 +117,12 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [KMPObjectSortProperty], - includeCount: Bool, - includeCustom: Bool, + include includeFields: KMPChannelIncludeFields, onSuccess: @escaping (([KMPChannelMetadata], NSNumber?, KMPHashedPage) -> Void), onFailure: @escaping ((Error) -> Void) ) { pubnub.allChannelMetadata( - include: PubNub.IncludeFields(custom: includeCustom, totalCount: includeCount), + include: mapToPubNubIncludeFields(from: includeFields), filter: filter, sort: objectSortProperties(from: sort), limit: limit?.intValue, @@ -117,11 +143,11 @@ public extension KMPPubNub { func getChannelMetadata( metadataId: String, - includeCustom: Bool, + include includeFields: KMPChannelIncludeFields, onSuccess: @escaping ((KMPChannelMetadata) -> Void), onFailure: @escaping ((Error) -> Void) ) { - pubnub.fetchChannelMetadata(metadataId, include: PubNub.ChannelIncludeFields(custom: includeCustom)) { + pubnub.fetchChannelMetadata(metadataId, include: mapToChannelIncludeFields(from: includeFields)) { switch $0 { case .success(let metadata): onSuccess(KMPChannelMetadata(metadata: metadata)) @@ -136,9 +162,9 @@ public extension KMPPubNub { name: String?, description: String?, custom: KMPAnyJSON?, - includeCustom: Bool, type: String?, status: String?, + include includeFields: KMPChannelIncludeFields, onSuccess: @escaping ((KMPChannelMetadata) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -150,7 +176,7 @@ public extension KMPPubNub { channelDescription: description, custom: convertDictionaryToScalars(custom?.asMap()) ) - pubnub.setChannelMetadata(channelMetadata, include: PubNub.ChannelIncludeFields(custom: includeCustom)) { + pubnub.setChannelMetadata(channelMetadata, include: mapToChannelIncludeFields(from: includeFields)) { switch $0 { case .success(let metadata): onSuccess(KMPChannelMetadata(metadata: metadata)) @@ -180,13 +206,12 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [KMPObjectSortProperty], - includeCount: Bool, - includeCustom: Bool, + include includeFields: KMPUserIncludeFields, onSuccess: @escaping (([KMPUserMetadata], NSNumber?, KMPHashedPage) -> Void), onFailure: @escaping ((Error) -> Void) ) { pubnub.allUserMetadata( - include: PubNub.UserIncludeFields(custom: includeCustom, totalCount: includeCount), + include: mapToPubNubUserIncludeFields(from: includeFields), filter: filter, sort: objectSortProperties(from: sort), limit: limit?.intValue, @@ -207,11 +232,11 @@ public extension KMPPubNub { func getUserMetadata( metadataId: String?, - includeCustom: Bool, + include includeFields: KMPUserIncludeFields, onSuccess: @escaping ((KMPUserMetadata) -> Void), onFailure: @escaping ((Error) -> Void) ) { - pubnub.fetchUserMetadata(metadataId, include: PubNub.UserIncludeFields(custom: includeCustom)) { + pubnub.fetchUserMetadata(metadataId, include: mapToPubNubUserIncludeFields(from: includeFields)) { switch $0 { case .success(let metadata): onSuccess(KMPUserMetadata(metadata: metadata)) @@ -228,9 +253,9 @@ public extension KMPPubNub { profileUrl: String?, email: String?, custom: KMPAnyJSON?, - includeCustom: Bool, type: String?, status: String?, + include includeFields: KMPUserIncludeFields, onSuccess: @escaping ((KMPUserMetadata) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -244,10 +269,7 @@ public extension KMPPubNub { email: email, custom: convertDictionaryToScalars(custom?.asMap()) ) - pubnub.setUserMetadata( - userMetadata, - include: PubNub.UserIncludeFields(custom: includeCustom) - ) { + pubnub.setUserMetadata(userMetadata, include: mapToPubNubUserIncludeFields(from: includeFields)) { switch $0 { case .success(let metadata): onSuccess(KMPUserMetadata(metadata: metadata)) @@ -278,22 +300,21 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [String], - includeCount: Bool, - includeCustom: Bool, - includeChannelFields: Bool, - includeChannelCustomFields: Bool, - includeChannelType: Bool, + include includeFields: KMPMembershipIncludeFields, onSuccess: @escaping (([KMPMembershipMetadata], NSNumber?, KMPHashedPage?) -> Void), onFailure: @escaping ((Error) -> Void) ) { pubnub.fetchMemberships( userId: userId, include: .init( - customFields: includeCustom, - channelFields: includeChannelFields, - channelCustomFields: includeChannelCustomFields, - channelTypeField: includeChannelType, - totalCount: includeCount + customFields: includeFields.includeCustom, + channelFields: includeFields.includeChannel, + statusField: includeFields.includeStatus, + typeField: includeFields.includeType, + channelCustomFields: includeFields.includeChannelCustom, + channelTypeField: includeFields.includeChannelType, + channelStatusField: includeFields.includeChannelStatus, + totalCount: includeFields.includeTotalCount ), filter: filter, sort: mapToMembershipSortFields(from: sort), @@ -320,11 +341,7 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [String], - includeCount: Bool, - includeCustom: Bool, - includeChannelFields: Bool, - includeChannelCustomFields: Bool, - includeChannelType: Bool, + include includeFields: KMPMembershipIncludeFields, onSuccess: @escaping (([KMPMembershipMetadata], NSNumber?, KMPHashedPage?) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -339,11 +356,14 @@ public extension KMPPubNub { ) }, include: .init( - customFields: includeCustom, - channelFields: includeChannelFields, - channelCustomFields: includeChannelCustomFields, - channelTypeField: includeChannelType, - totalCount: includeCount + customFields: includeFields.includeCustom, + channelFields: includeFields.includeChannel, + statusField: includeFields.includeStatus, + typeField: includeFields.includeType, + channelCustomFields: includeFields.includeChannelCustom, + channelTypeField: includeFields.includeChannelType, + channelStatusField: includeFields.includeChannelStatus, + totalCount: includeFields.includeTotalCount ), filter: filter, sort: mapToMembershipSortFields(from: sort), @@ -370,11 +390,7 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [String], - includeCount: Bool, - includeCustom: Bool, - includeChannelFields: Bool, - includeChannelCustomFields: Bool, - includeChannelType: Bool, + include includeFields: KMPMembershipIncludeFields, onSuccess: @escaping (([KMPMembershipMetadata], NSNumber?, KMPHashedPage?) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -387,11 +403,14 @@ public extension KMPPubNub { ) }, include: .init( - customFields: includeCustom, - channelFields: includeChannelFields, - channelCustomFields: includeChannelCustomFields, - channelTypeField: includeChannelType, - totalCount: includeCount + customFields: includeFields.includeCustom, + channelFields: includeFields.includeChannel, + statusField: includeFields.includeStatus, + typeField: includeFields.includeType, + channelCustomFields: includeFields.includeChannelCustom, + channelTypeField: includeFields.includeChannelType, + channelStatusField: includeFields.includeChannelStatus, + totalCount: includeFields.includeTotalCount ), filter: filter, sort: mapToMembershipSortFields(from: sort), @@ -417,22 +436,21 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [String], - includeCount: Bool, - includeCustom: Bool, - includeUserFields: Bool, - includeUserCustomFields: Bool, - includeUserType: Bool, + include includeFields: KMPMemberIncludeFields, onSuccess: @escaping (([KMPMembershipMetadata], NSNumber?, KMPHashedPage?) -> Void), onFailure: @escaping ((Error) -> Void) ) { pubnub.fetchMembers( channel: channel, include: .init( - customFields: includeCustom, - uuidFields: includeUserFields, - uuidCustomFields: includeUserCustomFields, - uuidTypeField: includeUserType, - totalCount: includeCount + customFields: includeFields.includeCustom, + uuidFields: includeFields.includeUser, + statusField: includeFields.includeStatus, + typeField: includeFields.includeType, + uuidCustomFields: includeFields.includeUserCustom, + uuidTypeField: includeFields.includeUserType, + uuidStatusField: includeFields.includeUserStatus, + totalCount: includeFields.includeTotalCount ), filter: filter, sort: mapToMembershipSortFields(from: sort), @@ -459,11 +477,7 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [String], - includeCount: Bool, - includeCustom: Bool, - includeUser: Bool, - includeUserCustom: Bool, - includeUserType: Bool, + include includeFields: KMPMemberIncludeFields, onSuccess: @escaping (([KMPMembershipMetadata], NSNumber?, KMPHashedPage?) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -478,11 +492,14 @@ public extension KMPPubNub { ) }, include: .init( - customFields: includeCustom, - uuidFields: includeUser, - uuidCustomFields: includeUserCustom, - uuidTypeField: includeUserType, - totalCount: includeCount + customFields: includeFields.includeCustom, + uuidFields: includeFields.includeUser, + statusField: includeFields.includeStatus, + typeField: includeFields.includeType, + uuidCustomFields: includeFields.includeUserCustom, + uuidTypeField: includeFields.includeUserType, + uuidStatusField: includeFields.includeUserStatus, + totalCount: includeFields.includeTotalCount ), filter: filter, sort: mapToMembershipSortFields(from: sort), @@ -509,11 +526,7 @@ public extension KMPPubNub { page: KMPHashedPage?, filter: String?, sort: [String], - includeCount: Bool, - includeCustom: Bool, - includeUser: Bool, - includeUserCustom: Bool, - includeUserType: Bool, + include includeFields: KMPMemberIncludeFields, onSuccess: @escaping (([KMPMembershipMetadata], NSNumber?, KMPHashedPage?) -> Void), onFailure: @escaping ((Error) -> Void) ) { @@ -526,11 +539,14 @@ public extension KMPPubNub { ) }, include: .init( - customFields: includeCustom, - uuidFields: includeUser, - uuidCustomFields: includeUserCustom, - uuidTypeField: includeUserType, - totalCount: includeCount + customFields: includeFields.includeCustom, + uuidFields: includeFields.includeUser, + statusField: includeFields.includeStatus, + typeField: includeFields.includeType, + uuidCustomFields: includeFields.includeUserCustom, + uuidTypeField: includeFields.includeUserType, + uuidStatusField: includeFields.includeUserStatus, + totalCount: includeFields.includeTotalCount ), filter: filter, sort: mapToMembershipSortFields(from: sort), diff --git a/Sources/PubNub/KMP/KMPPubNub.swift b/Sources/PubNub/KMP/KMPPubNub.swift index a68db9d8..d71622d9 100644 --- a/Sources/PubNub/KMP/KMPPubNub.swift +++ b/Sources/PubNub/KMP/KMPPubNub.swift @@ -13,7 +13,7 @@ // While these symbols are public, they are intended strictly for internal usage. // // External developers should refrain from directly using these symbols in their code, as their implementation details -// may change in future versions of the framework, potentially leading to breaking changes.. +// may change in future versions of the framework, potentially leading to breaking changes. import Foundation diff --git a/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift b/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift new file mode 100644 index 00000000..9dd47338 --- /dev/null +++ b/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift @@ -0,0 +1,131 @@ +// +// KMPAppContextIncludeFields.swift +// +// Copyright (c) PubNub Inc. +// All rights reserved. +// +// This source code is licensed under the license found in the +// LICENSE file in the root directory of this source tree. +// +// IMPORTANT NOTE FOR DEVELOPERS USING THIS SDK +// +// All public symbols in this file are intended to allow interoperation with Kotlin Multiplatform for other PubNub frameworks. +// While these symbols are public, they are intended strictly for internal usage. +// +// External developers should refrain from directly using these symbols in their code, as their implementation details +// may change in future versions of the framework, potentially leading to breaking changes. + +import Foundation + +@objc public class KMPAppContextIncludeFields: NSObject { + @objc public let includeCustom: Bool + @objc public let includeStatus: Bool + @objc public let includeType: Bool + @objc public let includeTotalCount: Bool + + @objc init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true, + includeTotalCount: Bool = true + ) { + self.includeCustom = includeCustom + self.includeStatus = includeStatus + self.includeType = includeType + self.includeTotalCount = includeTotalCount + } +} + +@objc public class KMPUserIncludeFields: KMPAppContextIncludeFields { + override public init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true, + includeTotalCount: Bool = true + ) { + super.init( + includeCustom: includeCustom, + includeStatus: includeStatus, + includeType: includeType, + includeTotalCount: includeTotalCount + ) + } +} + +@objc public class KMPChannelIncludeFields: KMPAppContextIncludeFields { + override public init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true, + includeTotalCount: Bool = true + ) { + super.init( + includeCustom: includeCustom, + includeStatus: includeStatus, + includeType: includeType, + includeTotalCount: includeTotalCount + ) + } +} + +@objc public class KMPMemberIncludeFields: KMPAppContextIncludeFields { + @objc public let includeUser: Bool + @objc public let includeUserCustom: Bool + @objc public let includeUserType: Bool + @objc public let includeUserStatus: Bool + + @objc + public init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true, + includeTotalCount: Bool = false, + includeUser: Bool = false, + includeUserCustom: Bool = false, + includeUserType: Bool = false, + includeUserStatus: Bool = false + ) { + self.includeUser = includeUser + self.includeUserCustom = includeUserCustom + self.includeUserType = includeUserType + self.includeUserStatus = includeUserStatus + + super.init( + includeCustom: includeCustom, + includeStatus: includeStatus, + includeType: includeType, + includeTotalCount: includeTotalCount + ) + } +} + +@objc public class KMPMembershipIncludeFields: KMPAppContextIncludeFields { + @objc public let includeChannel: Bool + @objc public let includeChannelCustom: Bool + @objc public let includeChannelType: Bool + @objc public let includeChannelStatus: Bool + + @objc + public init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true, + includeTotalCount: Bool = false, + includeChannel: Bool = false, + includeChannelCustom: Bool = false, + includeChannelType: Bool = false, + includeChannelStatus: Bool = false + ) { + self.includeChannel = includeChannel + self.includeChannelCustom = includeChannelCustom + self.includeChannelType = includeChannelType + self.includeChannelStatus = includeChannelStatus + + super.init( + includeCustom: includeCustom, + includeStatus: includeStatus, + includeType: includeType, + includeTotalCount: includeTotalCount + ) + } +} From bd28bd4d58da1459ca10089de9551932e077c5c7 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Thu, 2 Jan 2025 14:08:07 +0100 Subject: [PATCH 2/5] Convenience initializers --- .../Wrappers/KMPAppContextIncludeFields.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift b/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift index 9dd47338..a5a87453 100644 --- a/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift +++ b/Sources/PubNub/KMP/Wrappers/KMPAppContextIncludeFields.swift @@ -37,6 +37,7 @@ import Foundation } @objc public class KMPUserIncludeFields: KMPAppContextIncludeFields { + @objc override public init( includeCustom: Bool = true, includeStatus: Bool = true, @@ -50,9 +51,24 @@ import Foundation includeTotalCount: includeTotalCount ) } + + @objc + public convenience init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true + ) { + self.init( + includeCustom: includeCustom, + includeStatus: includeStatus, + includeType: includeType, + includeTotalCount: false + ) + } } @objc public class KMPChannelIncludeFields: KMPAppContextIncludeFields { + @objc override public init( includeCustom: Bool = true, includeStatus: Bool = true, @@ -66,6 +82,20 @@ import Foundation includeTotalCount: includeTotalCount ) } + + @objc + public convenience init( + includeCustom: Bool = true, + includeStatus: Bool = true, + includeType: Bool = true + ) { + self.init( + includeCustom: includeCustom, + includeStatus: includeStatus, + includeType: includeType, + includeTotalCount: false + ) + } } @objc public class KMPMemberIncludeFields: KMPAppContextIncludeFields { From 9d2d8bbe004fef4ae86c70b6b8d9ea08629bfd97 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Thu, 2 Jan 2025 15:03:18 +0100 Subject: [PATCH 3/5] Add missing type field --- Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift b/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift index 895216a8..245de88e 100644 --- a/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift +++ b/Sources/PubNub/KMP/Wrappers/KMPAppContextEventResult.swift @@ -221,9 +221,10 @@ public class KMPChannelMetadata: NSObject { } @objc - public init(id: String, custom: KMPAnyJSON, status: String?) { + public init(id: String, custom: KMPAnyJSON, type: String?, status: String?) { self.id = id self.custom = custom.asMap() + self.type = type self.status = status } } @@ -255,10 +256,12 @@ public class KMPUserMetadata: NSObject { public init( id: String, custom: KMPAnyJSON?, + type: String?, status: String? ) { self.id = id self.custom = custom?.asMap() + self.type = type self.status = status } From 3abe89c96482a430d04e96e902270fc66e55af19 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Thu, 2 Jan 2025 15:29:36 +0100 Subject: [PATCH 4/5] Add missing type field (2) --- Sources/PubNub/KMP/KMPPubNub+AppContext.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/PubNub/KMP/KMPPubNub+AppContext.swift b/Sources/PubNub/KMP/KMPPubNub+AppContext.swift index 069258f9..c85c5fac 100644 --- a/Sources/PubNub/KMP/KMPPubNub+AppContext.swift +++ b/Sources/PubNub/KMP/KMPPubNub+AppContext.swift @@ -352,6 +352,7 @@ public extension KMPPubNub { userMetadataId: userId ?? pubnub.configuration.userId, channelMetadataId: $0.id, status: $0.status, + type: $0.type, custom: convertDictionaryToScalars($0.custom) ) }, @@ -488,6 +489,7 @@ public extension KMPPubNub { userMetadataId: $0.id, channelMetadataId: channel, status: $0.status, + type: $0.type, custom: convertDictionaryToScalars($0.custom) ) }, From db382384c12277ad8d0cebd23f3ac506b1b664b9 Mon Sep 17 00:00:00 2001 From: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:48:32 +0000 Subject: [PATCH 5/5] PubNub SDK 8.2.3 release. --- .pubnub.yml | 9 +++++++-- PubNub.xcodeproj/project.pbxproj | 16 ++++++++-------- PubNubSwift.podspec | 2 +- Sources/PubNub/Helpers/Constants.swift | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.pubnub.yml b/.pubnub.yml index 2f9dc9e0..594af080 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,9 +1,14 @@ --- name: swift scm: github.com/pubnub/swift -version: "8.2.2" +version: "8.2.3" schema: 1 changelog: + - date: 2025-01-03 + version: 8.2.3 + changes: + - type: feature + text: "Handle all possible values for the `include` field in the KMP layer (internal usage)." - date: 2024-12-11 version: 8.2.2 changes: @@ -631,7 +636,7 @@ sdks: - distribution-type: source distribution-repository: GitHub release package-name: PubNub - location: https://github.com/pubnub/swift/archive/refs/tags/8.2.2.zip + location: https://github.com/pubnub/swift/archive/refs/tags/8.2.3.zip supported-platforms: supported-operating-systems: macOS: diff --git a/PubNub.xcodeproj/project.pbxproj b/PubNub.xcodeproj/project.pbxproj index 5d743514..39dd392d 100644 --- a/PubNub.xcodeproj/project.pbxproj +++ b/PubNub.xcodeproj/project.pbxproj @@ -3999,7 +3999,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -4050,7 +4050,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -4158,7 +4158,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -4211,7 +4211,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -4332,7 +4332,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -4384,7 +4384,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -4864,7 +4864,7 @@ "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14"; OTHER_CFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)"; @@ -4907,7 +4907,7 @@ "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 8.2.2; + MARKETING_VERSION = 8.2.3; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14"; OTHER_CFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)"; diff --git a/PubNubSwift.podspec b/PubNubSwift.podspec index 8c70511c..b5c8b543 100644 --- a/PubNubSwift.podspec +++ b/PubNubSwift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'PubNubSwift' - s.version = '8.2.2' + s.version = '8.2.3' s.homepage = 'https://github.com/pubnub/swift' s.documentation_url = 'https://www.pubnub.com/docs/swift-native/pubnub-swift-sdk' s.authors = { 'PubNub, Inc.' => 'support@pubnub.com' } diff --git a/Sources/PubNub/Helpers/Constants.swift b/Sources/PubNub/Helpers/Constants.swift index 1ef03510..49e5ae72 100644 --- a/Sources/PubNub/Helpers/Constants.swift +++ b/Sources/PubNub/Helpers/Constants.swift @@ -57,7 +57,7 @@ public enum Constant { static let pubnubSwiftSDKName: String = "PubNubSwift" - static let pubnubSwiftSDKVersion: String = "8.2.2" + static let pubnubSwiftSDKVersion: String = "8.2.3" static let appBundleId: String = { if let info = Bundle.main.infoDictionary,