1212#import < Instabug/IBGLog.h>
1313#import < Instabug/IBGAPM.h>
1414#import < asl.h>
15- #import < React/RCTLog.h>
1615#import < os/log.h>
17- #import < Instabug/IBGTypes.h>
1816#import < React/RCTUIManager.h>
19- #import " Util/IBGNetworkLogger+CP .h"
17+ #import " RNInstabug .h"
2018
2119@interface Instabug (PrivateWillSendAPI)
2220+ (void )setWillSendReportHandler_private : (void (^)(IBGReport *report, void (^reportCompletionHandler)(IBGReport *)))willSendReportHandler_private ;
@@ -40,31 +38,13 @@ - (dispatch_queue_t)methodQueue {
4038}
4139
4240RCT_EXPORT_METHOD (init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel) {
43- SEL setPrivateApiSEL = NSSelectorFromString (@" setCurrentPlatform:" );
44- if ([[Instabug class ] respondsToSelector: setPrivateApiSEL]) {
45- NSInteger *platform = IBGPlatformReactNative;
46- NSInvocation *inv = [NSInvocation invocationWithMethodSignature: [[Instabug class ] methodSignatureForSelector: setPrivateApiSEL]];
47- [inv setSelector: setPrivateApiSEL];
48- [inv setTarget: [Instabug class ]];
49- [inv setArgument: &(platform) atIndex: 2 ];
50- [inv invoke ];
51- }
5241 IBGInvocationEvent invocationEvents = 0 ;
53- NSLog ( @" invocation events: %ld " ,( long )invocationEvents);
42+
5443 for (NSNumber *boxedValue in invocationEventsArray) {
5544 invocationEvents |= [boxedValue intValue ];
5645 }
57- [IBGNetworkLogger disableAutomaticCapturingOfNetworkLogs ];
58- [Instabug startWithToken: token invocationEvents: invocationEvents];
59- [Instabug setSdkDebugLogsLevel: sdkDebugLogsLevel];
6046
61- RCTAddLogFunction (InstabugReactLogFunction);
62- RCTSetLogThreshold (RCTLogLevelInfo);
63-
64- IBGNetworkLogger.enabled = YES ;
65-
66- // Temporarily disabling APM hot launches
67- IBGAPM.hotAppLaunchEnabled = NO ;
47+ [RNInstabug initWithToken: token invocationEvents: invocationEvents debugLogsLevel: sdkDebugLogsLevel];
6848}
6949
7050RCT_EXPORT_METHOD (setReproStepsConfig:(IBGUserStepsMode)bugMode :(IBGUserStepsMode)crashMode:(IBGUserStepsMode)sessionReplayMode) {
@@ -415,44 +395,4 @@ + (BOOL)iOSVersionIsLessThan:(NSString *)iOSVersion {
415395 return [iOSVersion compare: [UIDevice currentDevice ].systemVersion options: NSNumericSearch] == NSOrderedDescending;
416396};
417397
418- // Note: This function is used to bridge IBGNSLog with RCTLogFunction.
419- // This log function should not be used externally and is only an implementation detail.
420- void RNIBGLog (IBGLogLevel logLevel, NSString *format, ...) {
421- va_list arg_list;
422- va_start (arg_list, format);
423- IBGNSLogWithLevel (format, arg_list, logLevel);
424- va_end (arg_list);
425- }
426-
427- RCTLogFunction InstabugReactLogFunction = ^(
428- RCTLogLevel level,
429- __unused RCTLogSource source,
430- NSString *fileName,
431- NSNumber *lineNumber,
432- NSString *message
433- )
434- {
435- NSString *formatString = @" Instabug - REACT LOG: %@ " ;
436- NSString *log = RCTFormatLog ([NSDate date ], level, fileName, lineNumber, message);
437-
438- switch (level) {
439- case RCTLogLevelTrace:
440- RNIBGLog (IBGLogLevelVerbose, formatString, log);
441- break ;
442- case RCTLogLevelInfo:
443- RNIBGLog (IBGLogLevelInfo, formatString, log);
444- break ;
445- case RCTLogLevelWarning:
446- RNIBGLog (IBGLogLevelWarning, formatString, log);
447- break ;
448- case RCTLogLevelError:
449- RNIBGLog (IBGLogLevelError, formatString, log);
450- break ;
451- case RCTLogLevelFatal:
452- RNIBGLog (IBGLogLevelError, formatString, log);
453- break ;
454- }
455- };
456-
457-
458398@end
0 commit comments