change(react-native): android use promise

This commit is contained in:
Shekar Siri 2024-12-02 17:15:19 +01:00
parent f95c1c9c94
commit 076e664ced

View file

@ -95,8 +95,13 @@ class ReactNativeModule(reactContext: ReactApplicationContext) :
}
@ReactMethod
fun getSessionId(): String {
return OpenReplay.getSessionId()
fun getSessionID(promise: Promise) {
try {
val sessionId = OpenReplay.getSessionID() ?: ""
promise.resolve(sessionId) // Resolve the promise with the session ID
} catch (e: Exception) {
promise.reject("GET_SESSION_ID_ERROR", "Failed to retrieve session ID", e)
}
}
@ReactMethod