Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
27568eb
feat: Forward push payload to our notification sdk
rahul-lohra Jul 28, 2025
f013c8a
Merge branch 'develop' into feature/rahullohra/push-payload-downstream
rahul-lohra Jul 28, 2025
77ebf87
feat: Fix compile time
rahul-lohra Jul 28, 2025
0a75117
feat: replace DeprecationLevel.ERROR with DeprecationLevel.WARNING,
rahul-lohra Jul 28, 2025
30f2caf
feat: remove unnecessary apis,
rahul-lohra Jul 28, 2025
5f404f7
Merge branch 'develop' into feature/rahullohra/push-payload-downstream
rahul-lohra Jul 28, 2025
d3b308a
feat: update deprecation message
rahul-lohra Jul 28, 2025
d309f4a
feat: remove unnecessary code
rahul-lohra Jul 28, 2025
18de591
feat: refactor code
rahul-lohra Jul 28, 2025
774d32e
Merge branch 'develop' into feature/rahullohra/push-payload-downstream
aleksandar-apostolov Jul 29, 2025
6d33678
feat: Allow customization of Pending intent
rahul-lohra Jul 31, 2025
bf3dadc
fix: Fix UTs
rahul-lohra Jul 31, 2025
e25203c
fix: Update logic to reject class via notification buttons
rahul-lohra Aug 1, 2025
c80899d
fix: Refactor code
rahul-lohra Aug 1, 2025
48ffdd2
fix: Refactor code
rahul-lohra Aug 1, 2025
ae3ec9d
Merge branch 'develop' into feature/rahullohra/handle-call-reject-on-…
rahul-lohra Aug 1, 2025
f9a2d93
Merge branch 'develop' into feature/rahullohra/handle-call-reject-on-…
aleksandar-apostolov Aug 1, 2025
f755649
fix: Pass rejection intent via call state
rahul-lohra Aug 1, 2025
8b867d1
Merge branch 'develop' into feature/rahullohra/handle-call-reject-on-…
aleksandar-apostolov Aug 1, 2025
96e4481
temp commit
rahul-lohra Aug 1, 2025
df6b078
temp commit
rahul-lohra Aug 1, 2025
8764c16
temp commit
rahul-lohra Aug 1, 2025
e14a2a9
removed isInTransition
rahul-lohra Aug 1, 2025
97c9d95
Remove comments
rahul-lohra Aug 1, 2025
4c8bf45
Refactor code
rahul-lohra Aug 1, 2025
355fafb
Refactor code
rahul-lohra Aug 1, 2025
3f49b5f
Refactor code
rahul-lohra Aug 1, 2025
7574eea
Refactor code
rahul-lohra Aug 1, 2025
8c63540
Refactor code
rahul-lohra Aug 1, 2025
aa22bd8
Merge remote-tracking branch 'origin/feature/rahullohra/handle-call-r…
rahul-lohra Aug 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ internal class RejectCallBroadcastReceiver : GenericCallActionBroadcastReceiver(

override suspend fun onReceive(call: Call, context: Context, intent: Intent) {
when (val rejectResult = call.reject(RejectReason.Decline)) {
is Result.Success -> logger.d { "[onReceive] rejectCall, Success: $rejectResult" }
is Result.Failure -> logger.d { "[onReceive] rejectCall, Failure: $rejectResult" }
is Result.Success -> {
val userId = StreamVideo.instanceOrNull()?.userId
userId?.let {
val set = mutableSetOf(it)
call.state.updateRejectedBy(set)
}
logger.d { "[onReceive] rejectCall, Success: $rejectResult" }
}
is Result.Failure -> {
logger.d { "[onReceive] rejectCall, Failure: $rejectResult" }
}
}
logger.d { "[onReceive] #ringing; callId: ${call.id}, action: ${intent.action}" }
CallService.removeIncomingCall(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.SignalWifiBad
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -70,6 +71,7 @@ import io.getstream.video.android.compose.ui.components.video.config.videoRender
import io.getstream.video.android.core.Call
import io.getstream.video.android.core.MemberState
import io.getstream.video.android.core.RealtimeConnection
import io.getstream.video.android.core.StreamVideo
import io.getstream.video.android.core.call.CallType
import io.getstream.video.android.core.call.state.CallAction
import io.getstream.video.android.core.call.state.CancelCall
Expand Down Expand Up @@ -309,6 +311,28 @@ public open class StreamCallActivityComposeDelegate : StreamCallActivityComposeU
}
}
}

