@@ -60,26 +60,22 @@ internal class FastRsaModule(reactContext: ReactApplicationContext) :
6060 }.start()
6161 }
6262
63- @ReactMethod
64- fun install (promise : Promise ) {
65- Thread {
66- reactApplicationContext.runOnJSQueueThread {
67- Log .d(TAG , " installing" )
68- try {
69- val contextHolder = this .reactApplicationContext.javaScriptContextHolder!! .get()
70- if (contextHolder.toInt() == 0 ) {
71- promise.resolve(false )
72- return @runOnJSQueueThread
73- }
74- initialize(contextHolder)
75- Log .i(TAG , " successfully installed" )
76- promise.resolve(true )
77- } catch (exception: java.lang.Exception ) {
78- Log .e(TAG , " failed to install JSI" , exception)
79- promise.reject(exception)
80- }
63+ @ReactMethod(isBlockingSynchronousMethod = true )
64+ fun install (): Boolean {
65+ Log .d(TAG , " installing" )
66+ try {
67+ val contextHolder = this .reactApplicationContext.javaScriptContextHolder!! .get()
68+ if (contextHolder.toInt() == 0 ) {
69+ Log .d(TAG , " context not available" )
70+ return false
8171 }
82- }.start()
72+ initialize(contextHolder)
73+ Log .i(TAG , " successfully installed" )
74+ return true
75+ } catch (exception: java.lang.Exception ) {
76+ Log .e(TAG , " failed to install JSI" , exception)
77+ return false
78+ }
8379 }
8480
8581 override fun getName (): String {
0 commit comments