@logrocket/react-native 0.23.2 → 0.27.0
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/README.md +1 -1
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/logrocket/plugins/react/LogRocketNativeModule.java +32 -32
- package/dist/build.js +2 -2
- package/ios/LogRocketNativeModule.h +2 -1
- package/ios/LogRocketNativeModule.m +105 -69
- package/ios/LogRocketNativeModule.xcodeproj/project.pbxproj +2 -2
- package/logrocket-react-native.podspec +2 -2
- package/package.json +1 -1
- package/types.d.ts +2 -1
|
@@ -6,6 +6,36 @@
|
|
|
6
6
|
|
|
7
7
|
RCT_EXPORT_MODULE();
|
|
8
8
|
|
|
9
|
+
static NSMutableDictionary<NSString *, LROResponseBuilder *> *capturedRequests;
|
|
10
|
+
|
|
11
|
+
- (id)init {
|
|
12
|
+
self = [super init];
|
|
13
|
+
|
|
14
|
+
if (self) {
|
|
15
|
+
capturedRequests = [[NSMutableDictionary alloc] init];
|
|
16
|
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleError:) name:@"LogRocketSDKError" object:nil];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return self;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
-(void)handleError:(NSNotification*)notification {
|
|
23
|
+
NSString *errorMessage = notification.userInfo[@"errorMessage"];
|
|
24
|
+
NSNumber *shouldDisableAndFreeMemory = notification.userInfo[@"shouldDisableAndFreeMemory"];
|
|
25
|
+
NSNumber *shouldWarnAboutReduxSize = notification.userInfo[@"shouldWarnAboutReduxSize"];
|
|
26
|
+
|
|
27
|
+
[self sendEventWithName:@"LogRocketSDKOnError" body:@{@"errorMessage": errorMessage, @"shouldDisableAndFreeMemory": shouldDisableAndFreeMemory, @"shouldWarnAboutReduxSize": shouldWarnAboutReduxSize}];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
31
|
+
return YES;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
35
|
+
return @[@"LogRocketSDKOnError"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
9
39
|
RCT_EXPORT_METHOD(addLog:(NSString *)level args:(NSArray *)args)
|
|
10
40
|
{
|
|
11
41
|
[LROSDK addLogWithLevel:level args:args];
|
|
@@ -19,29 +49,82 @@ RCT_EXPORT_METHOD(captureException:(NSString *)message
|
|
|
19
49
|
[LROSDK captureExceptionWithErrorMessage:message errorType:errorType exceptionType:exceptionType stackTrace:stackTrace];
|
|
20
50
|
}
|
|
21
51
|
|
|
22
|
-
RCT_EXPORT_METHOD(
|
|
52
|
+
RCT_EXPORT_METHOD(captureReduxAction:(NSDictionary *)data)
|
|
23
53
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
54
|
+
NSNumber *storeId = data[@"storeId"];
|
|
55
|
+
NSNumber *count = data[@"count"];
|
|
56
|
+
NSNumber *duration = data[@"duration"];
|
|
57
|
+
NSString *stateDelta = data[@"stateDelta"];
|
|
58
|
+
NSString *action = data[@"action"];
|
|
27
59
|
|
|
28
|
-
[LROSDK
|
|
60
|
+
[LROSDK captureReduxActionWithAction:action storeId:storeId duration:duration stateDelta:stateDelta count:count];
|
|
29
61
|
}
|
|
30
62
|
|
|
31
|
-
|
|
63
|
+
RCT_EXPORT_METHOD(captureReduxInitialState:(NSDictionary *)data)
|
|
64
|
+
{
|
|
65
|
+
NSNumber *storeId = data[@"storeId"];
|
|
66
|
+
NSString *state = data[@"state"];
|
|
32
67
|
|
|
33
|
-
|
|
34
|
-
|
|
68
|
+
[LROSDK captureReduxInitialStateWithState:state storeId:storeId];
|
|
69
|
+
}
|
|
35
70
|
|
|
36
|
-
|
|
37
|
-
|
|
71
|
+
RCT_EXPORT_METHOD(captureRequest:(NSString *)reqID request:(NSDictionary *)request)
|
|
72
|
+
{
|
|
73
|
+
LRORequestBuilder *builder = [LROSDK newRequestBuilder];
|
|
74
|
+
builder.url = request[@"url"];
|
|
75
|
+
|
|
76
|
+
if ([request objectForKey:@"body"]) {
|
|
77
|
+
NSDictionary *arson = [request objectForKey:@"body"];
|
|
78
|
+
if (arson && [arson objectForKey:@"arson"]) {
|
|
79
|
+
builder.arsonBody = [arson objectForKey:@"arson"];
|
|
80
|
+
}
|
|
38
81
|
}
|
|
39
82
|
|
|
40
|
-
|
|
83
|
+
if ([request objectForKey:@"method"]) {
|
|
84
|
+
builder.method = [request objectForKey:@"method"];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if ([request objectForKey:@"headers"]) {
|
|
88
|
+
builder.headers = [request objectForKey:@"headers"];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
capturedRequests[reqID] = [builder capture];
|
|
41
92
|
}
|
|
42
93
|
|
|
43
|
-
|
|
44
|
-
|
|
94
|
+
RCT_EXPORT_METHOD(captureResponse:(NSString *)reqID response:(NSDictionary *)response)
|
|
95
|
+
{
|
|
96
|
+
LROResponseBuilder *builder = capturedRequests[reqID];
|
|
97
|
+
|
|
98
|
+
if (builder) {
|
|
99
|
+
if ([response objectForKey:@"body"]) {
|
|
100
|
+
NSDictionary *arson = [response objectForKey:@"body"];
|
|
101
|
+
if (arson && [arson objectForKey:@"arson"]) {
|
|
102
|
+
builder.arsonBody = [arson objectForKey:@"arson"];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if ([response objectForKey:@"statusCode"]) {
|
|
107
|
+
NSNumber *statusCode = (NSNumber *) [response objectForKey:@"statusCode"];
|
|
108
|
+
builder.status = [statusCode longValue];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if ([response objectForKey:@"headers"]) {
|
|
112
|
+
builder.headers = [response objectForKey:@"headers"];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[builder capture];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[capturedRequests removeObjectForKey:reqID];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
RCT_EXPORT_METHOD(getSessionURL:(RCTResponseSenderBlock)callback)
|
|
122
|
+
{
|
|
123
|
+
void (^completion)(NSString*) = ^(NSString* sessionURL) {
|
|
124
|
+
callback(@[sessionURL]);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
[LROSDK getSessionURL:completion];
|
|
45
128
|
}
|
|
46
129
|
|
|
47
130
|
RCT_EXPORT_METHOD(initWithConfig:(NSString *)appID
|
|
@@ -51,7 +134,7 @@ RCT_EXPORT_METHOD(initWithConfig:(NSString *)appID
|
|
|
51
134
|
{
|
|
52
135
|
@try {
|
|
53
136
|
NSString *serverURL = config[@"serverURL"];
|
|
54
|
-
|
|
137
|
+
NSMutableSet<NSString *> *tags = [NSMutableSet setWithArray:config[@"redactionTags"]];
|
|
55
138
|
|
|
56
139
|
LROConfiguration *configuration = [[LROConfiguration alloc] initWithAppID:appID];
|
|
57
140
|
|
|
@@ -64,6 +147,10 @@ RCT_EXPORT_METHOD(initWithConfig:(NSString *)appID
|
|
|
64
147
|
configuration.responseSanitizer = nil;
|
|
65
148
|
configuration.registerTouchHandlers = true;
|
|
66
149
|
|
|
150
|
+
if ([config objectForKey:@"useAlternateIosViewCapture"]) {
|
|
151
|
+
configuration.useAlternateViewCapture = true;
|
|
152
|
+
}
|
|
153
|
+
|
|
67
154
|
BOOL result = [LROSDK initializeWithConfiguration:configuration];
|
|
68
155
|
resolve(@(result));
|
|
69
156
|
}
|
|
@@ -106,75 +193,24 @@ RCT_EXPORT_METHOD(shutdown:(RCTPromiseResolveBlock)resolve
|
|
|
106
193
|
|
|
107
194
|
RCT_EXPORT_METHOD(track:(NSString *)customEventName eventProperties:(NSDictionary *)eventProperties)
|
|
108
195
|
{
|
|
109
|
-
LROCustomEventBuilder *builder = [[LROCustomEventBuilder alloc]
|
|
196
|
+
LROCustomEventBuilder *builder = [[LROCustomEventBuilder alloc] init:customEventName];
|
|
110
197
|
|
|
111
198
|
for (NSString *key in eventProperties) {
|
|
112
199
|
NSDictionary *value = [eventProperties objectForKey:key];
|
|
113
200
|
|
|
114
201
|
if ([value objectForKey:@"doubleVal"]) {
|
|
115
202
|
NSArray *doubleArray = [value objectForKey:@"doubleVal"];
|
|
116
|
-
[builder
|
|
203
|
+
[builder putDoubleArray:key value:doubleArray];
|
|
117
204
|
} else if ([value objectForKey:@"boolVal"]) {
|
|
118
205
|
NSArray *boolArray = [value objectForKey:@"boolVal"];
|
|
119
|
-
[builder
|
|
206
|
+
[builder putBoolArray:key value:boolArray];
|
|
120
207
|
} else if ([value objectForKey:@"stringVal"]) {
|
|
121
208
|
NSArray *stringArray = [value objectForKey:@"stringVal"];
|
|
122
|
-
[builder
|
|
209
|
+
[builder putStringArray:key value:stringArray];
|
|
123
210
|
}
|
|
124
211
|
}
|
|
125
212
|
|
|
126
213
|
[LROSDK track:builder];
|
|
127
214
|
}
|
|
128
215
|
|
|
129
|
-
|
|
130
|
-
RCT_EXPORT_METHOD(captureRequest:(NSString *)reqID request:(NSDictionary *)request)
|
|
131
|
-
{
|
|
132
|
-
LRORequestBuilder *builder = [LROSDK newRequestBuilder];
|
|
133
|
-
builder.url = request[@"url"];
|
|
134
|
-
|
|
135
|
-
if ([request objectForKey:@"body"]) {
|
|
136
|
-
NSDictionary *arson = [request objectForKey:@"body"];
|
|
137
|
-
if (arson && [arson objectForKey:@"arson"]) {
|
|
138
|
-
builder.arsonBody = [arson objectForKey:@"arson"];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if ([request objectForKey:@"method"]) {
|
|
143
|
-
builder.method = [request objectForKey:@"method"];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if ([request objectForKey:@"headers"]) {
|
|
147
|
-
builder.headers = [request objectForKey:@"headers"];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
capturedRequests[reqID] = [builder capture];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
RCT_EXPORT_METHOD(captureResponse:(NSString *)reqID response:(NSDictionary *)response)
|
|
154
|
-
{
|
|
155
|
-
LROResponseBuilder *builder = capturedRequests[reqID];
|
|
156
|
-
|
|
157
|
-
if (builder) {
|
|
158
|
-
if ([response objectForKey:@"body"]) {
|
|
159
|
-
NSDictionary *arson = [response objectForKey:@"body"];
|
|
160
|
-
if (arson && [arson objectForKey:@"arson"]) {
|
|
161
|
-
builder.arsonBody = [arson objectForKey:@"arson"];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if ([response objectForKey:@"statusCode"]) {
|
|
166
|
-
NSNumber *statusCode = (NSNumber *) [response objectForKey:@"statusCode"];
|
|
167
|
-
builder.status = [statusCode longValue];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if ([response objectForKey:@"headers"]) {
|
|
171
|
-
builder.headers = [response objectForKey:@"headers"];
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
[builder capture];
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
[capturedRequests removeObjectForKey:reqID];
|
|
178
|
-
}
|
|
179
|
-
|
|
180
216
|
@end
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
167
167
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
168
168
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
169
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
169
|
+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
|
170
170
|
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
|
171
171
|
LIBRARY_SEARCH_PATHS = (
|
|
172
172
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
219
219
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
220
220
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
221
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
221
|
+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
|
222
222
|
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
|
223
223
|
LIBRARY_SEARCH_PATHS = (
|
|
224
224
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
@@ -9,14 +9,14 @@ Pod::Spec.new do |s|
|
|
|
9
9
|
s.license = "MIT"
|
|
10
10
|
|
|
11
11
|
s.authors = package["author"]
|
|
12
|
-
s.platforms = { :ios => "
|
|
12
|
+
s.platforms = { :ios => "12.0" }
|
|
13
13
|
s.homepage = package["repository"]["baseUrl"]
|
|
14
14
|
s.source = { :git => 'https://github.com/AppHub/LogRocket.git' }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,c,m,swift}"
|
|
17
17
|
s.requires_arc = true
|
|
18
18
|
|
|
19
|
-
s.dependency "LogRocket", "0.
|
|
19
|
+
s.dependency "LogRocket", "0.27.0"
|
|
20
20
|
s.dependency "React"
|
|
21
21
|
end
|
|
22
22
|
|
package/package.json
CHANGED
package/types.d.ts
CHANGED