@log-drop/react-native 2.0.7 → 2.0.9-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,5 +22,5 @@ if respond_to?(:install_modules_dependencies, true)
22
22
  else
23
23
  s.dependency "React-Core"
24
24
  end
25
- s.dependency 'LogDrop', '2.1.7'
25
+ s.dependency 'LogDrop', '2.1.8'
26
26
  end
package/README.md CHANGED
@@ -42,6 +42,76 @@ LogDrop.init(config);
42
42
  > 💡 Make sure to initialize LogDrop **only once** during app startup.
43
43
  > 💡 You can later update the app ID dynamically with `LogDrop.setAppId("YOUR_APP_ID")`.
44
44
 
45
+ ### 3. Upload iOS symbols
46
+
47
+ Create `ios/LogDrop-Services.plist`:
48
+
49
+ ```xml
50
+ <?xml version="1.0" encoding="UTF-8"?>
51
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
52
+ <plist version="1.0">
53
+ <dict>
54
+ <key>base_url</key>
55
+ <string>https://server.logdrop.io</string>
56
+ <key>projects</key>
57
+ <dict>
58
+ <key>com.example.app</key>
59
+ <dict>
60
+ <key>app_id</key>
61
+ <string>YOUR_LOGDROP_APP_ID</string>
62
+ </dict>
63
+ </dict>
64
+ </dict>
65
+ </plist>
66
+ ```
67
+
68
+ Replace `com.example.app` with your iOS bundle identifier.
69
+
70
+ Add a Run Script phase after **Bundle React Native code and images**. Keep the
71
+ native dSYM and React Native source-map uploads as separate commands:
72
+
73
+ ```sh
74
+ set -e
75
+
76
+ SERVICES_PLIST="${SRCROOT}/LogDrop-Services.plist"
77
+ export LOGDROP_BASE_URL=$(/usr/libexec/PlistBuddy -c "Print :base_url" "$SERVICES_PLIST" 2>/dev/null)
78
+ export LOGDROP_API_KEY=$(/usr/libexec/PlistBuddy -c "Print :projects:${PRODUCT_BUNDLE_IDENTIFIER}:app_id" "$SERVICES_PLIST" 2>/dev/null)
79
+
80
+ export REACT_NATIVE_PATH="${SRCROOT}/../node_modules/react-native"
81
+ WITH_ENVIRONMENT="${REACT_NATIVE_PATH}/scripts/xcode/with-environment.sh"
82
+ UPLOAD_DSYM_SCRIPT="${PODS_ROOT}/LogDrop/upload_dsym.sh"
83
+ UPLOAD_RN_IOS_SCRIPT="${SRCROOT}/../node_modules/@log-drop/react-native/scripts/upload_rn_ios.sh"
84
+
85
+ /bin/sh "$UPLOAD_DSYM_SCRIPT"
86
+ /bin/sh -c "\"$WITH_ENVIRONMENT\" \"$UPLOAD_RN_IOS_SCRIPT\""
87
+ ```
88
+
89
+ Add these Input Files to the phase:
90
+
91
+ ```text
92
+ ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
93
+ ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}
94
+ ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist
95
+ $(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)
96
+ $(SRCROOT)/.xcode.env.local
97
+ $(SRCROOT)/.xcode.env
98
+ $(SRCROOT)/LogDrop-Services.plist
99
+ ```
100
+
101
+ Before the standard React Native bundle command, add:
102
+
103
+ ```sh
104
+ export EXTRA_PACKAGER_ARGS="--sourcemap-output $CONFIGURATION_BUILD_DIR/main.jsbundle.map"
105
+ ```
106
+
107
+ `upload_rn_ios.sh` uses the same configuration contract as the native
108
+ `upload_dsym.sh`: it reads `base_url` and the current bundle identifier's
109
+ `app_id` from `LogDrop-Services.plist`. `LOGDROP_APP_ID` and
110
+ `LOGDROP_API_KEY` can override the app ID. The environment exports in the Run
111
+ Script keep the currently bundled native LogDrop Pod compatible with the same
112
+ plist. React Native source maps are also uploaded for Debug and simulator
113
+ builds.
114
+
45
115
  ---
46
116
 
47
117
  ## 🤖 Android Setup
@@ -250,7 +320,7 @@ Add LogDrop to the extension target and run `pod install`:
250
320
 
