Skip to content

Commit c30e2f0

Browse files
Fix some iOS KMP converters (#336)
* Some iOS converters were putting empty strings into objects instead of null * PubNub SDK v10.4.3 release. --------- Co-authored-by: PubNub Release Bot <[email protected]>
1 parent f3ecdda commit c30e2f0

File tree

10 files changed

+42
-28
lines changed

10 files changed

+42
-28
lines changed

.pubnub.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: kotlin
2-
version: 10.4.2
2+
version: 10.4.3
33
schema: 1
44
scm: github.com/pubnub/kotlin
55
files:
6-
- build/libs/pubnub-kotlin-10.4.2-all.jar
6+
- build/libs/pubnub-kotlin-10.4.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.4.2
27-
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.4.2/pubnub-kotlin-10.4.2.jar
26+
package-name: pubnub-kotlin-10.4.3
27+
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.4.3/pubnub-kotlin-10.4.3.jar
2828
supported-platforms:
2929
supported-operating-systems:
3030
Android:
@@ -121,6 +121,11 @@ sdks:
121121
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
122122
is-required: Required
123123
changelog:
124+
- date: 2025-02-28
125+
version: v10.4.3
126+
changes:
127+
- type: bug
128+
text: "Internal fixes."
124129
- date: 2025-02-25
125130
version: v10.4.2
126131
changes:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v10.4.3
2+
February 28 2025
3+
4+
#### Fixed
5+
- Internal fixes.
6+
17
## v10.4.2
28
February 25 2025
39

README.md

Lines changed: 1 addition & 1 deletion
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.4.2</version>
23+
<version>10.4.3</version>
2424
</dependency>
2525
```
2626

gradle.properties

Lines changed: 1 addition & 1 deletion
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.4.2
21+
VERSION_NAME=10.4.3
2222
POM_PACKAGING=jar
2323

2424
POM_NAME=PubNub SDK

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/files/DownloadFile.ios.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ class DownloadFileImpl(
2929
channel = channel,
3030
fileName = fileName,
3131
fileId = fileId,
32-
onSuccess = callback.onSuccessHandler {
32+
onSuccess = callback.onSuccessHandler { file ->
33+
requireNotNull(file)
3334
PNDownloadFileResult(
34-
fileName = it?.name().orEmpty(),
35-
byteStream = it?.url()?.let { url -> DownloadableImpl(inputStream = NSInputStream(uRL = url)) }
35+
fileName = file.name(),
36+
byteStream = file.url()?.let { url -> DownloadableImpl(inputStream = NSInputStream(uRL = url)) }
3637
)
3738
},
3839
onFailure = callback.onFailureHandler()

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/files/GetFileUrl.ios.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GetFileUrlImpl(
2727
channel = channel,
2828
fileName = fileName,
2929
fileId = fileId,
30-
onSuccess = callback.onSuccessHandler { PNFileUrlResult(url = it.orEmpty()) },
30+
onSuccess = callback.onSuccessHandler { PNFileUrlResult(url = requireNotNull(it)) },
3131
onFailure = callback.onFailureHandler()
3232
)
3333
}

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/files/SendFile.ios.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ class SendFileImpl(
5050
shouldStore = shouldStore?.let { NSNumber(it) },
5151
customMessageType = customMessageType,
5252
onSuccess = callback.onSuccessHandler2 { uploadedFile, timetoken ->
53+
requireNotNull(uploadedFile)
5354
PNFileUploadResult(
5455
status = 200,
5556
timetoken = timetoken.toLong(),
5657
file = PNBaseFile(
57-
id = uploadedFile?.id().orEmpty(),
58-
name = uploadedFile?.name().orEmpty()
58+
id = uploadedFile.id(),
59+
name = uploadedFile.name()
5960
)
6061
)
6162
},

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/message_actions/AddMessageAction.ios.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ class AddMessageActionImpl(
3131
actionValue = actionValue,
3232
messageTimetoken = messageTimetoken.toULong(),
3333
onSuccess = callback.onSuccessHandler { messageActionObjC ->
34+
requireNotNull(messageActionObjC)
3435
PNAddMessageActionResult(
3536
action = PNMessageAction(
36-
type = messageActionObjC?.actionType().orEmpty(),
37-
value = messageActionObjC?.actionValue().orEmpty(),
38-
messageTimetoken = messageActionObjC?.messageTimetoken()?.toLong() ?: 0,
37+
type = messageActionObjC.actionType(),
38+
value = messageActionObjC.actionValue(),
39+
messageTimetoken = messageActionObjC.messageTimetoken().toLong(),
3940
).apply {
40-
uuid = messageActionObjC?.publisher()
41-
actionTimetoken = messageActionObjC?.actionTimetoken()?.toLong()
41+
uuid = messageActionObjC.publisher()
42+
actionTimetoken = messageActionObjC.actionTimetoken().toLong()
4243
}
4344
)
4445
},

pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/converters.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ internal fun createPNUUIDMetadata(from: KMPUserMetadata?): PNUUIDMetadata {
4949
externalId = PatchValue.of(from.externalId()),
5050
profileUrl = PatchValue.of(from.profileUrl()),
5151
email = PatchValue.of(from.email()),
52-
custom = PatchValue.of(from.custom()?.safeCast()),
53-
updated = PatchValue.of(from.updated().orEmpty()),
54-
eTag = PatchValue.of(from.eTag().orEmpty()),
52+
custom = from.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
53+
updated = from.updated()?.let { PatchValue.of(it) },
54+
eTag = from.eTag()?.let { PatchValue.of(it) },
5555
type = PatchValue.of(from.type()),
5656
status = PatchValue.of(from.status())
5757
)
@@ -64,9 +64,9 @@ internal fun createPNChannelMetadata(from: KMPChannelMetadata?): PNChannelMetada
6464
id = from!!.id(),
6565
name = PatchValue.of(from.name()),
6666
description = PatchValue.of(from.descr()),
67-
custom = PatchValue.of(from.custom()?.safeCast()),
68-
updated = PatchValue.of(from.updated().orEmpty()),
69-
eTag = PatchValue.of(from.eTag().orEmpty()),
67+
custom = from.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
68+
updated = from.updated()?.let { PatchValue.of(it) },
69+
eTag = from.eTag()?.let { PatchValue.of(it) },
7070
type = PatchValue.of(from.type()),
7171
status = PatchValue.of(from.status())
7272
)
@@ -90,9 +90,9 @@ internal fun createPNChannelMembership(from: KMPMembershipMetadata): PNChannelMe
9090
id = from.channelMetadataId(),
9191
name = PatchValue.of(from.channel()?.name()),
9292
description = PatchValue.of(from.channel()?.descr()),
93-
custom = PatchValue.of(from.channel()?.custom()?.safeCast()),
94-
updated = PatchValue.of(from.channel()?.updated().orEmpty()),
95-
eTag = PatchValue.of(from.channel()?.eTag().orEmpty()),
93+
custom = from.channel()?.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
94+
updated = from.channel()?.updated()?.let { PatchValue.of(it) },
95+
eTag = from.channel()?.eTag()?.let { PatchValue.of(it) },
9696
type = PatchValue.of(from.channel()?.type()),
9797
status = PatchValue.of(from.channel()?.status())
9898
),
@@ -109,7 +109,7 @@ internal fun createPNChannelMembership(from: KMPMembershipMetadata): PNChannelMe
109109
internal fun createPNMember(from: KMPMembershipMetadata?): PNMember {
110110
return PNMember(
111111
uuid = createPNUUIDMetadata(from = from!!.user()),
112-
custom = PatchValue.of(from.custom()?.safeCast()),
112+
custom = from.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
113113
updated = from.updated().orEmpty(),
114114
eTag = from.eTag().orEmpty(),
115115
status = PatchValue.of(from.status()),

pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubImplTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class PubNubImplTest : BaseTest() {
5656
fun getVersionAndTimeStamp() {
5757
val version = PubNubImpl.SDK_VERSION
5858
val timeStamp = PubNubImpl.timestamp()
59-
assertEquals("10.4.2", version)
59+
assertEquals("10.4.3", version)
6060
assertTrue(timeStamp > 0)
6161
}
6262

0 commit comments

Comments
 (0)