diff --git a/lib/utils/error_reporter.dart b/lib/utils/error_reporter.dart index 2449761c3..f3b3bfabd 100644 --- a/lib/utils/error_reporter.dart +++ b/lib/utils/error_reporter.dart @@ -10,6 +10,7 @@ class ErrorReporter { void onErrorCallback(Object error, [StackTrace? stackTrace]) async { Logs().e(message ?? 'Error caught', error, stackTrace); + // #Pangea ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( @@ -17,65 +18,50 @@ class ErrorReporter { ), ), ); - // #Pangea -// final text = '$error\n${stackTrace ?? ''}'; -// final consent = await showAdaptiveDialog( -// 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(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(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 - -// ### 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# + // final text = '$error\n${stackTrace ?? ''}'; + // await showAdaptiveDialog( + // 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(), + // child: Text(L10n.of(context)!.close), + // ), + // TextButton( + // onPressed: () => Clipboard.setData( + // ClipboardData(text: text), + // ), + // child: Text(L10n.of(context)!.copy), + // ), + // TextButton( + // onPressed: () => launchUrl( + // AppConfig.newIssueUrl.resolveUri( + // Uri( + // queryParameters: { + // 'template': 'bug_report.yaml', + // 'title': '[BUG]: ${message ?? error.toString()}', + // }, + // ), + // ), + // mode: LaunchMode.externalApplication, + // ), + // child: Text(L10n.of(context)!.report), + // ), + // ], + // ), + // ); + // Pangea# } } diff --git a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart index 97978ce02..8ffa9201f 100644 --- a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart +++ b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart @@ -3,7 +3,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:file_picker/file_picker.dart'; -import 'package:flutter_file_dialog/flutter_file_dialog.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:matrix/matrix.dart'; @@ -15,10 +14,6 @@ import 'package:fluffychat/utils/size_string.dart'; extension MatrixFileExtension on MatrixFile { void save(BuildContext context) async { - if (PlatformInfos.isIOS || PlatformInfos.isAndroid) { - _mobileDownload(context); - } - if (PlatformInfos.isWeb) { _webDownload(); return; @@ -28,14 +23,17 @@ extension MatrixFileExtension on MatrixFile { dialogTitle: L10n.of(context)!.saveFile, fileName: name, type: filePickerFileType, + bytes: bytes, ); if (downloadPath == null) return; - final result = await showFutureLoadingDialog( - context: context, - future: () => File(downloadPath).writeAsBytes(bytes), - ); - if (result.error != null) return; + if (PlatformInfos.isDesktop) { + final result = await showFutureLoadingDialog( + context: context, + future: () => File(downloadPath).writeAsBytes(bytes), + ); + if (result.error != null) return; + } ScaffoldMessenger.of(context).showSnackBar( SnackBar( @@ -53,25 +51,6 @@ extension MatrixFileExtension on MatrixFile { return FileType.any; } - void _mobileDownload(BuildContext context) async { - final downloadPath = await FlutterFileDialog.saveFile( - params: SaveFileDialogParams( - fileName: name, - data: bytes, - ), - ); - if (downloadPath != null) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - L10n.of(context)!.fileHasBeenSavedAt(downloadPath), - ), - ), - ); - } - return; - } - void _webDownload() { html.AnchorElement( href: html.Url.createObjectUrlFromBlob( diff --git a/needed-translations.txt b/needed-translations.txt index 05f0c48e8..94b6f1416 100644 --- a/needed-translations.txt +++ b/needed-translations.txt @@ -769,10 +769,6 @@ "clickToManageSubscription", "emptyInviteWarning", "errorGettingAudio", - "publicChatAddresses", - "createNewAddress", - "userRole", - "minimumPowerLevel", "signUp", "pleaseChooseAtLeastChars", "noEmailWarning", @@ -10542,10 +10538,6 @@ "clickToManageSubscription", "emptyInviteWarning", "errorGettingAudio", - "publicChatAddresses", - "createNewAddress", - "userRole", - "minimumPowerLevel", "signUp", "pleaseChooseAtLeastChars", "noEmailWarning", @@ -12541,102 +12533,11 @@ "addGroupDescription", "addNewFriend", "alreadyHaveAnAccount", - "appLockDescription", "classes", - "commandHint_clearcache", - "commandHint_create", - "commandHint_discardsession", - "commandHint_dm", - "commandHint_html", - "commandHint_invite", - "commandHint_join", - "commandHint_kick", - "commandHint_leave", - "commandHint_me", - "commandHint_myroomavatar", - "commandHint_myroomnick", - "commandHint_op", - "commandHint_plain", - "commandHint_react", - "commandHint_send", - "commandHint_unban", - "commandInvalid", - "commandMissing", - "compareEmojiMatch", - "compareNumbersMatch", - "configureChat", - "confirm", - "connect", - "contactHasBeenInvitedToTheGroup", - "containsDisplayName", - "containsUserName", - "contentHasBeenReported", - "copiedToClipboard", - "copy", - "copyToClipboard", - "couldNotDecryptMessage", - "countParticipants", - "create", - "createdTheChat", - "createGroup", - "createNewSpace", "createNewGroup", - "currentlyActive", - "darkTheme", - "dateAndTimeOfDay", - "dateWithoutYear", - "dateWithYear", - "deactivateAccountWarning", - "defaultPermissionLevel", - "delete", - "deleteAccount", - "deleteMessage", - "device", - "deviceId", - "devices", - "directChats", - "allRooms", - "displaynameHasBeenChanged", - "downloadFile", - "edit", - "editBlockedServers", - "chatPermissions", "editChatPermissions", - "editDisplayname", - "editRoomAliases", - "editRoomAvatar", - "emoteExists", - "emoteInvalid", - "emoteKeyboardNoRecents", - "emotePacks", - "emoteSettings", - "globalChatId", - "accessAndVisibility", - "accessAndVisibilityDescription", - "calls", - "customEmojisAndStickers", - "customEmojisAndStickersBody", - "emoteShortcode", - "emoteWarnNeedToPick", - "emptyChat", - "enableEmotesGlobally", - "enableEncryption", - "enableEncryptionWarning", - "encrypted", - "encryption", - "encryptionNotEnabled", - "endedTheCall", "enterAGroupName", - "enterAnEmailAddress", "enterASpacepName", - "homeserver", - "enterYourHomeserver", - "errorObtainingLocation", - "everythingReady", - "extremeOffensive", - "fileName", - "fluffychat", - "fontSize", "forward", "fromJoining", "fromTheInvitation", @@ -22697,10 +22598,6 @@ "clickToManageSubscription", "emptyInviteWarning", "errorGettingAudio", - "publicChatAddresses", - "createNewAddress", - "userRole", - "minimumPowerLevel", "signUp", "pleaseChooseAtLeastChars", "noEmailWarning", @@ -32193,37 +32090,17 @@ "addGroupDescription", "addNewFriend", "alreadyHaveAnAccount", - "appLockDescription", "classes", "createNewGroup", "editChatPermissions", - "globalChatId", - "accessAndVisibility", - "accessAndVisibilityDescription", - "calls", - "customEmojisAndStickers", - "customEmojisAndStickersBody", "enterAGroupName", "enterASpacepName", "groupDescription", "groupDescriptionHasBeenChanged", - "hideRedactedMessages", - "hideRedactedMessagesBody", - "hideInvalidOrUnknownMessageFormats", "ignoreListDescription", "ignoreUsername", "optionalGroupName", - "hideMemberChangesInPublicChats", - "hideMemberChangesInPublicChatsBody", - "overview", - "notifyMeFor", - "passwordRecoverySettings", "writeAMessageFlag", - "usersMustKnock", - "noOneCanJoin", - "userWouldLikeToChangeTheChat", - "noPublicLinkHasBeenCreatedYet", - "knock", "requests", "allCorrect", "newWayAllGood", @@ -32967,8 +32844,6 @@ "reportMessageTitle", "reportMessageBody", "noTeachersFound", - "knocking", - "chatCanBeDiscoveredViaSearchOnServer", "createClass", "createExchange", "viewArchive", @@ -32980,10 +32855,6 @@ "clickToManageSubscription", "emptyInviteWarning", "errorGettingAudio", - "publicChatAddresses", - "createNewAddress", - "userRole", - "minimumPowerLevel", "signUp", "pleaseChooseAtLeastChars", "noEmailWarning", @@ -33071,9 +32942,7 @@ "capacitySetTooLow", "roomCapacityExplanation", "enterNumber", - "buildTranslation", - "noDatabaseEncryption", - "thereAreCountUsersBlocked" + "buildTranslation" ], "pt_PT": [ @@ -45054,10 +44923,6 @@ "clickToManageSubscription", "emptyInviteWarning", "errorGettingAudio", - "publicChatAddresses", - "createNewAddress", - "userRole", - "minimumPowerLevel", "signUp", "pleaseChooseAtLeastChars", "noEmailWarning", diff --git a/pubspec.lock b/pubspec.lock index 9c1358c7c..87e2d0c1d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -420,10 +420,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6" + sha256: b6283d7387310ad83bc4f3bc245b75d223a032ae6eba275afcd585de2b9a1476 url: "https://pub.dev" source: hosted - version: "6.1.1" + version: "8.0.1" file_selector_linux: dependency: transitive description: @@ -570,14 +570,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_file_dialog: - dependency: "direct main" - description: - name: flutter_file_dialog - sha256: "9344b8f07be6a1b6f9854b723fb0cf84a8094ba94761af1d213589d3cb087488" - url: "https://pub.dev" - source: hosted - version: "3.0.2" flutter_foreground_task: dependency: "direct main" description: @@ -1067,10 +1059,10 @@ packages: dependency: "direct main" description: name: image_picker - sha256: "26222b01a0c9a2c8fe02fc90b8208bd3325da5ed1f4a2acabf75939031ac0bdd" + sha256: fe9ee64ccb8d599a5dfb0e21cc6652232c610bcf667af4e79b9eb175cc30a7a5 url: "https://pub.dev" source: hosted - version: "1.0.7" + version: "1.1.0" image_picker_android: dependency: transitive description: @@ -1115,10 +1107,10 @@ packages: dependency: transitive description: name: image_picker_platform_interface - sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" url: "https://pub.dev" source: hosted - version: "2.9.3" + version: "2.10.0" image_picker_windows: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5e856d902..f882ee935 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,12 +32,11 @@ dependencies: emoji_proposal: ^0.0.1 emojis: ^0.9.9 #fcm_shared_isolate: ^0.1.0 - file_picker: ^6.1.1 + file_picker: ^8.0.1 flutter: sdk: flutter flutter_app_badger: ^1.5.0 flutter_cache_manager: ^3.3.1 - flutter_file_dialog: ^3.0.2 flutter_foreground_task: ^6.1.3 flutter_highlighter: ^0.1.1 flutter_html: ^3.0.0-beta.2 @@ -65,7 +64,7 @@ dependencies: html: ^0.15.4 http: ^1.2.0 image: ^4.1.7 - image_picker: ^1.0.7 + image_picker: ^1.1.0 intl: any just_audio: ^0.9.37 keyboard_shortcuts: ^0.1.4