Skip to content

Commit

Permalink
Merge branch 'develop' into participant_view_redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed Oct 20, 2023
2 parents 261a336 + 307fafb commit dff7734
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ androidxActivity = "1.7.2"
androidxDataStore = "1.0.0"
googleService = "4.3.14"

androidxComposeBom = "2023.10.00"
androidxComposeBom = "2023.10.01"
androidxComposeCompiler = "1.5.3"
androidxComposeTracing = "1.0.0-alpha03"
androidxHiltNavigation = "1.0.0"
Expand Down Expand Up @@ -52,7 +52,7 @@ streamPush = "1.1.4"
androidxTest = "1.5.2"
androidxTestCore = "1.5.0"
androidxProfileinstaller = "1.3.1"
androidxMacroBenchmark = "1.2.0-rc02"
androidxMacroBenchmark = "1.2.0"
androidxUiAutomator = "2.3.0-alpha04"
androidxContraintLayout = "2.1.4"
androidxEspresso = "3.5.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ public class CallState(
_participants.mapState { it.values.toList() }

private val _startedAt: MutableStateFlow<OffsetDateTime?> = MutableStateFlow(null)

/**
* Will return always null with current SFU implementation - it may be fixed later. For now
* do not use it.
*/
public val startedAt: StateFlow<OffsetDateTime?> = _startedAt

private val _participantCounts: MutableStateFlow<ParticipantCount?> = MutableStateFlow(null)
Expand Down Expand Up @@ -896,8 +901,14 @@ public class CallState(
// update the participant count
_participantCounts.value = event.participantCount

val instant = Instant.ofEpochSecond(event.callState.started_at?.epochSecond!!, 0)
_startedAt.value = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC)
val startedAt = event.callState.started_at
if (startedAt != null) {
val instant = Instant.ofEpochSecond(startedAt.epochSecond, 0)
_startedAt.value = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC)
} else {
_startedAt.value = null
}

// creates the participants
val participantStates = event.callState.participants.map {
getOrCreateParticipant(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.getstream.video.android.core

import android.content.Context
import android.content.Intent
import androidx.core.content.ContextCompat
import io.getstream.video.android.core.notifications.NotificationHandler
import io.getstream.video.android.core.notifications.internal.service.OngoingCallService
import io.getstream.video.android.model.StreamCallId
Expand Down Expand Up @@ -101,7 +102,7 @@ class ClientState(client: StreamVideo) {

fun setActiveCall(call: Call) {
removeRingingCall()
maybeStartForeGroundService(call)
maybeStartForegroundService(call)
this._activeCall.value = call
}

Expand All @@ -121,15 +122,15 @@ class ClientState(client: StreamVideo) {
}

// Internal logic
private fun maybeStartForeGroundService(call: Call) {
private fun maybeStartForegroundService(call: Call) {
if (clientImpl.runForeGroundService) {
val context = clientImpl.context
val serviceIntent = Intent(context, OngoingCallService::class.java)
serviceIntent.putExtra(
NotificationHandler.INTENT_EXTRA_CALL_CID,
StreamCallId.fromCallCid(call.cid),
)
context.startService(serviceIntent)
ContextCompat.startForegroundService(context, serviceIntent)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import androidx.core.app.NotificationManagerCompat
import io.getstream.log.taggedLogger
import io.getstream.video.android.core.StreamVideo
import io.getstream.video.android.core.notifications.NotificationHandler.Companion.INTENT_EXTRA_CALL_CID
import io.getstream.video.android.core.notifications.internal.DefaultStreamIntentResolver
import io.getstream.video.android.model.StreamCallId
import io.getstream.video.android.model.streamCallId

Expand All @@ -33,7 +32,6 @@ import io.getstream.video.android.model.streamCallId
internal class OngoingCallService : Service() {
private val logger by taggedLogger("OngoingCallService")
private var callId: StreamCallId? = null
private val intentResolver = DefaultStreamIntentResolver(this)

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
callId = intent?.streamCallId(INTENT_EXTRA_CALL_CID)
Expand Down

0 comments on commit dff7734

Please sign in to comment.