diff --git a/.pubnub.yml b/.pubnub.yml index e2adba0b..13bf7b27 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,9 +1,14 @@ --- name: swift scm: github.com/pubnub/swift -version: "5.0.0" +version: "5.0.1" schema: 1 changelog: + - date: 2022-01-19 + version: 5.0.1 + changes: + - type: bug + text: "Fix issue because of which access token not updated in subscription session." - date: 2022-01-12 version: 5.0.0 changes: @@ -434,7 +439,7 @@ sdks: - distribution-type: source distribution-repository: GitHub release package-name: PubNub - location: https://github.com/pubnub/swift/archive/refs/tags/5.0.0.zip + location: https://github.com/pubnub/swift/archive/refs/tags/5.0.1.zip supported-platforms: supported-operating-systems: macOS: diff --git a/Examples/Example-iOS/Info.plist b/Examples/Example-iOS/Info.plist index 728d6b6e..3afa0c18 100644 --- a/Examples/Example-iOS/Info.plist +++ b/Examples/Example-iOS/Info.plist @@ -6,6 +6,8 @@ demo PubNubSubscribeKey demo + PubNubUuid + demo-user CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/PubNub.xcodeproj/project.pbxproj b/PubNub.xcodeproj/project.pbxproj index 7d67f733..710b79c3 100644 --- a/PubNub.xcodeproj/project.pbxproj +++ b/PubNub.xcodeproj/project.pbxproj @@ -2506,7 +2506,7 @@ "$(inherited)", "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx", ); - MARKETING_VERSION = 5.0.0; + MARKETING_VERSION = 5.0.1; OTHER_CFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)"; @@ -2539,7 +2539,7 @@ "$(inherited)", "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx", ); - MARKETING_VERSION = 5.0.0; + MARKETING_VERSION = 5.0.1; OTHER_CFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)"; diff --git a/PubNubSwift.podspec b/PubNubSwift.podspec index 3caedd42..0e2086a8 100644 --- a/PubNubSwift.podspec +++ b/PubNubSwift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'PubNubSwift' - s.version = '5.0.0' + s.version = '5.0.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.' => 'support@pubnub.com' } diff --git a/Sources/PubNub/Helpers/Constants.swift b/Sources/PubNub/Helpers/Constants.swift index cd27f883..30842f44 100644 --- a/Sources/PubNub/Helpers/Constants.swift +++ b/Sources/PubNub/Helpers/Constants.swift @@ -62,7 +62,7 @@ public struct Constant { }() static let pubnubSwiftSDKVersion: String = { - "5.0.0" + "5.0.1" }() static let appBundleId: String = { diff --git a/Sources/PubNub/PubNub.swift b/Sources/PubNub/PubNub.swift index 070f402c..ca58d337 100644 --- a/Sources/PubNub/PubNub.swift +++ b/Sources/PubNub/PubNub.swift @@ -2041,6 +2041,7 @@ extension PubNub { /// - Parameter token: The token to add to the Token Management System. public mutating func set(token: String) { configuration.authToken = token + subscription.configuration.authToken = token } } diff --git a/Sources/PubNub/Subscription/SubscribeSessionFactory.swift b/Sources/PubNub/Subscription/SubscribeSessionFactory.swift index dfd44a0f..93db3aab 100644 --- a/Sources/PubNub/Subscription/SubscribeSessionFactory.swift +++ b/Sources/PubNub/Subscription/SubscribeSessionFactory.swift @@ -113,6 +113,8 @@ public protocol SubscriptionConfiguration: RouterConfiguration { var requestMessageCountThreshold: UInt { get } /// PSV2 feature to subscribe with a custom filter expression. var filterExpression: String? { get } + /// If Access Manager (PAM) is enabled, client will use `authToken` instead of `authKey` on all requests + override var authToken: String? { get set } } extension SubscriptionConfiguration { diff --git a/Sources/PubNub/Subscription/SubscriptionSession.swift b/Sources/PubNub/Subscription/SubscriptionSession.swift index 3b2aa185..a30f1157 100644 --- a/Sources/PubNub/Subscription/SubscriptionSession.swift +++ b/Sources/PubNub/Subscription/SubscriptionSession.swift @@ -33,7 +33,7 @@ public class SubscriptionSession { public let uuid = UUID() let longPollingSession: SessionReplaceable - let configuration: SubscriptionConfiguration + internal(set) var configuration: SubscriptionConfiguration let sessionStream: SessionListener /// PSV2 feature to subscribe with a custom filter expression. diff --git a/Tests/PubNubTests/Helpers/PAMTokenTests.swift b/Tests/PubNubTests/Helpers/PAMTokenTests.swift index 0a0e7190..d613dc13 100644 --- a/Tests/PubNubTests/Helpers/PAMTokenTests.swift +++ b/Tests/PubNubTests/Helpers/PAMTokenTests.swift @@ -69,6 +69,16 @@ extension PAMTokenTests { pubnub.set(token: "access-token") XCTAssertEqual(pubnub.configuration.authToken, "access-token") + XCTAssertEqual(pubnub.subscription.configuration.authToken, "access-token") + } + + func testChangeToken() { + var pubnub = PubNub(configuration: config) + pubnub.set(token: "access-token") + pubnub.set(token: "access-token-updated") + + XCTAssertEqual(pubnub.configuration.authToken, "access-token-updated") + XCTAssertEqual(pubnub.subscription.configuration.authToken, "access-token-updated") } // swiftlint:enable line_length