From d3d75252ee79148de17640adef5e8464f08c45d3 Mon Sep 17 00:00:00 2001 From: OfficialDakari Date: Mon, 9 Jun 2025 15:14:19 +0500 Subject: [PATCH] update archive --- lib/pages/chat/chat.dart | 29 +++- lib/pages/chat/send_file_dialog.dart | 152 +++++++++--------- .../settings_emotes/settings_emotes.dart | 4 +- lib/utils/client_manager.dart | 2 +- .../event_extension.dart | 2 +- pubspec.lock | 16 +- pubspec.yaml | 2 +- 7 files changed, 114 insertions(+), 93 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index ce6a95b..69a9b64 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -136,6 +136,7 @@ class ChatController extends State builder: (c) => SendFileDialog( files: details.files, room: room, + replyEvent: replyEvent, outerContext: context, ), ); @@ -273,10 +274,11 @@ class ChatController extends State showAdaptiveDialog( context: context, builder: (c) => SendFileDialog( - files: files, - room: room, - outerContext: context, - replyEvent: replyEvent), + files: files, + room: room, + outerContext: context, + replyEvent: replyEvent, + ), ); } @@ -554,7 +556,10 @@ class ChatController extends State allowMultiple: true, type: type, ); - if (files.isEmpty) return; + if (files.isEmpty) { + Logs().v("Returning in sendFileAction, bc files.isEmpty==true"); + return; + } await showAdaptiveDialog( context: context, builder: (c) => SendFileDialog( @@ -764,9 +769,10 @@ class ChatController extends State ); return; } - var content = {...event.content}; + var content = {...event.content}; try { - text = await Translator.translate(text, PlatformDispatcher.instance.locale.languageCode); + text = await Translator.translate( + text, PlatformDispatcher.instance.locale.languageCode); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(L10n.of(context).errorTranslatingMessage)), @@ -782,7 +788,14 @@ class ChatController extends State Navigator.of(context).push(new MaterialPageRoute( builder: (BuildContext ctx) { return TranslatedEventDialog( - event: new Event(content: content, type: 'm.room.message', eventId: event.eventId, senderId: event.senderId, originServerTs: event.originServerTs, room: room), timeline: timeline!); + event: new Event( + content: content, + type: 'm.room.message', + eventId: event.eventId, + senderId: event.senderId, + originServerTs: event.originServerTs, + room: room), + timeline: timeline!); }, fullscreenDialog: true)); } diff --git a/lib/pages/chat/send_file_dialog.dart b/lib/pages/chat/send_file_dialog.dart index 5277d3d..40cef41 100644 --- a/lib/pages/chat/send_file_dialog.dart +++ b/lib/pages/chat/send_file_dialog.dart @@ -243,82 +243,82 @@ class SendFileDialogState extends State { mainAxisSize: MainAxisSize.min, children: [ const SizedBox(height: 12), - if (uniqueFileType == 'image') - Padding( - padding: const EdgeInsets.only(bottom: 16.0), - child: SizedBox( - height: 256, - child: Center( - child: ListView.builder( - shrinkWrap: true, - itemCount: widget.files.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, i) => Padding( - padding: const EdgeInsets.only(right: 8.0), - child: Material( - borderRadius: BorderRadius.circular( - AppConfig.borderRadius / 2, - ), - color: Colors.black, - clipBehavior: Clip.hardEdge, - child: FutureBuilder( - future: widget.files[i].readAsBytes(), - builder: (context, snapshot) { - final bytes = snapshot.data; - if (bytes == null) { - return const Center( - child: CircularProgressIndicator - .adaptive(), - ); - } - if (snapshot.error != null) { - Logs().w( - 'Unable to preview image', - snapshot.error, - snapshot.stackTrace, - ); - return const Center( - child: SizedBox( - width: 256, - height: 256, - child: Icon( - Icons.broken_image_outlined, - size: 64, - ), - ), - ); - } - return Image.memory( - bytes, - height: 256, - width: widget.files.length == 1 - ? 256 - 36 - : null, - fit: BoxFit.contain, - errorBuilder: (context, e, s) { - Logs() - .w('Unable to preview image', e, s); - return const Center( - child: SizedBox( - width: 256, - height: 256, - child: Icon( - Icons.broken_image_outlined, - size: 64, - ), - ), - ); - }, - ); - }, - ), - ), - ), - ), - ), - ), - ), - if (uniqueFileType != 'image') + // if (uniqueFileType == 'image') + // Padding( + // padding: const EdgeInsets.only(bottom: 16.0), + // child: SizedBox( + // height: 256, + // child: Center( + // child: ListView.builder( + // shrinkWrap: true, + // itemCount: widget.files.length, + // scrollDirection: Axis.horizontal, + // itemBuilder: (context, i) => Padding( + // padding: const EdgeInsets.only(right: 8.0), + // child: Material( + // borderRadius: BorderRadius.circular( + // AppConfig.borderRadius / 2, + // ), + // color: Colors.black, + // clipBehavior: Clip.hardEdge, + // child: FutureBuilder( + // future: widget.files[i].readAsBytes(), + // builder: (context, snapshot) { + // final bytes = snapshot.data; + // if (bytes == null) { + // return const Center( + // child: CircularProgressIndicator + // .adaptive(), + // ); + // } + // if (snapshot.error != null) { + // Logs().w( + // 'Unable to preview image', + // snapshot.error, + // snapshot.stackTrace, + // ); + // return const Center( + // child: SizedBox( + // width: 256, + // height: 256, + // child: Icon( + // Icons.broken_image_outlined, + // size: 64, + // ), + // ), + // ); + // } + // return Image.memory( + // bytes, + // height: 256, + // width: widget.files.length == 1 + // ? 256 - 36 + // : null, + // fit: BoxFit.contain, + // errorBuilder: (context, e, s) { + // Logs() + // .w('Unable to preview image', e, s); + // return const Center( + // child: SizedBox( + // width: 256, + // height: 256, + // child: Icon( + // Icons.broken_image_outlined, + // size: 64, + // ), + // ), + // ); + // }, + // ); + // }, + // ), + // ), + // ), + // ), + // ), + // ), + // ), + // if (uniqueFileType != 'image') Padding( padding: const EdgeInsets.only(bottom: 16.0), child: Row( diff --git a/lib/pages/settings_emotes/settings_emotes.dart b/lib/pages/settings_emotes/settings_emotes.dart index 62a5d3b..4216d6d 100644 --- a/lib/pages/settings_emotes/settings_emotes.dart +++ b/lib/pages/settings_emotes/settings_emotes.dart @@ -286,9 +286,9 @@ class EmotesSettingsController extends State { if (result.isEmpty) return null; - final buffer = InputStream(await result.first.readAsBytes()); + final buffer = await result.first.readAsBytes(); - final archive = ZipDecoder().decodeBuffer(buffer); + final archive = ZipDecoder().decodeBytes(buffer); return archive; }, diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index 56d9c3d..9bc6e74 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -118,7 +118,7 @@ abstract class ClientManager { }, logLevel: kReleaseMode ? Level.warning : Level.verbose, //database: flutterMatrixSdkDatabaseBuilder(client), - legacyDatabaseBuilder: flutterMatrixSdkDatabaseBuilder, + databaseBuilder: flutterMatrixSdkDatabaseBuilder, supportedLoginTypes: { AuthenticationTypes.password, AuthenticationTypes.sso, diff --git a/lib/utils/matrix_sdk_extensions/event_extension.dart b/lib/utils/matrix_sdk_extensions/event_extension.dart index 2eb5473..1782df1 100644 --- a/lib/utils/matrix_sdk_extensions/event_extension.dart +++ b/lib/utils/matrix_sdk_extensions/event_extension.dart @@ -19,7 +19,7 @@ extension LocalizedBody on Event { void saveFile(BuildContext context) async { final matrixFile = await _getFile(context); - + matrixFile.result?.save(context); } diff --git a/pubspec.lock b/pubspec.lock index bea1375..3c83481 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -69,10 +69,10 @@ packages: dependency: "direct main" description: name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" url: "https://pub.dev" source: hosted - version: "3.6.1" + version: "4.0.7" args: dependency: transitive description: @@ -901,10 +901,10 @@ packages: dependency: "direct main" description: name: image - sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d + sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" url: "https://pub.dev" source: hosted - version: "4.3.0" + version: "4.5.4" image_picker: dependency: "direct main" description: @@ -1445,6 +1445,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + posix: + dependency: transitive + description: + name: posix + sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 + url: "https://pub.dev" + source: hosted + version: "6.0.2" pretty_qr_code: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index fd5909c..510045b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: animations: ^2.0.11 app_links: ^6.3.3 - archive: ^3.4.10 + archive: ^4.0.7 async: ^2.11.0 badges: ^3.1.2 blurhash_dart: ^1.2.1