~emersion/goguma-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Enable users to upload images from their IME

Details
Message ID
<20240229212506.2074-1-delthas@dille.cc>
DKIM signature
missing
Download raw message
Patch: +11 -0
Tested on Gboard on Android.

See: https://developer.android.com/develop/ui/views/touch-and-input/image-keyboard
See: https://github.com/flutter/flutter/pull/110052
See: https://api.flutter.dev/flutter/material/TextField/contentInsertionConfiguration.html
---
 lib/widget/composer.dart | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/widget/composer.dart b/lib/widget/composer.dart
index 4bab95e..0bb2455 100644
--- a/lib/widget/composer.dart
+++ b/lib/widget/composer.dart
@@ -513,6 +513,7 @@ class ComposerState extends State<Composer> {
	}

	Widget _buildTextField(BuildContext context, TextEditingController controller, FocusNode focusNode, VoidCallback onFieldSubmitted) {
		var client = context.read<Client>();
		var prefs = context.read<Prefs>();
		var sendTyping = prefs.typingIndicator;

@@ -548,6 +549,16 @@ class ComposerState extends State<Composer> {
			minLines: 1,
			maxLines: 5,
			keyboardType: TextInputType.text, // disallows newlines
			contentInsertionConfiguration: (client.isupport.filehost != null) ? ContentInsertionConfiguration(
				allowedMimeTypes: const <String>['image/jpeg', 'image/png', 'image/gif'],
				onContentInserted: (KeyboardInsertedContent data) async {
					if (data.hasData) {
						_runAddMenuTask(() async {
							await _uploadFile(XFile.fromData(data.data!, mimeType: data.mimeType, path: data.uri));
						});
					}
				},
			) : null,
		);
	}


base-commit: 2d16a7005d5ace641d69bf795c97c05244fa67cb
-- 
2.38.0
Details
Message ID
<Px33au79riwcT8WGOxaSgj6FmBGrv3bXvPfgGhF7d94J1RSq6oPZPvXhY4pYnhvrnt8YylnfoXelrLms1M4ST0oVHFliusMPkxkF4EQjoqY=@emersion.fr>
In-Reply-To
<20240229212506.2074-1-delthas@dille.cc> (view parent)
DKIM signature
pass
Download raw message
Pushed with a small edit to leave allowedMimeTypes null to allow all.
Thanks!
Reply to thread Export thread (mbox)