251
321
  ```ruby
252
322
  target 'LogDropNotificationServiceExtension' do
253
- pod 'LogDrop', '2.1.7'
323
+ pod 'LogDrop', '2.1.8'
254
324
  end
255
325
  ```
256
326
 
@@ -286,6 +356,56 @@ Forces the SDK to send any cached logs immediately.
286
356
 
287
357
  ---
288
358
 
359
+ ### `LogDrop.trackCustomEvent(eventName: string, properties?: Record<string, unknown>): void`
360
+ Tracks an application-specific event with an optional JSON-compatible
361
+ properties object. Event and property codes shown in the panel are managed by
362
+ LogDrop.
363
+
364
+ ```ts
365
+ LogDrop.trackCustomEvent('purchase_completed', {
366
+ coupon_code: 'SUMMER10',
367
+ amount: 49.9,
368
+ item_count: 2,
369
+ is_first_order: true,
370
+ });
371
+
372
+ LogDrop.trackCustomEvent('onboarding_completed');
373
+ ```
374
+
375
+ Supported values are strings, numbers, booleans, null, nested objects, and
376
+ arrays. Object keys must be strings. Convert JavaScript `Date` instances to
377
+ ISO-8601 strings before passing them through the native-module bridge:
378
+
379
+ ```ts
380
+ LogDrop.trackCustomEvent('product_viewed', {
381
+ sku: 'LD-100',
382
+ viewed_at: new Date().toISOString(),
383
+ product: { name: 'LogDrop Hoodie', price: 79.95 },
384
+ categories: ['merch', 'hoodies'],
385
+ campaign: null,
386
+ });
387
+ ```
388
+
389
+ Use stable event names and keep each property's type consistent. Do not place
390
+ IDs or timestamps in an event name and do not reuse a LogDrop default event
391
+ name. Reusing the same custom event name updates the same schema; changing the
392
+ name creates a different custom event. If a property is later sent with another
393
+ type, LogDrop keeps the event but marks a type conflict in the panel.
394
+
395
+ Limits and validation:
396
+
397
+ - Event and property names must not be empty and can contain up to **128 characters**.
398
+ - One event can contain up to **100 top-level properties**.
399
+ - The complete properties JSON can contain up to **16 KB in UTF-8**.
400
+ - Property values must be JSON-compatible.
401
+
402
+ If validation fails, the native SDK rejects the complete event, logs the reason,
403
+ and never silently truncates names, properties, or payloads. No event definition
404
+ is required before tracking; the first valid event creates its schema in the
405
+ LogDrop panel.
406
+
407
+ ---
408
+
289
409
  ### `LogDrop.trackDeepLink(url: string): void`
290
410
  Tracks a deep link or universal link URL in the native LogDrop SDK.
291
411
 
@@ -77,5 +77,5 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
77
77
  dependencies {
78
78
  implementation "com.facebook.react:react-android"
79
79
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
80
- implementation "io.logdrop:sdk:2.1.6"
80
+ implementation "io.logdrop:sdk:2.1.8"
81
81
  }
@@ -37,7 +37,7 @@ class LogDropReactNativeModule(reactContext: ReactApplicationContext) :
37
37
 
38
38
  @ReactMethod
