@@ -16,7 +16,7 @@ import com.datadog.android.core.InternalSdkCore
1616import com.datadog.android.flags.internal.DatadogFlagsClient
1717import com.datadog.android.flags.internal.DefaultRumEvaluationLogger
1818import com.datadog.android.flags.internal.FlagsFeature
19- import com.datadog.android.flags.internal.FlagsStateChannel
19+ import com.datadog.android.flags.internal.FlagsStateManager
2020import com.datadog.android.flags.internal.LogWithPolicy
2121import com.datadog.android.flags.internal.NoOpFlagsClient
2222import com.datadog.android.flags.internal.NoOpRumEvaluationLogger
@@ -28,7 +28,6 @@ import com.datadog.android.flags.internal.repository.DefaultFlagsRepository
2828import com.datadog.android.flags.internal.repository.NoOpFlagsRepository
2929import com.datadog.android.flags.internal.repository.net.PrecomputeMapper
3030import com.datadog.android.flags.model.EvaluationContext
31- import com.datadog.android.flags.model.FlagsClientState
3231import com.datadog.android.flags.model.ResolutionDetails
3332import com.datadog.android.internal.utils.DDCoreSubscription
3433import org.json.JSONObject
@@ -151,21 +150,12 @@ interface FlagsClient {
151150 */
152151 fun <T : Any > resolve (flagKey : String , defaultValue : T ): ResolutionDetails <T >
153152
154- /* *
155- * Gets the current state of this [FlagsClient].
156- *
157- * The state indicates whether the client is ready to evaluate flags, currently loading
158- * new flag values, or in an error state.
159- *
160- * @return The current [FlagsClientState].
161- */
162- fun getCurrentState (): FlagsClientState
163-
164153 /* *
165154 * Registers a listener to receive state change notifications.
166155 *
167- * The listener will be notified whenever the client's state changes (e.g., from NOT_READY
168- * to READY, or from READY to RECONCILING when the evaluation context changes).
156+ * The listener will be notified whenever the client's state changes (e.g., from
157+ * [FlagsClientState.NotReady] to [FlagsClientState.Ready], or from [FlagsClientState.Ready]
158+ * to [FlagsClientState.Reconciling] when the evaluation context changes).
169159 *
170160 * @param listener The [FlagsStateListener] to register.
171161 */
@@ -432,8 +422,9 @@ interface FlagsClient {
432422
433423 val precomputeMapper = PrecomputeMapper (featureSdkCore.internalLogger)
434424
435- val flagStateChannel = FlagsStateChannel (
436- subscription = DDCoreSubscription .create()
425+ val flagStateManager = FlagsStateManager (
426+ subscription = DDCoreSubscription .create(),
427+ executorService = executorService
437428 )
438429
439430 val evaluationsManager = EvaluationsManager (
@@ -442,7 +433,7 @@ interface FlagsClient {
442433 flagsRepository = flagsRepository,
443434 assignmentsReader = assignmentsDownloader,
444435 precomputeMapper = precomputeMapper,
445- flagStateChannel = flagStateChannel
436+ flagStateManager = flagStateManager
446437 )
447438
448439 val rumEvaluationLogger = createRumEvaluationLogger(featureSdkCore)
@@ -454,7 +445,7 @@ interface FlagsClient {
454445 flagsConfiguration = configuration,
455446 rumEvaluationLogger = rumEvaluationLogger,
456447 processor = flagsFeature.processor,
457- flagStateChannel = flagStateChannel
448+ flagStateManager = flagStateManager
458449 )
459450 }
460451 }
0 commit comments