Skip to content

[FSSDK-9433]: Adds support to override sdkName and sdkVersion for events #512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 20, 2023

Conversation

yasirfolio3
Copy link
Contributor

@yasirfolio3 yasirfolio3 commented Jun 16, 2023

Summary

  • Adds support to override sdkName and sdkVersion for events necessary for flutter.

Test plan

  • New unit tests added.
  • All previous tests should pass

Issues

Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we consider to change Utils.sdkVersion and Utils.swiftSdkClientName to reflect when customized? Then we may not need the changes in other codes.

@@ -84,12 +86,13 @@ open class OptimizelyClient: NSObject {
odpManager: OdpManager? = nil,
defaultLogLevel: OptimizelyLogLevel? = nil,
defaultDecideOptions: [OptimizelyDecideOption]? = nil,
settings: OptimizelySdkSettings? = nil) {
settings: OptimizelySdkSettings? = nil,
clientName: String? = nil) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this new option into OptimizelySdkSettings? It's not a common configuration usage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to config "sdkVersion" as well.
We can use "sdkName" and "sdkVersion" to be consistent with android-sdk?

@@ -744,7 +750,7 @@ open class OptimizelyClient: NSObject {
throw OptimizelyError.eventKeyInvalid(eventKey)
}

sendConversionEvent(eventKey: eventKey, userId: userId, attributes: attributes, eventTags: eventTags)
sendConversionEvent(eventKey: eventKey, userId: userId, attributes: attributes, eventTags: eventTags, clientName: self.clientName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can change Utils.sdkVersion and Utils.swiftSdkClientName to update when customize. In that way, we do not change these apis.

@@ -285,7 +289,8 @@ open class OptimizelyClient: NSObject {
attributes: attributes,
flagKey: "",
ruleType: Constants.DecisionSource.experiment.rawValue,
enabled: true)
enabled: true,
clientName: clientName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before. If we change Utils.sdkVersion, no need for this change.

@yasirfolio3 yasirfolio3 requested a review from jaeopt June 19, 2023 22:09
@yasirfolio3 yasirfolio3 reopened this Jun 19, 2023
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
We also need a test case validating ODPEvent which includes sdk name and version.

Comment on lines 31 to 32
Utils.sdkVersion = OPTIMIZELYSDKVERSION
Utils.swiftSdkClientName = "swift-sdk"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this lines for testing? It may be more interesting without them to check if all works fine with default config.

@yasirfolio3 yasirfolio3 requested a review from jaeopt June 20, 2023 20:50
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yasirfolio3 yasirfolio3 changed the title [FSSDK-9433]: Adds support to override clientName for events [FSSDK-9433]: Adds support to override sdkName and sdkVersion for events Jun 20, 2023
@yasirfolio3 yasirfolio3 merged commit 2f64936 into master Jun 20, 2023
@yasirfolio3 yasirfolio3 deleted the yasir/FSSDK-9433 branch June 20, 2023 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants