feat: Implement new error reporting tool when critical features break like playing audio or video messages or opening a chat
This commit is contained in:
parent
b95cb93bf0
commit
2a1a68de22
7 changed files with 90 additions and 20 deletions
|
|
@ -23,6 +23,7 @@ import 'package:fluffychat/pages/chat/chat_view.dart';
|
|||
import 'package:fluffychat/pages/chat/event_info_dialog.dart';
|
||||
import 'package:fluffychat/pages/chat/recording_dialog.dart';
|
||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||
import 'package:fluffychat/utils/error_reporter.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/ios_badge_client_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
|
|
@ -274,7 +275,10 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
super.initState();
|
||||
sendingClient = Matrix.of(context).client;
|
||||
readMarkerEventId = room.fullyRead;
|
||||
loadTimelineFuture = _getTimeline(eventContextId: readMarkerEventId);
|
||||
loadTimelineFuture =
|
||||
_getTimeline(eventContextId: readMarkerEventId).onError(
|
||||
ErrorReporter(context, 'Unable to load timeline').onErrorCallback,
|
||||
);
|
||||
}
|
||||
|
||||
void updateView() {
|
||||
|
|
@ -380,7 +384,12 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
}
|
||||
// then cancel the old timeline
|
||||
// fixes bug with read reciepts and quick switching
|
||||
loadTimelineFuture = _getTimeline(eventContextId: room.fullyRead);
|
||||
loadTimelineFuture = _getTimeline(eventContextId: room.fullyRead).onError(
|
||||
ErrorReporter(
|
||||
context,
|
||||
'Unable to load timeline after changing sending Client',
|
||||
).onErrorCallback,
|
||||
);
|
||||
|
||||
// then set the new sending client
|
||||
setState(() => sendingClient = c);
|
||||
|
|
@ -811,6 +820,9 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
loadTimelineFuture = _getTimeline(
|
||||
eventContextId: eventId,
|
||||
timeout: const Duration(seconds: 30),
|
||||
).onError(
|
||||
ErrorReporter(context, 'Unable to load timeline after scroll to ID')
|
||||
.onErrorCallback,
|
||||
);
|
||||
});
|
||||
await loadTimelineFuture;
|
||||
|
|
@ -831,7 +843,10 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
setState(() {
|
||||
timeline = null;
|
||||
_scrolledUp = false;
|
||||
loadTimelineFuture = _getTimeline();
|
||||
loadTimelineFuture = _getTimeline().onError(
|
||||
ErrorReporter(context, 'Unable to load timeline after scroll down')
|
||||
.onErrorCallback,
|
||||
);
|
||||
});
|
||||
await loadTimelineFuture;
|
||||
setReadMarker(eventId: timeline!.events.first.eventId);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/error_reporter.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import '../../../utils/matrix_sdk_extensions/event_extension.dart';
|
||||
|
||||
|
|
@ -132,14 +133,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
} else {
|
||||
await audioPlayer.setAudioSource(MatrixFileAudioSource(matrixFile!));
|
||||
}
|
||||
audioPlayer.play().catchError((e, s) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(L10n.of(context)!.oopsSomethingWentWrong),
|
||||
),
|
||||
);
|
||||
Logs().w('Error while playing audio', e, s);
|
||||
});
|
||||
audioPlayer.play().onError(
|
||||
ErrorReporter(context, 'Unable to play audio message')
|
||||
.onErrorCallback,
|
||||
);
|
||||
}
|
||||
|
||||
static const double buttonSize = 36;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import 'package:video_player/video_player.dart';
|
|||
import 'package:fluffychat/pages/chat/events/image_bubble.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import '../../../utils/error_reporter.dart';
|
||||
|
||||
class EventVideoPlayer extends StatefulWidget {
|
||||
final Event event;
|
||||
|
|
@ -69,12 +70,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
),
|
||||
);
|
||||
} catch (e, s) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(e.toLocalizedString(context)),
|
||||
),
|
||||
);
|
||||
Logs().w('Error while playing video', e, s);
|
||||
ErrorReporter(context, 'Unable to play video').onErrorCallback(e, s);
|
||||
} finally {
|
||||
// Workaround for Chewie needs time to get the aspectRatio
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue