Allow sending errors to Sentry
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:okane/i18n/strings.g.dart';
|
||||
import 'package:okane/ui/pages/account/breakdown_card.dart';
|
||||
import 'package:okane/ui/state/settings.dart';
|
||||
import 'package:okane/ui/utils.dart';
|
||||
|
||||
@@ -67,6 +68,74 @@ class SettingsPage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
BlocBuilder<SettingsCubit, SettingsWrapper>(
|
||||
builder:
|
||||
(context, state) => ListTile(
|
||||
title: Text("Sentry"),
|
||||
subtitle: Text(
|
||||
"When enabled sends errors to the configured Sentry DSN.",
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.clear),
|
||||
onPressed:
|
||||
state.settings.sentryDsn == null
|
||||
? null
|
||||
: () async {
|
||||
final result = await confirm(
|
||||
context,
|
||||
"Clear Sentry DSN",
|
||||
"Are you sure you want to clear the Sentry DSN?",
|
||||
);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
||||
await GetIt.I.get<SettingsCubit>().setSettings(
|
||||
state.settings.copyWith(sentryDsn: null),
|
||||
);
|
||||
},
|
||||
),
|
||||
onTap: () async {
|
||||
final controller = TextEditingController(
|
||||
text: state.settings.sentryDsn ?? '',
|
||||
);
|
||||
final result = await showDialogOrModal<String>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(hintText: "Sentry DSN"),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
OutlinedButton(
|
||||
child: Text("Apply"),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(controller.text);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
await GetIt.I.get<SettingsCubit>().setSettings(
|
||||
state.settings.copyWith(sentryDsn: result),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user