Skip to content

Commit

Permalink
Add internal fixes to the publish method for Apple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
jguz-pubnub committed Jan 10, 2025
1 parent 5779f48 commit 8854a34
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dokka = "1.9.20"
kotlinx_datetime = "0.6.1"
kotlinx_coroutines = "1.9.0"
pubnub_js = "8.4.1"
pubnub_swift = "8.2.3"
pubnub_swift = "8.2.4"

[libraries]
retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit2" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
pubNubObjC.removeAllListeners()
}

// TODO: replicate and usePost parameters are not present in Swift SDK
// TODO: replicate is not present in Swift SDK
override fun publish(
channel: String,
message: Any,
Expand All @@ -206,19 +206,20 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
message = message,
meta = meta,
shouldStore = shouldStore,
usePost = usePost,
ttl = ttl,
customMessageType = customMessageType
)
}

// TODO: usePost parameter is not present in Swift SDK
override fun fire(channel: String, message: Any, meta: Any?, usePost: Boolean): Publish {
return PublishImpl(
pubnub = pubNubObjC,
channel = channel,
message = message,
meta = meta,
shouldStore = false,
usePost = usePost,
ttl = 0,
customMessageType = null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class PublishImpl(
private val message: Any,
private val meta: Any?,
private val shouldStore: Boolean?,
private val usePost: Boolean?,
private val ttl: Int?,
private val customMessageType: String?
) : Publish {
Expand All @@ -32,6 +33,7 @@ class PublishImpl(
message = message,
meta = meta,
shouldStore = shouldStore?.let { NSNumber(bool = it) },
usePost = usePost?.let { NSNumber(bool = it) },
ttl = ttl?.let { NSNumber(it) },
customMessageType = customMessageType,
onSuccess = callback.onSuccessHandler { PNPublishResult(it.toLong()) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ private fun MembershipInclude.toMembershipIncludeOptions(): PubNubJs.MembershipI
}

private fun MemberInclude.toMemberIncludeOptions(): PubNubJs.IncludeOptions {
return createJsObject<PubNubJs.IncludeOptions> {
return createJsObject<PubNubJs.IncludeOptions> {
this.totalCount = this@toMemberIncludeOptions.includeTotalCount
this.customFields = this@toMemberIncludeOptions.includeCustom
this.UUIDFields = this@toMemberIncludeOptions.includeUser
Expand Down

0 comments on commit 8854a34

Please sign in to comment.