@scalebun/react-native 1.10.1 → 1.10.3

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.
Files changed (31) hide show
  1. package/android/src/main/java/com/scalebun/rn/crash/ScaleBunCrashModule.kt +24 -0
  2. package/android/src/oldarch/java/com/scalebun/rn/crash/ScaleBunCrashSpec.kt +3 -0
  3. package/dist/scalebun.full.js +811 -768
  4. package/dist/scalebun.full.js.map +1 -1
  5. package/dist/scalebun.slim.js +825 -782
  6. package/dist/scalebun.slim.js.map +1 -1
  7. package/ios/Crash/ScaleBunCrashBridge.mm +5 -0
  8. package/ios/Crash/ScaleBunCrashModule.swift +15 -0
  9. package/lib/commonjs/core/constants/version.js +1 -1
  10. package/lib/commonjs/features/crash/CrashFeature.js +17 -1
  11. package/lib/commonjs/features/crash/CrashFeature.js.map +1 -1
  12. package/lib/commonjs/features/crash/nativeCrashBridge.js +61 -3
  13. package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
  14. package/lib/commonjs/specs/NativeScaleBunCrash.js.map +1 -1
  15. package/lib/module/core/constants/version.js +1 -1
  16. package/lib/module/features/crash/CrashFeature.js +17 -1
  17. package/lib/module/features/crash/CrashFeature.js.map +1 -1
  18. package/lib/module/features/crash/nativeCrashBridge.js +60 -3
  19. package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
  20. package/lib/module/specs/NativeScaleBunCrash.js.map +1 -1
  21. package/lib/typescript/core/constants/version.d.ts +1 -1
  22. package/lib/typescript/features/crash/CrashFeature.d.ts.map +1 -1
  23. package/lib/typescript/features/crash/nativeCrashBridge.d.ts +24 -0
  24. package/lib/typescript/features/crash/nativeCrashBridge.d.ts.map +1 -1
  25. package/lib/typescript/specs/NativeScaleBunCrash.d.ts +11 -0
  26. package/lib/typescript/specs/NativeScaleBunCrash.d.ts.map +1 -1
  27. package/package.json +2 -2
  28. package/src/core/constants/version.ts +1 -1
  29. package/src/features/crash/CrashFeature.ts +17 -1
  30. package/src/features/crash/nativeCrashBridge.ts +69 -3
  31. package/src/specs/NativeScaleBunCrash.ts +12 -0
@@ -3,6 +3,7 @@ package com.scalebun.rn.crash
3
3
  import com.facebook.react.bridge.*
4
4
  import com.scalebun.core.crash.CrashStorage
5
5
  import com.scalebun.core.crash.NativeCrashHandler
6
+ import org.json.JSONObject
6
7
 
7
8
  /**
8
9
  * React Native bridge for native crash capture.
@@ -161,4 +162,27 @@ class ScaleBunCrashModule(reactContext: ReactApplicationContext) :
161
162
  promise.reject("CRASH_DRAIN_ERROR", e.message, e)
162
163
  }
163
164
  }
165
+
166
+ /**
167
+ * Persist a FATAL JS crash to the same store native crashes use.
168
+ *
169
+ * BLOCKING SYNCHRONOUS on purpose. A fatal JS error unwinds the process, and
170
+ * an async promise call would return before the write ran — losing the crash,
171
+ * which is exactly the bug this closes. A synchronous write finishes on disk
172
+ * before the JS handler returns, so the next launch drains it via
173
+ * drainPendingCrash like any native crash.
174
+ *
175
+ * Never throws: it runs while the app is already dying, and the crashId in the
176
+ * record makes the eventual delivery idempotent.
177
+ */
178
+ @ReactMethod(isBlockingSynchronousMethod = true)
179
+ override fun persistJsCrash(recordJson: String?): Boolean {
180
+ return try {
181
+ if (recordJson.isNullOrEmpty()) return false
182
+ CrashStorage.write(reactApplicationContext.applicationContext, JSONObject(recordJson))
183
+ true
184
+ } catch (e: Exception) {
185
+ false
186
+ }
187
+ }
164
188
  }
@@ -34,4 +34,7 @@ abstract class ScaleBunCrashSpec(reactContext: ReactApplicationContext) :
34
34
  */
35
35
  abstract fun setActiveSessionId(sessionId: String?, promise: Promise)
36
36
  abstract fun clearPendingCrash(crashId: String?, promise: Promise)
37
+
38
+ // Synchronous: returns a value, so no Promise. See the module for why.
39
+ abstract fun persistJsCrash(recordJson: String?): Boolean
37
40
  }