Skip to content

Conversation

@rahul-lohra
Copy link
Contributor

@rahul-lohra rahul-lohra commented Dec 26, 2024

🎯 Goal

Problem Statement: SDK Users need to re-initialize stream sdk to change/update call configuration
This PR presents solves this by allowing the users to update call configuration any time

🛠 Implementation details

We introduced a new class CallServiceConfigRegistry to hold the mapping for call type with call configuration

It exposes the following apis

Registering Configurations:

    val registry = CallServiceConfigRegistry()
 
    // Register a configuration explicitly
    registry.register(CallType.Default.name, CallServiceConfig())

    // Register a configuration using a builder
    registry.register("livestream") {
        setServiceClass(MyCallService::class.java)
        setRunCallServiceInForeground(true)
    }
 
    // Register multiple configurations using a map
    registry.register(
            mapOf(
            CallType.AudioCall.name to CallServiceConfig(),
            CallType.Default.name to CallServiceConfig()
        )
    )

Retrieving Configurations:

   val config = registry.get(CallType.Default.name)

Updating Configurations:

    registry.update(CallType.Default.name) {
         setRunCallServiceInForeground(false)
    }

CallServiceConfigRegistry is exposed via ClientState

Deprecated APIs in CallServiceConfig.kt

Deprecated API Replacement Notes
val callServicePerType: Map<String, Class<*>> CallServiceConfigRegistry This property will be removed soon.
callServiceConfig() DefaultCallConfigurations.default Use the default call foreground service configuration.
livestreamCallServiceConfig() DefaultCallConfigurations.livestream Use for livestream hosts with camera and microphone services.
livestreamAudioCallServiceConfig() DefaultCallConfigurations.livestreamAudioCall Use for audio-only livestream hosts.
livestreamGuestCallServiceConfig() DefaultCallConfigurations.livestreamGuestCall Use for livestream viewers with media playback service.
audioCallServiceConfig() DefaultCallConfigurations.audioCall Use for audio-only calls.
resolveServiceClass(callId: StreamCallId, config: CallServiceConfig) CallServiceConfigRegistry.get() This internal API will be removed soon.

Deprecated APIs in StreamVideoBuilder.kt

Deprecated API Replacement Notes
private val runForegroundServiceForCalls: Boolean callServiceConfigRegistry Use the callServiceConfigRegistry instead.
private val callServiceConfig: CallServiceConfig? callServiceConfigRegistry Use the callServiceConfigRegistry instead.

@rahul-lohra rahul-lohra force-pushed the feature/rahullohra/extend-call-service-config branch from 5ebaa44 to 0a5afe3 Compare December 26, 2024 12:00
@rahul-lohra rahul-lohra changed the base branch from develop to extend-call-service-config December 26, 2024 12:03
@rahul-lohra rahul-lohra force-pushed the feature/rahullohra/extend-call-service-config branch from 0a5afe3 to 9e45c80 Compare December 26, 2024 22:15
@rahul-lohra rahul-lohra changed the base branch from extend-call-service-config to develop December 26, 2024 22:24
@rahul-lohra rahul-lohra force-pushed the feature/rahullohra/extend-call-service-config branch 3 times, most recently from 8c1311d to 8f9034c Compare December 30, 2024 10:57
Refactor CallService configuration
@rahul-lohra rahul-lohra force-pushed the feature/rahullohra/extend-call-service-config branch from 8f9034c to a0fae30 Compare December 30, 2024 11:22
…-service-config

# Conflicts:
#	stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt
@rahul-lohra rahul-lohra self-assigned this Dec 30, 2024
@rahul-lohra rahul-lohra marked this pull request as ready for review December 30, 2024 11:46
@rahul-lohra rahul-lohra requested a review from a team as a code owner December 30, 2024 11:46
@rahul-lohra rahul-lohra force-pushed the feature/rahullohra/extend-call-service-config branch from 853e6d3 to b8c503e Compare December 30, 2024 12:19
@aleksandar-apostolov aleksandar-apostolov merged commit 88ecbad into develop Dec 31, 2024
5 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the feature/rahullohra/extend-call-service-config branch December 31, 2024 09:30
@aleksandar-apostolov aleksandar-apostolov changed the title Refactor call service config [AND-171] Refactor call service config Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants