mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 13:05:11 +00:00
fix: URL too long when reporting bug
This commit is contained in:
parent
d8414e8d15
commit
faf4ecd088
1 changed files with 10 additions and 2 deletions
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_highlighter/flutter_highlighter.dart';
|
||||
|
@ -20,6 +21,7 @@ class ErrorReporter {
|
|||
|
||||
void onErrorCallback(Object error, [StackTrace? stackTrace]) async {
|
||||
Logs().e(message ?? 'Error caught', error, stackTrace);
|
||||
final text = '$error\n${stackTrace ?? ''}';
|
||||
final consent = await showAdaptiveDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog.adaptive(
|
||||
|
@ -29,7 +31,7 @@ class ErrorReporter {
|
|||
width: 256,
|
||||
child: SingleChildScrollView(
|
||||
child: HighlightView(
|
||||
'$error\n${stackTrace ?? ''}',
|
||||
text,
|
||||
language: 'sh',
|
||||
theme: shadesOfPurpleTheme,
|
||||
),
|
||||
|
@ -40,6 +42,12 @@ class ErrorReporter {
|
|||
onPressed: () => Navigator.of(context).pop<bool>(false),
|
||||
child: Text(L10n.of(context)!.close),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Clipboard.setData(
|
||||
ClipboardData(text: text),
|
||||
),
|
||||
child: Text(L10n.of(context)!.copy),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop<bool>(true),
|
||||
child: Text(L10n.of(context)!.report),
|
||||
|
@ -58,7 +66,7 @@ class ErrorReporter {
|
|||
$error
|
||||
|
||||
### StackTrace
|
||||
$stackTrace
|
||||
${stackTrace?.toString().split('\n').take(10).join('\n')}
|
||||
''';
|
||||
launchUrl(
|
||||
AppConfig.newIssueUrl.resolveUri(
|
||||
|
|
Loading…
Reference in a new issue