Skip to content

Commit

Permalink
PubNub SDK v5.1.2 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
client-engineering-bot committed Mar 9, 2021
1 parent 7e4c137 commit 826e81c
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 249 deletions.
14 changes: 12 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
name: kotlin
version: 5.1.1
version: 5.1.2
schema: 1
scm: github.com/pubnub/kotlin
files:
- build/libs/pubnub-kotlin-5.1.1-all.jar
- build/libs/pubnub-kotlin-5.1.2-all.jar
changelog:
-
version: v5.1.2
date: 2021-03-09
changes:
-
type: bug
text: "In some specific timing conditions subscription loop could loose reference to one of the retrofit call and we would loose posibility to control it. In the meantime we'd start yet another subscription call. One of them is obviously not necessary Synchronization has been improved so it's no longer possible."
-
type: bug
text: "It was not possible to properly cancel the OkHttp connection when Google Security Provider (ProviderInstaller) is being used."
-
version: v5.1.1
date: 2021-01-20
Expand Down
11 changes: 5 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
## [v5.1.1](https://github.com/pubnub/kotlin/releases/tag/v5.1.1)
January 20 2021
## [v5.1.2](https://github.com/pubnub/kotlin/releases/tag/v5.1.2)
March 9 2021

[Full Changelog](https://github.com/pubnub/kotlin/compare/v5.1.0...v5.1.1)
[Full Changelog](https://github.com/pubnub/kotlin/compare/v5.1.1...v5.1.2)

- File upload encryption fix.
- Asynchronous file upload encryption fix.
- Telemetry fix - removal of `putIfAbsent`.
- In some specific timing conditions subscription loop could loose reference to one of the retrofit call and we would loose posibility to control it. In the meantime we'd start yet another subscription call. One of them is obviously not necessary Synchronization has been improved so it's no longer possible.
- It was not possible to properly cancel the OkHttp connection when Google Security Provider (ProviderInstaller) is being used.


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

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = 'com.pubnub'
version = '5.1.0'
version = '5.1.2'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/pubnub/api/PubNub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PubNub(val configuration: PNConfiguration) {

private companion object Constants {
private const val TIMESTAMP_DIVIDER = 1000
private const val SDK_VERSION = "5.1.1"
private const val SDK_VERSION = "5.1.2"
private const val MAX_SEQUENCE = 65535
}

Expand Down
58 changes: 31 additions & 27 deletions src/main/kotlin/com/pubnub/api/builder/PubSubOperations.kt
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
package com.pubnub.api.builder

// basic publish/subscribe class

internal abstract class PubSubOperation(
internal val channels: List<String> = emptyList(),
internal val channelGroups: List<String> = emptyList()
)
internal sealed class PubSubOperation

// concrete publish/subscribe cases
internal data class SubscribeOperation(
val channels: List<String> = emptyList(),
val channelGroups: List<String> = emptyList(),
val presenceEnabled: Boolean = false,
val timetoken: Long = 0L
) : PubSubOperation()

internal data class UnsubscribeOperation(
val channels: List<String> = emptyList(),
val channelGroups: List<String> = emptyList()
) : PubSubOperation()

internal data class PresenceOperation(
val channels: List<String> = emptyList(),
val channelGroups: List<String> = emptyList(),
val connected: Boolean = false
) : PubSubOperation()

internal class SubscribeOperation(
channels: List<String> = emptyList(),
channelGroups: List<String> = emptyList(),
internal val presenceEnabled: Boolean = false,
internal val timetoken: Long = 0L
) : PubSubOperation(channels, channelGroups)

internal class UnsubscribeOperation(
channels: List<String> = emptyList(),
channelGroups: List<String> = emptyList()
) : PubSubOperation(channels, channelGroups)

internal class PresenceOperation(
channels: List<String> = emptyList(),
channelGroups: List<String> = emptyList(),
internal val connected: Boolean = false
) : PubSubOperation(channels, channelGroups)

internal class StateOperation(
channels: List<String> = emptyList(),
channelGroups: List<String> = emptyList(),
internal data class StateOperation(
val channels: List<String> = emptyList(),
val channelGroups: List<String> = emptyList(),
val state: Any? = null
) : PubSubOperation(channels, channelGroups)
) : PubSubOperation()

internal data class TimetokenRegionOperation(
val timetoken: Long = 0L,
val region: String
) : PubSubOperation()

internal object ConnectedStatusAnnouncedOperation : PubSubOperation()

internal object NoOpOperation : PubSubOperation()
3 changes: 3 additions & 0 deletions src/main/kotlin/com/pubnub/api/managers/DuplicationManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ internal class DuplicationManager(private val config: PNConfiguration) {
"${publishMetaData?.publishTimetoken}-${payload.hashCode()}"
}

@Synchronized
fun isDuplicate(message: SubscribeMessage) = hashHistory.contains(getKey(message))

@Synchronized
fun addEntry(message: SubscribeMessage) {
if (hashHistory.size >= config.maximumMessagesCacheSize) {
hashHistory.removeAt(0)
}
hashHistory.add(getKey(message))
}

@Synchronized
fun clearHistory() = hashHistory.clear()
}
7 changes: 0 additions & 7 deletions src/main/kotlin/com/pubnub/api/managers/ListenerManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,30 @@ internal class ListenerManager(val pubnub: PubNub) {
return tempCallbackList
}

@Synchronized
fun announce(status: PNStatus) {
getListeners().forEach { it.status(pubnub, status) }
}

@Synchronized
fun announce(message: PNMessageResult) {
getListeners().forEach { it.message(pubnub, message) }
}

@Synchronized
fun announce(presence: PNPresenceEventResult) {
getListeners().forEach { it.presence(pubnub, presence) }
}

@Synchronized
fun announce(signal: PNSignalResult) {
getListeners().forEach { it.signal(pubnub, signal) }
}

@Synchronized
fun announce(messageAction: PNMessageActionResult) {
getListeners().forEach { it.messageAction(pubnub, messageAction) }
}

@Synchronized
fun announce(pnObjectEventResult: PNObjectEventResult) {
getListeners().forEach { it.objects(pubnub, pnObjectEventResult) }
}

@Synchronized
fun announce(pnFileEventResult: PNFileEventResult) {
getListeners().forEach { it.file(pubnub, pnFileEventResult) }
}
Expand Down
8 changes: 5 additions & 3 deletions src/main/kotlin/com/pubnub/api/managers/RetrofitManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import com.pubnub.api.services.S3Service
import com.pubnub.api.services.SignalService
import com.pubnub.api.services.SubscribeService
import com.pubnub.api.services.TimeService
import okhttp3.Call
import okhttp3.OkHttpClient
import okhttp3.PNCallFactory
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import java.util.concurrent.ExecutorService
Expand Down Expand Up @@ -57,7 +59,7 @@ class RetrofitManager(val pubnub: PubNub) {
}

val transactionInstance = createRetrofit(transactionClientInstance)
val subscriptionInstance = createRetrofit(subscriptionClientInstance)
val subscriptionInstance = createRetrofit(PNCallFactory(subscriptionClientInstance))
val noSignatureInstance = createRetrofit(noSignatureClientInstance)

timeService = transactionInstance.create(TimeService::class.java)
Expand Down Expand Up @@ -122,9 +124,9 @@ class RetrofitManager(val pubnub: PubNub) {
return okHttpClient
}

private fun createRetrofit(okHttpClient: OkHttpClient): Retrofit {
private fun createRetrofit(callFactory: Call.Factory): Retrofit {
val retrofitBuilder = Retrofit.Builder()
.client(okHttpClient)
.callFactory(callFactory)
.baseUrl(pubnub.baseUrl())
.addConverterFactory(pubnub.mapper.converterFactory)

Expand Down
Loading

0 comments on commit 826e81c

Please sign in to comment.