Skip to content

Commit 7b131fb

Browse files
authored
Add support for the type field in PubNubMembershipMetadata (#194)
feat(membership): add support for the `type` field in `PubNubMembershipMetadata` feat(app-context): deprecate methods containing `uuid` parameter, introduce new versions feat(app-context): deprecate methods containing the `include` parameter of the `Bool` type, introduce new versions feat(app-context): deprecate `remove(channel:custom:completion:)`, introduce new version feat(app-context): replace `PubNubUUIDMetadata` with `PubNubUserMetadata` feat(app-context): replace `PubNubUUIDMetadataBase` with `PubNubUserMetadataBase` feat(app-context): add an alias for backward compatibility with the customer code using `PubNubUUIDMetadata` feat(app-context): add an alias for backward compatibility with the customer code using `PubNubUUIDMetadataBase` feat(listeners): replace `PubNubUUIDMetadataChangeset` with `PubNubUserMetadataChangeset` feat(listeners): add an alias for backward compatibility with the customer code using `PubNubUUIDMetadataChangeset`
1 parent 022aa54 commit 7b131fb

40 files changed

+1754
-805
lines changed

.pubnub.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
---
22
name: swift
33
scm: github.com/pubnub/swift
4-
version: "8.1.0"
4+
version: "8.2.0"
55
schema: 1
66
changelog:
7+
- date: 2024-12-04
8+
version: 8.2.0
9+
changes:
10+
- type: feature
11+
text: "Add support for the Membership `type` field."
12+
- type: feature
13+
text: "Deprecate methods containing `uuid` parameter, introduce new versions."
14+
- type: feature
15+
text: "Deprecate methods containing `include` parameter of `Bool` type, introduce new versions."
16+
- type: feature
17+
text: "Deprecate `remove(channel:custom:completion:)`, introduce new version ."
18+
- type: feature
19+
text: "Replace `PubNubUUIDMetadata` with `PubNubUserMetadata`."
20+
- type: feature
21+
text: "Replace `PubNubUUIDMetadataBase` with `PubNubUserMetadataBase`."
22+
- type: feature
23+
text: "Add an alias for backward compatibility with the customer code using `PubNubUUIDMetadata`."
24+
- type: feature
25+
text: "Add an alias for backward compatibility with the customer code using `PubNubUUIDMetadataBase`."
26+
- type: feature
27+
text: "Replace `PubNubUUIDMetadataChangeset` with `PubNubUserMetadataChangeset`."
28+
- type: feature
29+
text: "Add an alias for backward compatibility with the customer code using `PubNubUUIDMetadataChangeset`."
730
- date: 2024-11-18
831
version: 8.1.0
932
changes:
@@ -596,7 +619,7 @@ sdks:
596619
- distribution-type: source
597620
distribution-repository: GitHub release
598621
package-name: PubNub
599-
location: https://github.com/pubnub/swift/archive/refs/tags/8.1.0.zip
622+
location: https://github.com/pubnub/swift/archive/refs/tags/8.2.0.zip
600623
supported-platforms:
601624
supported-operating-systems:
602625
macOS:

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ source "https://rubygems.org"
22

33
gem "cocoapods"
44
gem "fastlane"
5-
gem 'rexml', '3.3.8'
5+
gem 'rexml', '3.3.9'

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ GEM
252252
trailblazer-option (>= 0.1.1, < 0.2.0)
253253
uber (< 0.2.0)
254254
retriable (3.1.2)
255-
rexml (3.3.8)
255+
rexml (3.3.9)
256256
rouge (2.0.7)
257257
ruby-macho (2.5.1)
258258
ruby2_keywords (0.0.5)
@@ -311,7 +311,7 @@ PLATFORMS
311311
DEPENDENCIES
312312
cocoapods
313313
fastlane
314-
rexml (= 3.3.8)
314+
rexml (= 3.3.9)
315315

316316
BUNDLED WITH
317317
2.5.22

PubNub.xcodeproj/project.pbxproj

Lines changed: 26 additions & 26 deletions
Large diffs are not rendered by default.

PubNubMembership/Sources/Membership+PubNub.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public extension PubNubMembershipInterface {
350350
customFields: nil,
351351
totalCount: false,
352352
changes: .init(
353-
set: users.map { .init(metadataId: $0.user.id, status: $0.status, custom: $0.custom?.flatJSON) },
353+
set: users.map { .init(metadataId: $0.user.id, status: $0.status, type: nil, custom: $0.custom?.flatJSON) },
354354
delete: []
355355
),
356356
filter: nil,
@@ -387,7 +387,7 @@ public extension PubNubMembershipInterface {
387387
customFields: nil,
388388
totalCount: false,
389389
changes: .init(
390-
set: spaces.map { .init(metadataId: $0.space.id, status: $0.status, custom: $0.custom?.flatJSON) },
390+
set: spaces.map { .init(metadataId: $0.space.id, status: $0.status, type: nil, custom: $0.custom?.flatJSON) },
391391
delete: []
392392
),
393393
filter: nil,
@@ -451,7 +451,7 @@ public extension PubNubMembershipInterface {
451451
totalCount: false,
452452
changes: .init(
453453
set: [],
454-
delete: userIds.map { .init(metadataId: $0, status: nil, custom: nil) }
454+
delete: userIds.map { .init(metadataId: $0, status: nil, type: nil, custom: nil) }
455455
),
456456
filter: nil,
457457
sort: [],
@@ -488,7 +488,7 @@ public extension PubNubMembershipInterface {
488488
totalCount: false,
489489
changes: .init(
490490
set: [],
491-
delete: spaceIds.map { .init(metadataId: $0, status: nil, custom: nil) }
491+
delete: spaceIds.map { .init(metadataId: $0, status: nil, type: nil, custom: nil) }
492492
),
493493
filter: nil,
494494
sort: [],

PubNubSpace/Sources/Space+PubNub.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public extension PubNubSpaceInterface {
197197
) {
198198
let router = ObjectsChannelRouter(
199199
.all(
200-
customFields: includeCustom,
200+
include: PubNub.ChannelIncludeFields(custom: includeCustom).includeFields,
201201
totalCount: includeTotalCount,
202202
filter: filter,
203203
sort: sort.map { $0.routerParameter },
@@ -229,7 +229,7 @@ public extension PubNubSpaceInterface {
229229
completion: @escaping (Result<PubNubSpace, Error>) -> Void
230230
) {
231231
let router = ObjectsChannelRouter(
232-
.fetch(metadataId: spaceId, customFields: includeCustom),
232+
.fetch(metadataId: spaceId, include: PubNub.ChannelIncludeFields(custom: includeCustom).includeFields),
233233
configuration: requestConfig.customConfiguration ?? configuration
234234
)
235235

@@ -265,7 +265,7 @@ public extension PubNubSpaceInterface {
265265
channelDescription: description,
266266
custom: custom?.flatJSON
267267
),
268-
customFields: includeCustom
268+
include: PubNub.ChannelIncludeFields(custom: includeCustom).includeFields
269269
),
270270
configuration: requestConfig.customConfiguration ?? configuration
271271
)

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.1.0'
3+
s.version = '8.2.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]' }

PubNubUser/Sources/PubNubUser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ extension PubNubUser: Codable {
139139

140140
// MARK: Object v2 Migration
141141

142-
public extension PubNubUUIDMetadata {
143-
/// Converts Object V2 UUID Metadata to a Space entity
142+
public extension PubNubUserMetadata {
143+
/// Converts Object V2 User Metadata to a User entity
144144
///
145145
/// - returns: The `PubNubUser` built from the Object V2 data
146146
func convert() -> PubNubUser {

PubNubUser/Sources/User+PubNub.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ public extension PubNubUserInterface {
203203
requestConfig: PubNub.RequestConfiguration = .init(),
204204
completion: @escaping ((Result<(users: [PubNubUser], next: PubNubHashedPage?), Error>) -> Void)
205205
) {
206-
let router = ObjectsUUIDRouter(
206+
let router = ObjectsUserRouter(
207207
.all(
208-
customFields: includeCustom,
208+
include: PubNub.UserIncludeFields(custom: includeCustom).includeFields,
209209
totalCount: includeTotalCount,
210210
filter: filter,
211211
sort: sort.map { $0.routerParameter },
@@ -226,7 +226,7 @@ public extension PubNubUserInterface {
226226
completion(result.map { (
227227
users: $0.payload.data,
228228
next: PubNub.Page(next: $0.payload.next, prev: $0.payload.prev, totalCount: $0.payload.totalCount)
229-
) })
229+
)})
230230
}
231231
}
232232

@@ -236,10 +236,10 @@ public extension PubNubUserInterface {
236236
requestConfig: PubNub.RequestConfiguration = .init(),
237237
completion: @escaping (Result<PubNubUser, Error>) -> Void
238238
) {
239-
let router = ObjectsUUIDRouter(
239+
let router = ObjectsUserRouter(
240240
.fetch(
241241
metadataId: userId ?? (requestConfig.customConfiguration?.uuid ?? configuration.uuid),
242-
customFields: includeCustom
242+
include: PubNub.UserIncludeFields(custom: includeCustom).includeFields
243243
),
244244
configuration: requestConfig.customConfiguration ?? configuration
245245
)
@@ -268,9 +268,9 @@ public extension PubNubUserInterface {
268268
requestConfig: PubNub.RequestConfiguration = .init(),
269269
completion: ((Result<PubNubUser, Error>) -> Void)?
270270
) {
271-
let router = ObjectsUUIDRouter(
271+
let router = ObjectsUserRouter(
272272
.set(
273-
metadata: PubNubUUIDMetadataBase(
273+
metadata: PubNubUserMetadataBase(
274274
metadataId: userId ?? (requestConfig.customConfiguration?.uuid ?? configuration.uuid),
275275
name: name,
276276
type: type,
@@ -280,7 +280,7 @@ public extension PubNubUserInterface {
280280
email: email,
281281
custom: custom?.flatJSON
282282
),
283-
customFields: includeCustom
283+
include: PubNub.UserIncludeFields(custom: includeCustom).includeFields
284284
),
285285
configuration: requestConfig.customConfiguration ?? configuration
286286
)
@@ -329,7 +329,7 @@ public extension PubNubUserInterface {
329329
requestConfig: PubNub.RequestConfiguration = .init(),
330330
completion: ((Result<Void, Error>) -> Void)?
331331
) {
332-
let router = ObjectsUUIDRouter(
332+
let router = ObjectsUserRouter(
333333
.remove(metadataId: userId ?? (requestConfig.customConfiguration?.uuid ?? configuration.uuid)),
334334
configuration: requestConfig.customConfiguration ?? configuration
335335
)

PubNubUser/Tests/Test+PubNubUser.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class PubNubUserModelTests: XCTestCase {
103103
}
104104

105105
func testPubNubUser_Convert_UUIDMetadata() {
106-
let userMetadata = PubNubUUIDMetadataBase(
106+
let userMetadata = PubNubUserMetadataBase(
107107
metadataId: testUser.id,
108108
name: testUser.name,
109109
type: testUser.type,
@@ -120,7 +120,7 @@ class PubNubUserModelTests: XCTestCase {
120120
}
121121

122122
func testPubNubUser_Convert_UUIDMetadata_nilProfileUrl() {
123-
let userMetadata = PubNubUUIDMetadataBase(
123+
let userMetadata = PubNubUserMetadataBase(
124124
metadataId: testUser.id,
125125
name: testUser.name,
126126
type: testUser.type,
@@ -140,7 +140,7 @@ class PubNubUserModelTests: XCTestCase {
140140
}
141141

142142
func testPubNubUser_Convert_UUIDMetadata_nilCustom() {
143-
let userMetadata = PubNubUUIDMetadataBase(
143+
let userMetadata = PubNubUserMetadataBase(
144144
metadataId: testUser.id,
145145
name: testUser.name,
146146
type: testUser.type,

0 commit comments

Comments
 (0)