Skip to content

Commit

Permalink
Merge pull request #75 from pangeachat/ui-updates
Browse files Browse the repository at this point in the history
UI updates
  • Loading branch information
wcjord authored Feb 21, 2024
2 parents 3d10d5a + d8927b6 commit 45d0b55
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 65 deletions.
4 changes: 3 additions & 1 deletion lib/pages/chat_list/space_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ class _SpaceViewState extends State<SpaceView> {
// Pangea#

void _refresh() {
_lastResponse.remove(widget.controller.activeSpaceId);
// #Pangea
// _lastResponse.remove(widget.controller.activseSpaceId);
// Pangea#
loadHierarchy();
}

Expand Down
126 changes: 62 additions & 64 deletions lib/utils/error_reporter.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
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';
import 'package:flutter_highlighter/themes/shades-of-purple.dart';
import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher.dart';

import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/platform_infos.dart';

class ErrorReporter {
final BuildContext context;
Expand All @@ -21,63 +10,72 @@ 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(
title: Text(L10n.of(context)!.reportErrorDescription),
content: SizedBox(
height: 256,
width: 256,
child: SingleChildScrollView(
child: HighlightView(
text,
language: 'sh',
theme: shadesOfPurpleTheme,
),
),
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
L10n.of(context)!.oopsSomethingWentWrong,
),
actions: [
TextButton(
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),
),
],
),
);
if (consent != true) return;
final os = kIsWeb ? 'web' : Platform.operatingSystem;
final version = await PlatformInfos.getVersion();
final description = '''
- Operating system: $os
- Version: $version
// #Pangea
// final text = '$error\n${stackTrace ?? ''}';
// final consent = await showAdaptiveDialog<bool>(
// context: context,
// builder: (context) => AlertDialog.adaptive(
// title: Text(L10n.of(context)!.reportErrorDescription),
// content: SizedBox(
// height: 256,
// width: 256,
// child: SingleChildScrollView(
// child: HighlightView(
// text,
// language: 'sh',
// theme: shadesOfPurpleTheme,
// ),
// ),
// ),
// actions: [
// TextButton(
// 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),
// ),
// ],
// ),
// );
// if (consent != true) return;
// final os = kIsWeb ? 'web' : Platform.operatingSystem;
// final version = await PlatformInfos.getVersion();
// final description = '''
// - Operating system: $os
// - Version: $version

### Exception
$error
// ### Exception
// $error

### StackTrace
${stackTrace?.toString().split('\n').take(10).join('\n')}
''';
launchUrl(
AppConfig.newIssueUrl.resolveUri(
Uri(
queryParameters: {
'title': '[BUG]: ${message ?? error.toString()}',
'body': description,
},
),
),
mode: LaunchMode.externalApplication,
);
// ### StackTrace
// ${stackTrace?.toString().split('\n').take(10).join('\n')}
// ''';
// launchUrl(
// AppConfig.newIssueUrl.resolveUri(
// Uri(
// queryParameters: {
// 'title': '[BUG]: ${message ?? error.toString()}',
// 'body': description,
// },
// ),
// ),
// mode: LaunchMode.externalApplication,
// );
// Pangea#
}
}

0 comments on commit 45d0b55

Please sign in to comment.