@luciq/react-native 18.0.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/CHANGELOG.md +5 -0
- package/FONTS_SETUP_GUIDE.md +521 -0
- package/Gemfile +1 -0
- package/Gemfile.lock +11 -0
- package/LICENSE +21 -0
- package/README.md +148 -0
- package/RNLuciq.podspec +21 -0
- package/android/build.gradle +88 -0
- package/android/gradle.properties +4 -0
- package/android/jacoco.gradle +52 -0
- package/android/native.gradle +7 -0
- package/android/proguard-rules.txt +1 -0
- package/android/sourcemaps.gradle +255 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/ai/luciq/reactlibrary/ArgsRegistry.java +278 -0
- package/android/src/main/java/ai/luciq/reactlibrary/Constants.java +20 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciq.java +328 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqAPMModule.java +392 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqBugReportingModule.java +444 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqCrashReportingModule.java +169 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqFeatureRequestsModule.java +98 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqNetworkLoggerModule.java +195 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativeModule.java +1611 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativePackage.java +41 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqRepliesModule.java +298 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSessionReplayModule.java +213 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSurveysModule.java +237 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/ArrayUtil.java +167 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/EventEmitterModule.java +35 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/LuciqUtil.java +58 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/MainThreadHandler.java +13 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/MapUtil.java +171 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/RNTouchedViewExtractor.java +167 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/ReportUtil.java +67 -0
- package/app.plugin.js +1 -0
- package/babel.config.js +3 -0
- package/bin/commands/MigrateCommand.d.ts +6 -0
- package/bin/commands/UploadEasUpdatesSourcemaps.d.ts +2 -0
- package/bin/commands/UploadSoFiles.d.ts +6 -0
- package/bin/commands/UploadSourcemaps.d.ts +2 -0
- package/bin/config/migration-config.json +125 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +19179 -0
- package/bin/upload/index.d.ts +4 -0
- package/bin/upload/migrate.d.ts +14 -0
- package/bin/upload/uploadEasUpdatesSourcemaps.d.ts +21 -0
- package/bin/upload/uploadSoFiles.d.ts +21 -0
- package/bin/upload/uploadSourcemaps.d.ts +21 -0
- package/cli/commands/MigrateCommand.ts +32 -0
- package/cli/commands/UploadEasUpdatesSourcemaps.ts +34 -0
- package/cli/commands/UploadSoFiles.ts +38 -0
- package/cli/commands/UploadSourcemaps.ts +40 -0
- package/cli/config/migration-config.json +125 -0
- package/cli/index.ts +21 -0
- package/cli/upload/index.ts +4 -0
- package/cli/upload/migrate.ts +271 -0
- package/cli/upload/uploadEasUpdatesSourcemaps.ts +74 -0
- package/cli/upload/uploadSoFiles.ts +112 -0
- package/cli/upload/uploadSourcemaps.ts +73 -0
- package/dangerfile.ts +44 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +14 -0
- package/dist/models/FeatureFlag.d.ts +11 -0
- package/dist/models/FeatureFlag.js +1 -0
- package/dist/models/LuciqConfig.d.ts +42 -0
- package/dist/models/LuciqConfig.js +1 -0
- package/dist/models/NonFatalOptions.d.ts +15 -0
- package/dist/models/NonFatalOptions.js +1 -0
- package/dist/models/OverAirUpdate.d.ts +12 -0
- package/dist/models/OverAirUpdate.js +1 -0
- package/dist/models/Report.d.ts +70 -0
- package/dist/models/Report.js +109 -0
- package/dist/models/ReproConfig.d.ts +27 -0
- package/dist/models/ReproConfig.js +1 -0
- package/dist/models/SessionMetadata.d.ts +55 -0
- package/dist/models/SessionMetadata.js +1 -0
- package/dist/models/ThemeConfig.d.ts +27 -0
- package/dist/models/ThemeConfig.js +1 -0
- package/dist/models/W3cExternalTraceAttributes.d.ts +22 -0
- package/dist/models/W3cExternalTraceAttributes.js +1 -0
- package/dist/modules/APM.d.ts +77 -0
- package/dist/modules/APM.js +104 -0
- package/dist/modules/BugReporting.d.ts +138 -0
- package/dist/modules/BugReporting.js +202 -0
- package/dist/modules/CrashReporting.d.ts +19 -0
- package/dist/modules/CrashReporting.js +40 -0
- package/dist/modules/FeatureRequests.d.ts +20 -0
- package/dist/modules/FeatureRequests.js +28 -0
- package/dist/modules/Luciq.d.ts +362 -0
- package/dist/modules/Luciq.js +797 -0
- package/dist/modules/NetworkLogger.d.ts +52 -0
- package/dist/modules/NetworkLogger.js +208 -0
- package/dist/modules/Replies.d.ts +78 -0
- package/dist/modules/Replies.js +121 -0
- package/dist/modules/SessionReplay.d.ts +78 -0
- package/dist/modules/SessionReplay.js +98 -0
- package/dist/modules/Surveys.d.ts +75 -0
- package/dist/modules/Surveys.js +101 -0
- package/dist/native/NativeAPM.d.ts +18 -0
- package/dist/native/NativeAPM.js +4 -0
- package/dist/native/NativeBugReporting.d.ts +32 -0
- package/dist/native/NativeBugReporting.js +10 -0
- package/dist/native/NativeConstants.d.ts +182 -0
- package/dist/native/NativeConstants.js +1 -0
- package/dist/native/NativeCrashReporting.d.ts +18 -0
- package/dist/native/NativeCrashReporting.js +2 -0
- package/dist/native/NativeFeatureRequests.d.ts +8 -0
- package/dist/native/NativeFeatureRequests.js +2 -0
- package/dist/native/NativeLuciq.d.ts +86 -0
- package/dist/native/NativeLuciq.js +10 -0
- package/dist/native/NativeNetworkLogger.d.ts +21 -0
- package/dist/native/NativeNetworkLogger.js +14 -0
- package/dist/native/NativePackage.d.ts +21 -0
- package/dist/native/NativePackage.js +2 -0
- package/dist/native/NativeReplies.d.ts +21 -0
- package/dist/native/NativeReplies.js +8 -0
- package/dist/native/NativeSessionReplay.d.ts +16 -0
- package/dist/native/NativeSessionReplay.js +8 -0
- package/dist/native/NativeSurveys.d.ts +22 -0
- package/dist/native/NativeSurveys.js +9 -0
- package/dist/utils/AppStatesHandler.d.ts +3 -0
- package/dist/utils/AppStatesHandler.js +16 -0
- package/dist/utils/Enums.d.ts +244 -0
- package/dist/utils/Enums.js +266 -0
- package/dist/utils/FeatureFlags.d.ts +7 -0
- package/dist/utils/FeatureFlags.js +24 -0
- package/dist/utils/LuciqConstants.d.ts +14 -0
- package/dist/utils/LuciqConstants.js +15 -0
- package/dist/utils/LuciqUtils.d.ts +97 -0
- package/dist/utils/LuciqUtils.js +301 -0
- package/dist/utils/UnhandledRejectionTracking.d.ts +9 -0
- package/dist/utils/UnhandledRejectionTracking.js +99 -0
- package/dist/utils/XhrNetworkInterceptor.d.ts +39 -0
- package/dist/utils/XhrNetworkInterceptor.js +253 -0
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/config.js +6 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +39 -0
- package/expo.d.ts +1 -0
- package/expo.js +1 -0
- package/ios/RNLuciq/ArgsRegistry.h +32 -0
- package/ios/RNLuciq/ArgsRegistry.m +276 -0
- package/ios/RNLuciq/LuciqAPMBridge.h +26 -0
- package/ios/RNLuciq/LuciqAPMBridge.m +99 -0
- package/ios/RNLuciq/LuciqBugReportingBridge.h +60 -0
- package/ios/RNLuciq/LuciqBugReportingBridge.m +241 -0
- package/ios/RNLuciq/LuciqCrashReportingBridge.h +18 -0
- package/ios/RNLuciq/LuciqCrashReportingBridge.m +68 -0
- package/ios/RNLuciq/LuciqFeatureRequestsBridge.h +30 -0
- package/ios/RNLuciq/LuciqFeatureRequestsBridge.m +61 -0
- package/ios/RNLuciq/LuciqNetworkLoggerBridge.h +44 -0
- package/ios/RNLuciq/LuciqNetworkLoggerBridge.m +206 -0
- package/ios/RNLuciq/LuciqReactBridge.h +151 -0
- package/ios/RNLuciq/LuciqReactBridge.m +548 -0
- package/ios/RNLuciq/LuciqRepliesBridge.h +40 -0
- package/ios/RNLuciq/LuciqRepliesBridge.m +80 -0
- package/ios/RNLuciq/LuciqSessionReplayBridge.h +32 -0
- package/ios/RNLuciq/LuciqSessionReplayBridge.m +107 -0
- package/ios/RNLuciq/LuciqSurveysBridge.h +46 -0
- package/ios/RNLuciq/LuciqSurveysBridge.m +107 -0
- package/ios/RNLuciq/RCTConvert+LuciqEnums.h +18 -0
- package/ios/RNLuciq/RCTConvert+LuciqEnums.m +127 -0
- package/ios/RNLuciq/RNLuciq.h +35 -0
- package/ios/RNLuciq/RNLuciq.m +107 -0
- package/ios/RNLuciq/Util/LCQAPM+PrivateAPIs.h +15 -0
- package/ios/RNLuciq/Util/LCQCrashReporting+CP.h +13 -0
- package/ios/RNLuciq/Util/LCQNetworkLogger+CP.h +68 -0
- package/ios/RNLuciq/Util/Luciq+CP.h +12 -0
- package/ios/RNLuciq.xcodeproj/project.pbxproj +352 -0
- package/ios/native.rb +12 -0
- package/ios/sourcemaps.sh +120 -0
- package/migrate.js +569 -0
- package/package.json +92 -0
- package/plugin/build/index.js +42078 -0
- package/plugin/src/index.ts +5 -0
- package/plugin/src/pluginProps.ts +6 -0
- package/plugin/src/withLuciq.ts +51 -0
- package/plugin/src/withLuciqAndroid.ts +99 -0
- package/plugin/src/withLuciqIOS.ts +109 -0
- package/plugin/tsconfig.json +7 -0
- package/react-native.config.js +16 -0
- package/scripts/customize-ios-endpoints.sh +28 -0
- package/scripts/dream-11-delete-unused-features.sh +62 -0
- package/scripts/find-token.js +58 -0
- package/scripts/find-token.sh +70 -0
- package/scripts/notify-github.sh +15 -0
- package/scripts/replace.js +58 -0
- package/scripts/snapshot-comment.md +15 -0
- package/scripts/snapshot-version.sh +11 -0
- package/src/index.ts +40 -0
- package/src/models/FeatureFlag.ts +12 -0
- package/src/models/LuciqConfig.ts +48 -0
- package/src/models/NonFatalOptions.ts +16 -0
- package/src/models/OverAirUpdate.ts +14 -0
- package/src/models/Report.ts +124 -0
- package/src/models/ReproConfig.ts +31 -0
- package/src/models/SessionMetadata.ts +57 -0
- package/src/models/ThemeConfig.ts +34 -0
- package/src/models/W3cExternalTraceAttributes.ts +22 -0
- package/src/modules/APM.ts +117 -0
- package/src/modules/BugReporting.ts +254 -0
- package/src/modules/CrashReporting.ts +54 -0
- package/src/modules/FeatureRequests.ts +32 -0
- package/src/modules/Luciq.ts +934 -0
- package/src/modules/NetworkLogger.ts +270 -0
- package/src/modules/Replies.ts +137 -0
- package/src/modules/SessionReplay.ts +111 -0
- package/src/modules/Surveys.ts +118 -0
- package/src/native/NativeAPM.ts +51 -0
- package/src/native/NativeBugReporting.ts +70 -0
- package/src/native/NativeConstants.ts +215 -0
- package/src/native/NativeCrashReporting.ts +29 -0
- package/src/native/NativeFeatureRequests.ts +12 -0
- package/src/native/NativeLuciq.ts +179 -0
- package/src/native/NativeNetworkLogger.ts +42 -0
- package/src/native/NativePackage.ts +25 -0
- package/src/native/NativeReplies.ts +34 -0
- package/src/native/NativeSessionReplay.ts +21 -0
- package/src/native/NativeSurveys.ts +34 -0
- package/src/promise.d.ts +11 -0
- package/src/utils/AppStatesHandler.ts +19 -0
- package/src/utils/Enums.ts +266 -0
- package/src/utils/FeatureFlags.ts +33 -0
- package/src/utils/LuciqConstants.ts +24 -0
- package/src/utils/LuciqUtils.ts +417 -0
- package/src/utils/UnhandledRejectionTracking.ts +118 -0
- package/src/utils/XhrNetworkInterceptor.ts +333 -0
- package/src/utils/config.ts +7 -0
- package/src/utils/logger.ts +54 -0
- package/tsconfig.json +32 -0
- package/tsconfig.test.json +4 -0
- package/tsconfig.upload.json +10 -0
- package/upload/index.d.ts +4 -0
- package/upload/index.js +17314 -0
- package/upload/migrate.d.ts +14 -0
- package/upload/package.json +5 -0
- package/upload/uploadEasUpdatesSourcemaps.d.ts +21 -0
- package/upload/uploadSoFiles.d.ts +21 -0
- package/upload/uploadSourcemaps.d.ts +21 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LuciqNetworkLoggerBridge.m
|
|
3
|
+
// RNLuciq
|
|
4
|
+
//
|
|
5
|
+
// Created by Andrew Amin on 01/10/2024.
|
|
6
|
+
//
|
|
7
|
+
#import "LuciqNetworkLoggerBridge.h"
|
|
8
|
+
#import "Util/LCQNetworkLogger+CP.h"
|
|
9
|
+
|
|
10
|
+
#import <React/RCTLog.h>
|
|
11
|
+
#import <React/RCTConvert.h>
|
|
12
|
+
|
|
13
|
+
// Extend RCTConvert to handle NetworkListenerType enum conversion
|
|
14
|
+
@implementation RCTConvert (NetworkListenerType)
|
|
15
|
+
|
|
16
|
+
// The RCT_ENUM_CONVERTER macro handles the conversion between JS values (Int) and Objective-C enum values
|
|
17
|
+
RCT_ENUM_CONVERTER(NetworkListenerType, (@{
|
|
18
|
+
@"filtering": @(NetworkListenerTypeFiltering),
|
|
19
|
+
@"obfuscation": @(NetworkListenerTypeObfuscation),
|
|
20
|
+
@"both": @(NetworkListenerTypeBoth)
|
|
21
|
+
}), NetworkListenerTypeFiltering, integerValue)
|
|
22
|
+
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
@implementation LuciqNetworkLoggerBridge
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
- (instancetype)init {
|
|
29
|
+
self = [super init];
|
|
30
|
+
if (self) {
|
|
31
|
+
_requestObfuscationCompletionDictionary = [[NSMutableDictionary alloc] init];
|
|
32
|
+
_responseObfuscationCompletionDictionary = [[NSMutableDictionary alloc] init];
|
|
33
|
+
_requestFilteringCompletionDictionary = [[NSMutableDictionary alloc] init];
|
|
34
|
+
_responseFilteringCompletionDictionary = [[NSMutableDictionary alloc] init];
|
|
35
|
+
}
|
|
36
|
+
return self;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (dispatch_queue_t)methodQueue {
|
|
40
|
+
return dispatch_get_main_queue();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
+ (BOOL)requiresMainQueueSetup
|
|
44
|
+
{
|
|
45
|
+
return NO;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
49
|
+
return @[
|
|
50
|
+
@"LCQpreInvocationHandler",
|
|
51
|
+
@"LCQNetworkLoggerHandler"
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
RCT_EXPORT_MODULE(LCQNetworkLogger)
|
|
55
|
+
|
|
56
|
+
bool lcq_hasListeners = NO;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// Will be called when this module's first listener is added.
|
|
61
|
+
-(void)startObserving {
|
|
62
|
+
lcq_hasListeners = YES;
|
|
63
|
+
// Set up any upstream listeners or background tasks as necessary
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Will be called when this module's last listener is removed, or on dealloc.
|
|
67
|
+
-(void)stopObserving {
|
|
68
|
+
lcq_hasListeners = NO;
|
|
69
|
+
// Remove upstream listeners, stop unnecessary background tasks
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isNativeInterceptionEnabled) {
|
|
73
|
+
return @(LCQNetworkLogger.isNativeNetworkInterceptionFeatureEnabled);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
RCT_EXPORT_METHOD(registerNetworkLogsListener: (NetworkListenerType) listenerType) {
|
|
79
|
+
switch (listenerType) {
|
|
80
|
+
case NetworkListenerTypeFiltering:
|
|
81
|
+
[self setupRequestFilteringHandler];
|
|
82
|
+
break;
|
|
83
|
+
|
|
84
|
+
case NetworkListenerTypeObfuscation:
|
|
85
|
+
[self setupRequestObfuscationHandler];
|
|
86
|
+
break;
|
|
87
|
+
|
|
88
|
+
case NetworkListenerTypeBoth:
|
|
89
|
+
// The obfuscation handler sends additional data to the JavaScript side. If filtering is applied, the request will be ignored; otherwise, it will be obfuscated and saved in the database.
|
|
90
|
+
[self setupRequestObfuscationHandler];
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
default:
|
|
94
|
+
NSLog(@"Unknown NetworkListenerType");
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
RCT_EXPORT_METHOD(updateNetworkLogSnapshot:(NSString * _Nonnull)url
|
|
101
|
+
callbackID:(NSString * _Nonnull)callbackID
|
|
102
|
+
requestBody:(NSString * _Nullable)requestBody
|
|
103
|
+
responseBody:(NSString * _Nullable)responseBody
|
|
104
|
+
responseCode:(double)responseCode
|
|
105
|
+
requestHeaders:(NSDictionary * _Nullable)requestHeaders
|
|
106
|
+
responseHeaders:(NSDictionary * _Nullable)responseHeaders)
|
|
107
|
+
{
|
|
108
|
+
// Validate and construct the URL
|
|
109
|
+
NSURL *requestURL = [NSURL URLWithString:url];
|
|
110
|
+
if (!requestURL) {
|
|
111
|
+
NSLog(@"Invalid URL: %@", url);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Initialize the NSMutableURLRequest
|
|
116
|
+
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:requestURL];
|
|
117
|
+
|
|
118
|
+
// Set the HTTP body if provided
|
|
119
|
+
if (requestBody && [requestBody isKindOfClass:[NSString class]]) {
|
|
120
|
+
request.HTTPBody = [requestBody dataUsingEncoding:NSUTF8StringEncoding];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Ensure requestHeaders is a valid dictionary before setting it
|
|
124
|
+
if (requestHeaders && [requestHeaders isKindOfClass:[NSDictionary class]]) {
|
|
125
|
+
request.allHTTPHeaderFields = requestHeaders;
|
|
126
|
+
} else {
|
|
127
|
+
NSLog(@"Invalid requestHeaders format, expected NSDictionary.");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Ensure callbackID is valid and the completion handler exists
|
|
131
|
+
LCQURLRequestAsyncObfuscationCompletedHandler completionHandler = self.requestObfuscationCompletionDictionary[callbackID];
|
|
132
|
+
if (callbackID && [callbackID isKindOfClass:[NSString class]] && completionHandler) {
|
|
133
|
+
// Call the completion handler with the constructed request
|
|
134
|
+
completionHandler(request);
|
|
135
|
+
} else {
|
|
136
|
+
NSLog(@"CallbackID not found or completion handler is unavailable for CallbackID: %@", callbackID);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
RCT_EXPORT_METHOD(setNetworkLoggingRequestFilterPredicateIOS: (NSString * _Nonnull) callbackID : (BOOL)value ){
|
|
141
|
+
|
|
142
|
+
if (self.requestFilteringCompletionDictionary[callbackID] != nil) {
|
|
143
|
+
// ⬇️ YES == Request will be saved, NO == will be ignored
|
|
144
|
+
((LCQURLRequestResponseAsyncFilteringCompletedHandler)self.requestFilteringCompletionDictionary[callbackID])(value);
|
|
145
|
+
} else {
|
|
146
|
+
NSLog(@"Not Available Completion");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
#pragma mark - Helper Methods
|
|
152
|
+
|
|
153
|
+
// Set up the filtering handler
|
|
154
|
+
- (void)setupRequestFilteringHandler {
|
|
155
|
+
[LCQNetworkLogger setCPRequestFilteringHandler:^(NSURLRequest * _Nonnull request, void (^ _Nonnull completion)(BOOL)) {
|
|
156
|
+
NSString *callbackID = [[[NSUUID alloc] init] UUIDString];
|
|
157
|
+
self.requestFilteringCompletionDictionary[callbackID] = completion;
|
|
158
|
+
|
|
159
|
+
NSDictionary *dict = [self createNetworkRequestDictForRequest:request callbackID:callbackID];
|
|
160
|
+
if(lcq_hasListeners){
|
|
161
|
+
[self sendEventWithName:@"LCQNetworkLoggerHandler" body:dict];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Set up the obfuscation handler
|
|
168
|
+
- (void)setupRequestObfuscationHandler {
|
|
169
|
+
[LCQNetworkLogger setCPRequestAsyncObfuscationHandler:^(NSURLRequest * _Nonnull request, void (^ _Nonnull completion)(NSURLRequest * _Nonnull)) {
|
|
170
|
+
NSString *callbackID = [[[NSUUID alloc] init] UUIDString];
|
|
171
|
+
self.requestObfuscationCompletionDictionary[callbackID] = completion;
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
NSDictionary *dict = [self createNetworkRequestDictForRequest:request callbackID:callbackID];
|
|
175
|
+
if (lcq_hasListeners) {
|
|
176
|
+
[self sendEventWithName:@"LCQNetworkLoggerHandler" body:dict];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
}];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Helper to create a dictionary from the request and callbackID
|
|
183
|
+
- (NSDictionary *)createNetworkRequestDictForRequest:(NSURLRequest *)request callbackID:(NSString *)callbackID {
|
|
184
|
+
NSString *urlString = request.URL.absoluteString ?: @"";
|
|
185
|
+
NSString *bodyString = [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding] ?: @"";
|
|
186
|
+
NSDictionary *headerDict = request.allHTTPHeaderFields ?: @{};
|
|
187
|
+
|
|
188
|
+
return @{
|
|
189
|
+
@"id": callbackID,
|
|
190
|
+
@"url": urlString,
|
|
191
|
+
@"requestBody": bodyString,
|
|
192
|
+
@"requestHeader": headerDict
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
RCT_EXPORT_METHOD(forceStartNetworkLoggingIOS) {
|
|
197
|
+
[LCQNetworkLogger forceStartNetworkLogging];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
RCT_EXPORT_METHOD(forceStopNetworkLoggingIOS) {
|
|
201
|
+
[LCQNetworkLogger forceStopNetworkLogging];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
@end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LuciqReactBridge.h
|
|
3
|
+
// luciqDemo
|
|
4
|
+
//
|
|
5
|
+
// Created by Yousef Hamza on 9/29/16.
|
|
6
|
+
// Copyright © 2016 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <React/RCTBridgeModule.h>
|
|
11
|
+
#import <React/RCTEventEmitter.h>
|
|
12
|
+
#import <LuciqSDK/LuciqSDK.h>
|
|
13
|
+
#import <LuciqSDK/LCQBugReporting.h>
|
|
14
|
+
#import <LuciqSDK/LCQCrashReporting.h>
|
|
15
|
+
#import <LuciqSDK/LCQLog.h>
|
|
16
|
+
#import <LuciqSDK/LCQTypes.h>
|
|
17
|
+
#import "ArgsRegistry.h"
|
|
18
|
+
|
|
19
|
+
@interface LuciqReactBridge : RCTEventEmitter <RCTBridgeModule>
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
+------------------------------------------------------------------------+
|
|
23
|
+
| Luciq Module |
|
|
24
|
+
+------------------------------------------------------------------------+
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
- (void)setEnabled:(BOOL)isEnabled;
|
|
28
|
+
|
|
29
|
+
- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(LCQSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion appVariant:(NSString *)appVariant options:(nullable NSDictionary *)options overAirVersion:(NSDictionary *)overAirVersion;
|
|
30
|
+
|
|
31
|
+
- (void)setCodePushVersion:(NSString *)version;
|
|
32
|
+
|
|
33
|
+
- (void)setOverAirVersion:(NSDictionary *)overAirVersion;
|
|
34
|
+
|
|
35
|
+
- (void)setUserData:(NSString *)userData;
|
|
36
|
+
|
|
37
|
+
- (void)setAppVariant:(NSString *)appVariant;
|
|
38
|
+
|
|
39
|
+
- (void)setTrackUserSteps:(BOOL)isEnabled;
|
|
40
|
+
|
|
41
|
+
- (void)setSessionProfilerEnabled:(BOOL)sessionProfilerEnabled;
|
|
42
|
+
|
|
43
|
+
- (void)setLocale:(LCQLocale)locale;
|
|
44
|
+
|
|
45
|
+
- (void)setColorTheme:(LCQColorTheme)colorTheme;
|
|
46
|
+
|
|
47
|
+
- (void)setPrimaryColor:(UIColor *)color;
|
|
48
|
+
|
|
49
|
+
- (void)setTheme:(NSDictionary *)themeConfig;
|
|
50
|
+
|
|
51
|
+
- (void)appendTags:(NSArray *)tags;
|
|
52
|
+
|
|
53
|
+
- (void)resetTags;
|
|
54
|
+
|
|
55
|
+
- (void)getTags:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject;
|
|
56
|
+
|
|
57
|
+
- (void)setString:(NSString *)value toKey:(NSString *)key;
|
|
58
|
+
|
|
59
|
+
- (void)identifyUser:(NSString *)email name:(NSString *)name userId:(nullable NSString *)userId;
|
|
60
|
+
|
|
61
|
+
- (void)logOut;
|
|
62
|
+
|
|
63
|
+
- (void)logUserEvent:(NSString *)name;
|
|
64
|
+
|
|
65
|
+
- (void)logVerbose:(NSString *)log;
|
|
66
|
+
|
|
67
|
+
- (void)setReproStepsConfig:(LCQUserStepsMode)bugMode:(LCQUserStepsMode)crashMode:(LCQUserStepsMode)sessionReplayMode;
|
|
68
|
+
|
|
69
|
+
- (void)setUserAttribute:(NSString *)key withValue:(NSString *)value;
|
|
70
|
+
|
|
71
|
+
- (void)getUserAttribute:(NSString *)key
|
|
72
|
+
:(RCTPromiseResolveBlock)resolve
|
|
73
|
+
:(RCTPromiseRejectBlock)reject;
|
|
74
|
+
|
|
75
|
+
- (void)removeUserAttribute:(NSString *)key;
|
|
76
|
+
|
|
77
|
+
- (void)getAllUserAttributes:(RCTPromiseResolveBlock)resolve
|
|
78
|
+
:(RCTPromiseRejectBlock)reject;
|
|
79
|
+
|
|
80
|
+
- (void)clearAllUserAttributes;
|
|
81
|
+
|
|
82
|
+
- (void)showWelcomeMessageWithMode:(LCQWelcomeMessageMode)welcomeMessageMode;
|
|
83
|
+
|
|
84
|
+
- (void)setWelcomeMessageMode:(LCQWelcomeMessageMode)welcomeMessageMode;
|
|
85
|
+
|
|
86
|
+
- (void)setFileAttachment:(NSString *)fileLocation;
|
|
87
|
+
|
|
88
|
+
- (void)show;
|
|
89
|
+
|
|
90
|
+
- (void) willRedirectToStore;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
+------------------------------------------------------------------------+
|
|
95
|
+
| Log Module |
|
|
96
|
+
+------------------------------------------------------------------------+
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
- (void)setLCQLogPrintsToConsole:(BOOL)printsToConsole;
|
|
100
|
+
- (void)logVerbose:(NSString *)log;
|
|
101
|
+
- (void)logDebug:(NSString *)log;
|
|
102
|
+
- (void)logInfo:(NSString *)log;
|
|
103
|
+
- (void)logWarn:(NSString *)log;
|
|
104
|
+
- (void)logError:(NSString *)log;
|
|
105
|
+
- (void)clearLogs;
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
+------------------------------------------------------------------------+
|
|
109
|
+
| Network Logging |
|
|
110
|
+
+------------------------------------------------------------------------+
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
- (void)setNetworkLoggingEnabled:(BOOL)isEnabled;
|
|
114
|
+
- (void)isW3ExternalTraceIDEnabled:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject;
|
|
115
|
+
- (void)isW3ExternalGeneratedHeaderEnabled:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject;
|
|
116
|
+
- (void)isW3CaughtHeaderEnabled:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject;
|
|
117
|
+
- (void)networkLogIOS:(NSString * _Nonnull)url
|
|
118
|
+
method:(NSString * _Nonnull)method
|
|
119
|
+
requestBody:(NSString * _Nonnull)requestBody
|
|
120
|
+
requestBodySize:(double)requestBodySize
|
|
121
|
+
responseBody:(NSString * _Nonnull)responseBody
|
|
122
|
+
responseBodySize:(double)responseBodySize
|
|
123
|
+
responseCode:(double)responseCode
|
|
124
|
+
requestHeaders:(NSDictionary * _Nonnull)requestHeaders
|
|
125
|
+
responseHeaders:(NSDictionary * _Nonnull)responseHeaders
|
|
126
|
+
contentType:(NSString * _Nonnull)contentType
|
|
127
|
+
errorDomain:(NSString * _Nullable)errorDomain
|
|
128
|
+
errorCode:(double)errorCode
|
|
129
|
+
startTime:(double)startTime
|
|
130
|
+
duration:(double)duration
|
|
131
|
+
gqlQueryName:(NSString * _Nullable)gqlQueryName
|
|
132
|
+
serverErrorMessage:(NSString * _Nullable)serverErrorMessage
|
|
133
|
+
w3cExternalTraceAttributes:(NSDictionary * _Nullable)w3cExternalTraceAttributes;
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
+------------------------------------------------------------------------+
|
|
137
|
+
| Experiments |
|
|
138
|
+
+------------------------------------------------------------------------+
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
- (void)addExperiments:(NSArray *)experiments;
|
|
142
|
+
- (void)removeExperiments:(NSArray *)experiments;
|
|
143
|
+
- (void)clearAllExperiments;
|
|
144
|
+
- (void)addFeatureFlags:(NSDictionary *)featureFlagsMap;
|
|
145
|
+
- (void)removeFeatureFlags:(NSArray *)featureFlags;
|
|
146
|
+
- (void)removeAllFeatureFlags;
|
|
147
|
+
- (void)setNetworkLogBodyEnabled:(BOOL)isEnabled;
|
|
148
|
+
- (void)enableAutoMasking:(NSArray *)autoMaskingTypes;
|
|
149
|
+
- (void)getNetworkBodyMaxSize:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject;
|
|
150
|
+
|
|
151
|
+
@end
|