39
39
  fun showPendingPushPopup(promise: Promise) {
40
- val activity = currentActivity
40
+ val activity = reactApplicationContext.currentActivity
41
41
  if (activity == null) {
42
42
  promise.reject("NO_ACTIVITY", "Cannot show a push popup without an active Activity")
43
43
  return
@@ -51,9 +51,14 @@ class LogDropReactNativeModule(reactContext: ReactApplicationContext) :
51
51
  LogDrop.sendLogs()
52
52
  }
53
53
 
54
+ @ReactMethod
55
+ fun trackCustomEvent(eventName: String, properties: ReadableMap?) {
56
+ LogDrop.trackCustomEvent(eventName, properties?.toHashMap() ?: emptyMap())
57
+ }
58
+
54
59
  @ReactMethod
55
60
  fun trackDeepLink(url: String) {
56
- LogDropReactNative.trackDeepLink(url, currentActivity)
61
+ LogDropReactNative.trackDeepLink(url, reactApplicationContext.currentActivity)
57
62
  }
58
63
 
59
64
  @ReactMethod
@@ -18,6 +18,8 @@ RCT_EXTERN_METHOD(userUpdate:(NSString *)userUuid)
18
18
  RCT_EXTERN_METHOD(setCustomAttributes:(NSDictionary *)attributes)
19
19
  RCT_EXTERN_METHOD(removeCustomAttribute:(NSString *)key)
20
20
  RCT_EXTERN_METHOD(sendLogs)
21
+ RCT_EXTERN_METHOD(trackCustomEvent:(NSString *)eventName
22
+ properties:(NSDictionary * _Nullable)properties)
21
23
  RCT_EXTERN_METHOD(trackDeepLink:(NSString *)urlString)
22
24
  RCT_EXTERN_METHOD(saveCustomCrashReport:(NSString *)threadName
23
25
  stackTrace:(NSString *)stackTrace
@@ -133,6 +133,14 @@ class LogDropReactNative: NSObject {
133
133
  LogDrop.sendLogs()
134
134
  }
135
135
 
136
+ @objc
137
+ func trackCustomEvent(_ eventName: String, properties: NSDictionary?) {
138
+ LogDrop.trackCustomEvent(
139
+ eventName: eventName,
140
+ properties: properties as? [String: Any] ?? [:]
141
+ )
142
+ }
143
+
136
144
  @objc
137
145
  func trackDeepLink(_ urlString: String) {
138
146
  guard let url = URL(string: urlString.trimmingCharacters(in: .whitespacesAndNewlines)) else {
@@ -67,6 +67,11 @@ export default class LogDrop {
67
67
  static sendLogs = () => {
68
68
  LogDropReactNative.sendLogs();
69
69
  };
70
+
71
+ /** Tracks a customer-defined event with JSON-compatible properties. */
72
+ static trackCustomEvent = (eventName, properties = {}) => {
73
+ LogDropReactNative.trackCustomEvent(eventName, properties);
74
+ };
70
75
  static trackDeepLink = url => {
71
76
  LogDropReactNative.trackDeepLink?.(url);
72
77
  };
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","LogDropErrorTracking","LogDropReactNative","LogDropPopupShowResult","LogDrop","init","config","OS","initLogDrop","start","onRemoteMessageReceived","message","onNewFcmPushToken","token","onNewHmsPushToken","onNewApnsToken","isLogDropPush","showPendingPushPopup","NotInitialized","result","Shown","NothingToShow","sendLogs","trackDeepLink","url","setAppId","appId","userUpdate","userId","setCustomAttributes","attributes","removeCustomAttribute","key","e","tag","logFlow","d","i","w"],"sourceRoot":"../../src","sources":["LogDrop.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,QAAQ,iCAA8B;AAGnE,SAASC,kBAAkB,QAAQ,yBAAsB;AAEzD,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAMlC,eAAe,MAAMC,OAAO,CAAC;EAC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B,KAAW;IACpEjC,kBAAkB,CAACkC,CAAC,CAACF,GAAG,EAAEvB,OAAO,EAAEwB,OAAO,CAAC;EAC7C,CAAC;EAED,OAAOE,CAAC,GAAGA,CAACH,GAAW,EAAEvB,OAAe,EAAEwB,OAAiB,KAAW;IACpEjC,kBAAkB,CAACmC,CAAC,CAACH,GAAG,EAAEvB,OAAO,EAAEwB,OAAO,CAAC;EAC7C,CAAC;EAED,OAAOG,CAAC,GAAGA,CAACJ,GAAW,EAAEvB,OAAe,EAAEwB,OAAiB,KAAW;IACpEjC,kBAAkB,CAACoC,CAAC,CAACJ,GAAG,EAAEvB,OAAO,EAAEwB,OAAO,CAAC;EAC7C,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["Platform","LogDropErrorTracking","LogDropReactNative","LogDropPopupShowResult","LogDrop","init","config","OS","initLogDrop","start","onRemoteMessageReceived","message","onNewFcmPushToken","token","onNewHmsPushToken","onNewApnsToken","isLogDropPush","showPendingPushPopup","NotInitialized","result","Shown","NothingToShow","sendLogs","trackCustomEvent","eventName","properties","trackDeepLink","url","setAppId","appId","userUpdate","userId","setCustomAttributes","attributes","removeCustomAttribute","key","e","tag","logFlow","d","i","w"],"sourceRoot":"../../src","sources":["LogDrop.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,QAAQ,iCAA8B;AAGnE,SAASC,kBAAkB,QAAQ,yBAAsB;AAEzD,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAMlC,eAAe,MAAMC,OAAO,CAAC;EAC3B,OAAOC,IAAI,GAAIC,MAAqB,IAAW;IAC7C,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAIP,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MACtDL,kBAAkB,CAACM,WAAW,GAAGF,MAAM,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AW;IACpEpC,kBAAkB,CAACqC,CAAC,CAACF,GAAG,EAAE1B,OAAO,EAAE2B,OAAO,CAAC;EAC7C,CAAC;EAED,OAAOE,CAAC,GAAGA,CAACH,GAAW,EAAE1B,OAAe,EAAE2B,OAAiB,KAAW;IACpEpC,kBAAkB,CAACsC,CAAC,CAACH,GAAG,EAAE1B,OAAO,EAAE2B,OAAO,CAAC;EAC7C,CAAC;EAED,OAAOG,CAAC,GAAGA,CAACJ,GAAW,EAAE1B,OAAe,EAAE2B,OAAiB,KAAW;IACpEpC,kBAAkB,CAACuC,CAAC,CAACJ,GAAG,EAAE1B,OAAO,EAAE2B,OAAO,CAAC;EAC7C,CAAC;AACH","ignoreList":[]}
@@ -19,6 +19,8 @@ export default class LogDrop {
19
19
  }) => Promise<boolean>;
20
20
  static showPendingPushPopup: () => Promise<LogDropPopupShowResult>;
21
21
  static sendLogs: () => void;
22
+ /** Tracks a customer-defined event with JSON-compatible properties. */
23
+ static trackCustomEvent: (eventName: string, properties?: Record<string, unknown>) => void;
22
24
  static trackDeepLink: (url: string) => void;
23
25
  static setAppId: (appId: string) => void;
24
26
  static userUpdate: (userId: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"LogDrop.d.ts","sourceRoot":"","sources":["../../../src/LogDrop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,oBAAY,sBAAsB;IAChC,KAAK,UAAU;IACf,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;CAClC;AAED,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,MAAM,CAAC,IAAI,GAAI,QAAQ,aAAa,KAAG,IAAI,CAKzC;IAEF,MAAM,CAAC,uBAAuB,GAAI,SAAS;QACzC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,KAAG,IAAI,CAIN;IAEF,MAAM,CAAC,iBAAiB,GAAI,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AE,MAAM,CAAC,KAAG,IAAI,CAErE;IAEF,kEAAkE;IAClE,MAAM,CAAC,qBAAqB,GAAI,KAAK,MAAM,KAAG,IAAI,CAEhD;IAEF,MAAM,CAAC,CAAC,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,OAAO,KAAG,IAAI,CAEhE;IAEF,MAAM,CAAC,CAAC,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,OAAO,KAAG,IAAI,CAEhE;IAEF,MAAM,CAAC,CAAC,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,OAAO,KAAG,IAAI,CAEhE;IAEF,MAAM,CAAC,CAAC,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,OAAO,KAAG,IAAI,CAEhE;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@log-drop/react-native",
3
- "version": "2.0.7",
3
+ "version": "2.0.9-alpha1",
4
4
  "description": "LogDrop React Native SDK",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -1,40 +1,66 @@
1
1
  #!/bin/sh
2
2
  #
3
- # upload_rn_ios.sh
4
- # LogDrop React Native SDK
5
- #
6
- # Created by Initial Code on 19.08.2025.
3
+ # Uploads the React Native iOS source map used to symbolicate JavaScript crashes.
4
+ # Native dSYM upload remains the responsibility of LogDrop's upload_dsym.sh.
7
5
  #
8
6
 
9
7
  set -e
10
8
 
11
- echo "LogDrop - Preparing React Native iOS sourcemap..."
9
+ echo "LogDrop - Preparing React Native iOS source map..."
10
+
11
+ SERVICES_PLIST="${SRCROOT}/LogDrop-Services.plist"
12
+ if [ ! -f "$SERVICES_PLIST" ]; then
13
+ SERVICES_PLIST=$(find "$SRCROOT" -name "LogDrop-Services.plist" -not -path "*/build/*" 2>/dev/null | head -n 1)
14
+ fi
15
+ if [ -z "$SERVICES_PLIST" ]; then
16
+ echo "LogDrop - LogDrop-Services.plist not found under $SRCROOT"
17
+ exit 1
18
+ fi
19
+ echo "LogDrop - Found LogDrop-Services.plist: $SERVICES_PLIST"
12
20
 
13
- if [ "$EFFECTIVE_PLATFORM_NAME" = "-iphonesimulator" ]; then
14
- echo "LogDrop - Simulator build detected. Skipping mapping upload."
15
- exit 0
21
+ BASE_URL=$(/usr/libexec/PlistBuddy -c "Print :base_url" "$SERVICES_PLIST" 2>/dev/null || true)
22
+ if [ -z "$BASE_URL" ]; then
23
+ echo "LogDrop - base_url not found in LogDrop-Services.plist, using production fallback"
24
+ BASE_URL="https://server.logdrop.io"
16
25
  fi
17
26
 
18
- LOGDROP_API_KEY=${LOGDROP_API_KEY:-""}
19
- BASE_URL=${LOGDROP_BASE_URL:-"https://server.logdrop.io"}
27
+ APP_ID="${LOGDROP_APP_ID:-}"
28
+ if [ -z "$APP_ID" ]; then
29
+ APP_ID="${LOGDROP_API_KEY:-}"
30
+ fi
31
+ if [ -z "$APP_ID" ]; then
32
+ APP_ID=$(/usr/libexec/PlistBuddy -c "Print :projects:${PRODUCT_BUNDLE_IDENTIFIER}:app_id" "$SERVICES_PLIST" 2>/dev/null || true)
33
+ fi
34
+ if [ -z "$APP_ID" ]; then
35
+ APP_ID=$(/usr/libexec/PlistBuddy -c "Print :projects:${PRODUCT_BUNDLE_IDENTIFIER}:api_key" "$SERVICES_PLIST" 2>/dev/null || true)
36
+ fi
37
+ if [ -z "$APP_ID" ]; then
38
+ echo "LogDrop - app_id not found for bundle ID '${PRODUCT_BUNDLE_IDENTIFIER}' in LogDrop-Services.plist"
39
+ exit 1
40
+ fi
20
41
 
42
+ # normalize base_url
21
43
  case "$BASE_URL" in
22
44
  */) ;;
23
45
  *) BASE_URL="${BASE_URL}/" ;;
24
46
  esac
25
47
  case "$BASE_URL" in
26
- */api/ ) ;;
27
- */api ) BASE_URL="${BASE_URL}/" ;;
48
+ */api/) ;;
49
+ */api) BASE_URL="${BASE_URL}/" ;;
28
50
  *) BASE_URL="${BASE_URL}api/" ;;
