@logrocket/react-native 0.23.1 → 0.26.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 +4 -4
- 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 -68
- package/ios/LogRocketNativeModule.xcodeproj/project.pbxproj +2 -2
- package/logrocket-react-native.podspec +2 -2
- package/package.json +2 -2
- package/types.d.ts +2 -0
|
@@ -6,6 +6,37 @@
|
|
|
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
|
+
{
|
|
24
|
+
NSString *errorMessage = notification.userInfo[@"errorMessage"];
|
|
25
|
+
NSNumber *shouldDisableAndFreeMemory = notification.userInfo[@"shouldDisableAndFreeMemory"];
|
|
26
|
+
NSNumber *shouldWarnAboutReduxSize = notification.userInfo[@"shouldWarnAboutReduxSize"];
|
|
27
|
+
|
|
28
|
+
[self sendEventWithName:@"LogRocketSDKOnError" body:@{@"errorMessage": errorMessage, @"shouldDisableAndFreeMemory": shouldDisableAndFreeMemory, @"shouldWarnAboutReduxSize": shouldWarnAboutReduxSize}];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
32
|
+
return YES;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
36
|
+
return @[@"LogRocketSDKOnError"];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
9
40
|
RCT_EXPORT_METHOD(addLog:(NSString *)level args:(NSArray *)args)
|
|
10
41
|
{
|
|
11
42
|
[LROSDK addLogWithLevel:level args:args];
|
|
@@ -19,29 +50,82 @@ RCT_EXPORT_METHOD(captureException:(NSString *)message
|
|
|
19
50
|
[LROSDK captureExceptionWithErrorMessage:message errorType:errorType exceptionType:exceptionType stackTrace:stackTrace];
|
|
20
51
|
}
|
|
21
52
|
|
|
22
|
-
RCT_EXPORT_METHOD(
|
|
53
|
+
RCT_EXPORT_METHOD(captureReduxAction:(NSDictionary *)data)
|
|
23
54
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
55
|
+
NSNumber *storeId = data[@"storeId"];
|
|
56
|
+
NSNumber *count = data[@"count"];
|
|
57
|
+
NSNumber *duration = data[@"duration"];
|
|
58
|
+
NSString *stateDelta = data[@"stateDelta"];
|
|
59
|
+
NSString *action = data[@"action"];
|
|
27
60
|
|
|
28
|
-
[LROSDK
|
|
61
|
+
[LROSDK captureReduxActionWithAction:action storeId:storeId duration:duration stateDelta:stateDelta count:count];
|
|
29
62
|
}
|
|
30
63
|
|
|
31
|
-
|
|
64
|
+
RCT_EXPORT_METHOD(captureReduxInitialState:(NSDictionary *)data)
|
|
65
|
+
{
|
|
66
|
+
NSNumber *storeId = data[@"storeId"];
|
|
67
|
+
NSString *state = data[@"state"];
|
|
32
68
|
|
|
33
|
-
|
|
34
|
-
|
|
69
|
+
[LROSDK captureReduxInitialStateWithState:state storeId:storeId];
|
|
70
|
+
}
|
|
35
71
|
|
|
36
|
-
|
|
37
|
-
|
|
72
|
+
RCT_EXPORT_METHOD(captureRequest:(NSString *)reqID request:(NSDictionary *)request)
|
|
73
|
+
{
|
|
74
|
+
LRORequestBuilder *builder = [LROSDK newRequestBuilder];
|
|
75
|
+
builder.url = request[@"url"];
|
|
76
|
+
|
|
77
|
+
if ([request objectForKey:@"body"]) {
|
|
78
|
+
NSDictionary *arson = [request objectForKey:@"body"];
|
|
79
|
+
if (arson && [arson objectForKey:@"arson"]) {
|
|
80
|
+
builder.arsonBody = [arson objectForKey:@"arson"];
|
|
81
|
+
}
|
|
38
82
|
}
|
|
39
83
|
|
|
40
|
-
|
|
84
|
+
if ([request objectForKey:@"method"]) {
|
|
85
|
+
builder.method = [request objectForKey:@"method"];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if ([request objectForKey:@"headers"]) {
|
|
89
|
+
builder.headers = [request objectForKey:@"headers"];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
capturedRequests[reqID] = [builder capture];
|
|
41
93
|
}
|
|
42
94
|
|
|
43
|
-
|
|
44
|
-
|
|
95
|
+
RCT_EXPORT_METHOD(captureResponse:(NSString *)reqID response:(NSDictionary *)response)
|
|
96
|
+
{
|
|
97
|
+
LROResponseBuilder *builder = capturedRequests[reqID];
|
|
98
|
+
|
|
99
|
+
if (builder) {
|
|
100
|
+
if ([response objectForKey:@"body"]) {
|
|
101
|
+
NSDictionary *arson = [response objectForKey:@"body"];
|
|
102
|
+
if (arson && [arson objectForKey:@"arson"]) {
|
|
103
|
+
builder.arsonBody = [arson objectForKey:@"arson"];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if ([response objectForKey:@"statusCode"]) {
|
|
108
|
+
NSNumber *statusCode = (NSNumber *) [response objectForKey:@"statusCode"];
|
|
109
|
+
builder.status = [statusCode longValue];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if ([response objectForKey:@"headers"]) {
|
|
113
|
+
builder.headers = [response objectForKey:@"headers"];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
[builder capture];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[capturedRequests removeObjectForKey:reqID];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
RCT_EXPORT_METHOD(getSessionURL:(RCTResponseSenderBlock)callback)
|
|
123
|
+
{
|
|
124
|
+
void (^completion)(NSString*) = ^(NSString* sessionURL) {
|
|
125
|
+
callback(@[sessionURL]);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
[LROSDK getSessionURL:completion];
|
|
45
129
|
}
|
|
46
130
|
|
|
47
131
|
RCT_EXPORT_METHOD(initWithConfig:(NSString *)appID
|
|
@@ -64,6 +148,10 @@ RCT_EXPORT_METHOD(initWithConfig:(NSString *)appID
|
|
|
64
148
|
configuration.responseSanitizer = nil;
|
|
65
149
|
configuration.registerTouchHandlers = true;
|
|
66
150
|
|
|
151
|
+
if ([config objectForKey:@"useAlternateIosViewCapture"]) {
|
|
152
|
+
configuration.useAlternateViewCapture = true;
|
|
153
|
+
}
|
|
154
|
+
|
|
67
155
|
BOOL result = [LROSDK initializeWithConfiguration:configuration];
|
|
68
156
|
resolve(@(result));
|
|
69
157
|
}
|
|
@@ -106,75 +194,24 @@ RCT_EXPORT_METHOD(shutdown:(RCTPromiseResolveBlock)resolve
|
|
|
106
194
|
|
|
107
195
|
RCT_EXPORT_METHOD(track:(NSString *)customEventName eventProperties:(NSDictionary *)eventProperties)
|
|
108
196
|
{
|
|
109
|
-
LROCustomEventBuilder *builder = [[LROCustomEventBuilder alloc]
|
|
197
|
+
LROCustomEventBuilder *builder = [[LROCustomEventBuilder alloc] init:customEventName];
|
|
110
198
|
|
|
111
199
|
for (NSString *key in eventProperties) {
|
|
112
200
|
NSDictionary *value = [eventProperties objectForKey:key];
|
|
113
201
|
|
|
114
202
|
if ([value objectForKey:@"doubleVal"]) {
|
|
115
203
|
NSArray *doubleArray = [value objectForKey:@"doubleVal"];
|
|
116
|
-
[builder
|
|
204
|
+
[builder putDoubleArray:key value:doubleArray];
|
|
117
205
|
} else if ([value objectForKey:@"boolVal"]) {
|
|
118
206
|
NSArray *boolArray = [value objectForKey:@"boolVal"];
|
|
119
|
-
[builder
|
|
207
|
+
[builder putBoolArray:key value:boolArray];
|
|
120
208
|
} else if ([value objectForKey:@"stringVal"]) {
|
|
121
209
|
NSArray *stringArray = [value objectForKey:@"stringVal"];
|
|
122
|
-
[builder
|
|
210
|
+
[builder putStringArray:key value:stringArray];
|
|
123
211
|
}
|
|
124
212
|
}
|
|
125
213
|
|
|
126
214
|
[LROSDK track:builder];
|
|
127
215
|
}
|
|
128
216
|
|
|
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
217
|
@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.26.0"
|
|
20
20
|
s.dependency "React"
|
|
21
21
|
end
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logrocket/react-native",
|
|
3
3
|
"title": "Logrocket Native Module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"description": "LogRocket SDK for react-native",
|
|
6
6
|
"typings": "types.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@apphub/logrocket-redux": "^0.0.85",
|
|
44
44
|
"@apphub/diffpatch": "^0.0.85",
|
|
45
45
|
"jest": "^26.6.3",
|
|
46
|
-
"react-native": "0.
|
|
46
|
+
"react-native": "0.66.4",
|
|
47
47
|
"@babel/core": "^7.13.15",
|
|
48
48
|
"@babel/preset-env": "^7.13.15",
|
|
49
49
|
"babel-jest": "^26.6.3"
|