Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ac868c9
Launch options: a typed accessor for every option either SDK registers
krassx Nov 16, 2026
1def1ef
API parity: bridge the native methods RN was missing, and guard the rest
krassx Nov 16, 2026
4c2d8a0
Address review: own-key legacy lookup, number-compatible enum setters…
krassx Nov 16, 2026
7cd5761
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
83809c0
Address review: tie the SDK API snapshot to the pinned versions
krassx Nov 16, 2026
4cfa03a
Address review: refuse before writing, and measure the SDK version
krassx Nov 16, 2026
9417c54
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
4db1477
Address review: stamp the SDK API snapshot with the measured version
krassx Nov 16, 2026
1d74d50
Address review: compute every fixture first, write them together
krassx Nov 16, 2026
0481985
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
a35eb28
Gate build and publish on the option manifests the SDK releases publish
krassx Nov 16, 2026
0f48e0f
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
c8945dd
Address review: 6.x warning advice follows the running platform
krassx Nov 16, 2026
f466b4f
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
7a6056b
Check the accessors, types and defaults against the published manifests
krassx Nov 16, 2026
4057ae3
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
25a086a
Address CodeQL: escape backslashes in table cells and regex keys
krassx Nov 16, 2026
9eccd41
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
744fa49
Address review: strict manifest parsing, accessor docs that stay in t…
krassx Nov 16, 2026
9319ba0
Merge branch 'feat/launch-options-parity' into feat/native-api-parity
krassx Nov 16, 2026
c74fa3f
Do not expose showVideoCapturePreview / hideVideoCapturePreview
krassx Nov 16, 2026
61c54b1
Merge main into feat/native-api-parity
krassx Nov 16, 2026
7bd6a0b
Address review: read Android method declarations across lines
krassx Nov 16, 2026
c9a87be
Address review: read annotated Android method declarations
krassx Nov 16, 2026
6283813
Address review: accept modifiers between `public` and `static`
krassx Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/launch-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ iOS, does nothing on Android, and reports nothing on either. `launch()` and `rel
- `launch(token, options)` starts the SDK with `options`. If the SDK is **already running** (iOS, or an Android process the
SDK relaunched itself after the OS killed it) the new options are **ignored**. Do not treat `true` as proof they were applied:
check `getStatus()` before the call if the difference matters. Android SDK 7.5.1 resolves `false` in this case, earlier SDKs `true`.
- `relaunch(options)` restarts with **exactly** the options you pass. Anything you leave out goes back to the SDK default;
it does **not** keep what the previous launch set. Pass the full set each time.
- `relaunch()` with **no argument** keeps your options: it replays `getHostLaunchOptions()`, the SDK's record of what the
app supplied. (The native SDKs' bare relaunch restarts with defaults.) `relaunch(options)`, including `relaunch({})`,
restarts with **exactly** the options you pass; anything you leave out goes back to the SDK default.

## Reference

Expand Down
35 changes: 35 additions & 0 deletions docs/native-api-parity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Native API parity

Every public method of the Android `Bugsee` class (7.4.2) and the iOS `Bugsee` interface (7.0.x) is either exposed
by `@bugsee/react-native` or deliberately not, with a reason. The mapping is
[`scripts/sdk-api-map.ts`](../scripts/sdk-api-map.ts); `scripts/sdk-api.json` holds the SDKs' method names, and a test
fails when either side drifts (a method a new SDK release adds, an entry naming nothing, or a mapping pointing at an RN
member that does not exist). Regenerate the names with `scripts/cli-extract-sdk-api.ts`, pointing it at checkouts of the
versions in `native-versions.json`.

## Platform-specific calls

These exist in only one SDK, and are no-ops on the other platform.

| Method | Android | iOS |
|---|---|---|
| `resetVideoCapturePermission()` | forgets the stored fullscreen-capture consent | no-op |
| `addSecureActivity(className)`, `removeSecureActivity(className)` | hides the activity from capture | no-op |
| `isSecureActivity(className)` | whether the activity is secure | `false` |

## Not exposed, and why

| SDK method | Reason |
|---|---|
| `addSecureWebView` | needs a native WebView instance, which JavaScript never holds. Cover web content with `<BugseeSecure>` or `setSecureRectangles`. |
| `getAllSecureRectangles` | the wrapper owns the rectangles it publishes (`setSecureRectangles` replaces them); the SDK's list is not read back. |
| `ext`, `registerExt` | native extension lookup and registration. Extension SPIs (Leak's `watchObject`, the OkHttp interceptor) take native objects. |
| `getDefaultNetworkSanitizer`, `getExchangeFactory` | used inside the wrapper's own filter and event bridges. |
| `getVideoFrameConsumer` | SPI for wrappers that feed their own video frames; this one records natively. |
| `setWrapper`, `onUncaughtException`, `delegate`, `sharedInstance` | the wrapper's own plumbing. |
| `showVideoCapturePreview`, `hideVideoCapturePreview` (iOS) | an SDK debug overlay for checking video capture; deliberately not exposed. |
| `getLaunched`, `launched` | `await getStatus()` against `Status.Launched`. |
| `addSecureViews`, `setLogFilter` (Android) | deprecated in the SDK. |

`relaunch()` with no argument keeps the options the app supplied (it replays `getHostLaunchOptions()`); the native SDKs'
bare relaunch restarts with defaults.
13 changes: 11 additions & 2 deletions packages/react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,21 @@ options.reportingUIEmailRequired = true;
`relaunch` log one `console.warn` per unknown key and name the key to use.
- **`launch` while the SDK is already running ignores the options** you pass: an iOS session that is
already up, or an Android process the SDK relaunched itself after the OS killed it. Check `getStatus()` first.
- **`relaunch(options)` restarts with exactly the options you pass.** Options you omit return to the SDK
default; the previous launch's are not kept.
- **`relaunch()` keeps your options; `relaunch(options)` replaces them.** With no argument it replays
`getHostLaunchOptions()`, the options the app supplied, so nothing resets. With an argument, including `{}`,
it restarts with exactly those options and whatever you leave out returns to the SDK default.

The full list, with keys, types and platforms, is in
[`docs/launch-options.md`](https://github.com/bugsee/bugsee-react-native/blob/main/docs/launch-options.md).

### Methods that exist on one platform

`getHostLaunchOptions()` returns only what your app supplied to `launch`. Android-only: `resetVideoCapturePermission()`,
`addSecureActivity(className)`, `removeSecureActivity(className)`, `isSecureActivity(className)`. iOS treats
these as no-ops. Which native methods
this package does not expose, and why, is in
[`docs/native-api-parity.md`](https://github.com/bugsee/bugsee-react-native/blob/main/docs/native-api-parity.md).

### Reporting render errors

Wrap part of the tree (or the whole app) in `<ErrorBoundary>` to report an error thrown while rendering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,37 @@ public void getLaunchOptions(final Promise promise) {
promise.resolve(toWritableMap(Bugsee.getLaunchOptions().toMap()));
}

@Override
public void getHostLaunchOptions(final Promise promise) {
// Only what the app itself supplied, not the SDK's defaults.
promise.resolve(toWritableMap(Bugsee.getHostLaunchOptions()));
}

@Override
public void testCrash() {
Bugsee.testCrash();
}

@Override
public void resetVideoCapturePermission() {
Bugsee.resetVideoCapturePermission();
}

@Override
public void addSecureActivity(final String className) {
Bugsee.addSecureActivity(className);
}

@Override
public void removeSecureActivity(final String className) {
Bugsee.removeSecureActivity(className);
}

@Override
public void isSecureActivity(final String className, final Promise promise) {
promise.resolve(Bugsee.isSecureActivity(className));
}

/**
* A handled JS exception. Posted onto {@link ExceptionExecutors#HANDLED}:
* the SDK must not run on the native-modules thread.
Expand Down
28 changes: 28 additions & 0 deletions packages/react-native/ios/BugseeModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1432,12 +1432,40 @@ - (void)getLaunchOptions:(RCTPromiseResolveBlock)resolve
});
}

- (void)getHostLaunchOptions:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject {
BGSRNRunOnMain(^{
// Only what the app itself supplied, not the SDK's defaults.
resolve([Bugsee getHostLaunchOptions] ?: @{});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P2 Medium
Problem: The iOS signatures were inventoried from origin/release ("7.0.x"), but the pin in native-versions.json is the stable 7.0.0 (SPM binary). getHostLaunchOptions, showVideoCapturePreview and hideVideoCapturePreview are only guaranteed to exist if they shipped in the 7.0.0 tag.
Impact: If any of the three is missing from 7.0.0, the iOS target fails to compile. The PR says CI is the first iOS compile, so the first signal would be a red build. The parity test cannot catch this, because sdk-api.json was extracted from an unreleased branch.
Scenario: release has moved past 7.0.0 and these were added after the tag. yarn jest passes and the iOS build fails with no known class method for selector 'getHostLaunchOptions'.
Fix: Regenerate sdk-api.json from the 7.0.0 tag, as the extractor's own doc says ("checkouts at the PINNED versions"). Or confirm that the three selectors are in the 7.0.0 header.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against the 7.0.0 release itself rather than the branch: the commit that bumped iOS to 7.0.0 (478d5165a) has a Bugsee.h byte-identical to origin/release, and getHostLaunchOptions, showVideoCapturePreview and hideVideoCapturePreview are declared in it. So the iOS snapshot describes 7.0.0 and the three selectors exist in the pinned SDK. The snapshot now records the versions it was extracted at (see the other thread), so this claim is checked from here on.

});
}

- (void)testCrash {
BGSRNRunOnMain(^{
[Bugsee testCrash];
});
}

#pragma mark - Android-only and iOS-only calls

// iOS has no MediaProjection consent and no secure activities: these are
// no-ops here, and isSecureActivity answers NO.

- (void)resetVideoCapturePermission {
}

- (void)addSecureActivity:(NSString *)className {
}

- (void)removeSecureActivity:(NSString *)className {
}

- (void)isSecureActivity:(NSString *)className
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject {
resolve(@NO);
}

/// A handled JS exception. `payloadJson` is the Task 7.1a payload, forwarded
/// verbatim as the reason; `optionsJson` is `{domain?}` or null. Unparseable
/// options are logged and the exception is still sent, without a domain — a
Expand Down
20 changes: 20 additions & 0 deletions packages/react-native/src/NativeBugsee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,28 @@ export interface Spec extends TurboModule {
getStatus(): Promise<number>;
/** The options the SDK reports as being in effect. */
getLaunchOptions(): Promise<CodegenTypes.UnsafeObject>;
/**
* Only the options the host app supplied to `launch`, without the SDK's
* defaults that {@link getLaunchOptions} merges them over. What `relaunch()`
* with no argument replays.
*/
getHostLaunchOptions(): Promise<CodegenTypes.UnsafeObject>;
testCrash(): void;

/**
* Android: forgets the stored MediaProjection (fullscreen capture) consent so
* the user is asked again. No-op on iOS, which has no such permission.
*/
resetVideoCapturePermission(): void;
/**
* Android: hides every window of the activity with this fully qualified class
* name from capture. No-op on iOS.
*/
addSecureActivity(className: string): void;
removeSecureActivity(className: string): void;
/** Whether the activity is currently secure. Always `false` on iOS. */
isSecureActivity(className: string): Promise<boolean>;

/**
* Creates and uploads a bug report immediately, without showing any UI.
*
Expand Down
7 changes: 7 additions & 0 deletions packages/react-native/src/__mocks__/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const DEFAULTS: Record<string, unknown> = {
stop: true,
getStatus: 0,
getLaunchOptions: {},
getHostLaunchOptions: {},
isSecureActivity: false,
reportRead: EMPTY_REPORT_SNAPSHOT,
createReport: null,
getAttribute: {},
Expand Down Expand Up @@ -267,6 +269,11 @@ export const native = {
stop: jest.fn<Promise<boolean>, []>(),
getStatus: jest.fn<Promise<number>, []>(),
getLaunchOptions: jest.fn<Promise<Record<string, unknown>>, []>(),
getHostLaunchOptions: jest.fn<Promise<Record<string, unknown>>, []>(),
resetVideoCapturePermission: jest.fn<void, []>(),
addSecureActivity: jest.fn<void, [string]>(),
removeSecureActivity: jest.fn<void, [string]>(),
isSecureActivity: jest.fn<Promise<boolean>, [string]>(),
testCrash: jest.fn<void, []>(),
upload: jest.fn<void, [string, string, number, string[] | null]>(),
showReportDialog:
Expand Down
84 changes: 84 additions & 0 deletions packages/react-native/src/__tests__/native-api.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
jest.mock('react-native', () => ({ Platform: { OS: 'android' } }));
jest.mock('../exceptions/handlers', () => ({
installExceptionHandlers: jest.fn(),
setExceptionCaptureEnabled: jest.fn(),
setCrashDetectionOptedOut: jest.fn(),
}));
jest.mock('../console/capture', () => ({ installConsoleCapture: jest.fn() }));
jest.mock('../NativeBugsee', () => require('../__mocks__/native').nativeMock);

import Bugsee from '../index';
import { native } from '../__mocks__/native';

beforeEach(() => native.reset());

describe('getHostLaunchOptions', () => {
it('returns what native reports', async () => {
native.getHostLaunchOptions.mockResolvedValue({
'com.bugsee.option.reporting.triggers.shake': false,
});
await expect(Bugsee.getHostLaunchOptions()).resolves.toEqual({
'com.bugsee.option.reporting.triggers.shake': false,
});
});
});

describe('relaunch', () => {
const hosted = {
'com.bugsee.option.reporting.triggers.shake': false,
'com.bugsee.option.capture.logs.level': 2,
};

it('with no argument replays the options the app supplied, so nothing resets', async () => {
native.getHostLaunchOptions.mockResolvedValue(hosted);
await Bugsee.relaunch();
expect(native.relaunch).toHaveBeenCalledWith(hosted);
});

it('with an argument sends exactly that and never asks for the host options', async () => {
native.getHostLaunchOptions.mockResolvedValue(hosted);
const next = { 'com.bugsee.option.capture.logs': false };
await Bugsee.relaunch(next);
expect(native.relaunch).toHaveBeenCalledWith(next);
expect(native.getHostLaunchOptions).not.toHaveBeenCalled();
});

it('with an explicit empty map still resets to the SDK defaults', async () => {
native.getHostLaunchOptions.mockResolvedValue(hosted);
await Bugsee.relaunch({});
expect(native.relaunch).toHaveBeenCalledWith({});
expect(native.getHostLaunchOptions).not.toHaveBeenCalled();
});

it('sends an empty map when the app supplied nothing', async () => {
native.getHostLaunchOptions.mockResolvedValue({});
await Bugsee.relaunch();
expect(native.relaunch).toHaveBeenCalledWith({});
});

it('does not relaunch when the host options cannot be read, rather than resetting every setting', async () => {
native.getHostLaunchOptions.mockRejectedValue(new Error('x'));
await expect(Bugsee.relaunch()).rejects.toThrow();
expect(native.relaunch).not.toHaveBeenCalled();
});
});

describe('platform-specific calls forward to native', () => {
it('resetVideoCapturePermission', () => {
Bugsee.resetVideoCapturePermission();
expect(native.resetVideoCapturePermission).toHaveBeenCalledTimes(1);
});

it('addSecureActivity and removeSecureActivity pass the class name', () => {
Bugsee.addSecureActivity('com.example.MainActivity');
Bugsee.removeSecureActivity('com.example.MainActivity');
expect(native.addSecureActivity).toHaveBeenCalledWith('com.example.MainActivity');
expect(native.removeSecureActivity).toHaveBeenCalledWith('com.example.MainActivity');
});

it('isSecureActivity returns the native answer', async () => {
native.isSecureActivity.mockResolvedValue(true);
await expect(Bugsee.isSecureActivity('com.example.A')).resolves.toBe(true);
expect(native.isSecureActivity).toHaveBeenCalledWith('com.example.A');
});
});
Loading
Loading