Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed Jul 8, 2024
2 parents 9005fa2 + 177913d commit 1ee29d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ object Configuration {
const val minSdk = 24
const val majorVersion = 1
const val minorVersion = 0
const val patchVersion = 9
const val patchVersion = 10
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 33
const val versionCode = 34
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "io.getstream"
const val streamVideoCallGooglePlayVersion = "1.1.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import io.getstream.video.android.model.User
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
Expand Down Expand Up @@ -124,7 +125,6 @@ import retrofit2.HttpException
import java.net.ConnectException
import java.util.*
import kotlin.coroutines.Continuation
import kotlin.coroutines.resumeWithException

internal const val WAIT_FOR_CONNECTION_ID_TIMEOUT = 5000L
internal const val defaultAudioUsage = AudioAttributes.USAGE_VOICE_COMMUNICATION
Expand Down Expand Up @@ -1025,6 +1025,7 @@ internal class StreamVideoImpl internal constructor(
}
}

@OptIn(InternalCoroutinesApi::class)
suspend fun _selectLocation(): Result<String> {
return wrapAPICall {
val url = "https://hint.stream-io-video.com/"
Expand All @@ -1033,7 +1034,9 @@ internal class StreamVideoImpl internal constructor(
val response = suspendCancellableCoroutine { continuation ->
call.enqueue(object : Callback {
override fun onFailure(call: okhttp3.Call, e: java.io.IOException) {
continuation.resumeWithException(e)
continuation.tryResumeWithException(e)?.let {
continuation.completeResume(it)
}
}

override fun onResponse(call: okhttp3.Call, response: Response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import io.getstream.video.android.core.internal.network.NetworkStateProvider
import io.getstream.video.android.core.socket.internal.HealthMonitor
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
Expand All @@ -44,8 +45,6 @@ import java.net.ConnectException
import java.net.SocketTimeoutException
import java.net.UnknownHostException
import java.util.concurrent.Executors
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException

/**
* PersistentSocket architecture
Expand Down Expand Up @@ -282,12 +281,15 @@ public open class PersistentSocket<T>(
healthMonitor.ack()
}

@OptIn(InternalCoroutinesApi::class)
protected fun setConnectedStateAndContinue(message: VideoEvent) {
_connectionState.value = SocketState.Connected(message)

if (!connectContinuationCompleted) {
connectContinuationCompleted = true
connectContinuation.resume(message as T)
connectContinuation.tryResume(message as T)?.let {
connectContinuation.completeResume(it)
}
}
}

Expand Down Expand Up @@ -370,9 +372,12 @@ public open class PersistentSocket<T>(
}
}

@OptIn(InternalCoroutinesApi::class)
private fun resumeConnectionPhaseWithException(error: Throwable) {
connectContinuationCompleted = true
connectContinuation.resumeWithException(error)
connectContinuation.tryResumeWithException(error)?.let {
connectContinuation.completeResume(it)
}
}

/**
Expand Down

0 comments on commit 1ee29d0

Please sign in to comment.