react-native-nexora 0.1.0 → 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.
package/ios/Nexora.h CHANGED
@@ -1,5 +1,6 @@
1
1
  #import <NexoraSpec/NexoraSpec.h>
2
+ #import <React/RCTBridgeModule.h>
2
3
 
3
- @interface NexoraBridge : NSObject <NativeNexoraSpec>
4
+ @interface NexoraBridge : NSObject <NativeNexoraSpec, RCTBridgeModule>
4
5
 
5
6
  @end
package/ios/Nexora.mm CHANGED
@@ -1,5 +1,7 @@
1
1
  #import "Nexora.h"
2
2
  #import <React/RCTLog.h>
3
+ #import <React/RCTBridgeModule.h>
4
+ #import <dispatch/dispatch.h>
3
5
 
4
6
  // Forward declare the Swift wrapper we created
5
7
  @interface NexoraRNWrapper : NSObject
@@ -14,6 +16,13 @@
14
16
 
15
17
  @implementation NexoraBridge
16
18
 
19
+ RCT_EXPORT_MODULE(Nexora)
20
+
21
+ + (BOOL)requiresMainQueueSetup
22
+ {
23
+ return YES;
24
+ }
25
+
17
26
  - (void)getDefaultInstance {
18
27
  NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
19
28
  NSString *baseURL = info[@"NexoraBaseURL"] ?: @"";
@@ -23,7 +32,23 @@
23
32
  NSString *appGroupId = info[@"NexoraAppGroupID"];
24
33
 
25
34
  if (baseURL.length > 0 && apiKey.length > 0 && projectId.length > 0 && clientId.length > 0) {
26
- [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
+ }
27
52
  } else {
28
53
  RCTLogError(@"Nexora React Native SDK: Missing required Info.plist keys");
29
54
  }
@@ -82,9 +107,4 @@
82
107
  return std::make_shared<facebook::react::NativeNexoraSpecJSI>(params);
83
108
  }
84
109
 
85
- + (NSString *)moduleName
86
- {
87
- return @"Nexora";
88
- }
89
-
90
110
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nexora",
3
- "version": "0.1.0",
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",
@@ -120,6 +120,11 @@
120
120
  "jsSrcsDir": "src",
121
121
  "android": {
122
122
  "javaPackageName": "com.nexora"
123
+ },
124
+ "ios": {
125
+ "modulesProvider": {
126
+ "Nexora": "NexoraBridge"
127
+ }
123
128
  }
124
129
  },
125
130
  "prettier": {