@scalebun/react-native 1.10.2 → 1.10.4
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.
- package/android/src/main/java/com/scalebun/rn/crash/ScaleBunCrashModule.kt +24 -0
- package/android/src/oldarch/java/com/scalebun/rn/crash/ScaleBunCrashSpec.kt +3 -0
- package/dist/scalebun.full.js +821 -768
- package/dist/scalebun.full.js.map +1 -1
- package/dist/scalebun.slim.js +835 -782
- package/dist/scalebun.slim.js.map +1 -1
- package/ios/Crash/ScaleBunCrashBridge.mm +5 -0
- package/ios/Crash/ScaleBunCrashModule.swift +15 -0
- package/lib/commonjs/bootstrap/SDKBootstrapper.js +14 -2
- package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/commonjs/core/constants/version.js +1 -1
- package/lib/commonjs/features/crash/CrashFeature.js +17 -1
- package/lib/commonjs/features/crash/CrashFeature.js.map +1 -1
- package/lib/commonjs/features/crash/nativeCrashBridge.js +61 -3
- package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/commonjs/specs/NativeScaleBunCrash.js.map +1 -1
- package/lib/module/bootstrap/SDKBootstrapper.js +13 -0
- package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/module/core/constants/version.js +1 -1
- package/lib/module/features/crash/CrashFeature.js +17 -1
- package/lib/module/features/crash/CrashFeature.js.map +1 -1
- package/lib/module/features/crash/nativeCrashBridge.js +60 -3
- package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/module/specs/NativeScaleBunCrash.js.map +1 -1
- package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
- package/lib/typescript/core/constants/version.d.ts +1 -1
- package/lib/typescript/features/crash/CrashFeature.d.ts.map +1 -1
- package/lib/typescript/features/crash/nativeCrashBridge.d.ts +24 -0
- package/lib/typescript/features/crash/nativeCrashBridge.d.ts.map +1 -1
- package/lib/typescript/specs/NativeScaleBunCrash.d.ts +11 -0
- package/lib/typescript/specs/NativeScaleBunCrash.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap/SDKBootstrapper.ts +15 -0
- package/src/core/constants/version.ts +1 -1
- package/src/features/crash/CrashFeature.ts +17 -1
- package/src/features/crash/nativeCrashBridge.ts +69 -3
- 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
|
}
|