add intent support for simple plain text

This commit is contained in:
Fabian Freund
2025-09-18 14:34:17 +02:00
parent 24c3cdbb94
commit a1bc9fa119
2 changed files with 9 additions and 0 deletions
@@ -62,6 +62,7 @@
<activity
android:name=".MainActivity"
android:label="WebLibre"
android:exported="true"
android:launchMode="singleTask"
android:taskAffinity="eu.weblibre.gecko.task"
@@ -133,6 +134,12 @@
<data android:mimeType="application/pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.WEB_SEARCH" />
@@ -35,6 +35,8 @@ final _sharingIntentTransformer =
StreamTransformer<Intent, ReceivedIntentParameter>.fromHandlers(
handleData: (intent, sink) async {
final data = switch (intent.action) {
'android.intent.action.PROCESS_TEXT' =>
intent.extra['android.intent.extra.PROCESS_TEXT'] as String?,
'android.intent.action.WEB_SEARCH' =>
intent.extra['query'] as String?,
'android.intent.action.VIEW' => intent.data,