/**
* Call can be rejected by [RejectCallBroadcastReceiver] so the activity
* needs to observe [Call.state.rejectedBy]
*/
val rejectedBy by call.state.rejectedBy.collectAsStateWithLifecycle()
LaunchedEffect(rejectedBy) {
val currentUserId = StreamVideo.instanceOrNull()?.userId
if (rejectedBy.contains(currentUserId)) {
// check if there is no ongoing call then safely finish it else do nothing
val noActiveCall = (StreamVideo.instanceOrNull()?.state?.activeCall?.value == null)
if (noActiveCall) {
onEnded(call)
val configuration = configurationMap[call.id]
if (configuration?.closeScreenOnCallEnded == true) {
safeFinish()
} else {
logger.d { "Don't close activity as some other call is active" }
}
}
}
}
}
}

Expand All @@ -330,7 +354,7 @@ public open class StreamCallActivityComposeDelegate : StreamCallActivityComposeU
granted: List<String>,
notGranted: List<String>,
) {
if (!showRationale && configuration.canSkipPermissionRationale) {
if (!showRationale && configurationMap[call.cid]?.canSkipPermissionRationale == true) {
logger.w { "Permissions were not granted, but rationale is required to be skipped." }
safeFinish()
} else {
Expand All @@ -351,7 +375,7 @@ public open class StreamCallActivityComposeDelegate : StreamCallActivityComposeU
val connection by call.state.connection.collectAsStateWithLifecycle()
when (connection) {
RealtimeConnection.Disconnected -> {
if (!configuration.closeScreenOnCallEnded) {
if (configurationMap[call.cid]?.closeScreenOnCallEnded == false) {
CallDisconnectedContent(call)
} else {
// This is just for safety, will be called from other place as well.
Expand All @@ -360,7 +384,7 @@ public open class StreamCallActivityComposeDelegate : StreamCallActivityComposeU
}

is RealtimeConnection.Failed -> {
if (!configuration.closeScreenOnError) {
if (configurationMap[call.cid]?.closeScreenOnError == false) {
val err = Exception("${(connection as? RealtimeConnection.Failed)?.error}")
CallFailedContent(call, err)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public abstract class io/getstream/video/android/ui/common/StreamCallActivity :
protected fun getCallTransitionTime ()J
protected final fun getConfig ()Lio/getstream/video/android/ui/common/StreamCallActivityConfiguration;
public fun getConfiguration ()Lio/getstream/video/android/ui/common/StreamCallActivityConfiguration;
public final fun getConfigurationMap ()Ljava/util/HashMap;
protected final fun getOnErrorFinish ()Lkotlin/jvm/functions/Function2;
protected final fun getOnSuccessFinish ()Lkotlin/jvm/functions/Function2;
public abstract fun getUiDelegate ()Lio/getstream/video/android/ui/common/StreamActivityUiDelegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public abstract class StreamCallActivity : ComponentActivity(), ActivityCallOper
* You can get Call id via
* `intent?.streamCallId(NotificationHandler.INTENT_EXTRA_CALL_CID)?.id`
*/
private val configurationMap: HashMap<String, StreamCallActivityConfiguration> =
public val configurationMap: HashMap<String, StreamCallActivityConfiguration> =
Comment thread
aleksandar-apostolov marked this conversation as resolved.
Outdated
HashMap()

private var cachedCallEventJob: Job? = null
Expand All @@ -193,11 +193,13 @@ public abstract class StreamCallActivity : ComponentActivity(), ActivityCallOper
if (configuration?.closeScreenOnCallEnded == true) {
safeFinish()
}
} else {
logger.d { "[onSuccessFinish] for non-active call" }
}
}

/**
* The Exception is `StreamCallActivityException`. We will update the args in next major release
* The Exception is [StreamCallActivityException]. We will update the args in next major release
*/
protected val onErrorFinish: suspend (Exception) -> Unit = { error ->
logger.e(error) { "Something went wrong" }
Expand All @@ -210,9 +212,13 @@ public abstract class StreamCallActivity : ComponentActivity(), ActivityCallOper
logger.e(error) { "Finishing the activity" }
safeFinish()
}
} else {
logger.e(error) { "[onErrorFinish] for non-active call" }
}
} else {
// older version ~ this flow might never going to be execute (Need to check)
/**
* This will execute when we got a error before creating the call object
*/
if (config.closeScreenOnError) {
logger.e(error) { "Finishing the activity" }
safeFinish()
Expand Down
Loading