Skip to content

Commit

Permalink
PubNub Swift Chat SDK 0.9.2 release (#11)
Browse files Browse the repository at this point in the history
feat(platforms): add support for other Apple platforms
fix(chat): remove `getChannelSuggestions(text:limit:completion:)` method from `Chat` interface
fix(chat): remove `getUserSuggestions(text:limit:completion:)` method from `Chat` interface
fix(message-draft): wrong user suggestion source for message draft created on ThreadChannel
fix(chat): wrong type of last user activity time stored on the server (precision)
feat(message): lock moderated messages from editing
refactor(events): moderation events are now sent to a channel prefixed with `PUBNUB_INTERNAL_MODERATION.`
  • Loading branch information
jguz-pubnub authored Dec 17, 2024
1 parent eb4457a commit 8898769
Show file tree
Hide file tree
Showing 25 changed files with 143 additions and 228 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Tests

on:
push:
branches-ignore:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Validations

on:
push:
branches-ignore:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
45 changes: 43 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
---
name: swift-chat-sdk
scm: github.com/pubnub/swift-chat-sdk
version: "0.9.1"
version: "0.9.2"
schema: 1
changelog:
- date: 2024-12-17
version: 0.9.2
changes:
- type: feature
text: "Add support for other Apple platforms."
- type: feature
text: "Lock moderated messages from editing."
- type: bug
text: "Remove `getChannelSuggestions(text:limit:completion:)` method from `Chat` interface."
- type: bug
text: "Remove `getUserSuggestions(text:limit:completion:)` method from `Chat` interface."
- type: bug
text: "Wrong user suggestion source for message draft created on ThreadChannel."
- type: bug
text: "Wrong type of last user activity time stored on the server (precision)."
- type: improvement
text: "Moderation events are now sent to a channel prefixed with `PUBNUB_INTERNAL_MODERATION.`."
- date: 2024-12-05
version: 0.9.1
changes:
Expand Down Expand Up @@ -51,7 +68,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: PubNubSwiftChatSDK
location: https://github.com/pubnub/swift-chat-sdk/archive/refs/tags/0.9.1-dev.zip
location: https://github.com/pubnub/swift-chat-sdk/archive/refs/tags/0.9.2-dev.zip
supported-platforms:
supported-operating-systems:
iOS:
Expand All @@ -66,7 +83,31 @@ sdks:
target-devices:
- iPhone
- iPad
macOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- macOS 11.0
maximum-os-version:
- macOS 15.0.1
target-architecture:
- arm64
- x86_64
tvOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- tvOS 14.0
maximum-os-version:
- tvOS 18.0
target-architecture:
- arm64
target-devices:
- Apple TV

supported-platforms:
- version: PubNub Swift Chat SDK
platforms:
- iOS 14.0 or higher
- macOS 11.0 or higher
- tvOS 14.0 or higher
10 changes: 7 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import PackageDescription

let package = Package(
name: "PubNubSwiftChatSDK",
platforms: [.iOS(.v14)],
platforms: [
.iOS(.v14),
.macOS(.v11),
.tvOS(.v14)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
Expand All @@ -14,8 +18,8 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/pubnub/kmp-chat", exact: "0.9.0-dev"),
.package(url: "https://github.com/pubnub/swift", exact: "8.0.1")
.package(url: "https://github.com/pubnub/kmp-chat", exact: "0.9.3-dev"),
.package(url: "https://github.com/pubnub/swift", exact: "8.2.2")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
50 changes: 27 additions & 23 deletions PubNubSwiftChatSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
3D2CA2482C621876008D2284 /* MessageActionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D2CA2472C621876008D2284 /* MessageActionType.swift */; };
3D334BD02C8EE9E500F8793C /* PubNub.PushService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D334BCF2C8EE9E500F8793C /* PubNub.PushService.swift */; };
3D334BD22C8EEAA800F8793C /* PubNub.PushEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D334BD12C8EEAA800F8793C /* PubNub.PushEnvironment.swift */; };
3D5B58412D10B9A100CB74D1 /* PubNubChat in Frameworks */ = {isa = PBXBuildFile; productRef = 3D5B58402D10B9A100CB74D1 /* PubNubChat */; };
3D79EB862D0C40ED00F7AB56 /* PubNubChat.PubNubError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D79EB852D0C40ED00F7AB56 /* PubNubChat.PubNubError.swift */; };
3D7BBF6F2C8893D400FBA623 /* ChatAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D7BBF6E2C8893D400FBA623 /* ChatAdapter.swift */; };
3D83621A2CC7B35200A21B9A /* MessageDraftChangeListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8362192CC7B35200A21B9A /* MessageDraftChangeListener.swift */; };
3D842D242C9DC0AA005C0B55 /* ErrorConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D842D232C9DC0AA005C0B55 /* ErrorConstants.swift */; };
Expand Down Expand Up @@ -80,7 +82,6 @@
3DB73A7D2C57EA94007FE249 /* Timetoken.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DB73A7C2C57EA94007FE249 /* Timetoken.swift */; };
3DB73A7F2C58CCAE007FE249 /* GetCurrentUserMentionsResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DB73A7E2C58CCAE007FE249 /* GetCurrentUserMentionsResult.swift */; };
3DCF7DFC2CD0FFCC00889326 /* PubNubSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 3DCF7DFB2CD0FFCC00889326 /* PubNubSDK */; };
3DCF7DFF2CD1226100889326 /* PubNubChat in Frameworks */ = {isa = PBXBuildFile; productRef = 3DCF7DFE2CD1226100889326 /* PubNubChat */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -121,6 +122,7 @@
3D2CA2472C621876008D2284 /* MessageActionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageActionType.swift; sourceTree = "<group>"; };
3D334BCF2C8EE9E500F8793C /* PubNub.PushService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PubNub.PushService.swift; sourceTree = "<group>"; };
3D334BD12C8EEAA800F8793C /* PubNub.PushEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PubNub.PushEnvironment.swift; sourceTree = "<group>"; };
3D79EB852D0C40ED00F7AB56 /* PubNubChat.PubNubError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PubNubChat.PubNubError.swift; sourceTree = "<group>"; };
3D7BBF6E2C8893D400FBA623 /* ChatAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatAdapter.swift; sourceTree = "<group>"; };
3D8362192CC7B35200A21B9A /* MessageDraftChangeListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageDraftChangeListener.swift; sourceTree = "<group>"; };
3D842D232C9DC0AA005C0B55 /* ErrorConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorConstants.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -190,7 +192,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3DCF7DFF2CD1226100889326 /* PubNubChat in Frameworks */,
3D5B58412D10B9A100CB74D1 /* PubNubChat in Frameworks */,
3DCF7DFC2CD0FFCC00889326 /* PubNubSDK in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -317,6 +319,7 @@
3D2CA23D2C5BBCDB008D2284 /* PubNubChat.PNPushType.swift */,
3D2CA23F2C5BBDB6008D2284 /* PubNubChat.PNPushEnvironment.swift */,
3DB73A742C57D073007FE249 /* PubNubChat.Event.swift */,
3D79EB852D0C40ED00F7AB56 /* PubNubChat.PubNubError.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -398,7 +401,7 @@
name = PubNubSwiftChatSDK;
packageProductDependencies = (
3DCF7DFB2CD0FFCC00889326 /* PubNubSDK */,
3DCF7DFE2CD1226100889326 /* PubNubChat */,
3D5B58402D10B9A100CB74D1 /* PubNubChat */,
);
productName = PubNubChatSDK;
productReference = 3DB73A072C4FE13C007FE249 /* PubNubSwiftChatSDK.framework */;
Expand Down Expand Up @@ -452,7 +455,7 @@
mainGroup = 3DB739FD2C4FE13B007FE249;
packageReferences = (
3DCF7DFA2CD0FFCC00889326 /* XCRemoteSwiftPackageReference "swift" */,
3DCF7DFD2CD1226100889326 /* XCRemoteSwiftPackageReference "kmp-chat" */,
3D5B583F2D10B9A100CB74D1 /* XCRemoteSwiftPackageReference "kmp-chat" */,
);
productRefGroup = 3DB73A082C4FE13C007FE249 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -522,6 +525,7 @@
3DB73A652C57A782007FE249 /* CreateDirectConversationResult.swift in Sources */,
3DB73A5D2C53CC0A007FE249 /* ThreadChannelImpl.swift in Sources */,
3D334BD22C8EEAA800F8793C /* PubNub.PushEnvironment.swift in Sources */,
3D79EB862D0C40ED00F7AB56 /* PubNubChat.PubNubError.swift in Sources */,
3DB73A4F2C52881A007FE249 /* PubNubChat.ChannelType.swift in Sources */,
3DB73A6B2C57B9D8007FE249 /* GetUnreadMessagesCount.swift in Sources */,
3DB49E212C761BD1006356ED /* AutoCloseable.swift in Sources */,
Expand Down Expand Up @@ -728,23 +732,23 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 0.9.1;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.9.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.pubnub.SwiftChatSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INSTALL_OBJC_HEADER = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 14.0;
WATCHOS_DEPLOYMENT_TARGET = 8;
XROS_DEPLOYMENT_TARGET = 1.1;
Expand Down Expand Up @@ -777,23 +781,23 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 0.9.1;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.9.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.pubnub.SwiftChatSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INSTALL_OBJC_HEADER = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 14.0;
WATCHOS_DEPLOYMENT_TARGET = 8;
XROS_DEPLOYMENT_TARGET = 1.1;
Expand Down Expand Up @@ -877,35 +881,35 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
3DCF7DFA2CD0FFCC00889326 /* XCRemoteSwiftPackageReference "swift" */ = {
3D5B583F2D10B9A100CB74D1 /* XCRemoteSwiftPackageReference "kmp-chat" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pubnub/swift";
repositoryURL = "https://github.com/pubnub/kmp-chat/";
requirement = {
kind = exactVersion;
version = 8.0.1;
version = "0.9.3-dev";
};
};
3DCF7DFD2CD1226100889326 /* XCRemoteSwiftPackageReference "kmp-chat" */ = {
3DCF7DFA2CD0FFCC00889326 /* XCRemoteSwiftPackageReference "swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pubnub/kmp-chat";
repositoryURL = "https://github.com/pubnub/swift";
requirement = {
kind = exactVersion;
version = "0.9.0-dev";
version = 8.2.2;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
3D5B58402D10B9A100CB74D1 /* PubNubChat */ = {
isa = XCSwiftPackageProductDependency;
package = 3D5B583F2D10B9A100CB74D1 /* XCRemoteSwiftPackageReference "kmp-chat" */;
productName = PubNubChat;
};
3DCF7DFB2CD0FFCC00889326 /* PubNubSDK */ = {
isa = XCSwiftPackageProductDependency;
package = 3DCF7DFA2CD0FFCC00889326 /* XCRemoteSwiftPackageReference "swift" */;
productName = PubNubSDK;
};
3DCF7DFE2CD1226100889326 /* PubNubChat */ = {
isa = XCSwiftPackageProductDependency;
package = 3DCF7DFD2CD1226100889326 /* XCRemoteSwiftPackageReference "kmp-chat" */;
productName = PubNubChat;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 3DB739FE2C4FE13C007FE249 /* Project object */;
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It exposes various PubNub APIs with twists:

## Requirements

* iOS 14.0+ (support for other platforms is coming in future releases)
* iOS 14.0+ / macOS 11.0+ / tvOS 14.0+
* Xcode 15+
* Swift 5+

Expand All @@ -37,7 +37,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
1. Create or open your project inside Xcode.
2. Navigate to **File -> Add Package Dependencies**.
3. Search for `https://github.com/pubnub/swift-chat-sdk`
4. From the **Dependency Rule** drop-down list, select **Exact**. In the version input field, type `0.9.1-dev`
4. From the **Dependency Rule** drop-down list, select **Exact**. In the version input field, type `0.9.2-dev`
5. Click the **Add Package** button.

For more information see Apple's guide on [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)
Expand Down
28 changes: 0 additions & 28 deletions Sources/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -435,34 +435,6 @@ public protocol Chat: AnyObject {
completion: ((Swift.Result<(memberships: [ChatMembershipType], page: PubNubHashedPage?), Error>) -> Void)?
)

/// Retrieves all channels that match the provided 3-letter string from your app's keyset.
///
/// - Parameters:
/// - text: At least a 3-letter string typed in after `#` with the channel name you want to reference
/// - limit: Maximum number of returned channel names that match the typed 3-letter suggestion
/// - completion: The async `Result` of the method call
/// - **Success**: An array of ``Channel`` objects
/// - **Failure**: An `Error` describing the failure
func getChannelSuggestions(
text: String,
limit: Int,
completion: ((Swift.Result<[ChatChannelType], Error>) -> Void)?
)

/// Returns all suggested users that match the provided 3-letter string.
///
/// - Parameters:
/// - text: At least a 3-letter string typed in after `@` with the user name you want to mention
/// - limit: Maximum number of returned usernames that match the typed 3-letter suggestion
/// - completion: The async `Result` of the method call
/// - **Success**: An array of ``Channel`` objects
/// - **Failure**: An `Error` describing the failure
func getUserSuggestions(
text: String,
limit: Int,
completion: ((Swift.Result<[ChatUserType], Error>) -> Void)?
)

/// Retrieves all channels where your registered device receives push notifications.
///
/// - Parameters:
Expand Down
40 changes: 0 additions & 40 deletions Sources/ChatImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -658,46 +658,6 @@ extension ChatImpl: Chat {
}
}

public func getChannelSuggestions(
text: String,
limit: Int = 10,
completion: ((Swift.Result<[ChannelImpl], Error>) -> Void)? = nil
) {
chat.getChannelSuggestions(
text: text,
limit: Int32(limit)
).async(caller: self) { (result: FutureResult<ChatImpl, [PubNubChat.Channel_]>) in
switch result.result {
case let .success(channels):
completion?(.success(channels.compactMap {
ChannelImpl(channel: $0)
}))
case let .failure(error):
completion?(.failure(error))
}
}
}

public func getUserSuggestions(
text: String,
limit: Int = 10,
completion: ((Swift.Result<[UserImpl], Error>) -> Void)? = nil
) {
chat.getUserSuggestions(
text: text,
limit: Int32(limit)
).async(caller: self) { (result: FutureResult<ChatImpl, [PubNubChat.User]>) in
switch result.result {
case let .success(users):
completion?(.success(users.compactMap {
UserImpl(user: $0)
}))
case let .failure(error):
completion?(.failure(error))
}
}
}

public func getPushChannels(completion: ((Swift.Result<[String], Error>) -> Void)? = nil) {
chat.getPushChannels().async(caller: self) { (result: FutureResult<ChatImpl, [String]>) in
switch result.result {
Expand Down
Loading

0 comments on commit 8898769

Please sign in to comment.