Skip to content

v10.0.0

Compare
Choose a tag to compare
@z4kn4fein z4kn4fein released this 28 Aug 16:58
· 20 commits to master since this release
23b9779

Added

  • The concept of Snapshots. They are for capturing the state of the SDK's feature flag data. A snapshot allows synchronous operations on the captured context.

    let snapshot = configCatClient.snapshot()
    let isMyFeatureEnabled = snapshot.getValue(for: "isMyFeatureEnabled", defaultValue: false)

    Snapshots are created from the actual state of the SDK; therefore, it's crucial to know whether the SDK has valid feature flag data to work on. The SDK already provides an onClientReady hook to determine whether creating snapshots is safe. It's being changed to accept a state parameter to give details about the SDK's initialization state.

    client.hooks.addOnReady { state in
      // the state parameter indicates what is the SDK's initialization state
    }

    These are the possible state values:

    • noFlagData: This means the SDK has no feature flag data to work on (it didn't get anything from the cache or the network)
    • hasLocalOverrideFlagDataOnly: The SDK was initialized with localOnly flag overrides.
    • hasCachedFlagDataOnly: The SDK has feature flag data only from the cache. It can happen when the SDK is configured with PollingModes.manualPoll() and there isn't yet a client.forceRefresh() call. Another example could be an SDK configured with PollingModes.autoPoll(), but it can't reach the ConfigCat CDN, so it falls back to the cache.
    • hasUpToDateFlagData: The SDK is initialized with up-to-date feature flag data.

    This functionality was extended with a new awaitable method waitForReady(), which asynchronously waits for the onClientReady hook to fire and returns with the SDK's initialization state.

    let state = await client.waitForReady()

Changed

  • Standardized config cache key generation algorithm and cache payload format to allow shared caches to be used by SDKs of different platforms.

Removed

  • getVariationId() and getAllVariationIds(). Alternative: getValueDetails() / getAllValueDetails().
  • refresh(). Alternative: forceRefresh().
  • Init function of PollingModes.autoPoll() with an onConfigChanged callback parameter. Alternative for subscribing to config changes: Hooks.
  • Each ***Sync() method that used DispatchSemaphore for synchronizing mainly asynchronous operations. For an alternative, see the added Snapshots feature.