Skip to content

Commit 04fb595

Browse files
Merge branch 'develop'
2 parents 54e226e + 9447db3 commit 04fb595

File tree

8 files changed

+37
-9
lines changed

8 files changed

+37
-9
lines changed

buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ object Configuration {
66
const val minSdk = 24
77
const val majorVersion = 1
88
const val minorVersion = 4
9-
const val patchVersion = 3
9+
const val patchVersion = 4
1010
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
11-
const val versionCode = 50
11+
const val versionCode = 51
1212
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
1313
const val artifactGroup = "io.getstream"
14-
const val streamVideoCallGooglePlayVersion = "1.4.3"
14+
const val streamVideoCallGooglePlayVersion = "1.4.4"
1515
const val streamWebRtcVersionName = "1.3.6"
1616
}

demo-app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ android {
157157

158158
play {
159159
enabled.set(false)
160+
resolutionStrategy.set(ResolutionStrategy.AUTO)
160161
}
161162

162163
androidComponents {

demo-app/src/main/kotlin/io/getstream/video/android/util/config/AppConfig.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import com.squareup.moshi.Moshi
2626
import com.squareup.moshi.adapter
2727
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
2828
import io.getstream.log.taggedLogger
29+
import io.getstream.video.android.BuildConfig
30+
import io.getstream.video.android.tooling.util.StreamFlavors
2931
import io.getstream.video.android.util.config.types.StreamEnvironment
3032
import kotlinx.coroutines.CoroutineScope
3133
import kotlinx.coroutines.DelicateCoroutinesApi
@@ -47,7 +49,6 @@ object AppConfig {
4749
private lateinit var prefs: SharedPreferences
4850

4951
// State of config values
50-
val currentEnvironment = MutableStateFlow<StreamEnvironment?>(null)
5152
val availableEnvironments = listOf(
5253
StreamEnvironment(
5354
env = "pronto",
@@ -74,6 +75,7 @@ object AppConfig {
7475
sharelink = "https://pronto-staging.getstream.io/join/",
7576
),
7677
)
78+
val currentEnvironment = MutableStateFlow(availableEnvironments.default(BuildConfig.FLAVOR))
7779

7880
// Utilities
7981
private val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
@@ -100,7 +102,7 @@ object AppConfig {
100102
val selectedEnvironment = selectedEnvData?.let {
101103
jsonAdapter.fromJson(it)
102104
}
103-
val which = selectedEnvironment ?: availableEnvironments[0]
105+
val which = selectedEnvironment ?: availableEnvironments.default(BuildConfig.FLAVOR)
104106
selectEnv(which)
105107
onLoaded()
106108
} catch (e: Exception) {
@@ -133,6 +135,14 @@ object AppConfig {
133135
}
134136
}
135137

138+
private fun List<StreamEnvironment>.default(currentFlavor: String): StreamEnvironment {
139+
return if (currentFlavor == StreamFlavors.development) {
140+
first { it.env == "pronto" }
141+
} else {
142+
first { it.env == "demo" }
143+
}
144+
}
145+
136146
private fun Uri?.extractEnvironment(): String? {
137147
// Extract the host from the Uri
138148
val host = this?.host ?: return null

stream-video-android-core/api/stream-video-android-core.api

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6307,7 +6307,8 @@ public final class io/getstream/video/android/core/StreamVideoBuilder {
63076307
public fun <init> (Landroid/content/Context;Ljava/lang/String;Lio/getstream/video/android/core/GEO;Lio/getstream/video/android/model/User;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/getstream/video/android/core/socket/common/token/TokenProvider;Lio/getstream/video/android/core/logging/LoggingLevel;Lio/getstream/video/android/core/notifications/NotificationConfig;Lkotlin/jvm/functions/Function1;JZLjava/lang/String;ZLio/getstream/video/android/core/notifications/internal/service/CallServiceConfig;Lio/getstream/video/android/core/notifications/internal/service/CallServiceConfigRegistry;Ljava/lang/String;Lio/getstream/video/android/core/sounds/Sounds;ZLio/getstream/video/android/core/permission/android/StreamPermissionCheck;ILjava/lang/String;)V
63086308
public fun <init> (Landroid/content/Context;Ljava/lang/String;Lio/getstream/video/android/core/GEO;Lio/getstream/video/android/model/User;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/getstream/video/android/core/socket/common/token/TokenProvider;Lio/getstream/video/android/core/logging/LoggingLevel;Lio/getstream/video/android/core/notifications/NotificationConfig;Lkotlin/jvm/functions/Function1;JZLjava/lang/String;ZLio/getstream/video/android/core/notifications/internal/service/CallServiceConfig;Lio/getstream/video/android/core/notifications/internal/service/CallServiceConfigRegistry;Ljava/lang/String;Lio/getstream/video/android/core/sounds/Sounds;ZLio/getstream/video/android/core/permission/android/StreamPermissionCheck;ILjava/lang/String;Lorg/webrtc/ManagedAudioProcessingFactory;)V
63096309
public fun <init> (Landroid/content/Context;Ljava/lang/String;Lio/getstream/video/android/core/GEO;Lio/getstream/video/android/model/User;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/getstream/video/android/core/socket/common/token/TokenProvider;Lio/getstream/video/android/core/logging/LoggingLevel;Lio/getstream/video/android/core/notifications/NotificationConfig;Lkotlin/jvm/functions/Function1;JZLjava/lang/String;ZLio/getstream/video/android/core/notifications/internal/service/CallServiceConfig;Lio/getstream/video/android/core/notifications/internal/service/CallServiceConfigRegistry;Ljava/lang/String;Lio/getstream/video/android/core/sounds/Sounds;ZLio/getstream/video/android/core/permission/android/StreamPermissionCheck;ILjava/lang/String;Lorg/webrtc/ManagedAudioProcessingFactory;J)V
6310-
public synthetic fun <init> (Landroid/content/Context;Ljava/lang/String;Lio/getstream/video/android/core/GEO;Lio/getstream/video/android/model/User;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/getstream/video/android/core/socket/common/token/TokenProvider;Lio/getstream/video/android/core/logging/LoggingLevel;Lio/getstream/video/android/core/notifications/NotificationConfig;Lkotlin/jvm/functions/Function1;JZLjava/lang/String;ZLio/getstream/video/android/core/notifications/internal/service/CallServiceConfig;Lio/getstream/video/android/core/notifications/internal/service/CallServiceConfigRegistry;Ljava/lang/String;Lio/getstream/video/android/core/sounds/Sounds;ZLio/getstream/video/android/core/permission/android/StreamPermissionCheck;ILjava/lang/String;Lorg/webrtc/ManagedAudioProcessingFactory;JILkotlin/jvm/internal/DefaultConstructorMarker;)V
6310+
public fun <init> (Landroid/content/Context;Ljava/lang/String;Lio/getstream/video/android/core/GEO;Lio/getstream/video/android/model/User;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/getstream/video/android/core/socket/common/token/TokenProvider;Lio/getstream/video/android/core/logging/LoggingLevel;Lio/getstream/video/android/core/notifications/NotificationConfig;Lkotlin/jvm/functions/Function1;JZLjava/lang/String;ZLio/getstream/video/android/core/notifications/internal/service/CallServiceConfig;Lio/getstream/video/android/core/notifications/internal/service/CallServiceConfigRegistry;Ljava/lang/String;Lio/getstream/video/android/core/sounds/Sounds;ZLio/getstream/video/android/core/permission/android/StreamPermissionCheck;ILjava/lang/String;Lorg/webrtc/ManagedAudioProcessingFactory;JZ)V
6311+
public synthetic fun <init> (Landroid/content/Context;Ljava/lang/String;Lio/getstream/video/android/core/GEO;Lio/getstream/video/android/model/User;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/getstream/video/android/core/socket/common/token/TokenProvider;Lio/getstream/video/android/core/logging/LoggingLevel;Lio/getstream/video/android/core/notifications/NotificationConfig;Lkotlin/jvm/functions/Function1;JZLjava/lang/String;ZLio/getstream/video/android/core/notifications/internal/service/CallServiceConfig;Lio/getstream/video/android/core/notifications/internal/service/CallServiceConfigRegistry;Ljava/lang/String;Lio/getstream/video/android/core/sounds/Sounds;ZLio/getstream/video/android/core/permission/android/StreamPermissionCheck;ILjava/lang/String;Lorg/webrtc/ManagedAudioProcessingFactory;JZILkotlin/jvm/internal/DefaultConstructorMarker;)V
63116312
public final fun build ()Lio/getstream/video/android/core/StreamVideo;
63126313
}
63136314

stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import io.getstream.video.android.core.call.RtcSession
7777
import io.getstream.video.android.core.closedcaptions.ClosedCaptionManager
7878
import io.getstream.video.android.core.closedcaptions.ClosedCaptionsSettings
7979
import io.getstream.video.android.core.events.AudioLevelChangedEvent
80+
import io.getstream.video.android.core.events.CallEndedSfuEvent
8081
import io.getstream.video.android.core.events.ChangePublishQualityEvent
8182
import io.getstream.video.android.core.events.ConnectionQualityChangeEvent
8283
import io.getstream.video.android.core.events.DominantSpeakerChangedEvent
@@ -675,10 +676,14 @@ public class CallState(
675676
}
676677

677678
is CallEndedEvent -> {
679+
updateFromResponse(event.call)
678680
_endedAt.value = OffsetDateTime.now(Clock.systemUTC())
679681
_endedByUser.value = event.user?.toUser()
682+
call.leave()
683+
}
680684

681-
// leave the call
685+
is CallEndedSfuEvent -> {
686+
_endedAt.value = OffsetDateTime.now(Clock.systemUTC())
682687
call.leave()
683688
}
684689

@@ -907,6 +912,7 @@ public class CallState(
907912
}
908913

909914
is CallSessionEndedEvent -> {
915+
updateFromResponse(event.call)
910916
_session.value = event.call.session
911917
}
912918

stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoBuilder.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ import java.net.ConnectException
8585
* @property appName Optional name for the application that is using the Stream Video SDK. Used for logging and debugging purposes.
8686
* @property audioProcessing The audio processor used for custom modifications to audio data within WebRTC.
8787
* @property callServiceConfigRegistry The audio processor used for custom modifications to audio data within WebRTC.
88+
* @property leaveAfterDisconnectSeconds The number of seconds to wait before leaving the call after the connection is disconnected.
89+
* @property callUpdatesAfterLeave Whether to update the call state after leaving the call.
8890
*
8991
* @see build
9092
* @see ClientState.connection
@@ -133,6 +135,7 @@ public class StreamVideoBuilder @JvmOverloads constructor(
133135
private val appName: String? = null,
134136
private val audioProcessing: ManagedAudioProcessingFactory? = null,
135137
private val leaveAfterDisconnectSeconds: Long = 30,
138+
private val callUpdatesAfterLeave: Boolean = false,
136139
) {
137140
private val context: Context = context.applicationContext
138141
private val scope = UserScope(ClientScope())
@@ -259,6 +262,7 @@ public class StreamVideoBuilder @JvmOverloads constructor(
259262
appName = appName,
260263
audioProcessing = audioProcessing,
261264
leaveAfterDisconnectSeconds = leaveAfterDisconnectSeconds,
265+
enableCallUpdatesAfterLeave = callUpdatesAfterLeave,
262266
)
263267

264268
if (user.type == UserType.Guest) {

stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ internal class StreamVideoClient internal constructor(
162162
internal val audioProcessing: ManagedAudioProcessingFactory? = null,
163163
internal val leaveAfterDisconnectSeconds: Long = 30,
164164
internal val appVersion: String? = null,
165+
internal val enableCallUpdatesAfterLeave: Boolean = false,
165166
) : StreamVideo, NotificationHandler by streamNotificationManager {
166167

167168
private var locationJob: Deferred<Result<String>>? = null
@@ -188,7 +189,10 @@ internal class StreamVideoClient internal constructor(
188189
val socketImpl = coordinatorConnectionModule.socketConnection
189190

190191
fun onCallCleanUp(call: Call) {
191-
calls.remove(call.cid)
192+
if (!enableCallUpdatesAfterLeave) {
193+
logger.d { "[cleanup] Removing call from cache: ${call.cid}" }
194+
calls.remove(call.cid)
195+
}
192196
}
193197

194198
override fun cleanup() {

stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import androidx.activity.ComponentActivity
3030
import androidx.annotation.CallSuper
3131
import androidx.lifecycle.lifecycleScope
3232
import io.getstream.android.video.generated.models.CallEndedEvent
33+
import io.getstream.android.video.generated.models.CallSessionEndedEvent
3334
import io.getstream.android.video.generated.models.CallSessionParticipantLeftEvent
3435
import io.getstream.android.video.generated.models.OwnCapability
3536
import io.getstream.android.video.generated.models.VideoEvent
@@ -52,6 +53,7 @@ import io.getstream.video.android.core.call.state.LeaveCall
5253
import io.getstream.video.android.core.call.state.ToggleCamera
5354
import io.getstream.video.android.core.call.state.ToggleMicrophone
5455
import io.getstream.video.android.core.call.state.ToggleSpeakerphone
56+
import io.getstream.video.android.core.events.CallEndedSfuEvent
5557
import io.getstream.video.android.core.events.ParticipantLeftEvent
5658
import io.getstream.video.android.core.model.RejectReason
5759
import io.getstream.video.android.core.notifications.NotificationHandler
@@ -717,7 +719,7 @@ public abstract class StreamCallActivity : ComponentActivity() {
717719
@CallSuper
718720
public open fun onCallEvent(call: Call, event: VideoEvent) {
719721
when (event) {
720-
is CallEndedEvent -> {
722+
is CallEndedEvent, is CallEndedSfuEvent, is CallSessionEndedEvent -> {
721723
// In any case finish the activity, the call is done for
722724
leave(call, onSuccess = onSuccessFinish, onError = onErrorFinish)
723725
}

0 commit comments

Comments
 (0)