react-native-rook-sdk 2.1.3 → 2.1.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/ios/RookSdk.mm +19 -13
- package/package.json +1 -1
- package/react-native-rook-sdk.podspec +1 -1
package/ios/RookSdk.mm
CHANGED
|
@@ -35,9 +35,9 @@ RCT_EXPORT_MODULE()
|
|
|
35
35
|
|
|
36
36
|
-(void)startObserving {
|
|
37
37
|
hasListeners = YES;
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
NSLog(@"Hay alguien escuchando");
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
42
42
|
selector:@selector(receiveTestNotification:)
|
|
43
43
|
name:@"kRookErrorBackground"
|
|
@@ -47,7 +47,7 @@ RCT_EXPORT_MODULE()
|
|
|
47
47
|
// Will be called when this module's last listener is removed, or on dealloc.
|
|
48
48
|
-(void)stopObserving {
|
|
49
49
|
hasListeners = NO;
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -64,12 +64,12 @@ RCT_EXPORT_MODULE()
|
|
|
64
64
|
{
|
|
65
65
|
if ([[notification name] isEqualToString:@"kRookErrorBackground"]) {
|
|
66
66
|
NSDictionary<NSString*, NSError *> *notificationInfo = [[notification userInfo] mutableCopy];
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
NSMutableDictionary *message = [[NSMutableDictionary alloc] init];
|
|
69
69
|
message[@"type"] = @"ROOK_APPLE_HEALTH_BACKGROUND_ERROR";
|
|
70
70
|
message[@"message"] = notificationInfo[@"Error"].localizedDescription;
|
|
71
71
|
message[@"code"] = notificationInfo[@"Error"].description;
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
if (hasListeners)
|
|
74
74
|
[self sendEventWithName:@"ROOK_NOTIFICATION" body: message];
|
|
75
75
|
}
|
|
@@ -80,7 +80,7 @@ RookConnectConfigurationManagerObjc *shared;
|
|
|
80
80
|
// MARK: - Configuration
|
|
81
81
|
/**
|
|
82
82
|
* Initializes the Rook SDK with the provided configuration.
|
|
83
|
-
*
|
|
83
|
+
*
|
|
84
84
|
* @param data A dictionary containing the configuration parameters:
|
|
85
85
|
* - clientUUID: The unique identifier for the client.
|
|
86
86
|
* - password: The client's secret key.
|
|
@@ -93,16 +93,16 @@ RookConnectConfigurationManagerObjc *shared;
|
|
|
93
93
|
RCT_EXPORT_METHOD(initRook:(NSDictionary *) data
|
|
94
94
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
95
95
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
shared = [RookConnectConfigurationManagerObjc shared];
|
|
98
98
|
[shared setConfigurationWithClientUUID:convertToString(data[@"clientUUID"])
|
|
99
99
|
secretKey:convertToString(data[@"password"])
|
|
100
100
|
enableBackgroundSync:NO
|
|
101
101
|
enableEventsBackgroundSync:[RCTConvert BOOL:data[@"enableEventsBackgroundSync"]]];
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
NSString *environment = convertToString(data[@"environment"]);
|
|
104
104
|
BOOL enableLogs = [RCTConvert BOOL:data[@"enableLogs"]];
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
NSDictionary *opcionActions = @{
|
|
107
107
|
@"production": ^{
|
|
108
108
|
[shared setEnvironmentForProduction];
|
|
@@ -116,14 +116,20 @@ RCT_EXPORT_METHOD(initRook:(NSDictionary *) data
|
|
|
116
116
|
[[IOSClass shared] test];
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
void (^selectAction)(void) = opcionActions[environment];
|
|
121
121
|
if (selectAction) selectAction();
|
|
122
|
-
|
|
122
|
+
|
|
123
|
+
[[AnalyticsExtractionConfigurator shared] setPlatformToReact];
|
|
123
124
|
[shared setConsoleLogAvailable: enableLogs];
|
|
125
|
+
|
|
126
|
+
@try {
|
|
124
127
|
[shared initRook];
|
|
125
|
-
|
|
126
128
|
resolve(@(YES));
|
|
129
|
+
} @catch (NSException *exception) {
|
|
130
|
+
NSLog(@"Exception: %@", [exception reason]);
|
|
131
|
+
resolve(@(NO));
|
|
132
|
+
}
|
|
127
133
|
}
|
|
128
134
|
|
|
129
135
|
|
|
@@ -131,7 +137,7 @@ RCT_EXPORT_METHOD(initRook:(NSDictionary *) data
|
|
|
131
137
|
// MARK: - RN Broadcast
|
|
132
138
|
|
|
133
139
|
/**
|
|
134
|
-
* Internal method to send messages to broadcast channel
|
|
140
|
+
* Internal method to send messages to broadcast channel
|
|
135
141
|
*
|
|
136
142
|
* @param resolve A block called with a boolean value indicating whether the result is.
|
|
137
143
|
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency "RookSDK", "1.
|
|
19
|
+
s.dependency "RookSDK", "1.8.1"
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|