Skip to content

Commit

Permalink
Add custom message type support (#191)
Browse files Browse the repository at this point in the history
feat(message-type): add custom message type support for the following APIs: publish, signal, share file, subscribe, and history
  • Loading branch information
jguz-pubnub authored Nov 18, 2024
1 parent 9ef3b1a commit 022aa54
Show file tree
Hide file tree
Showing 21 changed files with 573 additions and 177 deletions.
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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -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)";
Expand Down
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.' => '[email protected]' }
Expand Down
11 changes: 8 additions & 3 deletions Sources/PubNub/APIs/File+PubNub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/PubNub/Helpers/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 022aa54

Please sign in to comment.