29
51
  esac
30
52
  BACKEND_URL="${BASE_URL}crash/upload/framework/mapping"
31
53
 
54
+ NODE_EXECUTABLE="${NODE_BINARY:-}"
55
+ if [ -z "$NODE_EXECUTABLE" ] || [ ! -x "$NODE_EXECUTABLE" ]; then
56
+ NODE_EXECUTABLE=$(command -v node 2>/dev/null || true)
57
+ fi
58
+
32
59
  APP_DSYM="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
33
60
  if [ ! -d "$APP_DSYM" ]; then
34
61
  echo "LogDrop - dSYM not found: $APP_DSYM"
35
62
  exit 1
36
63
  fi
37
- echo "LogDrop - dSYM found: $APP_DSYM"
38
64
 
39
65
  DWARF_BINARY="${APP_DSYM}/Contents/Resources/DWARF/${PRODUCT_NAME}"
40
66
  if [ ! -f "$DWARF_BINARY" ]; then
@@ -42,79 +68,89 @@ if [ ! -f "$DWARF_BINARY" ]; then
42
68
  exit 1
43
69
  fi
44
70
 
45
- ACTIVE_ARCH="${ARCHS%% *}"
46
- echo "LogDrop - Active architecture: $ACTIVE_ARCH"
47
-
71
+ ACTIVE_ARCH="${CURRENT_ARCH:-${ARCHS%% *}}"
48
72
  NORMALIZED_ARCH="$ACTIVE_ARCH"
49
73
  case "$ACTIVE_ARCH" in
50
74
  arm64e) NORMALIZED_ARCH="arm64" ;;
51
75
  x86_64h) NORMALIZED_ARCH="x86_64" ;;
52
76
  esac
53
77
 
54
- DSYM_UUID=$(dwarfdump --uuid "$DWARF_BINARY" 2>/dev/null | grep "$NORMALIZED_ARCH" | awk '{print $2}' | head -n 1)
55
-
78
+ DSYM_UUID=$(dwarfdump --uuid "$DWARF_BINARY" 2>/dev/null | grep "$NORMALIZED_ARCH" | awk '{print $2}' | head -n 1 || true)
56
79
  if [ -z "$DSYM_UUID" ]; then
57
- echo "LogDrop - Could not find UUID for $NORMALIZED_ARCH, using first available UUID"
58
- DSYM_UUID=$(dwarfdump --uuid "$DWARF_BINARY" 2>/dev/null | grep "UUID:" | head -n 1 | awk '{print $2}')
80
+ DSYM_UUID=$(dwarfdump --uuid "$DWARF_BINARY" 2>/dev/null | awk '/UUID:/ {print $2; exit}' || true)
59
81
  fi
60
-
61
82
  if [ -z "$DSYM_UUID" ]; then
