Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom message type support #191

Merged
merged 11 commits into from
Nov 18, 2024
70 changes: 38 additions & 32 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---
name: swift
scm: github.com/pubnub/swift
version: "8.0.1"
version: "8.1.0"
schema: 1
changelog:
- date: 2024-11-18
version: 8.1.0
changes:
- type: feature
text: "Add custom message type support for the following APIs: publish, signal, share file, subscribe, and history."
- date: 2024-10-17
version: 8.0.1
changes:
@@ -591,39 +596,38 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: PubNub
location: https://github.com/pubnub/swift/archive/refs/tags/8.0.1.zip
location: https://github.com/pubnub/swift/archive/refs/tags/8.1.0.zip
supported-platforms:
supported-operating-systems:
macOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- OS X 10.11
- macOS 10.15
maximum-os-version:
- macOS 11.4
- macOS 15.0.1
target-architecture:
- arm64
- x86_64
iOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- iOS 9.0
- iOS 12.0
maximum-os-version:
- iOS 14.6
- iOS 18.0.1
target-architecture:
- arm64
- armv7
target-devices:
- iPhone
- iPad
tvOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- tvOS 10.0
- tvOS 12.0
maximum-os-version:
- tvOS 14.6
- tvOS 18.0
target-architecture:
- arm64
target-devices:
@@ -632,10 +636,11 @@ sdks:
runtime-version:
- Swift 5.x
minimum-os-version:
- watchOS 2.0
- watchOS 4.0
maximum-os-version:
- watchOS 7.5
- watchOS 12.0
target-architecture:
- arm64
- armv7k
- arm64_32
target-devices:
@@ -659,32 +664,31 @@ sdks:
runtime-version:
- Swift 5.x
minimum-os-version:
- OS X 10.11
- macOS 10.15
maximum-os-version:
- macOS 11.4
- macOS 15.0.1
target-architecture:
- arm64
- x86_64
iOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- iOS 9.0
- iOS 12.0
maximum-os-version:
- iOS 14.6
- iOS 18.0.1
target-architecture:
- arm64
- armv7
target-devices:
- iPhone
- iPad
tvOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- tvOS 10.0
- tvOS 12.0
maximum-os-version:
- tvOS 14.6
- tvOS 18.0
target-architecture:
- arm64
target-devices:
@@ -693,12 +697,13 @@ sdks:
runtime-version:
- Swift 5.x
minimum-os-version:
- watchOS 2.0
- watchOS 4.0
maximum-os-version:
- watchOS 7.5
- watchOS 12.0
target-architecture:
- armv7k
- arm64_32
- arm64
target-devices:
- Apple Watch
- distribution-type: package
@@ -711,19 +716,19 @@ sdks:
runtime-version:
- Swift 5.x
minimum-os-version:
- OS X 10.11
- macOS 10.15
maximum-os-version:
- macOS 11.4
- macOS 15.0.1
target-architecture:
- arm64
- x86_64
iOS:
runtime-version:
- Swift 5.x
minimum-os-version:
- iOS 9.0
- iOS 14.0
maximum-os-version:
- iOS 14.6
- iOS 18.0.1
target-architecture:
- arm64
- armv7
@@ -734,9 +739,9 @@ sdks:
runtime-version:
- Swift 5.x
minimum-os-version:
- tvOS 10.0
- tvOS 12.0
maximum-os-version:
- tvOS 14.6
- tvOS 18.0
target-architecture:
- arm64
target-devices:
@@ -745,18 +750,19 @@ sdks:
runtime-version:
- Swift 5.x
minimum-os-version:
- watchOS 2.0
- watchOS 4.0
maximum-os-version:
- watchOS 7.5
- watchOS 12.0
target-architecture:
- armv7k
- arm64_32
- arm64
target-devices:
- Apple Watch
supported-platforms:
- version: PubNub Swift SDK
platforms:
- iOS 9.0 or higher
- macOS 10.11 or higher
- tvOS 9.0 or higher
- watchOS 2.0 or higher
- iOS 14.0 or higher
- macOS 10.15 or higher
- tvOS 12.0 or higher
- watchOS 4.0 or higher
16 changes: 8 additions & 8 deletions PubNub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -3995,7 +3995,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@@ -4046,7 +4046,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
@@ -4154,7 +4154,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@@ -4207,7 +4207,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
@@ -4328,7 +4328,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@@ -4380,7 +4380,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
@@ -4860,7 +4860,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
@@ -4903,7 +4903,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 8.0.1;
MARKETING_VERSION = 8.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
2 changes: 1 addition & 1 deletion PubNubSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PubNubSwift'
s.version = '8.0.1'
s.version = '8.1.0'
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' }
11 changes: 8 additions & 3 deletions Sources/PubNub/APIs/File+PubNub.swift
Original file line number Diff line number Diff line change
@@ -80,6 +80,8 @@ public extension PubNub {
struct PublishFileRequest {
/// The optional message that will be include alongside the File information
public var additionalMessage: JSONCodable?
/// A user-provided custom message type
public var customMessageType: String?
/// If true the published message is stored in history.
public var store: Bool?
/// Set a per message time to live in storage.
@@ -92,18 +94,21 @@ public extension PubNub {
/// Default init
/// - Parameters:
/// - additionalMessage: The optional message that will be include alongside the File information
/// - store: If true the published message is stored in history.
/// - ttl: Set a per message time to live in storage.
/// - customMessageType: A user-provided custom message type
/// - store: If true the published message is stored in history
/// - ttl: Set a per message time to live in storage
/// - meta: Additional metadata to publish alongside the file
/// - customRequestConfig: Custom configuration overrides for this request
public init(
additionalMessage: JSONCodable? = nil,
customMessageType: String? = nil,
store: Bool? = nil,
ttl: Int? = nil,
meta: JSONCodable? = nil,
customRequestConfig: RequestConfiguration = RequestConfiguration()
) {
self.additionalMessage = additionalMessage
self.customMessageType = customMessageType
self.store = store
self.ttl = ttl
self.meta = meta
@@ -222,7 +227,7 @@ public extension PubNub {

let router = PublishRouter(
.file(
message: fileMessage,
message: fileMessage, customMessageType: request.customMessageType,
shouldStore: request.store, ttl: request.ttl, meta: request.meta?.codableValue
),
configuration: configuration
2 changes: 1 addition & 1 deletion Sources/PubNub/Helpers/Constants.swift
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public enum Constant {

static let pubnubSwiftSDKName: String = "PubNubSwift"

static let pubnubSwiftSDKVersion: String = "8.0.1"
static let pubnubSwiftSDKVersion: String = "8.1.0"

static let appBundleId: String = {
if let info = Bundle.main.infoDictionary,
Loading