Skip to content
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

CHNL-12052: Update to include SDK name and version in network requests #175

Merged
merged 8 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions ios/KlaviyoBridge.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import KlaviyoSwift
@_spi(KlaviyoPrivate) import KlaviyoCore

@objc
public class KlaviyoBridge: NSObject {
Expand Down Expand Up @@ -30,10 +31,10 @@ public class KlaviyoBridge: NSObject {
@objc
public static var getEventTypesKeys: [String: String] {
[
"VIEWED_PRODUCT": Event.EventName.ViewedProductMetric.value,
"STARTED_CHECKOUT": Event.EventName.StartedCheckoutMetric.value,
"OPENED_APP": Event.EventName.OpenedAppMetric.value,
"ADDED_TO_CART": Event.EventName.AddedToCartMetric.value
"VIEWED_PRODUCT": Event.EventName.viewedProductMetric.value,
"STARTED_CHECKOUT": Event.EventName.startedCheckoutMetric.value,
"OPENED_APP": Event.EventName.openedAppMetric.value,
"ADDED_TO_CART": Event.EventName.addedToCartMetric.value
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks! 🙏🏻

]
}

Expand Down Expand Up @@ -156,16 +157,16 @@ public class KlaviyoBridge: NSObject {

static func getEventMetricsName(_ str: String) -> Event.EventName? {
switch str {
case Event.EventName.ViewedProductMetric.value:
return .ViewedProductMetric
case Event.EventName.StartedCheckoutMetric.value:
return .StartedCheckoutMetric
case Event.EventName.AddedToCartMetric.value:
return .AddedToCartMetric
case Event.EventName.OpenedAppMetric.value:
return .OpenedAppMetric
case Event.EventName.viewedProductMetric.value:
return .viewedProductMetric
case Event.EventName.startedCheckoutMetric.value:
return .viewedProductMetric
case Event.EventName.addedToCartMetric.value:
return .addedToCartMetric
case Event.EventName.openedAppMetric.value:
return .openedAppMetric
default:
return .CustomEvent(str)
return .customEvent(str)
}
}

Expand Down
17 changes: 17 additions & 0 deletions ios/klaviyo-react-native-sdk-configuration.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
config.plist
Pods

Created by Ajay Subramanya on 9/18/24.
Copyright (c) 2024 Klaviyo. All rights reserved.
-->
<plist version="1.0">
<dict>
<key>react_native_sdk_name</key>
<string>react_native</string>
<key>react_native_sdk_version</key>
<string>9.8.8</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

9.8.8 ?

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 have a release doc pertaining to RN, lets make sure we update it to mention this is another spot the version needs to get incremented before release

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🤦🏾 I'm glad I used a crazy version for testing. Fixed it to 1.0.0 assuming it's going to be the next release. Good call, I update the confluence doc with this step.

</dict>
</plist>
1 change: 1 addition & 0 deletions klaviyo-react-native-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Pod::Spec.new do |s|
s.platforms = { :ios => "13.0" }
s.source = { :git => "https://github.com/klaviyo/klaviyo-react-native-sdk.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm,swift}"
s.resources = ["ios/klaviyo-react-native-sdk-configuration.plist"]
Copy link

Choose a reason for hiding this comment

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

There is no spm equivalent of this or that's not needed right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, didn't think about SPM. I think since we are including KlaviyoSwift SDK in the podspec and also since RN only supports cocoapods we should be good. Also, there is no package file in RN, there is no way to add this plist as a resource.


s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }

Expand Down
Loading