62
- echo "LogDrop - Failed to extract UUID"
83
+ echo "LogDrop - Failed to extract the dSYM UUID."
63
84
  exit 1
64
85
  fi
65
-
66
86
  DSYM_UUID=$(echo "$DSYM_UUID" | tr -d '-')
67
- echo "LogDrop - Extracted dSYM UUID for $NORMALIZED_ARCH: $DSYM_UUID"
68
87
 
69
88
  DSYM_PLIST="${APP_DSYM}/Contents/Info.plist"
70
- APP_VERSION=$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "${DSYM_PLIST}")
71
- BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "${DSYM_PLIST}")
89
+ APP_VERSION=$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$DSYM_PLIST")
90
+ BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$DSYM_PLIST")
72
91
 
73
- BUILD_DIR="${CONFIGURATION_BUILD_DIR}"
74
- BUNDLE_PATH="${BUILD_DIR}/main.jsbundle"
75
- IOS_MAP="${BUILD_DIR}/main.jsbundle.map"
92
+ BUILD_OUTPUT_DIR="${CONFIGURATION_BUILD_DIR}"
93
+ BUNDLE_PATH="${BUILD_OUTPUT_DIR}/main.jsbundle"
94
+ IOS_MAP="${BUILD_OUTPUT_DIR}/main.jsbundle.map"
76
95
 
77
- echo "LogDrop - Looking for sourcemap at: ${IOS_MAP}"
78
96
  if [ ! -f "$IOS_MAP" ]; then
79
- echo "LogDrop - Sourcemap not found in build dir. Trying to generate with RN CLI into build dir..."
97
+ if [ -z "$NODE_EXECUTABLE" ]; then
98
+ echo "LogDrop - Node.js was not found; cannot generate the React Native source map."
99
+ exit 1
100
+ fi
101
+
102
+ REACT_NATIVE_PATH="${REACT_NATIVE_PATH:-${SRCROOT}/../node_modules/react-native}"
103
+ PROJECT_ROOT="${PROJECT_ROOT:-${SRCROOT}/..}"
80
104
  ENTRY_FILE="${ENTRY_FILE:-index.js}"
81
- "${NODE_BINARY}" "${REACT_NATIVE_PATH}/cli.js" bundle \
82
- --platform ios \
83
- --dev false \
84
- --entry-file "${ENTRY_FILE}" \
85
- --bundle-output "${BUNDLE_PATH}" \
86
- --sourcemap-output "${IOS_MAP}"
105
+ DEV_MODE=false
106
+ MINIFY_MODE=true
107
+ case "${CONFIGURATION:-}" in
108
+ *Debug*) DEV_MODE=true; MINIFY_MODE=false ;;
109
+ esac
110
+
111
+ echo "LogDrop - Source map not found; generating it for ${CONFIGURATION:-the current configuration}."
112
+ (
113
+ cd "$PROJECT_ROOT"
114
+ "$NODE_EXECUTABLE" "${REACT_NATIVE_PATH}/cli.js" bundle \
115
+ --platform ios \
116
+ --dev "$DEV_MODE" \
117
+ --minify "$MINIFY_MODE" \
118
+ --entry-file "$ENTRY_FILE" \
119
+ --bundle-output "$BUNDLE_PATH" \
120
+ --sourcemap-output "$IOS_MAP"
121
+ )
87
122
  fi
