Skip to content

Commit

Permalink
Changes for Chat JS (#308)
Browse files Browse the repository at this point in the history
Internal changes for enabling Chat JS work
  • Loading branch information
wkal-pubnub authored Nov 14, 2024
1 parent b03b1a4 commit 926e4ac
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pubnub-kotlin/pubnub-kotlin-api/pubnub_kotlin_api.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'pubnub_kotlin_api'
spec.version = '10.0.0'
spec.version = '10.1.0'
spec.homepage = ''
spec.source = { :http=> ''}
spec.authors = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ open external class PubNub(config: Any /* UUID | UserId */) {
}

interface SignalResponse {
var timetoken: Number
var timetoken: String
}

interface HistoryParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ open class EndpointImpl<T, U>(private val promiseFactory: () -> Promise<T>, priv
PNFuture<U> {
override fun async(callback: Consumer<Result<U>>) {
try {
promiseFactory().then(
promiseFactory().let {
@Suppress("USELESS_CAST") // for some reason, sometimes we don't get a promise from JS SDK!
it as? Promise ?: Promise.resolve(it)
}.then(
onFulfilled = { response: T ->
try {
callback.accept(Result.success(responseMapping(response)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,9 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
jsPubNub,
createJsObject {
uuid?.let { this.uuid = it }
this.sort = sort.toJsMap()
sort.takeIf { it.isNotEmpty() }?.toJsMap()?.let { this.sort = it }
this.filter = filter
this.page = page.toMetadataPage()
page.toMetadataPage()?.let { this.page = it }
this.include = createJsObject<PubNubJs.MembershipIncludeOptions> {
this.customFields = includeCustom
this.totalCount = includeCount
Expand All @@ -689,6 +689,7 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
}
this.channelTypeField = includeType
this.channelStatusField = true
this.statusField = true
// todo we don't have parameters for all fields here?
}
}
Expand Down Expand Up @@ -722,6 +723,7 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
}
this.channelTypeField = includeType
this.channelStatusField = true
this.statusField = true
// todo we don't have parameters for all fields here?
}
this.uuid = uuid
Expand Down Expand Up @@ -764,6 +766,7 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
}
this.channelTypeField = includeType
this.channelStatusField = true
this.statusField = true
// todo we don't have parameters for all fields here?
}
this.uuid = uuid
Expand Down Expand Up @@ -817,6 +820,8 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
this.customFields = includeCustom
this.totalCount = includeCount
this.UUIDTypeField = includeType
this.UUIDStatusField = true
this.statusField = true
// todo we don't have parameters for all fields here
}
this.sort = sort.toJsMap()
Expand Down Expand Up @@ -861,8 +866,9 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
if (includeUUIDDetails == PNUUIDDetailsLevel.UUID_WITH_CUSTOM) {
this.customUUIDFields = true
}
// this.UUIDStatusField = true
this.UUIDTypeField = includeType
this.UUIDStatusField = true
this.statusField = true
// todo we don't have parameters for all fields here
}
}
Expand Down Expand Up @@ -901,6 +907,8 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
this.customUUIDFields = true
}
this.UUIDTypeField = includeType
this.UUIDStatusField = true
this.statusField = true
// todo we don't have parameters for all fields here
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'pubnub_kotlin_core_api'
spec.version = '10.0.0'
spec.version = '10.1.0'
spec.homepage = ''
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit 926e4ac

Please sign in to comment.