Skip to content

Commit 3ef0931

Browse files
committed
only do tti and update
1 parent cb61ea2 commit 3ef0931

File tree

7 files changed

+3505
-1548
lines changed

7 files changed

+3505
-1548
lines changed

examples/expo/src/app/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
error,
1919
warn,
2020
logScreenView,
21+
logAppLaunchTTI,
2122
} from '@bitdrift/react-native';
2223
import axios from 'axios';
2324
import { Picker } from '@react-native-picker/picker';
@@ -34,7 +35,7 @@ const LOG_LEVELS = new Map([
3435

3536
const hasAPIKeyConfigured = Boolean(
3637
process.env.EXPO_PUBLIC_BITDRIFT_API_KEY &&
37-
process.env.EXPO_PUBLIC_BITDRIFT_API_URL,
38+
process.env.EXPO_PUBLIC_BITDRIFT_API_URL,
3839
);
3940

4041
const sendRandomRequest = async () => {
@@ -68,6 +69,7 @@ const HomeScreen = () => {
6869
});
6970

7071
logScreenView('HomeScreen');
72+
logAppLaunchTTI(1.0);
7173
showToast(`Logged: [${selectedLogLevel.toUpperCase()}]: Log emitted`);
7274
}
7375
};

package-lock.json

Lines changed: 3431 additions & 1506 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
"@testing-library/react-native": "~12.8.1",
5151
"@types/jest": "^29.5.14",
5252
"@types/node": "22.9.0",
53-
"@types/react": "~18.2.79",
53+
"@types/react": "~19.0.10",
5454
"@typescript-eslint/eslint-plugin": "^8.14.0",
5555
"@typescript-eslint/parser": "^8.14.0",
5656
"babel-jest": "^29.7.0",
57-
"babel-preset-expo": "~11.0.0",
57+
"babel-preset-expo": "~13.0.0",
5858
"cargo-cp-artifact": "^0.1",
5959
"del-cli": "^6.0.0",
6060
"electron": ">=33",
@@ -66,39 +66,38 @@
6666
"eslint-plugin-prettier": "^5.2.1",
6767
"eslint-plugin-react": "7.37.2",
6868
"eslint-plugin-react-hooks": "5.0.0",
69-
"expo-build-properties": "^0.13.1",
69+
"expo-build-properties": "~0.14.6",
7070
"jest": "^29.7.0",
7171
"jest-environment-jsdom": "^29.7.0",
7272
"jest-environment-node": "^29.7.0",
73-
"jest-expo": "~51.0.2",
73+
"jest-expo": "~53.0.5",
7474
"jest-react-native": "18.0.0",
7575
"nx": "^20.3.0",
7676
"prettier": "^3.3.3",
77-
"react": "^18.2.0",
78-
"react-dom": "^18.2.0",
79-
"react-native": "0.76.6",
77+
"react": "19.0.0",
78+
"react-dom": "19.0.0",
79+
"react-native": "0.79.2",
8080
"react-native-builder-bob": "^0.35.2",
81-
"react-native-svg": "15.11.1",
81+
"react-native-svg": "15.11.2",
8282
"react-native-svg-transformer": "1.5.0",
83-
"react-native-web": "^0.19.13",
83+
"react-native-web": "^0.20.0",
8484
"react-test-renderer": "^18.2.0",
8585
"rollup": "^4.14.0",
8686
"ts-jest": "^29.2.5",
8787
"ts-node": "10.9.2",
8888
"tslib": "^2.3.0",
89-
"typescript": "~5.3.3"
89+
"typescript": "~5.8.3"
9090
},
9191
"dependencies": {
92-
"@expo/metro-config": "~0.19.8",
93-
"@expo/metro-runtime": "~4.0.0",
92+
"@expo/metro-config": "~0.20.0",
93+
"@expo/metro-runtime": "~5.0.4",
9494
"@react-native-picker/picker": "2.11.0",
95-
"expo": "~52.0.23",
96-
"expo-splash-screen": "~0.29.18",
97-
"expo-status-bar": "~2.0.0",
98-
"metro": "^0.80.12",
95+
"expo": "~53.0.8",
96+
"expo-splash-screen": "~0.30.8",
97+
"expo-status-bar": "~2.2.3",
98+
"metro": "^0.82.0",
9999
"metro-config": "^0.80.12",
100-
"metro-resolver": "^0.80.12",
101-
"uuid": "^11.1.0"
100+
"metro-resolver": "^0.80.12"
102101
},
103102
"overrides": {
104103
"got": "^11.8.6"

packages/react-native/android/src/main/java/com/bdreactnative/BdReactNativeModule.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import io.bitdrift.capture.Capture
1414
import io.bitdrift.capture.providers.session.SessionStrategy
1515
import com.facebook.react.bridge.Promise
1616
import okhttp3.HttpUrl.Companion.toHttpUrl
17+
import kotlin.time.Duration
18+
import kotlin.time.DurationUnit
19+
import kotlin.time.toDuration
1720

1821
class BdReactNativeModule internal constructor(context: ReactApplicationContext) :
1922
BdReactNativeSpec(context) {
@@ -95,6 +98,10 @@ class BdReactNativeModule internal constructor(context: ReactApplicationContext)
9598
Capture.Logger.logScreenView(screenView)
9699
}
97100

101+
override fun logAppLaunchTTI(ttiMs: Double) {
102+
Capture.Logger.logAppLaunchTTI(ttiMs.toDuration(DurationUnit.MILLISECONDS))
103+
}
104+
98105
companion object {
99106
const val NAME = "BdReactNative"
100107
}

packages/react-native/android/src/oldarch/BdReactNativeSpec.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ abstract class BdReactNativeSpec internal constructor(context: ReactApplicationC
3030
abstract fun removeField(key: String)
3131

3232
abstract fun logScreenView(screenView: String)
33+
34+
abstract fun logAppLaunchTTI(ttiMs: Double)
3335
}

packages/react-native/ios/BdReactNative.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ @implementation BdReactNative
4040
[CAPRNLogger logScreenViewWithScreenName:screenName];
4141
}
4242

