Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some iOS KMP converters #336

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: kotlin
version: 10.4.2
version: 10.4.3
schema: 1
scm: github.com/pubnub/kotlin
files:
- build/libs/pubnub-kotlin-10.4.2-all.jar
- build/libs/pubnub-kotlin-10.4.3-all.jar
sdks:
-
type: library
Expand All @@ -23,8 +23,8 @@ sdks:
-
distribution-type: library
distribution-repository: maven
package-name: pubnub-kotlin-10.4.2
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.4.2/pubnub-kotlin-10.4.2.jar
package-name: pubnub-kotlin-10.4.3
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.4.3/pubnub-kotlin-10.4.3.jar
supported-platforms:
supported-operating-systems:
Android:
Expand Down Expand Up @@ -121,6 +121,11 @@ sdks:
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
is-required: Required
changelog:
- date: 2025-02-28
version: v10.4.3
changes:
- type: bug
text: "Internal fixes."
- date: 2025-02-25
version: v10.4.2
changes:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v10.4.3
February 28 2025

#### Fixed
- Internal fixes.

## v10.4.2
February 25 2025

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.4.2</version>
<version>10.4.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.4.2
VERSION_NAME=10.4.3
POM_PACKAGING=jar

POM_NAME=PubNub SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ class DownloadFileImpl(
channel = channel,
fileName = fileName,
fileId = fileId,
onSuccess = callback.onSuccessHandler {
onSuccess = callback.onSuccessHandler { file ->
requireNotNull(file)
PNDownloadFileResult(
fileName = it?.name().orEmpty(),
byteStream = it?.url()?.let { url -> DownloadableImpl(inputStream = NSInputStream(uRL = url)) }
fileName = file.name(),
byteStream = file.url()?.let { url -> DownloadableImpl(inputStream = NSInputStream(uRL = url)) }
)
},
onFailure = callback.onFailureHandler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GetFileUrlImpl(
channel = channel,
fileName = fileName,
fileId = fileId,
onSuccess = callback.onSuccessHandler { PNFileUrlResult(url = it.orEmpty()) },
onSuccess = callback.onSuccessHandler { PNFileUrlResult(url = requireNotNull(it)) },
onFailure = callback.onFailureHandler()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ class SendFileImpl(
shouldStore = shouldStore?.let { NSNumber(it) },
customMessageType = customMessageType,
onSuccess = callback.onSuccessHandler2 { uploadedFile, timetoken ->
requireNotNull(uploadedFile)
PNFileUploadResult(
status = 200,
timetoken = timetoken.toLong(),
file = PNBaseFile(
id = uploadedFile?.id().orEmpty(),
name = uploadedFile?.name().orEmpty()
id = uploadedFile.id(),
name = uploadedFile.name()
)
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class AddMessageActionImpl(
actionValue = actionValue,
messageTimetoken = messageTimetoken.toULong(),
onSuccess = callback.onSuccessHandler { messageActionObjC ->
requireNotNull(messageActionObjC)
PNAddMessageActionResult(
action = PNMessageAction(
type = messageActionObjC?.actionType().orEmpty(),
value = messageActionObjC?.actionValue().orEmpty(),
messageTimetoken = messageActionObjC?.messageTimetoken()?.toLong() ?: 0,
type = messageActionObjC.actionType(),
value = messageActionObjC.actionValue(),
messageTimetoken = messageActionObjC.messageTimetoken().toLong(),
).apply {
uuid = messageActionObjC?.publisher()
actionTimetoken = messageActionObjC?.actionTimetoken()?.toLong()
uuid = messageActionObjC.publisher()
actionTimetoken = messageActionObjC.actionTimetoken().toLong()
}
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ internal fun createPNUUIDMetadata(from: KMPUserMetadata?): PNUUIDMetadata {
externalId = PatchValue.of(from.externalId()),
profileUrl = PatchValue.of(from.profileUrl()),
email = PatchValue.of(from.email()),
custom = PatchValue.of(from.custom()?.safeCast()),
updated = PatchValue.of(from.updated().orEmpty()),
eTag = PatchValue.of(from.eTag().orEmpty()),
custom = from.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
updated = from.updated()?.let { PatchValue.of(it) },
eTag = from.eTag()?.let { PatchValue.of(it) },
type = PatchValue.of(from.type()),
status = PatchValue.of(from.status())
)
Expand All @@ -64,9 +64,9 @@ internal fun createPNChannelMetadata(from: KMPChannelMetadata?): PNChannelMetada
id = from!!.id(),
name = PatchValue.of(from.name()),
description = PatchValue.of(from.descr()),
custom = PatchValue.of(from.custom()?.safeCast()),
updated = PatchValue.of(from.updated().orEmpty()),
eTag = PatchValue.of(from.eTag().orEmpty()),
custom = from.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
updated = from.updated()?.let { PatchValue.of(it) },
eTag = from.eTag()?.let { PatchValue.of(it) },
type = PatchValue.of(from.type()),
status = PatchValue.of(from.status())
)
Expand All @@ -90,9 +90,9 @@ internal fun createPNChannelMembership(from: KMPMembershipMetadata): PNChannelMe
id = from.channelMetadataId(),
name = PatchValue.of(from.channel()?.name()),
description = PatchValue.of(from.channel()?.descr()),
custom = PatchValue.of(from.channel()?.custom()?.safeCast()),
updated = PatchValue.of(from.channel()?.updated().orEmpty()),
eTag = PatchValue.of(from.channel()?.eTag().orEmpty()),
custom = from.channel()?.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
updated = from.channel()?.updated()?.let { PatchValue.of(it) },
eTag = from.channel()?.eTag()?.let { PatchValue.of(it) },
type = PatchValue.of(from.channel()?.type()),
status = PatchValue.of(from.channel()?.status())
),
Expand All @@ -109,7 +109,7 @@ internal fun createPNChannelMembership(from: KMPMembershipMetadata): PNChannelMe
internal fun createPNMember(from: KMPMembershipMetadata?): PNMember {
return PNMember(
uuid = createPNUUIDMetadata(from = from!!.user()),
custom = PatchValue.of(from.custom()?.safeCast()),
custom = from.custom()?.safeCast<String, Any>()?.let { PatchValue.of(it) },
updated = from.updated().orEmpty(),
eTag = from.eTag().orEmpty(),
status = PatchValue.of(from.status()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PubNubImplTest : BaseTest() {
fun getVersionAndTimeStamp() {
val version = PubNubImpl.SDK_VERSION
val timeStamp = PubNubImpl.timestamp()
assertEquals("10.4.2", version)
assertEquals("10.4.3", version)
assertTrue(timeStamp > 0)
}

Expand Down
Loading