88
123
 
89
124
  if [ ! -f "$IOS_MAP" ]; then
90
- echo "LogDrop - iOS sourcemap still not found at ${IOS_MAP}"
91
- echo "LogDrop - Ensure your 'Bundle React Native code and images' phase sets:"
92
- echo " export EXTRA_PACKAGER_ARGS=\"--sourcemap-output \$CONFIGURATION_BUILD_DIR/main.jsbundle.map\""
125
+ echo "LogDrop - React Native source map not found: $IOS_MAP"
126
+ echo "LogDrop - Add this before the React Native bundle script:"
127
+ echo ' export EXTRA_PACKAGER_ARGS="--sourcemap-output $CONFIGURATION_BUILD_DIR/main.jsbundle.map"'
93
128
  exit 1
94
129
  fi
95
130
 
96
- ARCHIVE_NAME="ios_sourcemap.map.gz"
97
- gzip -c "${IOS_MAP}" > "${ARCHIVE_NAME}"
131
+ ARCHIVE_PATH=$(mktemp "${TMPDIR:-/tmp}/logdrop-ios-sourcemap.XXXXXX")
132
+ RESPONSE_BODY=$(mktemp "${TMPDIR:-/tmp}/logdrop-ios-response.XXXXXX")
133
+ cleanup() {
134
+ rm -f "$ARCHIVE_PATH" "$RESPONSE_BODY"
135
+ }
136
+ trap cleanup EXIT HUP INT TERM
98
137
 
99
- echo "LogDrop - Uploading iOS sourcemap to ${BACKEND_URL}..."
100
- RESPONSE_BODY=$(mktemp)
101
- http_code=$(curl -s -o "$RESPONSE_BODY" -w "%{http_code}" -X POST "$BACKEND_URL" \
102
- -H "x-api-key: ${LOGDROP_API_KEY}" \
103
- -F "mapping=@${ARCHIVE_NAME};filename=${ARCHIVE_NAME}" \
138
+ gzip -c "$IOS_MAP" > "$ARCHIVE_PATH"
139
+
140
+ echo "LogDrop - Uploading React Native iOS source map..."
141
+ HTTP_CODE=$(curl -sS -o "$RESPONSE_BODY" -w "%{http_code}" -X POST "$BACKEND_URL" \
142
+ -H "x-api-key: ${APP_ID}" \
143
+ -F "mapping=@${ARCHIVE_PATH};filename=ios_sourcemap.map.gz" \
104
144
  -F "dsymUuid=${DSYM_UUID}" \
105
145
  -F "frameworkType=REACT_NATIVE" \
106
146
  -F "platform=ios" \
107
147
  -F "version=${APP_VERSION}" \
108
148
  -F "build=${BUILD_NUMBER}")
109
149
 
110
- if [ "$http_code" != "200" ]; then
111
- echo "LogDrop - Upload failed ($http_code)"
150
+ if [ "$HTTP_CODE" != "200" ]; then
151
+ echo "LogDrop - Source map upload failed ($HTTP_CODE)."
112
152
  cat "$RESPONSE_BODY"
113
- rm -f "$ARCHIVE_NAME" "$RESPONSE_BODY"
114
153
  exit 1
115
154
  fi
116
155
 
117
- rm -f "$ARCHIVE_NAME" "$RESPONSE_BODY"
118
-
119
- echo "LogDrop - Upload completed (UUID: $DSYM_UUID)"
120
- exit 0
156
+ echo "LogDrop - React Native iOS source map upload completed (UUID: $DSYM_UUID)."
package/src/LogDrop.ts CHANGED
@@ -81,6 +81,14 @@ export default class LogDrop {
81
81
  LogDropReactNative.sendLogs();
82
82
  };
83
83
 
84
+ /** Tracks a customer-defined event with JSON-compatible properties. */
85
+ static trackCustomEvent = (
86
+ eventName: string,
87
+ properties: Record<string, unknown> = {}
88
+ ): void => {
89
+ LogDropReactNative.trackCustomEvent(eventName, properties);
90
+ };
91
+
84
92
  static trackDeepLink = (url: string): void => {
85
93
  LogDropReactNative.trackDeepLink?.(url);
86
94
  };