Skip to content

Commit 5779f48

Browse files
marcin-cebojguz-pubnubpubnub-release-bot
authored
Updated KMP JS layer with membership type. (#325)
* Updated KMP JS layer with membership type. In KMP JS implemented new Memberships and ChannelMembers methods containing possibility to specify membership type and all optional data returned by API using include parameters. * Updated KMP Swift layer with membership type. In KMP JS implemented new Memberships and ChannelMembers methods containing possibility to specify membership type and all optional data returned by API using include parameters. * PubNub SDK v10.3.3 release. --------- Co-authored-by: jguz-pubnub <[email protected]> Co-authored-by: PubNub Release Bot <[email protected]>
1 parent a693c22 commit 5779f48

File tree

27 files changed

+427
-89
lines changed

27 files changed

+427
-89
lines changed

.pubnub.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: kotlin
2-
version: 10.3.2
2+
version: 10.3.3
33
schema: 1
44
scm: github.com/pubnub/kotlin
55
files:
6-
- build/libs/pubnub-kotlin-10.3.2-all.jar
6+
- build/libs/pubnub-kotlin-10.3.3-all.jar
77
sdks:
88
-
99
type: library
@@ -23,8 +23,8 @@ sdks:
2323
-
2424
distribution-type: library
2525
distribution-repository: maven
26-
package-name: pubnub-kotlin-10.3.2
27-
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.3.2/pubnub-kotlin-10.3.2.jar
26+
package-name: pubnub-kotlin-10.3.3
27+
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.3.3/pubnub-kotlin-10.3.3.jar
2828
supported-platforms:
2929
supported-operating-systems:
3030
Android:
@@ -121,6 +121,13 @@ sdks:
121121
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
122122
is-required: Required
123123
changelog:
124+
- date: 2025-01-07
125+
version: v10.3.3
126+
changes:
127+
- type: bug
128+
text: "Added validation for Leave and Heartbeat to ensure user receives an error when providing empty strings for channels or groups."
129+
- type: improvement
130+
text: "Internal refactor."
124131
- date: 2024-12-16
125132
version: v10.3.2
126133
changes:

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## v10.3.3
2+
January 07 2025
3+
4+
#### Fixed
5+
- Added validation for Leave and Heartbeat to ensure user receives an error when providing empty strings for channels or groups.
6+
7+
#### Modified
8+
- Internal refactor.
9+
110
## v10.3.2
211
December 16 2024
312

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
2020
<dependency>
2121
<groupId>com.pubnub</groupId>
2222
<artifactId>pubnub-kotlin</artifactId>
23-
<version>10.3.2</version>
23+
<version>10.3.3</version>
2424
</dependency>
2525
```
2626

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RELEASE_SIGNING_ENABLED=true
1818
SONATYPE_HOST=DEFAULT
1919
SONATYPE_AUTOMATIC_RELEASE=false
2020
GROUP=com.pubnub
21-
VERSION_NAME=10.3.2
21+
VERSION_NAME=10.3.3
2222
POM_PACKAGING=jar
2323

2424
POM_NAME=PubNub SDK

gradle/libs.versions.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ktlint = "12.1.0"
1212
dokka = "1.9.20"
1313
kotlinx_datetime = "0.6.1"
1414
kotlinx_coroutines = "1.9.0"
15-
pubnub_js = "8.3.1"
16-
pubnub_swift = "8.2.2"
15+
pubnub_js = "8.4.1"
16+
pubnub_swift = "8.2.3"
1717

1818
[libraries]
1919
retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit2" }

kotlin-js-store/yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,10 @@ proxy-from-env@^1.1.0:
659659
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
660660
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
661661

662-
pubnub@8.3.1:
663-
version "8.3.1"
664-
resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.3.1.tgz#48b6c2468452427c9d1aa9a51e78781d25eec660"
665-
integrity sha512-+aFp84Jsqpmu9utci8uQhABTMoh1Uk8UafGS1QANSkceXX3HDRTQnpTw8itH0UchzCS9pSfUATTl+Ay3jvM5EA==
662+
pubnub@8.4.0:
663+
version "8.4.0"
664+
resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.4.0.tgz#8a5fdd3af9783abb1de44ea4145107e296c8394d"
665+
integrity sha512-HvkFhn4XcfR1wdJv4paX94I0TT4UBHW/vIuYnS+6XuoSx0AunJMCk5wbKnSesmdbzYUZa8Ag3H1mJQZKuyRy8Q==
666666
dependencies:
667667
agentkeepalive "^3.5.2"
668668
buffer "^6.0.3"

pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml

+25-19
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/membership/MembershipInclude.kt">
77
<error line="20" column="5" source="standard:function-naming" />
88
</file>
9+
<file name="src/commonTest/kotlin/com/pubnub/test/integration/MembersTest.kt">
10+
<error line="18" column="1" source="standard:blank-line-before-declaration" />
11+
</file>
912
<file name="src/jsMain/kotlin/Pubnub.d.kt">
1013
<error line="156" column="40" source="standard:comment-wrapping" />
1114
<error line="411" column="15" source="standard:class-naming" />
@@ -19,36 +22,30 @@
1922
<error line="849" column="13" source="standard:property-naming" />
2023
<error line="1034" column="15" source="standard:class-naming" />
2124
<error line="1040" column="15" source="standard:class-naming" />
22-
<error line="1160" column="13" source="standard:property-naming" />
23-
<error line="1166" column="13" source="standard:property-naming" />
24-
<error line="1168" column="13" source="standard:property-naming" />
25-
<error line="1228" column="39" source="standard:comment-wrapping" />
26-
<error line="1313" column="15" source="standard:class-naming" />
27-
<error line="1341" column="42" source="standard:comment-wrapping" />
28-
<error line="1391" column="37" source="standard:comment-wrapping" />
29-
<error line="1412" column="13" source="standard:property-naming" />
30-
<error line="1413" column="13" source="standard:property-naming" />
31-
<error line="1417" column="13" source="standard:property-naming" />
25+
<error line="1161" column="13" source="standard:property-naming" />
26+
<error line="1169" column="13" source="standard:property-naming" />
27+
<error line="1171" column="13" source="standard:property-naming" />
28+
<error line="1234" column="39" source="standard:comment-wrapping" />
29+
<error line="1319" column="15" source="standard:class-naming" />
30+
<error line="1347" column="42" source="standard:comment-wrapping" />
31+
<error line="1397" column="37" source="standard:comment-wrapping" />
3232
<error line="1418" column="13" source="standard:property-naming" />
33-
<error line="1437" column="9" source="standard:property-naming" />
34-
<error line="1438" column="9" source="standard:property-naming" />
35-
<error line="1439" column="9" source="standard:property-naming" />
36-
<error line="1440" column="9" source="standard:property-naming" />
37-
<error line="1441" column="9" source="standard:property-naming" />
38-
<error line="1442" column="9" source="standard:property-naming" />
33+
<error line="1419" column="13" source="standard:property-naming" />
34+
<error line="1423" column="13" source="standard:property-naming" />
35+
<error line="1424" column="13" source="standard:property-naming" />
3936
<error line="1443" column="9" source="standard:property-naming" />
4037
<error line="1444" column="9" source="standard:property-naming" />
4138
<error line="1445" column="9" source="standard:property-naming" />
4239
<error line="1446" column="9" source="standard:property-naming" />
4340
<error line="1447" column="9" source="standard:property-naming" />
4441
<error line="1448" column="9" source="standard:property-naming" />
4542
<error line="1449" column="9" source="standard:property-naming" />
43+
<error line="1450" column="9" source="standard:property-naming" />
44+
<error line="1451" column="9" source="standard:property-naming" />
45+
<error line="1452" column="9" source="standard:property-naming" />
4646
<error line="1453" column="9" source="standard:property-naming" />
4747
<error line="1454" column="9" source="standard:property-naming" />
4848
<error line="1455" column="9" source="standard:property-naming" />
49-
<error line="1456" column="9" source="standard:property-naming" />
50-
<error line="1457" column="9" source="standard:property-naming" />
51-
<error line="1458" column="9" source="standard:property-naming" />
5249
<error line="1459" column="9" source="standard:property-naming" />
5350
<error line="1460" column="9" source="standard:property-naming" />
5451
<error line="1461" column="9" source="standard:property-naming" />
@@ -79,5 +76,14 @@
7976
<error line="1486" column="9" source="standard:property-naming" />
8077
<error line="1487" column="9" source="standard:property-naming" />
8178
<error line="1488" column="9" source="standard:property-naming" />
79+
<error line="1489" column="9" source="standard:property-naming" />
80+
<error line="1490" column="9" source="standard:property-naming" />
81+
<error line="1491" column="9" source="standard:property-naming" />
82+
<error line="1492" column="9" source="standard:property-naming" />
83+
<error line="1493" column="9" source="standard:property-naming" />
84+
<error line="1494" column="9" source="standard:property-naming" />
85+
</file>
86+
<file name="src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt">
87+
<error line="1446" column="12" source="standard:no-multi-spaces" />
8288
</file>
8389
</baseline>

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/PubNubImpl.kt

+3
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
741741
)
742742
}
743743

744+
// deprecated
744745
override fun getChannelMembers(
745746
channel: String,
746747
limit: Int?,
@@ -811,6 +812,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
811812
includeTotalCount = includeCount,
812813
includeCustom = includeCustom,
813814
includeType = includeType,
815+
includeStatus = true,
814816
includeUser = includeUUIDDetails == PNUUIDDetailsLevel.UUID || includeUUIDDetails == PNUUIDDetailsLevel.UUID_WITH_CUSTOM,
815817
includeUserCustom = includeUUIDDetails == PNUUIDDetailsLevel.UUID_WITH_CUSTOM,
816818
)
@@ -838,6 +840,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
838840
)
839841
}
840842

843+
// deprecated
841844
override fun removeChannelMembers(
842845
channel: String,
843846
uuids: List<String>,

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/channel/GetAllChannelMetadata.ios.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pubnub.api.endpoints.objects.channel
22

3+
import cocoapods.PubNubSwift.KMPChannelIncludeFields
34
import cocoapods.PubNubSwift.KMPChannelMetadata
45
import cocoapods.PubNubSwift.KMPPubNub
56
import cocoapods.PubNubSwift.getAllChannelMetadataWithLimit
@@ -40,8 +41,12 @@ class GetAllChannelMetadataImpl(
4041
page = createPubNubHashedPage(from = page),
4142
filter = filter,
4243
sort = createObjectSortProperties(from = sort),
43-
includeCount = includeCount,
44-
includeCustom = includeCustom,
44+
include = KMPChannelIncludeFields(
45+
includeCustom = includeCustom,
46+
includeTotalCount = includeCount,
47+
includeType = true,
48+
includeStatus = true
49+
),
4550
onSuccess = callback.onSuccessHandler3 { channels, totalCount, page ->
4651
PNChannelMetadataArrayResult(
4752
status = 200,

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/channel/GetChannelMetadata.ios.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pubnub.api.endpoints.objects.channel
22

3+
import cocoapods.PubNubSwift.KMPChannelIncludeFields
34
import cocoapods.PubNubSwift.KMPPubNub
45
import cocoapods.PubNubSwift.getChannelMetadataWithMetadataId
56
import com.pubnub.api.models.consumer.objects.channel.PNChannelMetadataResult
@@ -25,7 +26,11 @@ class GetChannelMetadataImpl(
2526
override fun async(callback: Consumer<Result<PNChannelMetadataResult>>) {
2627
pubnub.getChannelMetadataWithMetadataId(
2728
metadataId = channelId,
28-
includeCustom = includeCustom,
29+
include = KMPChannelIncludeFields(
30+
includeCustom = includeCustom,
31+
includeType = true,
32+
includeStatus = true
33+
),
2934
onSuccess = callback.onSuccessHandler {
3035
PNChannelMetadataResult(
3136
status = 200,

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/channel/SetChannelMetadata.ios.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.pubnub.api.endpoints.objects.channel
22

33
import cocoapods.PubNubSwift.KMPAnyJSON
4+
import cocoapods.PubNubSwift.KMPChannelIncludeFields
45
import cocoapods.PubNubSwift.KMPPubNub
56
import cocoapods.PubNubSwift.setChannelMetadataWithMetadataId
67
import com.pubnub.api.models.consumer.objects.channel.PNChannelMetadataResult
@@ -35,7 +36,11 @@ class SetChannelMetadataImpl(
3536
name = name,
3637
description = description,
3738
custom = KMPAnyJSON(custom),
38-
includeCustom = includeCustom,
39+
include = KMPChannelIncludeFields(
40+
includeCustom = includeCustom,
41+
includeType = true,
42+
includeStatus = true
43+
),
3944
type = type,
4045
status = status,
4146
onSuccess = callback.onSuccessHandler {

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/GetChannelMembers.ios.kt

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pubnub.api.endpoints.objects.member
22

3+
import cocoapods.PubNubSwift.KMPMemberIncludeFields
34
import cocoapods.PubNubSwift.KMPMembershipMetadata
45
import cocoapods.PubNubSwift.KMPPubNub
56
import cocoapods.PubNubSwift.getChannelMembersWithChannel
@@ -41,11 +42,16 @@ class GetChannelMembersImpl(
4142
page = createPubNubHashedPage(from = page),
4243
filter = filter,
4344
sort = sort.map { it.key.fieldName },
44-
includeCount = includeFields.includeTotalCount,
45-
includeCustom = includeFields.includeCustom,
46-
includeUserFields = includeFields.includeUser,
47-
includeUserCustomFields = includeFields.includeUserCustom,
48-
includeUserType = includeFields.includeUserType,
45+
include = KMPMemberIncludeFields(
46+
includeCustom = includeFields.includeCustom,
47+
includeStatus = includeFields.includeStatus,
48+
includeType = includeFields.includeType,
49+
includeTotalCount = includeFields.includeTotalCount,
50+
includeUser = includeFields.includeUser,
51+
includeUserCustom = includeFields.includeUserCustom,
52+
includeUserType = includeFields.includeUserType,
53+
includeUserStatus = includeFields.includeUserStatus
54+
),
4955
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, page ->
5056
PNMemberArrayResult(
5157
status = 200,

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/RemoveChannelMembers.ios.kt

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pubnub.api.endpoints.objects.member
22

3+
import cocoapods.PubNubSwift.KMPMemberIncludeFields
34
import cocoapods.PubNubSwift.KMPMembershipMetadata
45
import cocoapods.PubNubSwift.KMPPubNub
56
import cocoapods.PubNubSwift.removeChannelMembersWithChannel
@@ -37,11 +38,16 @@ class RemoveChannelMembersImpl(
3738
page = createPubNubHashedPage(from = page),
3839
filter = filter,
3940
sort = sort.map { it.key.fieldName },
40-
includeCount = includeFields.includeTotalCount,
41-
includeCustom = includeFields.includeCustom,
42-
includeUser = includeFields.includeUser,
43-
includeUserCustom = includeFields.includeUserCustom,
44-
includeUserType = includeFields.includeUserType,
41+
include = KMPMemberIncludeFields(
42+
includeCustom = includeFields.includeCustom,
43+
includeStatus = includeFields.includeStatus,
44+
includeType = includeFields.includeType,
45+
includeTotalCount = includeFields.includeTotalCount,
46+
includeUser = includeFields.includeUser,
47+
includeUserCustom = includeFields.includeUserCustom,
48+
includeUserType = includeFields.includeUserType,
49+
includeUserStatus = includeFields.includeUserStatus
50+
),
4551
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, next ->
4652
PNMemberArrayResult(
4753
status = 200,

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/SetChannelMembers.ios.kt

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.pubnub.api.endpoints.objects.member
22

33
import cocoapods.PubNubSwift.KMPAnyJSON
4+
import cocoapods.PubNubSwift.KMPMemberIncludeFields
45
import cocoapods.PubNubSwift.KMPMembershipMetadata
56
import cocoapods.PubNubSwift.KMPPubNub
67
import cocoapods.PubNubSwift.KMPUserMetadata
@@ -41,16 +42,21 @@ class SetChannelMembersImpl(
4142
override fun async(callback: Consumer<Result<PNMemberArrayResult>>) {
4243
pubnub.setChannelMembersWithChannel(
4344
channel = channelId,
44-
users = users.map { KMPUserMetadata(id = it.uuid, custom = KMPAnyJSON(it.custom), status = it.status) },
45+
users = users.map { KMPUserMetadata(it.uuid, KMPAnyJSON(it.custom), it.type, it.status) },
4546
limit = limit?.let { NSNumber(it) },
4647
page = createPubNubHashedPage(from = page),
4748
filter = filter,
4849
sort = sort.map { it.key.fieldName },
49-
includeCount = includeFields.includeTotalCount,
50-
includeCustom = includeFields.includeCustom,
51-
includeUser = includeFields.includeUser,
52-
includeUserCustom = includeFields.includeUserCustom,
53-
includeUserType = includeFields.includeUserType,
50+
include = KMPMemberIncludeFields(
51+
includeCustom = includeFields.includeCustom,
52+
includeStatus = includeFields.includeStatus,
53+
includeType = includeFields.includeType,
54+
includeTotalCount = includeFields.includeTotalCount,
55+
includeUser = includeFields.includeUser,
56+
includeUserCustom = includeFields.includeUserCustom,
57+
includeUserType = includeFields.includeUserType,
58+
includeUserStatus = includeFields.includeUserStatus
59+
),
5460
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, page ->
5561
PNMemberArrayResult(
5662
status = 200,

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/GetMemberships.ios.kt

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pubnub.api.endpoints.objects.membership
22

3+
import cocoapods.PubNubSwift.KMPMembershipIncludeFields
34
import cocoapods.PubNubSwift.KMPMembershipMetadata
45
import cocoapods.PubNubSwift.KMPPubNub
56
import cocoapods.PubNubSwift.getMembershipsWithUserId
@@ -41,11 +42,16 @@ class GetMembershipsImpl(
4142
page = createPubNubHashedPage(from = page),
4243
filter = filter,
4344
sort = sort.map { it.key.fieldName },
44-
includeCount = includeFields.includeTotalCount,
45-
includeCustom = includeFields.includeCustom,
46-
includeChannelFields = includeFields.includeChannel,
47-
includeChannelCustomFields = includeFields.includeChannelCustom,
48-
includeChannelType = includeFields.includeChannelType,
45+
include = KMPMembershipIncludeFields(
46+
includeCustom = includeFields.includeCustom,
47+
includeStatus = includeFields.includeStatus,
48+
includeType = includeFields.includeType,
49+
includeTotalCount = includeFields.includeTotalCount,
50+
includeChannel = includeFields.includeChannel,
51+
includeChannelCustom = includeFields.includeChannelCustom,
52+
includeChannelType = includeFields.includeChannelType,
53+
includeChannelStatus = includeFields.includeChannelStatus
54+
),
4955
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, page ->
5056
PNChannelMembershipArrayResult(
5157
status = 200,

0 commit comments

Comments
 (0)