open-feature / kotlin-sdk

Kotlin implementation of the OpenFeature SDK for Android clients
https://openfeature.dev
Apache License 2.0
12 stars 4 forks source link

feat: Update observeEvents() API #89

Closed fabriziodemaria closed 9 months ago

fabriziodemaria commented 9 months ago

This PR

Update the OpenFeatureAPI.observeEvents() API:

Usage example (from Application layer):


viewModelScope.launch {
    OpenFeatureAPI.observeEvents().collect {
        println(">> Event received: $it")
    }
}

viewModelScope.launch {
    OpenFeatureAPI.setProviderAndWait(
        ConfidenceFeatureProvider.create(
            app.applicationContext,
            clientSecret
        ),
        Dispatchers.IO,
        ctx
    )
}