react-native-netmera 1.4.3 → 1.4.4

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/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ReactNativePackager" nodePath="project" reactNativePackagePath="/usr/local/lib/node_modules/react-native-cli" workingDirectory="$PROJECT_DIR$/example" />
4
+ </project>
@@ -1,5 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
+ <component name="GradleMigrationSettings" migrationVersion="1" />
3
4
  <component name="GradleSettings">
4
5
  <option name="linkedExternalProjectsSettings">
5
6
  <GradleProjectSettings>
@@ -16,7 +16,7 @@ public class RNNetmera {
16
16
  static void setNetmeraHeaders() {
17
17
  ContentValues headerValues = new ContentValues();
18
18
  headerValues.put("X-netmera-framework", "react");
19
- headerValues.put("X-netmera-frameworkV", "1.4.3");
19
+ headerValues.put("X-netmera-frameworkV", "1.4.4");
20
20
  Netmera.setNetmeraHeaders(headerValues);
21
21
  }
22
22
  }
package/ios/RNNetmera.m CHANGED
@@ -46,7 +46,7 @@ NSString *const ERROR_MESSAGE_SET_CATEGORY_PREFERENCE = @"Error occurred while s
46
46
 
47
47
  + (void)setNetmeraHeaders {
48
48
  [Netmera setFramework:@"react"];
49
- [Netmera setFrameworkVersion:@"1.4.3"];
49
+ [Netmera setFrameworkVersion:@"1.4.4"];
50
50
  }
51
51
 
52
52
  + (void)setPushDelegate:(NSObject<NetmeraPushDelegate> *)delegate {
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -9,23 +9,39 @@
9
9
  #import "RNNetmeraRCTEventEmitter.h"
10
10
 
11
11
  @implementation RNNetmeraRCTEventEmitter
12
- {
13
- bool hasListeners;
14
- }
12
+
15
13
  RCT_EXPORT_MODULE();
16
14
 
17
- NSDictionary* pushToken = nil;
15
+ bool isReactBridgeInitialized;
18
16
 
19
- -(void)startObserving {
20
- hasListeners = YES;
17
+ NSDictionary* waitingOnPushRegister = nil;
18
+ NSDictionary* waitingOnPushReceive = nil;
19
+ NSDictionary* waitingOnPushOpen = nil;
20
+ NSDictionary* waitingOnPushDismiss = nil;
21
21
 
22
- if (pushToken != nil) {
23
- [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushRegister" object:nil userInfo: pushToken];
24
- }
22
+ -(void)startObserving {
23
+ isReactBridgeInitialized = YES;
24
+
25
+ if (waitingOnPushRegister != nil) {
26
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushRegister" object:nil userInfo: waitingOnPushRegister];
27
+ waitingOnPushRegister = nil;
28
+ }
29
+ if (waitingOnPushReceive != nil) {
30
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushReceive" object:nil userInfo: waitingOnPushReceive];
31
+ waitingOnPushReceive = nil;
32
+ }
33
+ if (waitingOnPushOpen != nil) {
34
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushOpen" object:nil userInfo: waitingOnPushOpen];
35
+ waitingOnPushOpen = nil;
36
+ }
37
+ if (waitingOnPushDismiss != nil) {
38
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushDismiss" object:nil userInfo: waitingOnPushDismiss];
39
+ waitingOnPushDismiss = nil;
40
+ }
25
41
  }
26
42
 
27
43
  -(void)stopObserving {
28
- hasListeners = NO;
44
+ isReactBridgeInitialized = NO;
29
45
  }
30
46
 
31
47
  - (NSArray<NSString *> *)supportedEvents
@@ -48,7 +64,7 @@ NSDictionary* pushToken = nil;
48
64
  }
49
65
 
50
66
  - (void)emitEvent:(NSNotification *)notification {
51
- if (hasListeners) {
67
+ if (isReactBridgeInitialized) {
52
68
  [self sendEventWithName:notification.name body:notification.userInfo];
53
69
  }
54
70
  }
@@ -61,21 +77,37 @@ NSDictionary* pushToken = nil;
61
77
  for (NSUInteger i = 0; i < deviceToken.length; i++) {
62
78
  [deviceTokenString appendFormat:@"%02x", bytes[i]];
63
79
  }
64
- pushToken = @{@"pushToken" : deviceTokenString};
80
+ NSDictionary* pushToken = @{@"pushToken" : deviceTokenString};
65
81
 
66
- [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushRegister" object:nil userInfo:pushToken];
82
+ if (isReactBridgeInitialized) {
83
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushRegister" object:nil userInfo:pushToken];
84
+ } else {
85
+ waitingOnPushRegister = pushToken;
86
+ }
67
87
  }
68
88
 
69
89
  + (void)onPushReceive:(NSDictionary *)body {
70
- [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushReceive" object:nil userInfo:body];
90
+ if (isReactBridgeInitialized) {
91
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushReceive" object:nil userInfo:body];
92
+ } else {
93
+ waitingOnPushReceive = body;
94
+ }
71
95
  }
72
96
 
73
97
  + (void)onPushOpen:(NSDictionary *)body {
74
- [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushOpen" object:nil userInfo:body];
98
+ if (isReactBridgeInitialized) {
99
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushOpen" object:nil userInfo:body];
100
+ } else {
101
+ waitingOnPushOpen = body;
102
+ }
75
103
  }
76
104
 
77
105
  + (void)onPushDismiss:(NSDictionary *)body {
78
- [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushDismiss" object:nil userInfo:body];
106
+ if (isReactBridgeInitialized) {
107
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"onPushDismiss" object:nil userInfo:body];
108
+ } else {
109
+ waitingOnPushDismiss = body;
110
+ }
79
111
  }
80
112
 
81
113
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-netmera",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Netmera React Native SDK",
5
5
  "main": "index.js",
6
6
  "author": "netmera",