From a327e8b0e9d990f0ce4fe84c5a6c8707bb99b4f0 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sat, 28 Oct 2023 11:47:31 +0200 Subject: [PATCH] chore: Limit image file and video picker until we have a background service --- lib/pages/chat/chat.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 23b77c70..9de368fc 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -485,7 +485,7 @@ class ChatController extends State { void sendFileAction() async { final result = await AppLock.of(context).pauseWhile( FilePicker.platform.pickFiles( - allowMultiple: true, + allowMultiple: false, withData: true, ), ); @@ -524,12 +524,11 @@ class ChatController extends State { } void sendImageAction() async { - //AppLock.of(context).pauseWhile(); final result = await AppLock.of(context).pauseWhile( FilePicker.platform.pickFiles( type: FileType.image, withData: true, - allowMultiple: true, + allowMultiple: false, ), ); if (result == null || result.files.isEmpty) return; @@ -575,7 +574,10 @@ class ChatController extends State { void openVideoCameraAction() async { // Make sure the textfield is unfocused before opening the camera FocusScope.of(context).requestFocus(FocusNode()); - final file = await ImagePicker().pickVideo(source: ImageSource.camera); + final file = await ImagePicker().pickVideo( + source: ImageSource.camera, + maxDuration: const Duration(minutes: 1), + ); if (file == null) return; final bytes = await file.readAsBytes(); await showDialog(