@@ -60,26 +60,22 @@ internal class FastRsaModule(reactContext: ReactApplicationContext) :
60
60
}.start()
61
61
}
62
62
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
81
71
}
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
+ }
83
79
}
84
80
85
81
override fun getName (): String {
0 commit comments