Skip to content

Commit

Permalink
Add Screen event support (#24)
Browse files Browse the repository at this point in the history
* Add screen event support

* clean up test app

* Fix versioning to only allow react-native-userleap 2.x.x
  • Loading branch information
earlsprig committed Dec 11, 2023
1 parent 70b61d3 commit ea12d64
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 37,619 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
package.lock.json
yarn.lock

# BUCK
buck-out/
Expand All @@ -64,4 +66,4 @@ lib/
coverage/

# Typescript
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo
21 changes: 18 additions & 3 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const App: () => Node = () => {
const isDarkMode = useColorScheme() === "dark";

const segmentClient = createClient({
writeKey: 'YOUR_SEGMENT_WRITE_KEY_HERE',
writeKey: '<SEGMENT_WRITE_KEY>',
trackAppLifecycleEvents: true,
defaultSettings: true,
});
Expand Down Expand Up @@ -83,7 +83,7 @@ const App: () => Node = () => {
<View style={styles.sectionDescription}>
<TouchableOpacity
onPress={() => {
segmentClient.track("YOUR_SPRIG_SURVEY_EVENT");
segmentClient.track("mobiletext");
}}
>
<Text>Send event</Text>
Expand All @@ -102,7 +102,22 @@ const App: () => Node = () => {
});
}}
>
<Text>Send event with properties</Text>
<Text>Send track event with properties</Text>
</TouchableOpacity>
</View>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Screen</Text>
<View style={styles.sectionDescription}>
<TouchableOpacity
onPress={() => {
segmentClient.screen("React Native Segment Screen", {
segmentActionsReactNative: true,
deviceType: "reactNative"
});
}}
>
<Text>Send screen event with properties</Text>
</TouchableOpacity>
</View>
</View>
Expand Down
3 changes: 1 addition & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"

import com.android.build.OutputFile

Expand Down Expand Up @@ -81,8 +82,6 @@ project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected ReactRootView createRootView() {
return reactRootView;
}

@Override
//@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rootProject.name = 'ReactNativeTestApp'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/react-native-gradle-plugin')
includeBuild('../node_modules/@react-native/gradle-plugin')

if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid")
Expand Down
14 changes: 10 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ PODS:
- React-jsinspector (0.69.5)
- React-logger (0.69.5):
- glog
- react-native-get-random-values (1.9.0):
- React-Core
- react-native-userleap (2.14.1):
- React
- UserLeapKit (= 4.13.0)
Expand Down Expand Up @@ -353,9 +355,9 @@ PODS:
- React-jsi (= 0.69.5)
- React-logger (= 0.69.5)
- React-perflogger (= 0.69.5)
- RNCAsyncStorage (1.17.11):
- RNCAsyncStorage (1.19.3):
- React-Core
- segment-analytics-react-native (2.8.0):
- segment-analytics-react-native (2.17.0):
- React-Core
- sovran-react-native
- SocketRocket (0.6.0)
Expand Down Expand Up @@ -410,6 +412,7 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-get-random-values (from `../node_modules/react-native-get-random-values`)
- react-native-userleap (from `../node_modules/react-native-userleap`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
Expand Down Expand Up @@ -486,6 +489,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
React-logger:
:path: "../node_modules/react-native/ReactCommon/logger"
react-native-get-random-values:
:path: "../node_modules/react-native-get-random-values"
react-native-userleap:
:path: "../node_modules/react-native-userleap"
React-perflogger:
Expand Down Expand Up @@ -554,6 +559,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: e42f0b46de293a026c2fb20e524d4fe09f81f575
React-jsinspector: e385fb7a1440ae3f3b2cd1a139ca5aadaab43c10
React-logger: 15c734997c06fe9c9b88e528fb7757601e7a56df
react-native-get-random-values: dee677497c6a740b71e5612e8dbd83e7539ed5bb
react-native-userleap: a9db6d86556443b4932282325461e48d30fa97de
React-perflogger: 367418425c5e4a9f0f80385ee1eaacd2a7348f8e
React-RCTActionSheet: e4885e7136f98ded1137cd3daccc05eaed97d5a6
Expand All @@ -567,8 +573,8 @@ SPEC CHECKSUMS:
React-RCTVibration: 42b34fde72e42446d9b08d2b9a3ddc2fa9ac6189
React-runtimeexecutor: c778439c3c430a5719d027d3c67423b390a221fe
ReactCommon: ab1003b81be740fecd82509c370a45b1a7dda0c1
RNCAsyncStorage: 8616bd5a58af409453ea4e1b246521bb76578d60
segment-analytics-react-native: f550cb6d5d5f67eb8099f78108f8ded1052cd5e4
RNCAsyncStorage: c913ede1fa163a71cea118ed4670bbaaa4b511bb
segment-analytics-react-native: dbdd08d96fec78132e96bda092562e41c2ce0ce0
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
sovran-react-native: fd3dc8f1a4b14acdc4ad25fc6b4ac4f52a2a2a15
UserLeapKit: 9b9884b32538574eabd351f6cef9ab8557a53b68
Expand Down
41 changes: 26 additions & 15 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,36 @@
"lint": "eslint ."
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.10",
"@segment/analytics-react-native": "2.8.0",
"@segment/sovran-react-native": "^0.4.4",
"@sprig-technologies/analytics-react-native-plugin-sprig": "../",
"react": "18.0.0",
"react-native": "0.69.5",
"react-native-userleap": "2.14.1"
"@react-native-async-storage/async-storage": "^1.19.4",
"@segment/analytics-react-native": "^2.17.0",
"@segment/sovran-react-native": "^1.0.4",
"@sprig-technologies/analytics-react-native-plugin-sprig": "file:../",
"react": "18.2.0",
"react-native": "0.72.7",
"react-native-get-random-values": "*",
"react-native-userleap": "2.15.3"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.70.3",
"react-test-renderer": "18.0.0"
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.11",
"@tsconfig/react-native": "^3.0.0",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.8",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"jest": {
"preset": "react-native"
},
"engines": {
"node": ">=16"
}
}

0 comments on commit ea12d64

Please sign in to comment.