Skip to content

Commit

Permalink
Align with Sentry Android naming
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis committed Jan 20, 2025
1 parent f96e2d1 commit 7788b81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,28 @@ private RNSentrySDK() {
throw new AssertionError("Utility class should not be instantiated");
}

private static void startWithOptions(
@NotNull final Context context, @NotNull final ReadableMap rnOptions) {
RNSentryStart.startWithOptions(context, rnOptions, null, logger);
}

/**
* Start the Native Android SDK with the provided options
*
* @param context Android Context
* @param options Map with options
*/
public static void startWithOptions(
public static void init(
@NotNull final Context context, @NotNull final Map<String, Object> options) {
ReadableMap rnOptions = RNSentryMapConverter.mapToReadableMap(options);
startWithOptions(context, rnOptions);
RNSentryStart.startWithOptions(context, rnOptions, null, logger);
}

/**
* Start the Native Android SDK with options from `sentry.options.json` configuration file
*
* @param context Android Context
*/
public static void start(@NotNull final Context context) {
public static void init(@NotNull final Context context) {
try {
JSONObject jsonObject = getOptionsFromConfigurationFile(context);
ReadableMap rnOptions = RNSentryMapConverter.jsonObjectToReadableMap(jsonObject);
startWithOptions(context, rnOptions);
RNSentryStart.startWithOptions(context, rnOptions, null, logger);
} catch (Exception e) {
logger.log(
SentryLevel.ERROR, "Failed to start Sentry with options from configuration file.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ class MainApplication :
}

private fun initializeSentry() {
// RNSentrySDK.startWithOptions(
// RNSentrySDK.init(
// this,
// mapOf(
// "dsn" to "https://[email protected]/5428561",
// "debug" to true,
// ),
// )

RNSentrySDK.start(this)
RNSentrySDK.init(this)
}
}

0 comments on commit 7788b81

Please sign in to comment.