Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed May 30, 2024
2 parents 3366f21 + 4457d5f commit 58a0053
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 43 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 = 3
const val patchVersion = 4
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 26
const val versionCode = 27
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "io.getstream"
const val streamVideoCallGooglePlayVersion = "1.1.2"
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/Android/02-tutorials/01-video-calling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you're new to android, note that there are 2 `build.gradle` files, you want t
```kotlin
dependencies {
// Stream Video Compose SDK
implementation("io.getstream:stream-video-android-ui-compose:1.0.3")
implementation("io.getstream:stream-video-android-ui-compose:1.0.4")

// Optionally add Jetpack Compose if Android studio didn't automatically include them
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/Android/02-tutorials/02-audio-room.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you're new to android, note that there are 2 `build.gradle` files, you want t
```groovy
dependencies {
// Stream Video Compose SDK
implementation("io.getstream:stream-video-android-ui-compose:1.0.3")
implementation("io.getstream:stream-video-android-ui-compose:1.0.4")
// Jetpack Compose (optional/ android studio typically adds them when you create a new project)
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/Android/02-tutorials/03-livestream.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you're new to android, note that there are 2 `build.gradle` files, you want t
```kotlin
dependencies {
// Stream Video Compose SDK
implementation("io.getstream:stream-video-android-ui-compose:1.0.3")
implementation("io.getstream:stream-video-android-ui-compose:1.0.4")

// Jetpack Compose (optional/ android studio typically adds them when you create a new project)
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/Android/06-advanced/07-chat-with-video.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Let the project sync. It should have all the dependencies required for you to fi
```groovy
dependencies {
// Stream Video Compose SDK
implementation("io.getstream:stream-video-android-ui-compose:1.0.3")
implementation("io.getstream:stream-video-android-ui-compose:1.0.4")
// Stream Chat
implementation(libs.stream.chat.compose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import okhttp3.Response
import org.openapitools.client.models.AcceptCallResponse
import org.openapitools.client.models.BlockUserRequest
import org.openapitools.client.models.BlockUserResponse
import org.openapitools.client.models.CallAcceptedEvent
import org.openapitools.client.models.CallRequest
import org.openapitools.client.models.CallSettingsRequest
import org.openapitools.client.models.ConnectedEvent
Expand Down Expand Up @@ -141,8 +142,7 @@ internal class StreamVideoImpl internal constructor(
internal val sounds: Sounds,
internal val crashOnMissingPermission: Boolean = true,
internal val permissionCheck: StreamPermissionCheck = DefaultStreamPermissionCheck(),
) : StreamVideo,
NotificationHandler by streamNotificationManager {
) : StreamVideo, NotificationHandler by streamNotificationManager {

private var locationJob: Deferred<Result<String>>? = null

Expand Down Expand Up @@ -304,42 +304,37 @@ internal class StreamVideoImpl internal constructor(
}

override suspend fun connectIfNotAlreadyConnected() {
if (connectionModule.coordinatorSocket.connectionState.value != SocketState.NotConnected &&
connectionModule.coordinatorSocket.connectionState.value != SocketState.Connecting
) {
if (connectionModule.coordinatorSocket.connectionState.value != SocketState.NotConnected && connectionModule.coordinatorSocket.connectionState.value != SocketState.Connecting) {
connectionModule.coordinatorSocket.connect()
}
}

/**
* Observes the app lifecycle and attempts to reconnect/release the socket connection.
*/
private val lifecycleObserver =
StreamLifecycleObserver(
lifecycle,
object : LifecycleHandler {
override fun started() {
scope.launch {
// We should only connect if we were previously connected
if (connectionModule.coordinatorSocket.connectionState.value != SocketState.NotConnected) {
connectionModule.coordinatorSocket.connect()
}
private val lifecycleObserver = StreamLifecycleObserver(
lifecycle,
object : LifecycleHandler {
override fun started() {
scope.launch {
// We should only connect if we were previously connected
if (connectionModule.coordinatorSocket.connectionState.value != SocketState.NotConnected) {
connectionModule.coordinatorSocket.connect()
}
}
}

override fun stopped() {
// We should only disconnect if we were previously connected
// Also don't disconnect the socket if we are in an active call
if (connectionModule.coordinatorSocket.connectionState.value != SocketState.NotConnected &&
state.activeCall.value == null
) {
connectionModule.coordinatorSocket.disconnect(
PersistentSocket.DisconnectReason.ByRequest,
)
}
override fun stopped() {
// We should only disconnect if we were previously connected
// Also don't disconnect the socket if we are in an active call
if (connectionModule.coordinatorSocket.connectionState.value != SocketState.NotConnected && state.activeCall.value == null) {
connectionModule.coordinatorSocket.disconnect(
PersistentSocket.DisconnectReason.ByRequest,
)
}
},
)
}
},
)

init {

Expand Down Expand Up @@ -522,6 +517,21 @@ internal class StreamVideoImpl internal constructor(
}

if (selectedCid.isNotEmpty()) {
// Special handling for accepted events
if (event is CallAcceptedEvent) {
// Skip accepted events not meant for the current outgoing call.
val currentRingingCall = state.ringingCall.value
val state = currentRingingCall?.state?.ringingState?.value
if (currentRingingCall != null &&
(state is RingingState.Outgoing || state == RingingState.Idle) &&
currentRingingCall.cid != event.callCid
) {
// Skip this event
return
}
}

// Update calls as usual
calls[selectedCid]?.let {
it.state.handleEvent(event)
it.session?.handleEvent(event)
Expand Down Expand Up @@ -938,12 +948,11 @@ internal class StreamVideoImpl internal constructor(
sessionId: String?,
): Result<ListRecordingsResponse> {
return wrapAPICall {
val result =
if (sessionId == null) {
connectionModule.api.listRecordingsTypeId0(type, id)
} else {
connectionModule.api.listRecordingsTypeIdSession1(type, id, sessionId)
}
val result = if (sessionId == null) {
connectionModule.api.listRecordingsTypeId0(type, id)
} else {
connectionModule.api.listRecordingsTypeIdSession1(type, id, sessionId)
}
result
}
}
Expand Down Expand Up @@ -1000,10 +1009,7 @@ internal class StreamVideoImpl internal constructor(
suspend fun _selectLocation(): Result<String> {
return wrapAPICall {
val url = "https://hint.stream-io-video.com/"
val request: Request = Request.Builder()
.url(url)
.method("HEAD", null)
.build()
val request: Request = Request.Builder().url(url).method("HEAD", null).build()
val call = connectionModule.okHttpClient.newCall(request)
val response = suspendCancellableCoroutine { continuation ->
call.enqueue(object : Callback {
Expand Down

0 comments on commit 58a0053

Please sign in to comment.