optimizely / swift-sdk

Swift SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
https://www.optimizely.com/products/full-stack/
Apache License 2.0
21 stars 30 forks source link

.ignoreUserProfileService is missing in DefaultDecisionService #509

Closed ginesnf closed 1 year ago

ginesnf commented 1 year ago

Hi,

I want to use the .ignoreUserProfileService policy but following the code I can see that decisionService.getVariation call in OptimizelyClient class has nil options and not defaultDecideOptions

https://github.com/optimizely/swift-sdk/blob/193cc00e1004d29f16f7b32e5b6787199760c482/Sources/Optimizely/OptimizelyClient.swift#L304

In DefaultDecisionService there is a check for this policy but options always will be nill https://github.com/optimizely/swift-sdk/blob/193cc00e1004d29f16f7b32e5b6787199760c482/Sources/Implementation/DefaultDecisionService.swift#L89

Is it correct?

Thanks.

Tamara-Barum commented 1 year ago

Ticket created for internal review: FSSDK-9404

jaeopt commented 1 year ago

@ginesnf the code you're referring to is for legacy API which does not support OptimizelyDecideOption, so always nil. If you want to use .ignoreUserProfileService, you should use decide API instead of the legacy API (activate, getVariation, etc).

ginesnf commented 1 year ago

Thanks for your answer @jaeopt,

We cloned the repository and modified those "nils" to add the defaultDecideOptions and it works perfectly. Our code is also legacy and depend a lot of your legacy code. For that, why we want to know if a fix is possible for your side.

Thanks.

jaeopt commented 1 year ago

@ginesnf glad to hear that you found a workaround. No plan to add the options to the legacy apis. You can consider migrating to decide apis. Most apis one-to-one mapped, migrating should be straightforward - https://docs.developers.optimizely.com/feature-experimentation/docs/migrate-from-older-versions-swift