43+
RCT_EXPORT_METHOD(logAppLaunchTTI:(double)ttiMs)
44+
{
45+
[CAPRNLogger logAppLaunchTTIWithTTI:ttiMs / 1000];
46+
}
47+
4348
#ifndef RCT_NEW_ARCH_ENABLED
4449

4550
RCT_EXPORT_METHOD(init:(NSString*)apiKey

packages/react-native/ios/Logger.swift

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,43 @@
88
import Capture
99

1010
@objc public class CAPRNLogger: NSObject {
11-
@objc public static func start(key: String, sessionStrategy: String, url: String?, enableNetworkInstrumentation: Bool) {
12-
let strategy = switch sessionStrategy {
13-
case "fixed":
14-
SessionStrategy.fixed()
15-
case "activity":
16-
SessionStrategy.activityBased()
17-
default:
18-
SessionStrategy.fixed()
19-
}
20-
11+
@objc public static func start(
12+
key: String, sessionStrategy: String, url: String?, enableNetworkInstrumentation: Bool
13+
) {
14+
let strategy =
15+
switch sessionStrategy {
16+
case "fixed":
17+
SessionStrategy.fixed()
18+
case "activity":
19+
SessionStrategy.activityBased()
20+
default:
21+
SessionStrategy.fixed()
22+
}
23+
2124
let integrator = Capture.Logger.start(
2225
withAPIKey: key,
2326
sessionStrategy: strategy,
2427
apiURL: URL(string: url ?? "https://api.bitdrift.io")!
2528
)
26-
29+
2730
if enableNetworkInstrumentation {
2831
integrator?.enableIntegrations([.urlSession()])
2932
}
3033
}
31-
34+
3235
@objc
33-
public static func getDeviceID(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
36+
public static func getDeviceID(
37+
_ resolve: @escaping RCTPromiseResolveBlock,
38+
rejecter reject: @escaping RCTPromiseRejectBlock
39+
) {
3440
let deviceID = Capture.Logger.deviceID
35-
if (deviceID == nil) {
41+
if deviceID == nil {
3642
reject("device_id_undefined", "Device ID is undefined", nil)
3743
return
3844
}
3945
resolve(deviceID)
4046
}
41-
47+
4248
@objc
4349
public static func log(_ level: Double, message: String, fields: [String: String]) {
4450
switch level {
@@ -56,39 +62,50 @@ import Capture
5662
return
5763
}
5864
}
59-
65+
6066
@objc
6167
public static func addField(_ key: String, value: String) {
6268
Capture.Logger.addField(withKey: key, value: value)
6369
}
64-
70+
6571
@objc
6672
public static func removeField(_ key: String) {
6773
Capture.Logger.removeField(withKey: key)
6874
}
6975

7076
@objc
71-
public static func getSessionID(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
77+
public static func getSessionID(
78+
_ resolve: @escaping RCTPromiseResolveBlock,
79+
rejecter reject: @escaping RCTPromiseRejectBlock
80+
) {
7281
let sessionID = Capture.Logger.sessionID
73-
if (sessionID == nil) {
82+
if sessionID == nil {
7483
reject("session_id_undefined", "Session ID is undefined", nil)
7584
return
7685
}
7786
resolve(sessionID)
7887
}
79-
88+
8089
@objc
81-
public static func getSessionURL(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
90+
public static func getSessionURL(
91+
_ resolve: @escaping RCTPromiseResolveBlock,
92+
rejecter reject: @escaping RCTPromiseRejectBlock
93+
) {
8294
let sessionURL = Capture.Logger.sessionURL
83-
if (sessionURL == nil) {
95+
if sessionURL == nil {
8496
reject("session_url_undefined", "Session URL is undefined", nil)
8597
return
8698
}
8799
resolve(sessionURL)
88100
}
89101

90-
@objc
102+
@objc
91103
public static func logScreenView(screenName: String) {
92104
Capture.Logger.logScreenView(screenName: screenName)
93105
}
106+
107+
@objc
108+
public static func logAppLaunchTTI(TTI: TimeInterval) {
109+
Capture.Logger.logAppLaunchTTI(TTI)
110+
}
94111
}

0 commit comments

Comments
 (0)