Using plist values for sdk name and version #204
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Looking for a plist resource that our react native SDK adds to the host app's bundle. If this plist is found then use the sdk name and version from that plist else use the name and version hardcoded within this SDK.
This is how the plist looks,
This plist is loaded to the host app's bundle using the react native SDK podspec like below,
notice the
s.resources = ["ios/klaviyo-sdk-configuration.plist"]
is what copies this over to the host app's bundle.The reason I think this method is better than the private API method is because, we don't have to worry about making sure that the values are overridden at any given point (initializing from native SDK vs react native etc). With this approach, we know that as long as the plist is correctly bundled on react native we'll always have the right value when the
SDKName
andSDKVersion
variables are accessed fromKlaviyoEnvironment
.Thanks to @evan-masseau for this idea.
Manual Test Plan
klaviyo-sdk-configuration.plist