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

RN SDK 1.1.0 release branch #188

Merged
merged 23 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
230243b
WIP pulling in swift sdk
belleklaviyo Jan 7, 2025
26e1edc
RN 1.1.0, Android 3.0.2, iOS 4.1.0
belleklaviyo Jan 8, 2025
0eb792f
Updating RN SDK to include badge count API (#187)
ajaysubra Jan 9, 2025
b0979b1
point to prerelease version 4.1.0-alpha.1
belleklaviyo Jan 10, 2025
85038e0
Merge branch 'rel/1.1.0' of github.com:klaviyo/klaviyo-react-native-s…
belleklaviyo Jan 10, 2025
a834a84
bump android sdk to 3.0.2
belleklaviyo Jan 13, 2025
1d0b230
restore podfile.lock
belleklaviyo Jan 13, 2025
a2464fd
restore yarn.lock
belleklaviyo Jan 14, 2025
d56914c
remove package-lock.json
belleklaviyo Jan 14, 2025
48e80be
Merge branch 'master' into rel/1.1.0
belleklaviyo Jan 14, 2025
1f030df
bump swift to 4.1.0
belleklaviyo Jan 21, 2025
d0cc32b
add badge count to README
belleklaviyo Jan 21, 2025
36a22fb
clean pods and re install
belleklaviyo Jan 21, 2025
7ae10e8
Merge branch 'rel/1.1.0' of github.com:klaviyo/klaviyo-react-native-s…
belleklaviyo Jan 21, 2025
94d3b49
add badge count to README directory
belleklaviyo Jan 21, 2025
e807c6d
change boost source
belleklaviyo Jan 21, 2025
895b2f4
Merge branch 'rel/1.1.0' of github.com:klaviyo/klaviyo-react-native-s…
belleklaviyo Jan 21, 2025
316062f
README copy
belleklaviyo Jan 21, 2025
e1db3eb
remove package-lock.json
belleklaviyo Jan 21, 2025
150f619
remove pod install on CI
belleklaviyo Jan 21, 2025
a2086d5
revert to correct key
belleklaviyo Jan 21, 2025
8461530
comment out yarn commands
belleklaviyo Jan 21, 2025
121c0c6
fix iOS CI
belleklaviyo Jan 21, 2025
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
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Tue Dec 19 15:08:27 EST 2023
KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=3.0.0
KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=3.0.2
KlaviyoReactNativeSdk_compileSdkVersion=31
KlaviyoReactNativeSdk_kotlinVersion=1.8.0
KlaviyoReactNativeSdk_minSdkVersion=23
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<resources>
<string name="klaviyo_sdk_version_override">1.0.0</string>
<string name="klaviyo_sdk_version_override">1.1.0</string>
<string name="klaviyo_sdk_name_override">react_native</string>
</resources>
84 changes: 42 additions & 42 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ PODS:
- hermes-engine (0.73.1):
- hermes-engine/Pre-built (= 0.73.1)
- hermes-engine/Pre-built (0.73.1)
- klaviyo-react-native-sdk (1.0.0):
- KlaviyoSwift (= 4.0.0)
- klaviyo-react-native-sdk (1.1.0):
- KlaviyoSwift (= 4.1.0-alpha.1)
- React-Core
- KlaviyoCore (4.0.0):
- KlaviyoCore (4.1.0-alpha.1):
- AnyCodable-FlightSchool
- KlaviyoSwift (4.0.0):
- KlaviyoSwift (4.1.0-alpha.1):
- AnyCodable-FlightSchool
- KlaviyoCore (~> 4.0.0)
- KlaviyoSwiftExtension (3.3.0)
- KlaviyoCore (~> 4.1.0-alpha.1)
- KlaviyoSwiftExtension (4.0.0)
- libevent (2.1.12)
- RCT-Folly (2022.05.16.00):
- boost
Expand Down Expand Up @@ -1234,62 +1234,62 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
AnyCodable-FlightSchool: 261cbe76757802b17d471b9059b21e6fa5edf57b
boost: 26fad476bfa736552bbfa698a06cc530475c1505
boost: 69c3d61aee7f5f7facabe24312f0302003b5af29
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
FBLazyVector: 2296bacb2fa157a43991048b0a9d71c1c8b65083
FBReactNativeSpec: df0ebe69acd14ce0be0269cf75b6e338a727259b
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 34df9d5034e90bd9bf1505e1ca198760373935af
klaviyo-react-native-sdk: 3fdd795c641df4e49f18d4805ce559c92d8adbd2
KlaviyoCore: 64cf0767bd46055245b778702a55ccc1f18d4eb1
KlaviyoSwift: f7ee04bdd50b42dcc6ede4efdeb6f05d1cc4549f
KlaviyoSwiftExtension: 3094f964d2d1f9ad6815d6543c2d2ffa9297243a
klaviyo-react-native-sdk: 6257ff905f93d3414f2853314f30f1a58b1ed94c
KlaviyoCore: 48884c1b3b55c6ec58c1d32cf9f6bac505d84fdf
KlaviyoSwift: 5d86adedadc8e50abdd143d3215481b8ddd508b8
KlaviyoSwiftExtension: 524d4f36594565f6af50a5e30a9c309e8fd86f35
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCT-Folly: cd21f1661364f975ae76b3308167ad66b09f53f5
RCTRequired: 6dda55e483f75d2b43781d8ad5bd7df276a50981
RCTTypeSafety: df0f2632f4e89938b9b9f6152b5e6c66fc6e969e
React: 5373769b4a544945831d9c5d455212186d68f763
React-callinvoker: 2c54fb73b27fdf9bd7772f36dcda23d76e0e7d14
React-Codegen: 433061982ce4803895a88d21321949d651ab3f3f
React-Core: f0e1e99728ebdb785286b0c4c55f0f923a9d826f
React-CoreModules: 1ee65dbd93429c1c6ec3de069d75f5fde05db5d5
React-cxxreact: dc0f1968914a6c7da62b1287c1eb84dd3ab0a7bb
React-Codegen: 491a91d6773424e81643275d25de30066a42024f
React-Core: 29cb7c8e019c40d9cd028dffc2606baf85b6b4af
React-CoreModules: bd3f3901d01e1f7f23346fdf2b19acf47e310a7c
React-cxxreact: a1ac0bf76620aac2b16342393d2dee1a02de348f
React-debug: 6c67b590ae38e4a509d4ca85d23ea5587926e606
React-Fabric: 484f455a25fea60c206f231427651871358ad9cd
React-FabricImage: 569f988e53f83307645c0899a875db9ca1d6a665
React-graphics: e281f386e7056c2173920724001047348b642d6a
React-hermes: 12499684a1005213e7ed71a94467ef72cf24320c
React-ImageManager: d6eaef7d36f3e840e2edc99117d283bda5fa388d
React-jserrorhandler: c34fe7aa3417fc3116fdc5f1464efb7ec64584ff
React-jsi: b03ac7f7af1371e3e81e8ac894af4e46454dee79
React-jsiexecutor: ae30693413a40b7c72f25da2e794997754a780bf
React-Fabric: 91429b2413355468cbffece003230e2cda69dbdb
React-FabricImage: e21bed4bb599e6156ec65358f013bd4d0f068ee5
React-graphics: 92d18cd6da4e7b118dd2a72a9562ad672fd71ca8
React-hermes: e87ea4a33640102676237dabfa117d60614d3e44
React-ImageManager: 3f386cd126fab05232c53b581481528c0a310110
React-jserrorhandler: 39aa916225e2d8d169f8777e0f3dc0bea24e0623
React-jsi: 1b03b7a00877cdba995e96d2476c8757495b8897
React-jsiexecutor: 38fef6e60367ad3090c54a8d91f1fb48ed773366
React-jsinspector: 369048694e39942063c5d08e9580b43e2edd379a
React-logger: e0c1e918d9588a9f39c9bc62d9d6bfe9ca238d9d
React-Mapbuffer: babe0bb3746937775f8a3a89b861cea3c077162d
React-logger: c6cc01d7cff5f77924db08c7fbaf5a4d7a9ab857
React-Mapbuffer: 5255b6d24f741e44e7a7ddbf1f494b7c25890eed
React-nativeconfig: a8685fce6d0ffbb77b1fe983895dbbc7bfe949ad
React-NativeModulesApple: 63accd5672e433f187e4c35ce61641f2b303098c
React-NativeModulesApple: a3dc48b47f71ee37e80db713bd65d6a2de920916
React-perflogger: 5ffc4d6ccb74eaac7b8b2867e58a447232483d6d
React-RCTActionSheet: eca2174431ff2cc14b7fb847f92b89e081d27541
React-RCTAnimation: a039b2416aa0a55e6fa7c8cd0a2e870bfffc4caa
React-RCTAppDelegate: be26c542774d36211b1562a9278c72f821887103
React-RCTBlob: 0d4892d25e57fbbce13e221fff7e4c9567a2ace3
React-RCTFabric: aa1048a7b3ec3d19dbb69341e15fcc587f27f753
React-RCTImage: 5b70891cb2adb75bbdc5ad8e6cc56c48e95d90e5
React-RCTLinking: 5fe4756ab016e9f200e93e771bd6e43ea05f8f50
React-RCTNetwork: 877b4a85f71c63cf719574f187e3333c1e15a425
React-RCTSettings: ae477a33a04389f5d42486004b09b04eeba64fd5
React-RCTText: 08dd5d7173ed279d3468b333217afb22bb7948c3
React-RCTVibration: 2f906cd58dfd44ff5e4ca4fc0edd8740dceda6be
React-rendererdebug: 7c1f4448bd25e6cd716a50ebdbff7be163fb0021
React-RCTAnimation: 86e56a30d021edabc56a9b1cf309c2868f0b69c2
React-RCTAppDelegate: a2009bdd4152e438df6a1af537904ce975bff9cf
React-RCTBlob: 25e279582da8859a6d41de52747f35d6ca9dcfb9
React-RCTFabric: 7de42801397cd34ac41a01bd3f35a1f41c2884ec
React-RCTImage: f380e18a6bcce14cb01c04bfb783f877816d48c8
React-RCTLinking: 2d793263f2413df759841dcdd24cbfcd575e932b
React-RCTNetwork: 0a23d76fcb3653cc2789f71d21aebe61163652ca
React-RCTSettings: 1aaae5f724b89519814717b5ed451f620256335c
React-RCTText: b930334c85d62557b32b42c7a337f04e05fa937d
React-RCTVibration: 7d2ca6bb0020ec1b93909a12b68563016b401a84
React-rendererdebug: ad6efcff93e615c25ca89061d8da7a485a559775
React-rncore: 68a68a2465903678582ecbdd013574b656e28c99
React-runtimeexecutor: d87e84455640dc5685e87563c2eaef90e5df8752
React-runtimescheduler: 83d1cc129804991a02f378f5d7094467d0aed15e
React-utils: fefa27e6d4a5b733f5e76cf8802ccf023ff8cc94
ReactCommon: 73242ec9768e71688f35ad97ae3d0709a0f66435
React-runtimescheduler: 65589c995a4177c7c2f8d21c97f284453e0b1531
React-utils: 7c600daa5b24f9103e230d99a776fabe64b85792
ReactCommon: a1f2941d66adaf304650f165f8addc976ff692c1
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 4f53dc50008d626fa679c7a1cb4bed898f8c0bde

PODFILE CHECKSUM: fb4c6f946002a62b798ca073d975abf271898252

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
6 changes: 6 additions & 0 deletions example/src/AppViewInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
setPhoneNumber,
setProfileAttribute,
setProfile,
setBadgeCount,
} from './KlaviyoReactWrapper';

