Skip to content

Commit

Permalink
feat(sentry): add screenshot support (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu3 authored Dec 8, 2024
1 parent 4629127 commit e62e547
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SENTRY_DSN=
ENABLE_SENTRY=false
ENABLE_SENTRY_SCREENSHOTS=false
# Select one of the following: debug, info, warning, error, off
LOG_LEVEL=off
11 changes: 10 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ void main() async {
servers!..update(appConfig),
),
],
child: Phoenix(child: const PiHoleClient()),
child: Phoenix(
child: const SentryWidget(
child: PiHoleClient(),
),
),
));

if ((kReleaseMode &&
Expand All @@ -142,6 +146,8 @@ void main() async {
SentryFlutter.init((options) {
options.dsn = dotenv.env['SENTRY_DSN'];
options.sendDefaultPii = false;
options.attachScreenshot =
dotenv.env['ENABLE_SENTRY_SCREENSHOTS'] == "true";
options.beforeSend = (event, hint) {
if (event.throwable is HttpException) {
return null;
Expand Down Expand Up @@ -203,6 +209,9 @@ class _PiHoleClientState extends State<PiHoleClient> {
return DynamicColorBuilder(
builder: ((lightDynamic, darkDynamic) {
return MaterialApp(
navigatorObservers: [
SentryNavigatorObserver(),
],
title: 'Droid Hole',
theme: appConfigProvider.androidDeviceInfo != null &&
appConfigProvider.androidDeviceInfo!.version.sdkInt >= 31
Expand Down

0 comments on commit e62e547

Please sign in to comment.