Skip to content

Commit 022aa54

Browse files
authored
Add custom message type support (#191)
feat(message-type): add custom message type support for the following APIs: publish, signal, share file, subscribe, and history
1 parent 9ef3b1a commit 022aa54

21 files changed

+573
-177
lines changed

.pubnub.yml

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
---
22
name: swift
33
scm: github.com/pubnub/swift
4-
version: "8.0.1"
4+
version: "8.1.0"
55
schema: 1
66
changelog:
7+
- date: 2024-11-18
8+
version: 8.1.0
9+
changes:
10+
- type: feature
11+
text: "Add custom message type support for the following APIs: publish, signal, share file, subscribe, and history."
712
- date: 2024-10-17
813
version: 8.0.1
914
changes:
@@ -591,39 +596,38 @@ sdks:
591596
- distribution-type: source
592597
distribution-repository: GitHub release
593598
package-name: PubNub
594-
location: https://github.com/pubnub/swift/archive/refs/tags/8.0.1.zip
599+
location: https://github.com/pubnub/swift/archive/refs/tags/8.1.0.zip
595600
supported-platforms:
596601
supported-operating-systems:
597602
macOS:
598603
runtime-version:
599604
- Swift 5.x
600605
minimum-os-version:
601-
- OS X 10.11
606+
- macOS 10.15
602607
maximum-os-version:
603-
- macOS 11.4
608+
- macOS 15.0.1
604609
target-architecture:
605610
- arm64
606611
- x86_64
607612
iOS:
608613
runtime-version:
609614
- Swift 5.x
610615
minimum-os-version:
611-
- iOS 9.0
616+
- iOS 12.0
612617
maximum-os-version:
613-
- iOS 14.6
618+
- iOS 18.0.1
614619
target-architecture:
615620
- arm64
616-
- armv7
617621
target-devices:
618622
- iPhone
619623
- iPad
620624
tvOS:
621625
runtime-version:
622626
- Swift 5.x
623627
minimum-os-version:
624-
- tvOS 10.0
628+
- tvOS 12.0
625629
maximum-os-version:
626-
- tvOS 14.6
630+
- tvOS 18.0
627631
target-architecture:
628632
- arm64
629633
target-devices:
@@ -632,10 +636,11 @@ sdks:
632636
runtime-version:
633637
- Swift 5.x
634638
minimum-os-version:
635-
- watchOS 2.0
639+
- watchOS 4.0
636640
maximum-os-version:
637-
- watchOS 7.5
641+
- watchOS 12.0
638642
target-architecture:
643+
- arm64
639644
- armv7k
640645
- arm64_32
641646
target-devices:
@@ -659,32 +664,31 @@ sdks:
659664
runtime-version:
660665
- Swift 5.x
661666
minimum-os-version:
662-
- OS X 10.11
667+
- macOS 10.15
663668
maximum-os-version:
664-
- macOS 11.4
669+
- macOS 15.0.1
665670
target-architecture:
666671
- arm64
667672
- x86_64
668673
iOS:
669674
runtime-version:
670675
- Swift 5.x
671676
minimum-os-version:
672-
- iOS 9.0
677+
- iOS 12.0
673678
maximum-os-version:
674-
- iOS 14.6
679+
- iOS 18.0.1
675680
target-architecture:
676681
- arm64
677-
- armv7
678682
target-devices:
679683
- iPhone
680684
- iPad
681685
tvOS:
682686
runtime-version:
683687
- Swift 5.x
684688
minimum-os-version:
685-
- tvOS 10.0
689+
- tvOS 12.0
686690
maximum-os-version:
687-
- tvOS 14.6
691+
- tvOS 18.0
688692
target-architecture:
689693
- arm64
690694
target-devices:
@@ -693,12 +697,13 @@ sdks:
693697
runtime-version:
694698
- Swift 5.x
695699
minimum-os-version:
696-
- watchOS 2.0
700+
- watchOS 4.0
697701
maximum-os-version:
698-
- watchOS 7.5
702+
- watchOS 12.0
699703
target-architecture:
700704
- armv7k
701705
- arm64_32
706+
- arm64
702707
target-devices:
703708
- Apple Watch
704709
- distribution-type: package
@@ -711,19 +716,19 @@ sdks:
711716
runtime-version:
712717
- Swift 5.x
713718
minimum-os-version:
714-
- OS X 10.11
719+
- macOS 10.15
715720
maximum-os-version:
716-
- macOS 11.4
721+
- macOS 15.0.1
717722
target-architecture:
718723
- arm64
719724
- x86_64
720725
iOS:
721726
runtime-version:
722727
- Swift 5.x
723728
minimum-os-version:
724-
- iOS 9.0
729+
- iOS 14.0
725730
maximum-os-version:
726-
- iOS 14.6
731+
- iOS 18.0.1
727732
target-architecture:
728733
- arm64
729734
- armv7
@@ -734,9 +739,9 @@ sdks:
734739
runtime-version:
735740
- Swift 5.x
736741
minimum-os-version:
737-
- tvOS 10.0
742+
- tvOS 12.0
738743
maximum-os-version:
739-
- tvOS 14.6
744+
- tvOS 18.0
740745
target-architecture:
741746
- arm64
742747
target-devices:
@@ -745,18 +750,19 @@ sdks:
745750
runtime-version:
746751
- Swift 5.x
747752
minimum-os-version:
748-
- watchOS 2.0
753+
- watchOS 4.0
749754
maximum-os-version:
750-
- watchOS 7.5
755+
- watchOS 12.0
751756
target-architecture:
752757
- armv7k
753758
- arm64_32
759+
- arm64
754760
target-devices:
755761
- Apple Watch
756762
supported-platforms:
757763
- version: PubNub Swift SDK
758764
platforms:
759-
- iOS 9.0 or higher
760-
- macOS 10.11 or higher
761-
- tvOS 9.0 or higher
762-
- watchOS 2.0 or higher
765+
- iOS 14.0 or higher
766+
- macOS 10.15 or higher
767+
- tvOS 12.0 or higher
768+
- watchOS 4.0 or higher

PubNub.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3995,7 +3995,7 @@
39953995
"@loader_path/Frameworks",
39963996
);
39973997
MACOSX_DEPLOYMENT_TARGET = 10.15;
3998-
MARKETING_VERSION = 8.0.1;
3998+
MARKETING_VERSION = 8.1.0;
39993999
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
40004000
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
40014001
MTL_FAST_MATH = YES;
@@ -4046,7 +4046,7 @@
40464046
"@loader_path/Frameworks",
40474047
);
40484048
MACOSX_DEPLOYMENT_TARGET = 10.15;
4049-
MARKETING_VERSION = 8.0.1;
4049+
MARKETING_VERSION = 8.1.0;
40504050
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
40514051
MTL_ENABLE_DEBUG_INFO = NO;
40524052
MTL_FAST_MATH = YES;
@@ -4154,7 +4154,7 @@
41544154
"@loader_path/Frameworks",
41554155
);
41564156
MACOSX_DEPLOYMENT_TARGET = 10.15;
4157-
MARKETING_VERSION = 8.0.1;
4157+
MARKETING_VERSION = 8.1.0;
41584158
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
41594159
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
41604160
MTL_FAST_MATH = YES;
@@ -4207,7 +4207,7 @@
42074207
"@loader_path/Frameworks",
42084208
);
42094209
MACOSX_DEPLOYMENT_TARGET = 10.15;
4210-
MARKETING_VERSION = 8.0.1;
4210+
MARKETING_VERSION = 8.1.0;
42114211
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
42124212
MTL_ENABLE_DEBUG_INFO = NO;
42134213
MTL_FAST_MATH = YES;
@@ -4328,7 +4328,7 @@
43284328
"@loader_path/Frameworks",
43294329
);
43304330
MACOSX_DEPLOYMENT_TARGET = 10.15;
4331-
MARKETING_VERSION = 8.0.1;
4331+
MARKETING_VERSION = 8.1.0;
43324332
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
43334333
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
43344334
MTL_FAST_MATH = YES;
@@ -4380,7 +4380,7 @@
43804380
"@loader_path/Frameworks",
43814381
);
43824382
MACOSX_DEPLOYMENT_TARGET = 10.15;
4383-
MARKETING_VERSION = 8.0.1;
4383+
MARKETING_VERSION = 8.1.0;
43844384
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
43854385
MTL_ENABLE_DEBUG_INFO = NO;
43864386
MTL_FAST_MATH = YES;
@@ -4860,7 +4860,7 @@
48604860
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
48614861
);
48624862
MACOSX_DEPLOYMENT_TARGET = 10.15;
4863-
MARKETING_VERSION = 8.0.1;
4863+
MARKETING_VERSION = 8.1.0;
48644864
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
48654865
OTHER_CFLAGS = "$(inherited)";
48664866
OTHER_LDFLAGS = "$(inherited)";
@@ -4903,7 +4903,7 @@
49034903
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
49044904
);
49054905
MACOSX_DEPLOYMENT_TARGET = 10.15;
4906-
MARKETING_VERSION = 8.0.1;
4906+
MARKETING_VERSION = 8.1.0;
49074907
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
49084908
OTHER_CFLAGS = "$(inherited)";
49094909
OTHER_LDFLAGS = "$(inherited)";

PubNubSwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'PubNubSwift'
3-
s.version = '8.0.1'
3+
s.version = '8.1.0'
44
s.homepage = 'https://github.com/pubnub/swift'
55
s.documentation_url = 'https://www.pubnub.com/docs/swift-native/pubnub-swift-sdk'
66
s.authors = { 'PubNub, Inc.' => '[email protected]' }

Sources/PubNub/APIs/File+PubNub.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public extension PubNub {
8080
struct PublishFileRequest {
8181
/// The optional message that will be include alongside the File information
8282
public var additionalMessage: JSONCodable?
83+
/// A user-provided custom message type
84+
public var customMessageType: String?
8385
/// If true the published message is stored in history.
8486
public var store: Bool?
8587
/// Set a per message time to live in storage.
@@ -92,18 +94,21 @@ public extension PubNub {
9294
/// Default init
9395
/// - Parameters:
9496
/// - additionalMessage: The optional message that will be include alongside the File information
95-
/// - store: If true the published message is stored in history.
96-
/// - ttl: Set a per message time to live in storage.
97+
/// - customMessageType: A user-provided custom message type
98+
/// - store: If true the published message is stored in history
99+
/// - ttl: Set a per message time to live in storage
97100
/// - meta: Additional metadata to publish alongside the file
98101
/// - customRequestConfig: Custom configuration overrides for this request
99102
public init(
100103
additionalMessage: JSONCodable? = nil,
104+
customMessageType: String? = nil,
101105
store: Bool? = nil,
102106
ttl: Int? = nil,
103107
meta: JSONCodable? = nil,
104108
customRequestConfig: RequestConfiguration = RequestConfiguration()
105109
) {
106110
self.additionalMessage = additionalMessage
111+
self.customMessageType = customMessageType
107112
self.store = store
108113
self.ttl = ttl
109114
self.meta = meta
@@ -222,7 +227,7 @@ public extension PubNub {
222227

223228
let router = PublishRouter(
224229
.file(
225-
message: fileMessage,
230+
message: fileMessage, customMessageType: request.customMessageType,
226231
shouldStore: request.store, ttl: request.ttl, meta: request.meta?.codableValue
227232
),
228233
configuration: configuration

Sources/PubNub/Helpers/Constants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public enum Constant {
5757

5858
static let pubnubSwiftSDKName: String = "PubNubSwift"
5959

60-
static let pubnubSwiftSDKVersion: String = "8.0.1"
60+
static let pubnubSwiftSDKVersion: String = "8.1.0"
6161

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

0 commit comments

Comments
 (0)