export interface AppViewInterface {
Expand Down Expand Up @@ -50,6 +51,11 @@ export const appViews: AppViewInterface[] = [
color: '#841584',
onPress: setExternalId,
},
{
title: 'Click to set badge count',
color: '#841584',
onPress: setBadgeCount,
},
{
title: 'Click to RESET the full profile',
color: '#ffcccb',
Expand Down
9 changes: 9 additions & 0 deletions example/src/KlaviyoReactWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ export const setExternalId = async () => {
}
};

export const setBadgeCount = async () => {
try {
const getRandomDigit = () => Math.floor(Math.random() * 10);
Klaviyo.setBadgeCount(getRandomDigit());
} catch (e: any) {
console.log(e.message, e.code);
}
};

export const getEmail = async () => {
try {
Klaviyo.getEmail((value: string) => {
Expand Down
5 changes: 5 additions & 0 deletions ios/KlaviyoBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public class KlaviyoBridge: NSObject {
KlaviyoSDK().set(pushToken: value)
}

@objc
public static func setBadgeCount(_ value: Int) {
KlaviyoSDK().setBadgeCount(value)
}

@objc
public static func resetProfile() {
KlaviyoSDK().resetProfile()
Expand Down
5 changes: 5 additions & 0 deletions ios/KlaviyoReactNativeSdk.mm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ - (NSDictionary *)constantsToExport {
[KlaviyoBridge setPushToken: pushToken];
}

RCT_EXPORT_METHOD(setBadgeCount: (nonnull NSNumber *)count)
{
[KlaviyoBridge setBadgeCount: count.intValue];
}

RCT_EXPORT_METHOD(resetProfile)
{
[KlaviyoBridge resetProfile];
Expand Down
2 changes: 1 addition & 1 deletion ios/klaviyo-react-native-sdk-configuration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<key>react_native_sdk_name</key>
<string>react_native</string>
<key>react_native_sdk_version</key>
<string>1.0.0</string>
<string>1.1.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion klaviyo-react-native-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }

s.dependency "React-Core"
s.dependency "KlaviyoSwift", "4.0.0"
s.dependency "KlaviyoSwift", "4.1.0-alpha.1"
end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "klaviyo-react-native-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "Official Klaviyo React Native SDK",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
7 changes: 7 additions & 0 deletions src/Push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ export interface KlaviyoPushApi {
* @param callback
*/
getPushToken(callback: Function | undefined): string | null;

/**
* Set the badge count for the app icon
*
* @param count
*/
setBadgeCount(count: number): void;
}
9 changes: 9 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export const Klaviyo: Spec = {
setProfileAttribute(propertyKey: ProfilePropertyKey, value: string): void {
KlaviyoReactNativeSdk.setProfileAttribute(propertyKey, value);
},
setBadgeCount(count: number): void {
// checking if method exists since this is iOS only and don't want a
// runtime error on android
if (KlaviyoReactNativeSdk.setBadgeCount) {
KlaviyoReactNativeSdk.setBadgeCount(count);
} else {
console.log('setBadgeCount is not available on this platform');
}
},
resetProfile(): void {
KlaviyoReactNativeSdk.resetProfile();
},
Expand Down