Files
readest/apps/readest-app/src-tauri/gen/apple/SentrySupport/SentryBootstrap.m
T
Huang Xin 967a7833ca feat(sentry): add crash reporting for Android, iOS, desktop, and web (#4914)
Report crashes and unhandled errors from every layer to one Sentry project via a
single build-time SENTRY_DSN (empty => disabled, so local and fork builds do not
report):

- JS/WebView + Rust panics via tauri-plugin-sentry (rustls transport; minidump
  handler desktop-only).
- Android native (JVM/NDK/ANR) via sentry-android 8.47.0 with manifest auto-init
  (excludes the discontinued lifecycle-common-java8 transitive).
- iOS native via sentry-cocoa started from a tracked SentrySupport/+load bootstrap
  that reads the DSN from a Rust readest_sentry_dsn() FFI (no generated-file edits).
- SENTRY_DSN resolved at build time from the environment, then .env.local, then
  .env (build.rs bakes it via cargo:rustc-env; build.gradle.kts for Android). CI
  passes the SENTRY_DSN secret through the existing .env.local step.

Crashes + errors only: traces sample rate 0, no session replay, no PII.
Symbolication (source maps / ProGuard / dSYM upload) is a follow-up.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 17:26:26 +02:00

32 lines
1.0 KiB
Objective-C

#import <Foundation/Foundation.h>
@import Sentry;
// Provided by the Rust static library (see src-tauri/src/sentry_config.rs).
extern const char *readest_sentry_dsn(void);
// Starts sentry-cocoa at class-load time (before main), so native iOS crashes
// are captured from launch without editing the generated main.mm / Info.plist.
// The DSN comes from the Rust side (single SENTRY_DSN build-time source); a null
// or empty DSN leaves the native SDK disabled, so local and fork builds do not
// report. Crashes + errors only: no tracing, no PII.
@interface ReadestSentryBootstrap : NSObject
@end
@implementation ReadestSentryBootstrap
+ (void)load {
const char *dsn = readest_sentry_dsn();
if (dsn == NULL || dsn[0] == '\0') {
return;
}
NSString *dsnString = [NSString stringWithUTF8String:dsn];
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
options.dsn = dsnString;
options.environment = @"production";
options.tracesSampleRate = @0.0;
options.sendDefaultPii = NO;
}];
}
@end