chore: Follow up bug report dialog

This commit is contained in:
krille-chan 2023-12-26 19:12:31 +01:00
parent 7d112b1e18
commit 8f3f5cdb8b
No known key found for this signature in database
3 changed files with 7 additions and 30 deletions

View file

@ -2317,7 +2317,7 @@
"readUpToHere": "Read up to here", "readUpToHere": "Read up to here",
"jump": "Jump", "jump": "Jump",
"openLinkInBrowser": "Open link in browser", "openLinkInBrowser": "Open link in browser",
"reportErrorDescription": "Oh no. Something went wrong. Please try again later. If you want, you can report the bug to the developers.", "reportErrorDescription": "😭 Oh no. Something went wrong. If you want, you can report this bug to the developers.",
"report": "report", "report": "report",
"signInWithPassword": "Sign in with password", "signInWithPassword": "Sign in with password",
"pleaseTryAgainLaterOrChooseDifferentServer": "Please try again later or choose a different server.", "pleaseTryAgainLaterOrChooseDifferentServer": "Please try again later or choose a different server.",

View file

@ -219,18 +219,7 @@ class ChatController extends State<ChatPageWithRoom> {
void requestHistory([_]) async { void requestHistory([_]) async {
if (!timeline!.canRequestHistory) return; if (!timeline!.canRequestHistory) return;
Logs().v('Requesting history...'); Logs().v('Requesting history...');
try { await timeline!.requestHistory(historyCount: _loadHistoryCount);
await timeline!.requestHistory(historyCount: _loadHistoryCount);
} catch (err) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
(err).toLocalizedString(context),
),
),
);
rethrow;
}
} }
void requestFuture() async { void requestFuture() async {
@ -238,20 +227,9 @@ class ChatController extends State<ChatPageWithRoom> {
if (timeline == null) return; if (timeline == null) return;
if (!timeline.canRequestFuture) return; if (!timeline.canRequestFuture) return;
Logs().v('Requesting future...'); Logs().v('Requesting future...');
try { final mostRecentEventId = timeline.events.first.eventId;
final mostRecentEventId = timeline.events.first.eventId; await timeline.requestFuture(historyCount: _loadHistoryCount);
await timeline.requestFuture(historyCount: _loadHistoryCount); setReadMarker(eventId: mostRecentEventId);
setReadMarker(eventId: mostRecentEventId);
} catch (err) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
(err).toLocalizedString(context),
),
),
);
rethrow;
}
} }
void _updateScrollController() { void _updateScrollController() {

View file

@ -9,7 +9,6 @@ import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
class ErrorReporter { class ErrorReporter {
@ -22,8 +21,8 @@ class ErrorReporter {
Logs().e(message ?? 'Error caught', error, stackTrace); Logs().e(message ?? 'Error caught', error, stackTrace);
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: error.toLocalizedString(context), title: L10n.of(context)!.reportErrorDescription,
message: L10n.of(context)!.reportErrorDescription, message: '$error\n${stackTrace ?? ''}',
okLabel: L10n.of(context)!.report, okLabel: L10n.of(context)!.report,
cancelLabel: L10n.of(context)!.close, cancelLabel: L10n.of(context)!.close,
); );