diff --git a/CHANGELOG.md b/CHANGELOG.md index a637b666c..c1ad3c8b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Added +- Add support for App variant. ([#1409](https://github.com/Instabug/Instabug-React-Native/pull/1409)) + - Add support enable/disable screenshot auto masking. ([#1389](https://github.com/Instabug/Instabug-React-Native/pull/1389)) - Add support for BugReporting user consents. ([#1383](https://github.com/Instabug/Instabug-React-Native/pull/1383)) diff --git a/android/native.gradle b/android/native.gradle index b7790876e..faa3246cd 100644 --- a/android/native.gradle +++ b/android/native.gradle @@ -1,5 +1,5 @@ project.ext.instabug = [ - version: '14.3.0.6760192-SNAPSHOT' + version: '15.0.1' ] dependencies { diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabug.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabug.java index 9b6348ab4..bbc5bf50d 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabug.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabug.java @@ -19,7 +19,8 @@ public class RNInstabug { private static RNInstabug instance; - private RNInstabug() {} + private RNInstabug() { + } public static RNInstabug getInstance() { @@ -36,14 +37,13 @@ public static RNInstabug getInstance() { /** * 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 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}. - * + * @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,29 @@ public void init( @NonNull Application application, @NonNull String applicationToken, int logLevel, + String codePushVersion, + String appVariant, @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(codePushVersion!=null){ + builder.setCodePushVersion(codePushVersion); + } + if(appVariant!=null) + builder.setAppVariant(appVariant); + + + builder.build(); // Temporarily disabling APM hot launches APM.setHotAppLaunchEnabled(false); @@ -80,15 +92,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( @@ -102,9 +112,11 @@ public void init( public void init( @NonNull Application application, @NonNull String applicationToken, + String codePushVersion, + String appVariant, @NonNull InstabugInvocationEvent... invocationEvent ) { - init(application, applicationToken, LogLevel.ERROR, invocationEvent); + init(application, applicationToken, LogLevel.ERROR,codePushVersion,appVariant, invocationEvent); } @VisibleForTesting @@ -160,6 +172,10 @@ public static class Builder { * The events that trigger the SDK's user interface. */ private InstabugInvocationEvent[] invocationEvents; + /** + * The App variant name to be used for all reports. + */ + private String appVariant; /** @@ -221,6 +237,16 @@ public Builder setInvocationEvents(InstabugInvocationEvent... invocationEvents) return this; } + /** + * Sets the invocation triggering events for the SDK's user interface + * + * @param appVariant the current App variant to work with. + */ + public Builder setAppVariant(String appVariant) { + this.appVariant = appVariant; + return this; + } + /** * Builds the Instabug instance with the provided configurations. */ @@ -236,6 +262,9 @@ public void build() { if (codePushVersion != null) { instabugBuilder.setCodePushVersion(codePushVersion); } + if(appVariant!=null){ + instabugBuilder.setAppVariant(appVariant); + } instabugBuilder.build(); diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index 17f48656f..431a8ca42 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -148,7 +148,9 @@ public void init( final ReadableArray invocationEventValues, final String logLevel, final boolean useNativeNetworkInterception, - @Nullable final String codePushVersion + @Nullable final String codePushVersion, + @Nullable final String appVariant + ) { MainThreadHandler.runOnMainThread(new Runnable() { @Override @@ -173,6 +175,9 @@ public void run() { builder.setCodePushVersion(codePushVersion); } } + if (appVariant != null) { + builder.setAppVariant(appVariant); + } builder.build(); } }); @@ -500,6 +505,8 @@ public void run() { }); } + + /** * Removes user attribute if exists. * @@ -1037,7 +1044,7 @@ public void run() { } /** - * @deprecated see {@link #addFeatureFlags(ReadableArray)} + * @deprecated see {@link #addFeatureFlags(ReadableMap)} */ @ReactMethod public void addExperiments(final ReadableArray experiments) { @@ -1351,4 +1358,19 @@ public void run() { } }); } + + /** + * Sets current App variant + * + * @param appVariant The app variant name . + */ + @ReactMethod + public void setAppVariant(@NonNull String appVariant) { + try { + Instabug.setAppVariant(appVariant); + + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java b/android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java index f4f6f9bc1..9b46bf854 100644 --- a/android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java +++ b/android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java @@ -631,6 +631,16 @@ public void testRemoveAllFeatureFlags() { mockInstabug.verify(() -> Instabug.removeAllFeatureFlags()); } + @Test + public void testSetAppVariant() { + String appVariant="App-variant"; + // when + rnModule.setAppVariant(appVariant); + + // then + mockInstabug.verify(() -> Instabug.setAppVariant(appVariant)); + } + @Test public void testWillRedirectToStore() { // when @@ -678,7 +688,7 @@ public void testSetNetworkLogBodyDisabled() { mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(false)); } - + @Test public void testEnableAutoMasking(){ diff --git a/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java b/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java index df169df1e..de0006783 100644 --- a/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java +++ b/android/src/test/java/com/instabug/reactlibrary/RNInstabugTest.java @@ -65,7 +65,7 @@ public void testInitWithLogLevel() { when(mock.setInvocationEvents(any())).thenReturn(mock); }); - sut.init(mContext, token, logLevel, invocationEvents); + sut.init(mContext, token, logLevel, null, null, invocationEvents); Instabug.Builder builder = mInstabugBuilder.constructed().get(0); @@ -75,7 +75,6 @@ public void testInitWithLogLevel() { verify(builder).build(); - verify(sut).setBaseUrlForDeprecationLogs(); verify(sut).setCurrentPlatform(); mInstabugBuilder.close(); @@ -86,16 +85,19 @@ public void testInitWithoutLogLevel() { final InstabugInvocationEvent[] invocationEvents = new InstabugInvocationEvent[]{InstabugInvocationEvent.FLOATING_BUTTON}; final String token = "fde...."; final int defaultLogLevel = LogLevel.ERROR; + final String appVariant = "app-variant"; MockedConstructionmInstabugBuilder = mockConstruction( Instabug.Builder.class, (mock, context) -> { when(mock.setSdkDebugLogsLevel(anyInt())).thenReturn(mock); when(mock.setInvocationEvents(any())).thenReturn(mock); + when(mock.setAppVariant(any())).thenReturn(mock); + }); - sut.init(mContext, token, invocationEvents); + sut.init(mContext, token, null, appVariant, invocationEvents); - verify(sut).init(mContext, token, defaultLogLevel, invocationEvents); + verify(sut).init(mContext, token, defaultLogLevel, null, appVariant, invocationEvents); mInstabugBuilder.close(); } diff --git a/examples/default/ios/InstabugTests/InstabugSampleTests.m b/examples/default/ios/InstabugTests/InstabugSampleTests.m index ded37c3af..f1960a354 100644 --- a/examples/default/ios/InstabugTests/InstabugSampleTests.m +++ b/examples/default/ios/InstabugTests/InstabugSampleTests.m @@ -69,15 +69,19 @@ - (void)testInit { IBGInvocationEvent floatingButtonInvocationEvent = IBGInvocationEventFloatingButton; NSString *appToken = @"app_token"; NSString *codePushVersion = @"1.0.0(1)"; + NSString *appVariant = @"variant 1"; + NSArray *invocationEvents = [NSArray arrayWithObjects:[NSNumber numberWithInteger:floatingButtonInvocationEvent], nil]; BOOL useNativeNetworkInterception = YES; IBGSDKDebugLogsLevel sdkDebugLogsLevel = IBGSDKDebugLogsLevelDebug; 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 appVariant:appVariant]; OCMVerify([mock setCodePushVersion:codePushVersion]); + XCTAssertEqual(Instabug.appVariant, appVariant); + OCMVerify([self.mRNInstabug initWithToken:appToken invocationEvents:floatingButtonInvocationEvent debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception]); } @@ -99,6 +103,14 @@ - (void)testSetUserData { OCMVerify([mock setUserData:userData]); } +- (void)testSetAppVariant { + id mock = OCMClassMock([Instabug class]); + NSString *appVariant = @"appVariant"; + + [self.instabugBridge setAppVariant: appVariant]; + XCTAssertEqual(Instabug.appVariant, appVariant); +} + - (void)testSetTrackUserSteps { id mock = OCMClassMock([Instabug class]); BOOL isEnabled = true; @@ -610,18 +622,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/examples/default/ios/Podfile b/examples/default/ios/Podfile index ef9550e04..e02a62de7 100644 --- a/examples/default/ios/Podfile +++ b/examples/default/ios/Podfile @@ -16,7 +16,7 @@ target 'InstabugExample' do rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path # add this line - pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/15.0.1/Instabug.podspec' +# pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/15.0.1/Instabug.podspec' # Flags change depending on the env values. flags = get_default_flags() diff --git a/examples/default/ios/Podfile.lock b/examples/default/ios/Podfile.lock index 61884fc18..155706532 100644 --- a/examples/default/ios/Podfile.lock +++ b/examples/default/ios/Podfile.lock @@ -31,7 +31,7 @@ PODS: - hermes-engine (0.75.4): - hermes-engine/Pre-built (= 0.75.4) - hermes-engine/Pre-built (0.75.4) - - Instabug (15.0.1) + - Instabug (15.1.1) - instabug-reactnative-ndk (0.1.0): - DoubleConversion - glog @@ -1770,7 +1770,6 @@ DEPENDENCIES: - fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - - Instabug (from `https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/15.0.1/Instabug.podspec`) - instabug-reactnative-ndk (from `../node_modules/instabug-reactnative-ndk`) - OCMock - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) @@ -1851,6 +1850,7 @@ SPEC REPOS: trunk: - Google-Maps-iOS-Utils - GoogleMaps + - Instabug - OCMock - SocketRocket @@ -1868,8 +1868,6 @@ EXTERNAL SOURCES: hermes-engine: :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" :tag: hermes-2024-08-15-RNv0.75.1-4b3bf912cc0f705b51b71ce1a5b8bd79b93a451b - Instabug: - :podspec: https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/15.0.1/Instabug.podspec instabug-reactnative-ndk: :path: "../node_modules/instabug-reactnative-ndk" RCT-Folly: @@ -2024,7 +2022,7 @@ SPEC CHECKSUMS: Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0 - Instabug: ba6587d15ad5e3ffa265afc8174ff83af4eed29d + Instabug: 3e7af445c14d7823fcdecba223f09b5f7c0c6ce1 instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641 OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74 RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740 @@ -2100,6 +2098,6 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 055f92ad73f8c8600a93f0e25ac0b2344c3b07e6 -PODFILE CHECKSUM: f7f8d2b03a0b566cb0f5b4b422469af0a1a278b1 +PODFILE CHECKSUM: 42f74b36b91ffedd1a4b69bf9b72165f04090424 COCOAPODS: 1.14.0 diff --git a/examples/default/src/App.tsx b/examples/default/src/App.tsx index ceef8bc19..51ad1420a 100644 --- a/examples/default/src/App.tsx +++ b/examples/default/src/App.tsx @@ -51,6 +51,7 @@ export const App: React.FC = () => { invocationEvents: [InvocationEvent.floatingButton], debugLogsLevel: LogLevel.verbose, networkInterceptionMode: NetworkInterceptionMode.javascript, + appVariant: 'App variant', }); CrashReporting.setNDKCrashesEnabled(true); diff --git a/ios/RNInstabug/InstabugReactBridge.h b/ios/RNInstabug/InstabugReactBridge.h index 1fe5505d3..995e57412 100644 --- a/ios/RNInstabug/InstabugReactBridge.h +++ b/ios/RNInstabug/InstabugReactBridge.h @@ -26,12 +26,15 @@ - (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 + appVariant:(NSString *)appVariant; - (void)setCodePushVersion:(NSString *)version; - (void)setUserData:(NSString *)userData; +- (void)setAppVariant:(NSString *)appVariant; + - (void)setTrackUserSteps:(BOOL)isEnabled; - (void)setSessionProfilerEnabled:(BOOL)sessionProfilerEnabled; diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index a48851ba8..d933a3e19 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -41,7 +41,14 @@ - (dispatch_queue_t)methodQueue { invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception - codePushVersion:(NSString *)codePushVersion) { + codePushVersion:(NSString *)codePushVersion + appVariant:(NSString *)appVariant + ) { + + if(appVariant != nil){ + Instabug.appVariant = appVariant; + } + IBGInvocationEvent invocationEvents = 0; for (NSNumber *boxedValue in invocationEventsArray) { @@ -60,6 +67,10 @@ - (dispatch_queue_t)methodQueue { [Instabug setCodePushVersion:version]; } +RCT_EXPORT_METHOD(setAppVariant:(NSString *)appVariant) { + Instabug.appVariant = appVariant; +} + RCT_EXPORT_METHOD(setReproStepsConfig:(IBGUserStepsMode)bugMode :(IBGUserStepsMode)crashMode:(IBGUserStepsMode)sessionReplayMode) { [Instabug setReproStepsFor:IBGIssueTypeBug withMode:bugMode]; [Instabug setReproStepsFor:IBGIssueTypeCrash withMode:crashMode]; diff --git a/ios/native.rb b/ios/native.rb index b09f2fd5f..41f497687 100644 --- a/ios/native.rb +++ b/ios/native.rb @@ -1,4 +1,4 @@ -$instabug = { :version => '15.0.1' } +$instabug = { :version => '15.1.1' } def use_instabug! (spec = nil) version = $instabug[:version] diff --git a/src/models/InstabugConfig.ts b/src/models/InstabugConfig.ts index 614ade892..282cd04b4 100644 --- a/src/models/InstabugConfig.ts +++ b/src/models/InstabugConfig.ts @@ -19,6 +19,11 @@ export interface InstabugConfig { */ codePushVersion?: string; + /** + * An optional current App variant to be used for filtering data. + */ + appVariant?: string; + /** * 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 f7d582e70..7188ecf06 100644 --- a/src/modules/Instabug.ts +++ b/src/modules/Instabug.ts @@ -126,6 +126,14 @@ export const init = async (config: InstabugConfig) => { }, 1000); }; +/** + * Set Current App Variant. + * @param appVariant the current App variant name + */ +export const setAppVariant = (appVariant: string) => { + NativeInstabug.setAppVariant(appVariant); +}; + /** * Handles app state changes and updates APM network flags if necessary. */ @@ -275,6 +283,7 @@ const initializeNativeInstabug = (config: InstabugConfig) => { shouldEnableNativeInterception && config.networkInterceptionMode === NetworkInterceptionMode.native, config.codePushVersion, + config.appVariant, ); }; diff --git a/src/native/NativeInstabug.ts b/src/native/NativeInstabug.ts index 7032bbc07..0066fa54e 100644 --- a/src/native/NativeInstabug.ts +++ b/src/native/NativeInstabug.ts @@ -26,11 +26,13 @@ export interface InstabugNativeModule extends NativeModule { debugLogsLevel: LogLevel, useNativeNetworkInterception: boolean, codePushVersion?: string, + appVariant?: string, ): void; show(): void; // Misc APIs // setCodePushVersion(version: string): void; + setAppVariant(appVariant: string): void; setIBGLogPrintsToConsole(printsToConsole: boolean): void; setSessionProfilerEnabled(isEnabled: boolean): void; diff --git a/test/mocks/mockInstabug.ts b/test/mocks/mockInstabug.ts index 391a00a38..d3d5206b5 100644 --- a/test/mocks/mockInstabug.ts +++ b/test/mocks/mockInstabug.ts @@ -42,6 +42,7 @@ const mockInstabug: InstabugNativeModule = { clearAllUserAttributes: jest.fn(), showWelcomeMessageWithMode: jest.fn(), setWelcomeMessageMode: jest.fn(), + setAppVariant: jest.fn(), setFileAttachment: jest.fn(), addPrivateView: jest.fn(), removePrivateView: jest.fn(), diff --git a/test/modules/Instabug.spec.ts b/test/modules/Instabug.spec.ts index f6e36d8e4..0cc9fea33 100644 --- a/test/modules/Instabug.spec.ts +++ b/test/modules/Instabug.spec.ts @@ -302,6 +302,7 @@ describe('Instabug Module', () => { instabugConfig.debugLogsLevel, usesNativeNetworkInterception, instabugConfig.codePushVersion, + undefined, ); }); @@ -353,6 +354,7 @@ describe('Instabug Module', () => { // usesNativeNetworkInterception should be true when using native interception mode with iOS true, instabugConfig.codePushVersion, + undefined, ); } }); @@ -952,6 +954,7 @@ describe('Instabug iOS initialization tests', () => { config.debugLogsLevel, false, // Disable native interception config.codePushVersion, + undefined, ); }); @@ -970,6 +973,7 @@ describe('Instabug iOS initialization tests', () => { config.debugLogsLevel, true, // Enable native interception config.codePushVersion, + undefined, ); }); @@ -988,6 +992,7 @@ describe('Instabug iOS initialization tests', () => { config.debugLogsLevel, false, // Disable native interception config.codePushVersion, + undefined, ); }); @@ -1032,6 +1037,7 @@ describe('Instabug Android initialization tests', () => { config.debugLogsLevel, false, // always disable native interception to insure sending network logs to core (Bugs & Crashes). config.codePushVersion, + undefined, ); }); }); @@ -1107,4 +1113,20 @@ describe('Instabug Android initialization tests', () => { ); }); }); + + it('should initialize correctly with App variant', async () => { + config.appVariant = 'App Variant'; + await Instabug.init(config); + fakeTimer(() => { + expect(NativeInstabug.setOnFeaturesUpdatedListener).toHaveBeenCalled(); + expect(NativeInstabug.init).toHaveBeenCalledWith( + config.token, + config.invocationEvents, + config.debugLogsLevel, + true, + config.codePushVersion, + config.appVariant, + ); + }); + }); });