Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- fix: removed circular dependencies #1144

Merged
merged 3 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 1 addition & 38 deletions src/js/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,10 @@ import { Event, EventHint, Severity, Transport } from "@sentry/types";
// @ts-ignore LogBox introduced in RN 0.63
import { Alert, LogBox, YellowBox } from "react-native";

import { ReactNativeOptions } from "./options";
import { NativeTransport } from "./transports/native";
import { NATIVE } from "./wrapper";

/**
* Configuration options for the Sentry ReactNative SDK.
* @see ReactNativeFrontend for more information.
*/
export interface ReactNativeOptions extends BrowserOptions {
/**
* Enables native transport + device info + offline caching.
* Be careful, disabling this also breaks automatic release setting.
* This means you have to manage setting the release yourself.
* Defaults to `true`.
*/
enableNative?: boolean;

/**
* Enables native crashHandling. This only works if `enableNative` is `true`.
* Defaults to `true`.
*/
enableNativeCrashHandling?: boolean;

/** Maximum time to wait to drain the request queue, before the process is allowed to exit. */
shutdownTimeout?: number;

/** Should the native nagger alert be shown or not. */
enableNativeNagger?: boolean;

/** Should sessions be tracked to Sentry Health or not. */
enableAutoSessionTracking?: boolean;

/** The interval to end a session if the App goes to the background. */
sessionTrackingIntervalMillis?: number;

/** Enable scope sync from Java to NDK on Android */
enableNdkScopeSync?: boolean;

/** When enabled, all the threads are automatically attached to all logged events on Android */
attachThreads?: boolean;
}

/** The Sentry ReactNative SDK Backend. */
export class ReactNativeBackend extends BaseBackend<BrowserOptions> {
private readonly _browserBackend: BrowserBackend;
Expand Down
5 changes: 3 additions & 2 deletions src/js/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BaseClient } from "@sentry/core";

import { ReactNativeBackend, ReactNativeOptions } from "./backend";
import { ReactNativeBackend } from "./backend";
import { ReactNativeOptions } from "./options";

/**
* The Sentry React Native SDK Client.
Expand All @@ -11,7 +12,7 @@ import { ReactNativeBackend, ReactNativeOptions } from "./backend";
export class ReactNativeClient extends BaseClient<
ReactNativeBackend,
ReactNativeOptions
> {
> {
/**
* Creates a new React Native SDK instance.
* @param options Configuration options for this SDK.
Expand Down
3 changes: 2 additions & 1 deletion src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export {
import * as Integrations from "./integrations";
import { SDK_NAME, SDK_VERSION } from "./version";

export { ReactNativeBackend, ReactNativeOptions } from "./backend";
export { ReactNativeBackend } from "./backend";
export { ReactNativeOptions } from "./options";
export { ReactNativeClient } from "./client";
// eslint-disable-next-line deprecation/deprecation
export { init, setDist, setRelease, nativeCrash } from "./sdk";
Expand Down
40 changes: 40 additions & 0 deletions src/js/options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { BrowserOptions } from "@sentry/react";

/**
* Configuration options for the Sentry ReactNative SDK.
* @see ReactNativeFrontend for more information.
*/

export interface ReactNativeOptions extends BrowserOptions {
/**
* Enables native transport + device info + offline caching.
* Be careful, disabling this also breaks automatic release setting.
* This means you have to manage setting the release yourself.
* Defaults to `true`.
*/
enableNative?: boolean;

/**
* Enables native crashHandling. This only works if `enableNative` is `true`.
* Defaults to `true`.
*/
enableNativeCrashHandling?: boolean;

/** Maximum time to wait to drain the request queue, before the process is allowed to exit. */
shutdownTimeout?: number;

/** Should the native nagger alert be shown or not. */
enableNativeNagger?: boolean;

/** Should sessions be tracked to Sentry Health or not. */
enableAutoSessionTracking?: boolean;

/** The interval to end a session if the App goes to the background. */
sessionTrackingIntervalMillis?: number;

/** Enable scope sync from Java to NDK on Android */
enableNdkScopeSync?: boolean;

/** When enabled, all the threads are automatically attached to all logged events on Android */
attachThreads?: boolean;
}
2 changes: 1 addition & 1 deletion src/js/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { defaultIntegrations, getCurrentHub } from "@sentry/react";
import { StackFrame } from "@sentry/types";
import { getGlobalObject } from "@sentry/utils";

import { ReactNativeOptions } from "./backend";
import { ReactNativeClient } from "./client";
import {
DebugSymbolicator,
DeviceContext,
ReactNativeErrorHandlers,
Release,
} from "./integrations";
import { ReactNativeOptions } from "./options";
import { ReactNativeScope } from "./scope";

const IGNORED_DEFAULT_INTEGRATIONS = [
Expand Down
2 changes: 1 addition & 1 deletion src/js/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Breadcrumb, Event, Response, Severity, User } from "@sentry/types";
import { logger, SentryError } from "@sentry/utils";
import { NativeModules, Platform } from "react-native";

import { ReactNativeOptions } from "./backend";
import { ReactNativeOptions } from "./options";

const { RNSentry } = NativeModules;

Expand Down