launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
69 stars 84 forks source link

How to get the variation source with the latest v4.3.0? #202

Closed iKiKi closed 4 years ago

iKiKi commented 4 years ago

Is your feature request related to a problem? Please describe. Previously, it was possible to get access of the variation source with variationAndSource. Now it is deprecated, and replaced by variationDetail, and we cannot get the source anymore.

Describe the solution you'd like Would be fine to get source from EvaluationDetail object, meaning no regression anymore with the previous API. Something like ⤵️

public final class EvaluationDetail<T> {
    public internal(set) var value: T
    public internal(set) var source: LDFlagValueSource
    public internal(set) var variationIndex: Int?
    public internal(set) var reason: Dictionary<String, Any>?

Describe alternatives you've considered 🤷‍♂️

Additional context NTR

torchhound commented 4 years ago

Hi @iKiKi variationAndSource was deprecated because the information returned by that method is available from other sources. The source is an enum composed of server, cache, or fallback. variationDetail will tell you whether or not a variation value is a fallback value and connectionInformation will tell you whether you are connected to the clientstream or polling.

iKiKi commented 4 years ago

variationDetail will tell you whether or not a variation value is a fallback value

I guess you are talking about the kind property with the value FALLTHROUGH in the reason dictionary?

connectionInformation will tell you whether you are connected to the clientstream or polling

How to determine server|cache from connectionInformation?

torchhound commented 4 years ago

You are correct about the fallthrough. getConnectionInformation will tell you whether you are connected to the clientstream (server) or haven't connected yet or have lost connection (cache).

torchhound commented 4 years ago

Hi @iKiKi this issue hasn't moved in several months so I'm going to close it. If you have further questions please ask here or reach out to LaunchDarkly support, thanks.