Skip to content

Commit

Permalink
Add third-party licenses and userSuggestionSource property for Messag…
Browse files Browse the repository at this point in the history
…eDraft (#10)

feat(licenses): add third-party dependencies due to Kotlin Multiplatform usage
fix(message-draft): add missing userSuggestionSource property
  • Loading branch information
jguz-pubnub authored Dec 5, 2024
1 parent b7e5d70 commit eb4457a
Show file tree
Hide file tree
Showing 19 changed files with 387 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
environment: [iOS]
timeout-minutes: 17
timeout-minutes: 18
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
11 changes: 9 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
---
name: swift-chat-sdk
scm: github.com/pubnub/swift-chat-sdk
version: "0.9.0"
version: "0.9.1"
schema: 1
changelog:
- date: 2024-12-05
version: 0.9.1
changes:
- type: feature
text: "Add third-party dependencies due to Kotlin Multiplatform usage."
- type: bug
text: "Add missing userSuggestionSource property."
- date: 2024-11-06
version: 0.9.0
changes:
Expand Down Expand Up @@ -44,7 +51,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.0-dev.zip
location: https://github.com/pubnub/swift-chat-sdk/archive/refs/tags/0.9.1-dev.zip
supported-platforms:
supported-operating-systems:
iOS:
Expand Down
9 changes: 2 additions & 7 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ disabled_rules:
- type_name
- function_body_length
- function_parameter_count
excluded:
- .build
- bundle
- .bundle
- fastlane
- Tests
- Pods
included:
- Sources/
opt_in_rules:
- force_unwrapping
- overridden_super_call
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"

gem "fastlane", '2.225.0'
gem 'rexml', '3.3.8'
gem 'rexml', '3.3.9'
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.3.8)
rexml (3.3.9)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand Down Expand Up @@ -217,7 +217,7 @@ PLATFORMS

DEPENDENCIES
fastlane (= 2.225.0)
rexml (= 3.3.8)
rexml (= 3.3.9)

BUNDLED WITH
2.5.22
4 changes: 2 additions & 2 deletions PubNubSwiftChatSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 0.9.0;
MARKETING_VERSION = 0.9.1;
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 @@ -778,7 +778,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 0.9.0;
MARKETING_VERSION = 0.9.1;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.0-dev`
4. From the **Dependency Rule** drop-down list, select **Exact**. In the version input field, type `0.9.1-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
2 changes: 1 addition & 1 deletion Sources/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public protocol Chat: AnyObject {
completion: ((Swift.Result<(memberships: [ChatMembershipType], page: PubNubHashedPage?), Error>) -> Void)?
)

/// Retrieves all channels referenced in the `channel.sendText(...)` that match the provided 3-letter string from your app's keyset.
/// 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
Expand Down
10 changes: 4 additions & 6 deletions Sources/ChatImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,12 @@ extension ChatImpl: Chat {
switch result.result {
case let .success(response):
let eventImplArray = response.events.compactMap {
$0 as? PubNubChat.Event
}.compactMap { (event: PubNubChat.Event) -> EventWrapper? in
EventWrapper(event: EventImpl(
chat: result.caller,
timetoken: Timetoken(event.timetoken_),
payload: EventContent.from(rawValue: event.payload),
channelId: event.channelId,
userId: event.userId
timetoken: Timetoken($0.timetoken_),
payload: EventContent.from(rawValue: $0.payload),
channelId: $0.channelId,
userId: $0.userId
))
}
completion?(.success((
Expand Down
13 changes: 13 additions & 0 deletions Sources/MessageDraft/MessageDraft.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public protocol MessageDraft {
var channel: C { get }
/// Whether modifying the message text triggers the typing indicator on ``channel``
var isTypingIndicatorTriggered: Bool { get }
/// The scope for searching for suggested users
var userSuggestionSource: UserSuggestionSource { get }
/// The limit on the number of users returned when searching for users to mention
var userLimit: Int { get }
/// The limit on the number of channels returned when searching for channels to reference
Expand Down Expand Up @@ -126,6 +128,17 @@ public enum UserSuggestionSource {
return .channel
}
}

static func from(source: PubNubChat.MessageDraftUserSuggestionSource) -> UserSuggestionSource {
switch source {
case .global:
return .global
case .channel:
return .channel
default:
return .global
}
}
}

/// Part of a ``Message`` or ``MessageDraft`` content.
Expand Down
2 changes: 1 addition & 1 deletion Sources/MessageDraft/MessageDraftChangeListener.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SuggestedMentionsFuture: FutureObject {
init(future: PubNubChat.PNFuture) {
self.future = future
}

func async(completion: @escaping (Swift.Result<[SuggestedMention], Error>) -> Void) {
future.async(caller: self, callback: { (result: FutureResult<SuggestedMentionsFuture, [PubNubChat.SuggestedMention]>) in
switch result.result {
Expand Down
4 changes: 4 additions & 0 deletions Sources/MessageDraft/MessageDraftImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ extension MessageDraftImpl: MessageDraft {
messageDraft.isTypingIndicatorTriggered
}

public var userSuggestionSource: UserSuggestionSource {
UserSuggestionSource.from(source: messageDraft.userSuggestionSource)
}

public var userLimit: Int {
Int(messageDraft.userLimit)
}
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 = "0.9.0"
let pubNubSwiftChatSDKVersion: String = "0.9.1"
29 changes: 29 additions & 0 deletions ThirdPartyLicenses/3-clause BSD license with copyright notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (C) 2012-2016 Free Software Foundation, Inc.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:

# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.

# (2) Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.

# (3) The name of the author may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
14 changes: 14 additions & 0 deletions ThirdPartyLicenses/Apache Harmony copyright notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Apache Harmony
Copyright 2006, 2010 The Apache Software Foundation.

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

Portions of Apache Harmony were originally developed by
Intel Corporation and are licensed to the Apache Software
Foundation under the "Software Grant and Corporate Contribution
License Agreement" and for which the following copyright notices
apply
(C) Copyright 2005 Intel Corporation
(C) Copyright 2005-2006 Intel Corporation
(C) Copyright 2006 Intel Corporation
Loading

0 comments on commit eb4457a

Please sign in to comment.