Skip to content

Commit

Permalink
[CHNL-6170] updated EventName cases in KlaviyoBridge (#172)
Browse files Browse the repository at this point in the history
* updated EventName cases in KlaviyoBridge

* Adopting modularization work (#173)

* Adopting ios modularization stuff

* added a comment to the podfile

* Update Podfile

* updating pod lock

* adding new podfile.lock

* added back no flipper = 1

* reverted back the pod file changes

---------

Co-authored-by: Ajay Subramanya <[email protected]>
  • Loading branch information
ab1470 and ajaysubra committed Sep 24, 2024
1 parent fe975a4 commit 42e8933
Show file tree
Hide file tree
Showing 8 changed files with 1,709 additions and 1,570 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
run: |
yarn example-setup
rm -f example/ios/.xcode.env.local
env:
NO_FLIPPER: 1

- name: Build example for iOS
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CC = "";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -762,6 +763,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CXX = "";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
Expand Down Expand Up @@ -792,6 +794,8 @@
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios",
);
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD = "";
LDPLUSPLUS = "";
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
Expand Down Expand Up @@ -826,6 +830,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CC = "";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -853,6 +858,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
CXX = "";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
Expand All @@ -876,6 +882,8 @@
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios",
);
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD = "";
LDPLUSPLUS = "";
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
Expand Down
4 changes: 2 additions & 2 deletions example/ios/KlaviyoReactNativeSdkExample/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ - (NSMutableDictionary *)getLaunchOptionsWithURL:(NSDictionary * _Nullable)launc

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self getBundleURL];
return [self bundleURL];
}

- (NSURL *)getBundleURL
- (NSURL *)bundleURL
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
Expand Down
19 changes: 3 additions & 16 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ require Pod::Executable.execute_command('node', ['-p',
platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Expand All @@ -32,14 +22,11 @@ target 'KlaviyoReactNativeSdkExample' do

use_react_native!(
:path => config[:reactNativePath],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

#TODO: remove this once iOS modularization release is made and the podspec is updated
pod 'KlaviyoSwift', :path => '../../../klaviyo-swift-sdk/'

target 'KlaviyoReactNativeSdkExampleTests' do
inherit! :complete
Expand Down
17 changes: 12 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ PODS:
- klaviyo-react-native-sdk (0.4.2):
- KlaviyoSwift (= 3.2.0)
- React-Core
- KlaviyoCore (0.1.0):
- AnyCodable-FlightSchool
- KlaviyoSwift (3.2.0):
- AnyCodable-FlightSchool
- KlaviyoSwiftExtension (3.2.0)
- KlaviyoCore (~> 0.1.0)
- KlaviyoSwiftExtension (3.3.0)
- libevent (2.1.12)
- RCT-Folly (2022.05.16.00):
- boost
Expand Down Expand Up @@ -1071,6 +1074,7 @@ DEPENDENCIES:
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- klaviyo-react-native-sdk (from `../..`)
- KlaviyoSwift (from `../../../klaviyo-swift-sdk/`)
- KlaviyoSwiftExtension
- libevent (~> 2.1.12)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
Expand Down Expand Up @@ -1122,7 +1126,7 @@ SPEC REPOS:
trunk:
- AnyCodable-FlightSchool
- fmt
- KlaviyoSwift
- KlaviyoCore
- KlaviyoSwiftExtension
- libevent
- SocketRocket
Expand All @@ -1143,6 +1147,8 @@ EXTERNAL SOURCES:
:tag: hermes-2023-11-17-RNv0.73.0-21043a3fc062be445e56a2c10ecd8be028dd9cc5
klaviyo-react-native-sdk:
:path: "../.."
KlaviyoSwift:
:path: "../../../klaviyo-swift-sdk/"
RCT-Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTRequired:
Expand Down Expand Up @@ -1238,8 +1244,9 @@ SPEC CHECKSUMS:
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 34df9d5034e90bd9bf1505e1ca198760373935af
klaviyo-react-native-sdk: edf2b7ad63175da7c9819811649018e2b10dd2be
KlaviyoSwift: 1f1630117681a5fad023eb3f4f745736cc8db642
KlaviyoSwiftExtension: ac856517fec2e18f4fb3ff1dc3faa7335865a78b
KlaviyoCore: a1c8bce61e3bf059e2122c68de67c0848ab18691
KlaviyoSwift: ae14ca3ab291d212e62ce6a7f75b7f98c117476a
KlaviyoSwiftExtension: 3094f964d2d1f9ad6815d6543c2d2ffa9297243a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: 6dda55e483f75d2b43781d8ad5bd7df276a50981
Expand Down Expand Up @@ -1285,6 +1292,6 @@ SPEC CHECKSUMS:
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 4f53dc50008d626fa679c7a1cb4bed898f8c0bde

PODFILE CHECKSUM: bd4bf6f2889a5907a9bf31c6a541ff32873bd6a8
PODFILE CHECKSUM: 9733c70a40fa45d4d6e22abd7d360e3c94c8e69c

COCOAPODS: 1.15.2
37 changes: 37 additions & 0 deletions example/ios/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>
26 changes: 13 additions & 13 deletions ios/KlaviyoBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,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
]
}

Expand Down Expand Up @@ -156,16 +156,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 .startedCheckoutMetric
case Event.EventName.addedToCartMetric.value:
return .addedToCartMetric
case Event.EventName.openedAppMetric.value:
return .openedAppMetric
default:
return .CustomEvent(str)
return .customEvent(str)
}
}

Expand Down
Loading

0 comments on commit 42e8933

Please sign in to comment.