react-native-nexora 0.1.1 → 0.1.2

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 (2) hide show
  1. package/ios/Nexora.mm +18 -1
  2. package/package.json +1 -1
package/ios/Nexora.mm CHANGED
@@ -1,6 +1,7 @@
1
1
  #import "Nexora.h"
2
2
  #import <React/RCTLog.h>
3
3
  #import <React/RCTBridgeModule.h>
4
+ #import <dispatch/dispatch.h>
4
5
 
5
6
  // Forward declare the Swift wrapper we created
6
7
  @interface NexoraRNWrapper : NSObject
@@ -31,7 +32,23 @@ RCT_EXPORT_MODULE(Nexora)
31
32
  NSString *appGroupId = info[@"NexoraAppGroupID"];
32
33
 
33
34
  if (baseURL.length > 0 && apiKey.length > 0 && projectId.length > 0 && clientId.length > 0) {
34
- [NexoraRNWrapper configureWithBaseURL:baseURL apiKey:apiKey clientId:clientId projectId:projectId appGroupId:appGroupId];
35
+ void (^configure)(void) = ^{
36
+ [NexoraRNWrapper configureWithBaseURL:baseURL
37
+ apiKey:apiKey
38
+ clientId:clientId
39
+ projectId:projectId
40
+ appGroupId:appGroupId];
41
+ };
42
+
43
+ // TurboModule methods run on React Native's module queue. Nexora's
44
+ // configuration reads UIApplication state, which must happen on the
45
+ // main thread. Run synchronously to keep configuration ordered before
46
+ // any event calls made immediately afterwards from JavaScript.
47
+ if ([NSThread isMainThread]) {
48
+ configure();
49
+ } else {
50
+ dispatch_sync(dispatch_get_main_queue(), configure);
51
+ }
35
52
  } else {
36
53
  RCTLogError(@"Nexora React Native SDK: Missing required Info.plist keys");
37
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nexora",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A React Native SDK for Nexora Apps",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",