diff --git a/lib/l10n/intl_eu.arb b/lib/l10n/intl_eu.arb index e300cbd4e..e22bc214a 100644 --- a/lib/l10n/intl_eu.arb +++ b/lib/l10n/intl_eu.arb @@ -1911,7 +1911,7 @@ "type": "String", "description": "Usage hint for the command /invite" }, - "commandHint_join": "Batu gelara", + "commandHint_join": "Batu adierazitako gelara", "@commandHint_join": { "type": "String", "description": "Usage hint for the command /join" @@ -2608,9 +2608,9 @@ "@invite": {}, "invalidInput": "Sartu duzunak ez du balio!", "@invalidInput": {}, - "inviteGroupChat": "📨 Gonbidatu taldeko txatera", + "inviteGroupChat": "📨 Taldeko txatera gonbidapena", "@inviteGroupChat": {}, - "invitePrivateChat": "📨 Gonbidatu txat pribatura", + "invitePrivateChat": "📨 Txat pribatura gonbidapena", "@invitePrivateChat": {}, "banUserDescription": "Erabiltzailea txatetik kanporatu eta berriro sartzeko debekua ezarriko zaio; ezingo da berriro sartu debekua kendu arte.", "@banUserDescription": {}, @@ -3380,8 +3380,12 @@ "@commandHint_logoutall": {}, "moreEvents": "Gertaera gehiago", "@moreEvents": {}, - "displayNavigationRail": "Erakutsi nabigazio errail txikian", + "displayNavigationRail": "Erakutsi nabigazio-barra mugikorrean", + "@displayNavigationRail": {}, "customReaction": "Erreakzio pertsonalizatua", + "@customReaction": {}, + "declineInvitation": "Uko egin gonbidapenari", + "@declineInvitation": {}, "writeAMessageLangCodes": "Idatzi {l1} edo {l2}...", "requests": "Eskariak", "holdForInfo": "Klikatu eta eutsi hitzaren informazioarentzat.", @@ -4509,14 +4513,6 @@ "inviteYourFriends": "Gonbidatu zure lagunak", "playWithAI": "Jolastu AIrekin orain", "courseStartDesc": "Pangea Bot prest dago noiznahi joateko!\n\n...baina ikastea lagunekin hobe da!", - "@displayNavigationRail": { - "type": "String", - "placeholders": {} - }, - "@customReaction": { - "type": "String", - "placeholders": {} - }, "@writeAMessageLangCodes": { "type": "String", "placeholders": { diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 59abca6b5..72fc8ce6f 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -24,6 +24,7 @@ import 'package:fluffychat/pangea/join_codes/space_code_controller.dart'; import 'package:fluffychat/pangea/join_codes/space_code_repo.dart'; import 'package:fluffychat/pangea/navigation/navigation_util.dart'; import 'package:fluffychat/pangea/subscription/widgets/subscription_snackbar.dart'; +import 'package:fluffychat/utils/error_reporter.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/platform_infos.dart'; @@ -43,6 +44,7 @@ import '../../widgets/matrix.dart'; import 'package:fluffychat/utils/tor_stub.dart' if (dart.library.html) 'package:tor_detector_web/tor_detector_web.dart'; + enum PopupMenuAction { settings, invite, @@ -559,6 +561,8 @@ class ChatListController extends State _checkTorBrowser(); + ErrorReporter(context).consumeTemporaryErrorLogFile(); + //#Pangea _invitedSpaceSubscription = Matrix.of(context) .client diff --git a/lib/utils/error_reporter.dart b/lib/utils/error_reporter.dart index d529292da..4e0958e58 100644 --- a/lib/utils/error_reporter.dart +++ b/lib/utils/error_reporter.dart @@ -1,23 +1,57 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:matrix/matrix.dart'; +import 'package:path/path.dart' as path; +import 'package:path_provider/path_provider.dart'; import 'package:fluffychat/l10n/l10n.dart'; import 'package:fluffychat/pangea/common/utils/error_handler.dart'; class ErrorReporter { - final BuildContext context; + final BuildContext? context; final String? message; const ErrorReporter(this.context, [this.message]); - void onErrorCallback(Object error, [StackTrace? stackTrace]) async { + Future _getTemporaryErrorLogFile() async { + final tempDir = await getTemporaryDirectory(); + return File(path.join(tempDir.path, 'error_log.txt')); + } + + Future writeToTemporaryErrorLogFile( + Object error, [ + StackTrace? stackTrace, + ]) async { + final file = await _getTemporaryErrorLogFile(); + if (await file.exists()) await file.delete(); + await file.writeAsString( + '[${DateTime.now().toIso8601String()}] $message - $error\n$stackTrace', + ); + } + + Future consumeTemporaryErrorLogFile() async { + final file = await _getTemporaryErrorLogFile(); + if (!(await file.exists())) return; + final content = await file.readAsString(); + + // #Pangea + // _onErrorCallback(content); + onErrorCallback(content); + // Pangea# + } + + void onErrorCallback(Object error, [StackTrace? stackTrace]) { Logs().e(message ?? 'Error caught', error, stackTrace); // #Pangea + // final text = '$error\n${stackTrace ?? ''}'; + // return _onErrorCallback(text); + if (context == null) return; try { // Attempt to retrieve the L10n instance using the current context - final L10n l10n = L10n.of(context); - ScaffoldMessenger.of(context).showSnackBar( + final L10n l10n = L10n.of(context!); + ScaffoldMessenger.of(context!).showSnackBar( SnackBar( content: Text( l10n.oopsSomethingWentWrong, // Use the non-null L10n instance to get the error message @@ -37,10 +71,13 @@ class ErrorReporter { data: {}, ); } + // Pangea# } - // final text = '$error\n${stackTrace ?? ''}'; + + // #Pangea + // void _onErrorCallback(String text) async { // await showAdaptiveDialog( - // context: context, + // context: context!, // builder: (context) => AlertDialog.adaptive( // title: Text(L10n.of(context).reportErrorDescription), // content: SizedBox( diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 03a88e085..9a65e9cd0 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -15,6 +15,7 @@ import 'package:fluffychat/l10n/l10n.dart'; import 'package:fluffychat/pangea/common/utils/error_handler.dart'; import 'package:fluffychat/utils/client_download_content_extension.dart'; import 'package:fluffychat/utils/client_manager.dart'; +import 'package:fluffychat/utils/error_reporter.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/platform_infos.dart'; @@ -42,7 +43,10 @@ Future pushHelper( // Pangea# ); } catch (e, s) { - Logs().v('Push Helper has crashed!', e, s); + Logs().e('Push Helper has crashed! Writing into temporary file', e, s); + + const ErrorReporter(null, 'Push Helper has crashed!') + .writeToTemporaryErrorLogFile(e, s); l10n ??= await lookupL10n(const Locale('en')); flutterLocalNotificationsPlugin.show( diff --git a/pubspec.lock b/pubspec.lock index c236424b8..408838668 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -301,10 +301,10 @@ packages: dependency: "direct main" description: name: chewie - sha256: "4d9554a8f87cc2dc6575dfd5ad20a4375015a29edd567fd6733febe6365e2566" + sha256: "19b93a1e60e4ba640a792208a6543f1c7d5b124d011ce0199e2f18802199d984" url: "https://pub.dev" source: hosted - version: "1.11.3" + version: "1.12.1" cli_config: dependency: transitive description: @@ -1394,10 +1394,10 @@ packages: dependency: "direct main" description: name: just_audio - sha256: f978d5b4ccea08f267dae0232ec5405c1b05d3f3cd63f82097ea46c015d5c09e + sha256: "679637a3ec5b6e00f36472f5a3663667df00ee4822cbf5dafca0f568c710960a" url: "https://pub.dev" source: hosted - version: "0.9.46" + version: "0.10.4" just_audio_platform_interface: dependency: transitive description: @@ -2352,10 +2352,10 @@ packages: dependency: "direct main" description: name: sqflite_common_ffi - sha256: "1f3ef3888d3bfbb47785cc1dda0dc7dd7ebd8c1955d32a9e8e9dae1e38d1c4c1" + sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.3.6" sqflite_darwin: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a36e090bb..ec84d8d4e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: async: ^2.11.0 badges: ^3.1.2 blurhash_dart: ^1.2.1 - chewie: ^1.11.3 + chewie: ^1.12.1 collection: ^1.18.0 cross_file: ^0.3.4+2 confetti: ^0.8.0 @@ -62,7 +62,7 @@ dependencies: image: ^4.1.7 image_picker: ^1.1.0 intl: any - just_audio: ^0.9.39 + just_audio: ^0.10.4 latlong2: ^0.9.1 linkify: ^5.0.0 # #Pangea @@ -90,7 +90,7 @@ dependencies: share_plus: ^10.0.2 shared_preferences: ^2.2.0 # Pinned because https://github.com/flutter/flutter/issues/118401 slugify: ^2.0.0 - sqflite_common_ffi: ^2.3.3 + sqflite_common_ffi: ^2.3.6 sqlcipher_flutter_libs: ^0.6.1 swipe_to_action: ^0.3.0 tor_detector_web: ^1.1.0