Skip to content

Commit

Permalink
Updated KMP JS layer with membership type. (#325)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent a693c22 commit 5779f48
Show file tree
Hide file tree
Showing 27 changed files with 427 additions and 89 deletions.
15 changes: 11 additions & 4 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: kotlin
version: 10.3.2
version: 10.3.3
schema: 1
scm: github.com/pubnub/kotlin
files:
- build/libs/pubnub-kotlin-10.3.2-all.jar
- build/libs/pubnub-kotlin-10.3.3-all.jar
sdks:
-
type: library
Expand All @@ -23,8 +23,8 @@ sdks:
-
distribution-type: library
distribution-repository: maven
package-name: pubnub-kotlin-10.3.2
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.3.2/pubnub-kotlin-10.3.2.jar
package-name: pubnub-kotlin-10.3.3
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.3.3/pubnub-kotlin-10.3.3.jar
supported-platforms:
supported-operating-systems:
Android:
Expand Down Expand Up @@ -121,6 +121,13 @@ sdks:
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
is-required: Required
changelog:
- date: 2025-01-07
version: v10.3.3
changes:
- type: bug
text: "Added validation for Leave and Heartbeat to ensure user receives an error when providing empty strings for channels or groups."
- type: improvement
text: "Internal refactor."
- date: 2024-12-16
version: v10.3.2
changes:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v10.3.3
January 07 2025

#### Fixed
- Added validation for Leave and Heartbeat to ensure user receives an error when providing empty strings for channels or groups.

#### Modified
- Internal refactor.

## v10.3.2
December 16 2024

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
<dependency>
<groupId>com.pubnub</groupId>
<artifactId>pubnub-kotlin</artifactId>
<version>10.3.2</version>
<version>10.3.3</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RELEASE_SIGNING_ENABLED=true
SONATYPE_HOST=DEFAULT
SONATYPE_AUTOMATIC_RELEASE=false
GROUP=com.pubnub
VERSION_NAME=10.3.2
VERSION_NAME=10.3.3
POM_PACKAGING=jar

POM_NAME=PubNub SDK
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ktlint = "12.1.0"
dokka = "1.9.20"
kotlinx_datetime = "0.6.1"
kotlinx_coroutines = "1.9.0"
pubnub_js = "8.3.1"
pubnub_swift = "8.2.2"
pubnub_js = "8.4.1"
pubnub_swift = "8.2.3"

[libraries]
retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit2" }
Expand Down
8 changes: 4 additions & 4 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,10 @@ proxy-from-env@^1.1.0:
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

pubnub@8.3.1:
version "8.3.1"
resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.3.1.tgz#48b6c2468452427c9d1aa9a51e78781d25eec660"
integrity sha512-+aFp84Jsqpmu9utci8uQhABTMoh1Uk8UafGS1QANSkceXX3HDRTQnpTw8itH0UchzCS9pSfUATTl+Ay3jvM5EA==
pubnub@8.4.0:
version "8.4.0"
resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.4.0.tgz#8a5fdd3af9783abb1de44ea4145107e296c8394d"
integrity sha512-HvkFhn4XcfR1wdJv4paX94I0TT4UBHW/vIuYnS+6XuoSx0AunJMCk5wbKnSesmdbzYUZa8Ag3H1mJQZKuyRy8Q==
dependencies:
agentkeepalive "^3.5.2"
buffer "^6.0.3"
Expand Down
44 changes: 25 additions & 19 deletions pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/membership/MembershipInclude.kt">
<error line="20" column="5" source="standard:function-naming" />
</file>
<file name="src/commonTest/kotlin/com/pubnub/test/integration/MembersTest.kt">
<error line="18" column="1" source="standard:blank-line-before-declaration" />
</file>
<file name="src/jsMain/kotlin/Pubnub.d.kt">
<error line="156" column="40" source="standard:comment-wrapping" />
<error line="411" column="15" source="standard:class-naming" />
Expand All @@ -19,36 +22,30 @@
<error line="849" column="13" source="standard:property-naming" />
<error line="1034" column="15" source="standard:class-naming" />
<error line="1040" column="15" source="standard:class-naming" />
<error line="1160" column="13" source="standard:property-naming" />
<error line="1166" column="13" source="standard:property-naming" />
<error line="1168" column="13" source="standard:property-naming" />
<error line="1228" column="39" source="standard:comment-wrapping" />
<error line="1313" column="15" source="standard:class-naming" />
<error line="1341" column="42" source="standard:comment-wrapping" />
<error line="1391" column="37" source="standard:comment-wrapping" />
<error line="1412" column="13" source="standard:property-naming" />
<error line="1413" column="13" source="standard:property-naming" />
<error line="1417" column="13" source="standard:property-naming" />
<error line="1161" column="13" source="standard:property-naming" />
<error line="1169" column="13" source="standard:property-naming" />
<error line="1171" column="13" source="standard:property-naming" />
<error line="1234" column="39" source="standard:comment-wrapping" />
<error line="1319" column="15" source="standard:class-naming" />
<error line="1347" column="42" source="standard:comment-wrapping" />
<error line="1397" column="37" source="standard:comment-wrapping" />
<error line="1418" column="13" source="standard:property-naming" />
<error line="1437" column="9" source="standard:property-naming" />
<error line="1438" column="9" source="standard:property-naming" />
<error line="1439" column="9" source="standard:property-naming" />
<error line="1440" column="9" source="standard:property-naming" />
<error line="1441" column="9" source="standard:property-naming" />
<error line="1442" column="9" source="standard:property-naming" />
<error line="1419" column="13" source="standard:property-naming" />
<error line="1423" column="13" source="standard:property-naming" />
<error line="1424" column="13" source="standard:property-naming" />
<error line="1443" column="9" source="standard:property-naming" />
<error line="1444" column="9" source="standard:property-naming" />
<error line="1445" column="9" source="standard:property-naming" />
<error line="1446" column="9" source="standard:property-naming" />
<error line="1447" column="9" source="standard:property-naming" />
<error line="1448" column="9" source="standard:property-naming" />
<error line="1449" column="9" source="standard:property-naming" />
<error line="1450" column="9" source="standard:property-naming" />
<error line="1451" column="9" source="standard:property-naming" />
<error line="1452" column="9" source="standard:property-naming" />
<error line="1453" column="9" source="standard:property-naming" />
<error line="1454" column="9" source="standard:property-naming" />
<error line="1455" column="9" source="standard:property-naming" />
<error line="1456" column="9" source="standard:property-naming" />
<error line="1457" column="9" source="standard:property-naming" />
<error line="1458" column="9" source="standard:property-naming" />
<error line="1459" column="9" source="standard:property-naming" />
<error line="1460" column="9" source="standard:property-naming" />
<error line="1461" column="9" source="standard:property-naming" />
Expand Down Expand Up @@ -79,5 +76,14 @@
<error line="1486" column="9" source="standard:property-naming" />
<error line="1487" column="9" source="standard:property-naming" />
<error line="1488" column="9" source="standard:property-naming" />
<error line="1489" column="9" source="standard:property-naming" />
<error line="1490" column="9" source="standard:property-naming" />
<error line="1491" column="9" source="standard:property-naming" />
<error line="1492" column="9" source="standard:property-naming" />
<error line="1493" column="9" source="standard:property-naming" />
<error line="1494" column="9" source="standard:property-naming" />
</file>
<file name="src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt">
<error line="1446" column="12" source="standard:no-multi-spaces" />
</file>
</baseline>
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
)
}

