try/catches added for minified:a7t sentry error, added back translationsfor l10n, added more to error_handler to get more info
This commit is contained in:
parent
b1bf8ce02a
commit
49251774cc
4 changed files with 95 additions and 31 deletions
|
|
@ -4068,6 +4068,25 @@
|
|||
"hintTitle": "Hint:",
|
||||
"speechToTextBody": "See how well you did by looking at your Accuracy and Words Per Minute scores",
|
||||
"previous": "Previous",
|
||||
"versionNotFound": "Version Not Found",
|
||||
"fetchingVersion": "Fetching version...",
|
||||
"versionFetchError": "Error fetching version",
|
||||
"connectedToStaging": "Connected to Staging",
|
||||
"versionText": "Version: {version}+{buildNumber}",
|
||||
"@versionText": {
|
||||
"description": "Text displaying the app version and build number.",
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"version": {
|
||||
"type": "String",
|
||||
"description": "The current version of the app."
|
||||
},
|
||||
"buildNumber": {
|
||||
"type": "String",
|
||||
"description": "The build number of the app."
|
||||
}
|
||||
}
|
||||
},
|
||||
"languageButtonLabel": "Language: {currentLanguage}",
|
||||
"@languageButtonLabel": {
|
||||
"type": "text",
|
||||
|
|
|
|||
|
|
@ -4717,5 +4717,25 @@
|
|||
"addChatToSpaceDesc": "Añadir un chat a un espacio hará que el chat aparezca dentro del espacio para los estudiantes y les dará acceso.",
|
||||
"addSpaceToSpaceDesc": "Añadir un espacio a otro espacio hará que el espacio hijo aparezca dentro del espacio padre para los estudiantes y les dará acceso.",
|
||||
"spaceAnalytics": "Analítica espacial",
|
||||
"changeAnalyticsLanguage": "Cambiar el lenguaje analítico"
|
||||
"changeAnalyticsLanguage": "Cambiar el lenguaje analítico",
|
||||
"versionNotFound": "Versión no encontrada",
|
||||
"fetchingVersion": "Obteniendo versión...",
|
||||
"versionFetchError": "Error al obtener la versión",
|
||||
"connectedToStaging": "Conectado al entorno de pruebas"
|
||||
"connectedToStaging": "Conectado al entorno de pruebas",
|
||||
"versionText": "Versión: {version}+{buildNumber}",
|
||||
"@versionText": {
|
||||
"description": "Texto que muestra la versión y el número de compilación de la aplicación.",
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"version": {
|
||||
"type": "String",
|
||||
"description": "La versión actual de la aplicación."
|
||||
},
|
||||
"buildNumber": {
|
||||
"type": "String",
|
||||
"description": "El número de compilación de la aplicación."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:scroll_to_index/scroll_to_index.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
import '../../utils/account_bundles.dart';
|
||||
import '../../utils/localized_exception_extension.dart';
|
||||
|
|
@ -481,35 +482,35 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
Future<void>? _setReadMarkerFuture;
|
||||
|
||||
void setReadMarker({String? eventId}) {
|
||||
if (_setReadMarkerFuture != null) return;
|
||||
if (_scrolledUp) return;
|
||||
if (scrollUpBannerEventId != null) return;
|
||||
if (eventId == null &&
|
||||
!room.hasNewMessages &&
|
||||
room.notificationCount == 0) {
|
||||
return;
|
||||
}
|
||||
if (_setReadMarkerFuture != null) return;
|
||||
if (_scrolledUp) return;
|
||||
if (scrollUpBannerEventId != null) return;
|
||||
if (eventId == null && !room.hasNewMessages && room.notificationCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not send read markers when app is not in foreground
|
||||
// #Pangea
|
||||
try {
|
||||
// Pangea#
|
||||
if (kIsWeb && !Matrix.of(context).webHasFocus) return;
|
||||
// #Pangea
|
||||
} catch (err, s) {
|
||||
ErrorHandler.logError(e: err, s: s);
|
||||
return;
|
||||
}
|
||||
// Do not send read markers when app is not in foreground
|
||||
// #Pangea
|
||||
try {
|
||||
// Pangea#
|
||||
if (!kIsWeb &&
|
||||
WidgetsBinding.instance.lifecycleState != AppLifecycleState.resumed) {
|
||||
return;
|
||||
}
|
||||
if (kIsWeb && !Matrix.of(context).webHasFocus) return;
|
||||
// #Pangea
|
||||
} catch (err, s) {
|
||||
ErrorHandler.logError(e: PangeaWarningError("Web focus error: $err"), s: s);
|
||||
return;
|
||||
}
|
||||
// Pangea#
|
||||
if (!kIsWeb && WidgetsBinding.instance.lifecycleState != AppLifecycleState.resumed) {
|
||||
return;
|
||||
}
|
||||
|
||||
final timeline = this.timeline;
|
||||
if (timeline == null || timeline.events.isEmpty) return;
|
||||
final timeline = this.timeline;
|
||||
if (timeline == null || timeline.events.isEmpty) {
|
||||
ErrorHandler.logError(e: PangeaWarningError("Timeline is null or empty"), s: StackTrace.current);
|
||||
return;
|
||||
}
|
||||
|
||||
Logs().d('Set read marker...', eventId);
|
||||
Logs().d('Set read marker...', eventId);
|
||||
// ignore: unawaited_futures
|
||||
_setReadMarkerFuture = timeline
|
||||
.setReadMarker(
|
||||
|
|
@ -518,11 +519,27 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
)
|
||||
.then((_) {
|
||||
_setReadMarkerFuture = null;
|
||||
});
|
||||
if (eventId == null || eventId == timeline.room.lastEvent?.eventId) {
|
||||
Matrix.of(context).backgroundPush?.cancelNotification(roomId);
|
||||
}
|
||||
}).catchError((e, s) {
|
||||
ErrorHandler.logError(
|
||||
e: PangeaWarningError("Failed to set read marker: $e"),
|
||||
s: s,
|
||||
m: 'Failed to set read marker for eventId: $eventId'
|
||||
);
|
||||
Sentry.captureException(
|
||||
e,
|
||||
stackTrace: s,
|
||||
withScope: (scope) {
|
||||
scope.setExtra('extra_info', 'Failed during setReadMarker with eventId: $eventId');
|
||||
scope.setTag('where', 'setReadMarker');
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
if (eventId == null || eventId == timeline.room.lastEvent?.eventId) {
|
||||
Matrix.of(context).backgroundPush?.cancelNotification(roomId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
|
|
|||
|
|
@ -53,8 +53,15 @@ class ErrorHandler {
|
|||
Map<String, dynamic>? data,
|
||||
SentryLevel level = SentryLevel.error,
|
||||
}) async {
|
||||
if (m != null) debugPrint("error message: $m");
|
||||
if (e is PangeaWarningError) {
|
||||
// Custom handling for PangeaWarningError
|
||||
debugPrint("PangeaWarningError: ${e.message}");
|
||||
} else {
|
||||
if (m != null) debugPrint("error message: $m");
|
||||
}
|
||||
|
||||
if ((e ?? m) != null) debugPrint("error to string: ${e?.toString() ?? m}");
|
||||
|
||||
if (data != null) {
|
||||
Sentry.addBreadcrumb(Breadcrumb.fromJson(data));
|
||||
debugPrint(data.toString());
|
||||
|
|
@ -68,6 +75,7 @@ class ErrorHandler {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ErrorCopy {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue