Skip to content

Commit

Permalink
PubNub Swift Chat SDK 0.10.3 release (#17)
Browse files Browse the repository at this point in the history
fix(membership): Fix the error when retrieving the unread messages count on the Membership instance
  • Loading branch information
jguz-pubnub authored Jan 23, 2025
1 parent c5b7919 commit f6e8397
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
needs: check-release
if: needs.check-release.outputs.release == 'true'
runs-on:
group: macos-arm-gh
group: macos-gh
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
SDK_PAM_PUB_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
SDK_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}
runs-on:
group: macos-arm-gh
group: macos-gh
strategy:
matrix:
environment: [iOS]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
package-managers-validation:
name: Validate package managers
runs-on:
group: macos-arm-gh
group: macos-gh
strategy:
matrix:
managers: [Swift Package Manager]
Expand Down
9 changes: 7 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: swift-chat-sdk
scm: github.com/pubnub/swift-chat-sdk
version: 0.10.2
version: 0.10.3
schema: 1
changelog:
- date: 2025-01-23
version: 0.10.3
changes:
- type: bug
text: "Fix the error when retrieving the unread messages count on the Membership instance."
- date: 2025-01-14
version: 0.10.2
changes:
Expand Down Expand Up @@ -95,7 +100,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: PubNubSwiftChatSDK
location: https://github.com/pubnub/swift-chat-sdk/archive/refs/tags/0.10.2-dev.zip
location: https://github.com/pubnub/swift-chat-sdk/archive/refs/tags/0.10.3-dev.zip
supported-platforms:
supported-operating-systems:
iOS:
Expand Down
4 changes: 2 additions & 2 deletions PubNubSwiftChatSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.10.2;
MARKETING_VERSION = 0.10.3;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
Expand Down Expand Up @@ -782,7 +782,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.10.2;
MARKETING_VERSION = 0.10.3;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
Expand Down
4 changes: 2 additions & 2 deletions Sources/Entities/Membership.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public protocol Membership {
///
/// - Parameters:
/// - completion: The async `Result` of the method call
/// - **Success**: The number of unread messages on the membership's channel
/// - **Success**: The number of unread messages on the membership's channel or `nil` when ``lastReadMessageTimetoken`` is also `nil`
/// - **Failure**: An `Error` describing the failure
func getUnreadMessagesCount(
completion: ((Swift.Result<UInt64, Error>) -> Void)?
completion: ((Swift.Result<UInt64?, Error>) -> Void)?
)

/// You can receive updates when specific user-channel Membership object(s) are added, edited, or removed.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Entities/MembershipImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ extension MembershipImpl: Membership {
}
}

public func getUnreadMessagesCount(completion: ((Swift.Result<UInt64, Error>) -> Void)? = nil) {
membership.getUnreadMessagesCount().async(caller: self) { (result: FutureResult<MembershipImpl, UInt64>) in
public func getUnreadMessagesCount(completion: ((Swift.Result<UInt64?, Error>) -> Void)? = nil) {
membership.getUnreadMessagesCount().async(caller: self) { (result: FutureResult<MembershipImpl, UInt64?>) in
switch result.result {
case let .success(messagesCount):
completion?(.success(messagesCount))
Expand Down
2 changes: 1 addition & 1 deletion Sources/Miscellaneous/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

import Foundation

let pubNubSwiftChatSDKVersion: String = "0.10.2"
let pubNubSwiftChatSDKVersion: String = "0.10.3"
13 changes: 13 additions & 0 deletions Tests/MembershipIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,19 @@ final class MembershipTests: PubNubSwiftChatSDKIntegrationTests {
)
}

func testMembership_GetUnreadMessagesCountForEmptyChannel() throws {
let someMembership = MembershipImpl(
chat: chat,
channel: channel,
user: UserImpl(chat: chat, id: randomString())
)
XCTAssertNil(
try awaitResultValue {
someMembership.getUnreadMessagesCount(completion: $0)
}
)
}

func testMembership_StreamUpdates() throws {
let expectation = expectation(description: "MembershipStreamUpdates")
expectation.assertForOverFulfill = true
Expand Down
2 changes: 1 addition & 1 deletion fastlane/.env.ios
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DESTINATION="platform=iOS Simulator,name=iPhone 16 Pro,OS=18.0"
DEVICES="iPhone 15 (17.5)"
PLATFORM="iOS Simulator"
2 changes: 1 addition & 1 deletion fastlane/.env.tvos
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DESTINATION="platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.0"
DEVICES="Apple TV (17.5)"
PLATFORM="tvOS Simulator"
24 changes: 17 additions & 7 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,24 @@ lane :test do
key: "subscribeKey",
value: sub_key
)
run_tests(
workspace: ENV['WORKSPACE'],
scheme: ENV['SCHEME_SDK'],
destination: ENV['DESTINATION'],
disable_concurrent_testing: true,
output_types: "html"
)

if ENV['PLATFORM'] == 'macOS'
run_tests(
workspace: ENV['WORKSPACE'],
scheme: ENV['SCHEME_SDK'],
destination: ENV['DESTINATION'],
disable_concurrent_testing: true,
output_types: "html"
)
else
run_tests(
workspace: ENV['WORKSPACE'],
scheme: ENV['SCHEME_SDK'],
devices: ENV['DEVICES'],
disable_concurrent_testing: true,
output_types: "html"
)
end
end

desc "Lints a release using Swift Package Manager"
Expand Down

0 comments on commit f6e8397

Please sign in to comment.