Pick one of the log levels described in {@link LogLevel}. - * default logLevel is {@link LogLevel#ERROR}
- * @param InvocationEvent The events that trigger the SDK's user interface. - * Choose from the available events listed in {@link InstabugInvocationEvent}. - * + * @param logLevel The level of detail in logs that you want to print. + *Pick one of the log levels described in {@link LogLevel}. + * default logLevel is {@link LogLevel#ERROR}
+ * @param InvocationEvent The events that trigger the SDK's user interface. + * Choose from the available events listed in {@link InstabugInvocationEvent}. * @exampleHere's an example usage:
** RNInstabug.getInstance().init( @@ -59,17 +59,24 @@ public void init( @NonNull Application application, @NonNull String applicationToken, int logLevel, + Boolean ignoreSecureFlag, @NonNull InstabugInvocationEvent... InvocationEvent - ) { + ) { try { setBaseUrlForDeprecationLogs(); setCurrentPlatform(); - new Instabug.Builder(application, applicationToken) + Instabug.Builder builder = new Instabug.Builder(application, applicationToken) .setInvocationEvents(InvocationEvent) - .setSdkDebugLogsLevel(logLevel) - .build(); + .setSdkDebugLogsLevel(logLevel); + + if (ignoreSecureFlag != null) { + builder.ignoreFlagSecure(ignoreSecureFlag); + } + + builder.build(); + // Temporarily disabling APM hot launches APM.setHotAppLaunchEnabled(false); @@ -80,15 +87,13 @@ public void init( } - /** * Initializes the SDK on the native side, which is useful for capturing startup issues specific to the native part of the app. * - * @param application The application context. + * @param application The application context. * @param applicationToken The app's identifying token, available on your dashboard. - * @param invocationEvent The events that trigger the SDK's user interface. - * Choose from the available events listed in {@link InstabugInvocationEvent}. - * + * @param invocationEvent The events that trigger the SDK's user interface. + * Choose from the available events listed in {@link InstabugInvocationEvent}. * @exampleHere's an example usage:
** RNInstabug.getInstance().init( @@ -104,7 +109,7 @@ public void init( @NonNull String applicationToken, @NonNull InstabugInvocationEvent... invocationEvent ) { - init(application, applicationToken, LogLevel.ERROR, invocationEvent); + init(application, applicationToken, LogLevel.ERROR,null, invocationEvent); } @VisibleForTesting @@ -160,6 +165,7 @@ public static class Builder { * The events that trigger the SDK's user interface. */ private InstabugInvocationEvent[] invocationEvents; + private Boolean ignoreFlagSecure; /** @@ -210,6 +216,16 @@ public Builder setCodePushVersion(String codePushVersion) { return this; } + /** + * Sets flag to override SDK screenshot security behavior. + * + * @param ignoreFlagSecure flag to override SDK screenshot security behavior. + */ + public Builder ignoreFlagSecure(boolean ignoreFlagSecure) { + this.ignoreFlagSecure = ignoreFlagSecure; + return this; + } + /** * Sets the invocation triggering events for the SDK's user interface * @@ -237,6 +253,10 @@ public void build() { instabugBuilder.setCodePushVersion(codePushVersion); } + if (ignoreFlagSecure != null) { + instabugBuilder.ignoreFlagSecure(ignoreFlagSecure); + } + instabugBuilder.build(); // Temporarily disabling APM hot launches diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index 17f48656f..69df22869 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -148,7 +148,8 @@ public void init( final ReadableArray invocationEventValues, final String logLevel, final boolean useNativeNetworkInterception, - @Nullable final String codePushVersion + @Nullable final String codePushVersion, + final ReadableMap map ) { MainThreadHandler.runOnMainThread(new Runnable() { @Override @@ -166,6 +167,10 @@ public void run() { .setInvocationEvents(invocationEvents) .setLogLevel(parsedLogLevel); + if (map!=null&&map.hasKey("ignoreFlagSecure")) { + builder.ignoreFlagSecure(map.getBoolean("ignoreFlagSecure")); + } + if (codePushVersion != null) { if (Instabug.isBuilt()) { Instabug.setCodePushVersion(codePushVersion); diff --git a/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java b/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java index df169df1e..625eab1c9 100644 --- a/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java +++ b/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java @@ -4,6 +4,7 @@ import static com.instabug.reactlibrary.util.GlobalMocks.reflected; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockConstruction; @@ -62,18 +63,20 @@ public void testInitWithLogLevel() { // Initializes Instabug with the correct token assertEquals(token, actualToken); when(mock.setSdkDebugLogsLevel(anyInt())).thenReturn(mock); + when(mock.ignoreFlagSecure(anyBoolean())).thenReturn(mock); when(mock.setInvocationEvents(any())).thenReturn(mock); }); - sut.init(mContext, token, logLevel, invocationEvents); + sut.init(mContext, token, logLevel, true, invocationEvents); Instabug.Builder builder = mInstabugBuilder.constructed().get(0); // Here we check that it has changed to verbose value of the `logLevel` property verify(builder).setSdkDebugLogsLevel(LogLevel.VERBOSE); verify(builder).setInvocationEvents(invocationEvents); - verify(builder).build(); + verify(builder).ignoreFlagSecure(true); + verify(builder).build(); verify(sut).setBaseUrlForDeprecationLogs(); @@ -95,7 +98,7 @@ public void testInitWithoutLogLevel() { sut.init(mContext, token, invocationEvents); - verify(sut).init(mContext, token, defaultLogLevel, invocationEvents); + verify(sut).init(mContext, token, defaultLogLevel, null,invocationEvents); mInstabugBuilder.close(); } diff --git a/examples/default/ios/InstabugTests/InstabugSampleTests.m b/examples/default/ios/InstabugTests/InstabugSampleTests.m index ded37c3af..34fe9cfe3 100644 --- a/examples/default/ios/InstabugTests/InstabugSampleTests.m +++ b/examples/default/ios/InstabugTests/InstabugSampleTests.m @@ -75,7 +75,9 @@ - (void)testInit { OCMStub([mock setCodePushVersion:codePushVersion]); - [self.instabugBridge init:appToken invocationEvents:invocationEvents debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception codePushVersion:codePushVersion]; + [self.instabugBridge init:appToken invocationEvents:invocationEvents debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception codePushVersion:codePushVersion + options:nil + ]; OCMVerify([mock setCodePushVersion:codePushVersion]); OCMVerify([self.mRNInstabug initWithToken:appToken invocationEvents:floatingButtonInvocationEvent debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception]); @@ -610,18 +612,18 @@ - (void) testIsW3CaughtHeaderEnabled { - (void)testEnableAutoMasking { id mock = OCMClassMock([Instabug class]); - + NSArray *autoMaskingTypes = [NSArray arrayWithObjects: [NSNumber numberWithInteger:IBGAutoMaskScreenshotOptionLabels], [NSNumber numberWithInteger:IBGAutoMaskScreenshotOptionTextInputs], [NSNumber numberWithInteger:IBGAutoMaskScreenshotOptionMedia], [NSNumber numberWithInteger:IBGAutoMaskScreenshotOptionMaskNothing], nil]; - + OCMStub([mock setAutoMaskScreenshots:IBGAutoMaskScreenshotOptionLabels | IBGAutoMaskScreenshotOptionTextInputs | IBGAutoMaskScreenshotOptionMedia | IBGAutoMaskScreenshotOptionMaskNothing]); - + [self.instabugBridge enableAutoMasking:autoMaskingTypes]; - + OCMVerify([mock setAutoMaskScreenshots:IBGAutoMaskScreenshotOptionLabels | IBGAutoMaskScreenshotOptionTextInputs | IBGAutoMaskScreenshotOptionMedia | IBGAutoMaskScreenshotOptionMaskNothing]); } diff --git a/ios/RNInstabug/InstabugReactBridge.h b/ios/RNInstabug/InstabugReactBridge.h index 1fe5505d3..45c075098 100644 --- a/ios/RNInstabug/InstabugReactBridge.h +++ b/ios/RNInstabug/InstabugReactBridge.h @@ -26,7 +26,8 @@ - (void)setEnabled:(BOOL)isEnabled; -- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion; +- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion +options:(nullable NSDictionary *)options; - (void)setCodePushVersion:(NSString *)version; diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index a48851ba8..682896515 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -41,7 +41,9 @@ - (dispatch_queue_t)methodQueue { invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception - codePushVersion:(NSString *)codePushVersion) { + codePushVersion:(NSString *)codePushVersion + options:(nullable NSDictionary *)options + ) { IBGInvocationEvent invocationEvents = 0; for (NSNumber *boxedValue in invocationEventsArray) { diff --git a/src/models/InstabugConfig.ts b/src/models/InstabugConfig.ts index 614ade892..af1d6e841 100644 --- a/src/models/InstabugConfig.ts +++ b/src/models/InstabugConfig.ts @@ -19,6 +19,11 @@ export interface InstabugConfig { */ codePushVersion?: string; + /** + * An optional flag to override SDK screenshot security behavior. + */ + ignoreAndroidSecureFlag?: boolean; + /** * An optional network interception mode, this determines whether network interception * is done in the JavaScript side or in the native Android and iOS SDK side. diff --git a/src/modules/Instabug.ts b/src/modules/Instabug.ts index 79ec492a5..fd4f17600 100644 --- a/src/modules/Instabug.ts +++ b/src/modules/Instabug.ts @@ -273,6 +273,11 @@ const initializeNativeInstabug = (config: InstabugConfig) => { shouldEnableNativeInterception && config.networkInterceptionMode === NetworkInterceptionMode.native, config.codePushVersion, + config.ignoreAndroidSecureFlag != null + ? { + ignoreAndroidSecureFlag: config.ignoreAndroidSecureFlag, + } + : undefined, ); }; diff --git a/src/native/NativeInstabug.ts b/src/native/NativeInstabug.ts index 7032bbc07..c9c078f37 100644 --- a/src/native/NativeInstabug.ts +++ b/src/native/NativeInstabug.ts @@ -26,6 +26,9 @@ export interface InstabugNativeModule extends NativeModule { debugLogsLevel: LogLevel, useNativeNetworkInterception: boolean, codePushVersion?: string, + options?: { + ignoreAndroidSecureFlag?: boolean; + }, ): void; show(): void; diff --git a/test/modules/Instabug.spec.ts b/test/modules/Instabug.spec.ts index d3d53e461..eeec8e8e4 100644 --- a/test/modules/Instabug.spec.ts +++ b/test/modules/Instabug.spec.ts @@ -294,6 +294,7 @@ describe('Instabug Module', () => { invocationEvents: [InvocationEvent.floatingButton, InvocationEvent.shake], debugLogsLevel: LogLevel.debug, codePushVersion: '1.1.0', + ignoreAndroidSecureFlag: true, }; const usesNativeNetworkInterception = false; @@ -307,6 +308,7 @@ describe('Instabug Module', () => { instabugConfig.debugLogsLevel, usesNativeNetworkInterception, instabugConfig.codePushVersion, + { ignoreAndroidSecureFlag: instabugConfig.ignoreAndroidSecureFlag }, ); }); @@ -326,6 +328,7 @@ describe('Instabug Module', () => { debugLogsLevel: LogLevel.debug, networkInterceptionMode: NetworkInterceptionMode.native, codePushVersion: '1.1.0', + ignoreAndroidSecureFlag: true, }; // Stubbing Network feature flags @@ -356,6 +359,7 @@ describe('Instabug Module', () => { // usesNativeNetworkInterception should be true when using native interception mode with iOS true, instabugConfig.codePushVersion, + { ignoreAndroidSecureFlag: instabugConfig.ignoreAndroidSecureFlag }, ); } }); @@ -955,6 +959,7 @@ describe('Instabug iOS initialization tests', () => { config.debugLogsLevel, false, // Disable native interception config.codePushVersion, + config.ignoreAndroidSecureFlag, ); }); @@ -971,6 +976,7 @@ describe('Instabug iOS initialization tests', () => { config.debugLogsLevel, true, // Enable native interception config.codePushVersion, + config.ignoreAndroidSecureFlag, ); }); @@ -987,6 +993,7 @@ describe('Instabug iOS initialization tests', () => { config.debugLogsLevel, false, // Disable native interception config.codePushVersion, + config.ignoreAndroidSecureFlag, ); }); @@ -1029,6 +1036,7 @@ describe('Instabug Android initialization tests', () => { config.debugLogsLevel, false, // always disable native interception to insure sending network logs to core (Bugs & Crashes). config.codePushVersion, + { ignoreAndroidSecureFlag: config.ignoreAndroidSecureFlag }, ); }); }); From 1c0b12cc86d701a61f5c7d2ef84d90c8f601687b Mon Sep 17 00:00:00 2001 From: ahmed alaa <154802748+ahmedAlaaInstabug@users.noreply.github.com> Date: Wed, 6 Aug 2025 11:45:56 +0300 Subject: [PATCH 3/4] Release: v15.0.2 --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f99a30df8..f4ede5591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ - Add support for ignoreFlagSecure to bypass SDK screenshot security protocols on Android. ([#1394](https://github.com/Instabug/Instabug-React-Native/pull/1394)) -- Rollout support for network spans. ([#1427](https://github.com/Instabug/Instabug-React-Native/pull/1427)) +### Fixed + +- async initialization. ([#1427](https://github.com/Instabug/Instabug-React-Native/pull/1427)) ## [15.0.1](https://github.com/Instabug/Instabug-React-Native/compare/v14.3.0...v15.0.1) From 999af159f51ee3a8803b046c78f68cdccbb505f7 Mon Sep 17 00:00:00 2001 From: ahmed alaa <154802748+ahmedAlaaInstabug@users.noreply.github.com> Date: Thu, 7 Aug 2025 14:20:24 +0300 Subject: [PATCH 4/4] Release: v15.0.2 --- .../instabug/reactlibrary/RNInstabugReactnativeModule.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index 69df22869..21bcf4f44 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -167,8 +167,8 @@ public void run() { .setInvocationEvents(invocationEvents) .setLogLevel(parsedLogLevel); - if (map!=null&&map.hasKey("ignoreFlagSecure")) { - builder.ignoreFlagSecure(map.getBoolean("ignoreFlagSecure")); + if (map!=null&&map.hasKey("ignoreAndroidSecureFlag")) { + builder.ignoreFlagSecure(map.getBoolean("ignoreAndroidSecureFlag")); } if (codePushVersion != null) {