// deprecated
override fun getChannelMembers(
channel: String,
limit: Int?,
Expand Down Expand Up @@ -811,6 +812,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
includeTotalCount = includeCount,
includeCustom = includeCustom,
includeType = includeType,
includeStatus = true,
includeUser = includeUUIDDetails == PNUUIDDetailsLevel.UUID || includeUUIDDetails == PNUUIDDetailsLevel.UUID_WITH_CUSTOM,
includeUserCustom = includeUUIDDetails == PNUUIDDetailsLevel.UUID_WITH_CUSTOM,
)
Expand Down Expand Up @@ -838,6 +840,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
)
}

// deprecated
override fun removeChannelMembers(
channel: String,
uuids: List<String>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pubnub.api.endpoints.objects.channel

import cocoapods.PubNubSwift.KMPChannelIncludeFields
import cocoapods.PubNubSwift.KMPChannelMetadata
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.getAllChannelMetadataWithLimit
Expand Down Expand Up @@ -40,8 +41,12 @@ class GetAllChannelMetadataImpl(
page = createPubNubHashedPage(from = page),
filter = filter,
sort = createObjectSortProperties(from = sort),
includeCount = includeCount,
includeCustom = includeCustom,
include = KMPChannelIncludeFields(
includeCustom = includeCustom,
includeTotalCount = includeCount,
includeType = true,
includeStatus = true
),
onSuccess = callback.onSuccessHandler3 { channels, totalCount, page ->
PNChannelMetadataArrayResult(
status = 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pubnub.api.endpoints.objects.channel

import cocoapods.PubNubSwift.KMPChannelIncludeFields
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.getChannelMetadataWithMetadataId
import com.pubnub.api.models.consumer.objects.channel.PNChannelMetadataResult
Expand All @@ -25,7 +26,11 @@ class GetChannelMetadataImpl(
override fun async(callback: Consumer<Result<PNChannelMetadataResult>>) {
pubnub.getChannelMetadataWithMetadataId(
metadataId = channelId,
includeCustom = includeCustom,
include = KMPChannelIncludeFields(
includeCustom = includeCustom,
includeType = true,
includeStatus = true
),
onSuccess = callback.onSuccessHandler {
PNChannelMetadataResult(
status = 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pubnub.api.endpoints.objects.channel

import cocoapods.PubNubSwift.KMPAnyJSON
import cocoapods.PubNubSwift.KMPChannelIncludeFields
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.setChannelMetadataWithMetadataId
import com.pubnub.api.models.consumer.objects.channel.PNChannelMetadataResult
Expand Down Expand Up @@ -35,7 +36,11 @@ class SetChannelMetadataImpl(
name = name,
description = description,
custom = KMPAnyJSON(custom),
includeCustom = includeCustom,
include = KMPChannelIncludeFields(
includeCustom = includeCustom,
includeType = true,
includeStatus = true
),
type = type,
status = status,
onSuccess = callback.onSuccessHandler {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pubnub.api.endpoints.objects.member

import cocoapods.PubNubSwift.KMPMemberIncludeFields
import cocoapods.PubNubSwift.KMPMembershipMetadata
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.getChannelMembersWithChannel
Expand Down Expand Up @@ -41,11 +42,16 @@ class GetChannelMembersImpl(
page = createPubNubHashedPage(from = page),
filter = filter,
sort = sort.map { it.key.fieldName },
includeCount = includeFields.includeTotalCount,
includeCustom = includeFields.includeCustom,
includeUserFields = includeFields.includeUser,
includeUserCustomFields = includeFields.includeUserCustom,
includeUserType = includeFields.includeUserType,
include = KMPMemberIncludeFields(
includeCustom = includeFields.includeCustom,
includeStatus = includeFields.includeStatus,
includeType = includeFields.includeType,
includeTotalCount = includeFields.includeTotalCount,
includeUser = includeFields.includeUser,
includeUserCustom = includeFields.includeUserCustom,
includeUserType = includeFields.includeUserType,
includeUserStatus = includeFields.includeUserStatus
),
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, page ->
PNMemberArrayResult(
status = 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pubnub.api.endpoints.objects.member

import cocoapods.PubNubSwift.KMPMemberIncludeFields
import cocoapods.PubNubSwift.KMPMembershipMetadata
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.removeChannelMembersWithChannel
Expand Down Expand Up @@ -37,11 +38,16 @@ class RemoveChannelMembersImpl(
page = createPubNubHashedPage(from = page),
filter = filter,
sort = sort.map { it.key.fieldName },
includeCount = includeFields.includeTotalCount,
includeCustom = includeFields.includeCustom,
includeUser = includeFields.includeUser,
includeUserCustom = includeFields.includeUserCustom,
includeUserType = includeFields.includeUserType,
include = KMPMemberIncludeFields(
includeCustom = includeFields.includeCustom,
includeStatus = includeFields.includeStatus,
includeType = includeFields.includeType,
includeTotalCount = includeFields.includeTotalCount,
includeUser = includeFields.includeUser,
includeUserCustom = includeFields.includeUserCustom,
includeUserType = includeFields.includeUserType,
includeUserStatus = includeFields.includeUserStatus
),
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, next ->
PNMemberArrayResult(
status = 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pubnub.api.endpoints.objects.member

import cocoapods.PubNubSwift.KMPAnyJSON
import cocoapods.PubNubSwift.KMPMemberIncludeFields
import cocoapods.PubNubSwift.KMPMembershipMetadata
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.KMPUserMetadata
Expand Down Expand Up @@ -41,16 +42,21 @@ class SetChannelMembersImpl(
override fun async(callback: Consumer<Result<PNMemberArrayResult>>) {
pubnub.setChannelMembersWithChannel(
channel = channelId,
users = users.map { KMPUserMetadata(id = it.uuid, custom = KMPAnyJSON(it.custom), status = it.status) },
users = users.map { KMPUserMetadata(it.uuid, KMPAnyJSON(it.custom), it.type, it.status) },
limit = limit?.let { NSNumber(it) },
page = createPubNubHashedPage(from = page),
filter = filter,
sort = sort.map { it.key.fieldName },
includeCount = includeFields.includeTotalCount,
includeCustom = includeFields.includeCustom,
includeUser = includeFields.includeUser,
includeUserCustom = includeFields.includeUserCustom,
includeUserType = includeFields.includeUserType,
include = KMPMemberIncludeFields(
includeCustom = includeFields.includeCustom,
includeStatus = includeFields.includeStatus,
includeType = includeFields.includeType,
includeTotalCount = includeFields.includeTotalCount,
includeUser = includeFields.includeUser,
includeUserCustom = includeFields.includeUserCustom,
includeUserType = includeFields.includeUserType,
includeUserStatus = includeFields.includeUserStatus
),
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, page ->
PNMemberArrayResult(
status = 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pubnub.api.endpoints.objects.membership

import cocoapods.PubNubSwift.KMPMembershipIncludeFields
import cocoapods.PubNubSwift.KMPMembershipMetadata
import cocoapods.PubNubSwift.KMPPubNub
import cocoapods.PubNubSwift.getMembershipsWithUserId
Expand Down Expand Up @@ -41,11 +42,16 @@ class GetMembershipsImpl(
page = createPubNubHashedPage(from = page),
filter = filter,
sort = sort.map { it.key.fieldName },
includeCount = includeFields.includeTotalCount,
includeCustom = includeFields.includeCustom,
includeChannelFields = includeFields.includeChannel,
includeChannelCustomFields = includeFields.includeChannelCustom,
includeChannelType = includeFields.includeChannelType,
include = KMPMembershipIncludeFields(
includeCustom = includeFields.includeCustom,
includeStatus = includeFields.includeStatus,
includeType = includeFields.includeType,
includeTotalCount = includeFields.includeTotalCount,
includeChannel = includeFields.includeChannel,
includeChannelCustom = includeFields.includeChannelCustom,
includeChannelType = includeFields.includeChannelType,
includeChannelStatus = includeFields.includeChannelStatus
),
onSuccess = callback.onSuccessHandler3 { memberships, totalCount, page ->
PNChannelMembershipArrayResult(
status = 200,
Expand Down
Loading

0 comments on commit 5779f48

Please sign in to comment.