Skip to content

Commit

Permalink
Generated Docs for "Update README.md (#90)" (#91)
Browse files Browse the repository at this point in the history
* Link to license file in README (#60)

Co-authored-by: Evan Masseau <>

* Updated readme to include troubleshooting steps when running pod install (#63)

updated readme

* Updating version to 0.1.1 (#66)

* 0.1.1

* updating version

* reverting back to use older rn version

* updating yarn lock

* removing changes to package lock file

* Fixes for React Native Apps <= 0.72.0 (#71)

* Fix the react-native gradle dependency
* Add a local property to enable specifying react-native version for the SDK for local development
* Specify Kotlin version that is compatible with Android SDK's (although this didn't seem to actually cause any build errors)
* Remove accidental use of an extension method that is technically SDK 24+

---------

Co-authored-by: Evan Masseau <>

* Update local.properties template files (#68)

* Add template local.properties file to example app
* Be clearer about VCS status of these files.

---------

Co-authored-by: Evan Masseau <>

* Bump example iOS project lockfile (#74)

I think this needs to be bumped when we increase the overall project version.

Co-authored-by: Evan Masseau <>

* Github CI Updates (#75)

* Move doc bot to its own file so we don't have to see it as skipped all the time.

* Use same ruby version as local dev environment

* Stop using `yarn pod-install` because it creates an erroneous xcode.env.local file that breaks the hermes build scripts.

---------

Co-authored-by: Evan Masseau <>

* Updating to iOS SDK 3.0.2 (#77)

* 0.1.1

* updated to us latest iOS SDK

* removing package lock

* Pod install | static linking issue | RCT Folly | Turbo modules (#70)

* 0.1.1

* removed turbo module stuff and added xcconfig

* removing package lock

* comitting example app pod lock file

---------

Co-authored-by: Evan Masseau <>
Co-authored-by: Evan C Masseau <[email protected]>

* Readme rewrite with references to native SDKs and Klaviyo help center (#62)


---------

Co-authored-by: Evan Masseau <>
Co-authored-by: Kenny Tsui <[email protected]>

* Release 0.1.2  (#84)

* 0.1.1

* Release 0.1.2

* removed package lock

* podlock file changes

* Break up CI files so we can get individual badges (#86)

* Break up CI files so we can get individual badges

* Add badges and fix names

---------

Co-authored-by: Evan Masseau <>

* Add action to publish to NPM after publishing a release (#82)


---------

Co-authored-by: Evan Masseau <>

* Update README.md (#90)

* Generated docs for fafe4f9

---------

Co-authored-by: Evan C Masseau <[email protected]>
Co-authored-by: Ajay Subramanya <[email protected]>
Co-authored-by: Kenny Tsui <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
5 people authored Feb 7, 2024
1 parent a6fe1de commit 7eef5e2
Show file tree
Hide file tree
Showing 20 changed files with 368 additions and 203 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Android CI

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: write

jobs:
build-android:
runs-on: ubuntu-22.04
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-
- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Install JDK
if: env.turbo_cache_hit != 1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build example for Android
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
114 changes: 0 additions & 114 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: write
pull-requests: write


jobs:
lint:
Expand Down Expand Up @@ -57,112 +52,3 @@ jobs:

- name: Build package
run: yarn prepare

build-android:
runs-on: ubuntu-22.04
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-
- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Install JDK
if: env.turbo_cache_hit != 1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build example for Android
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
build-ios:
runs-on: macos-13-xlarge
env:
TURBO_CACHE_DIR: .turbo/ios
DEVELOPER_DIR: /Applications/Xcode_15.1.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6.10'

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-
- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v4
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Install cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
pod install
env:
NO_FLIPPER: 1

- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
2 changes: 1 addition & 1 deletion .github/workflows/doc-bot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Documentation Bot

on:
push:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: iOS CI

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: write

jobs:
build-ios:
runs-on: macos-13-xlarge
env:
TURBO_CACHE_DIR: .turbo/ios
DEVELOPER_DIR: /Applications/Xcode_15.1.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6.10'

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-
- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v4
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Install cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
pod install
env:
NO_FLIPPER: 1

- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
26 changes: 26 additions & 0 deletions .github/workflows/publish-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish SDK to NPM

on:
release:
types: [ published ]

jobs:
publish-sdk:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Prepare
run: yarn prepare

- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
registry: "https://npm.pkg.github.com"
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# klaviyo-react-native-sdk

[![Android](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/android-ci.yml/badge.svg?branch=master&event=push)](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/android-ci.yml)
[![iOS](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/ios-ci.yml/badge.svg?branch=master&event=push)](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/ios-ci.yml)

⚠️ This repository is in beta development ⚠️

The Klaviyo React Native SDK allows developers to incorporate Klaviyo analytics and push notification functionality in
Expand Down Expand Up @@ -60,6 +63,74 @@ with the following modifications to the `android/build.gradle` file:
#### React Native <= 0.67.x
We are actively working to verify compatibility with these versions. If you encounter issues, please file an issue.

#### Android Troubleshooting
- We have seen projects, particularly on react-native versions `0.72.x` and `0.71.x`, that required a `minSdkVersion`
of `24`, despite the Klaviyo Android SDK supporting API 23+. If you encounter this, please file an issue in our
repository and provide version numbers of your react-native dependencies.

### iOS
After installing the npm package, run the following command in the `ios` directory of your React Native project.
Install [Cocoapods](https://cocoapods.org/) if you have not already.
```sh
pod install
```
> ℹ️ if the above command is outputting version mismatch errors for `KlaviyoSwift`, please run `pod update KlaviyoSwift` as indicated in the error message to update your local pods spec repo.
#### iOS Troubleshooting
If you are seeing issues related to `minimum deployment target` when installing pods, you may need to update your
minimum iOS version to 13.0 in your Podfile with one of the following strategies.
- Specify iOS version directly in the `Podfile`:
```ruby
MIN_IOS_OVERRIDE = '13.0'
if Gem::Version.new(MIN_IOS_OVERRIDE) > Gem::Version.new(min_ios_version_supported)
min_ios_version_supported = MIN_IOS_OVERRIDE
end
# existing code
platform :ios, min_ios_version_supported
```
- Set the deployment target to 13.0 in XCode, and then pull `IPHONEOS_DEPLOYMENT_TARGET` from the XCode project:
```ruby
#######
# Read min iOS version from Xcode project and set as min iOS version for Podfile
require 'xcodeproj'
project_path = './YOUR_XCODE_PROJECT.xcodeproj'
project = Xcodeproj::Project.open(project_path)
min_ios_version_supported = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
######
platform :ios, min_ios_version_supported
```

## Initialization
The SDK must be initialized with the short alphanumeric
[public API key](https://help.klaviyo.com/hc/en-us/articles/115005062267#difference-between-public-and-private-api-keys1)
for your Klaviyo account, also known as your Site ID. Initialization is done in the native layer, and must occur before
any other SDK methods can be invoked. Follow the native SDK instructions for initialization, and refer to the
[example app](./example) in this repository for guidance:
- [Android SDK instructions](https://github.com/klaviyo/klaviyo-android-sdk#Initialization), and
[example app `MainApplication.kt`](./example/android/app/src/main/java/com/klaviyoreactnativesdkexample/MainApplication.kt#L39)
- [iOS SDK instructions](https://github.com/klaviyo/klaviyo-swift-sdk#Initialization), and
[example app `AppDelegate.mm`](./example/ios/KlaviyoReactNativeSdkExample/AppDelegate.mm#L14)

### Android
Android installation requirements may vary depending upon your project configuration and other dependencies.
The Klaviyo React Native SDK's `build.gradle` file exposes transitive dependencies upon the Klaviyo Android SDK,
so you can import Android Klaviyo SDK references from your Kotlin/Java files without modifying your gradle configuration.
#### React Native 0.73.x
There are no additional installation requirements. Android support is fully tested and verified,
including `minSdkVersion=23`.
#### React Native 0.68.x - 0.72.x
We have successfully compiled the Klaviyo React Native SDK in a bare React Native template app for these versions
with the following modifications to the `android/build.gradle` file:
- Set `compileSdkVersion=34`
- Set `minSdkVersion=23`
#### React Native <= 0.67.x
We are actively working to verify compatibility with these versions. If you encounter issues, please file an issue.
#### Android Troubleshooting
- We have seen projects, particularly on react-native versions `0.72.x` and `0.71.x`, that required a `minSdkVersion`
of `24`, despite the Klaviyo Android SDK supporting API 23+. If you encounter this, please file an issue in our
Expand Down
Loading

0 comments on commit 7eef5e2

Please sign in to comment.