From 71f626e8e06e4c3ccee56a77886e63712e23e923 Mon Sep 17 00:00:00 2001 From: Trevor Date: Tue, 19 Aug 2025 11:56:30 -0500 Subject: [PATCH] Fix file sharing to properly handle EXTRA_STREAM Parcelable - Add support for EXTRA_STREAM as Parcelable URI instead of just String - Check for streamParcelable first, then fall back to string extras - Add logging to show both String and Parcelable EXTRA_STREAM values - This should fix the issue where file sharing was receiving description text instead of actual file content The logs showed that EXTRA_STREAM was null as String but the file content should be available as a Parcelable URI. --- .../futo/platformplayer/activities/MainActivity.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt index d3935558..1853f5e7 100644 --- a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt +++ b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt @@ -715,9 +715,19 @@ class MainActivity : AppCompatActivity, IWithResultLauncher { Intent.ACTION_SEND -> { val streamExtra = intent.getStringExtra(Intent.EXTRA_STREAM); val textExtra = intent.getStringExtra(Intent.EXTRA_TEXT); - Logger.i(TAG, "Share Received - EXTRA_STREAM: $streamExtra"); + val streamParcelable = intent.getParcelableExtra(Intent.EXTRA_STREAM); + + Logger.i(TAG, "Share Received - EXTRA_STREAM (String): $streamExtra"); + Logger.i(TAG, "Share Received - EXTRA_STREAM (Parcelable): $streamParcelable"); Logger.i(TAG, "Share Received - EXTRA_TEXT: $textExtra"); - targetData = streamExtra ?: textExtra; + + // Try to get the actual file content + targetData = when { + streamParcelable != null -> streamParcelable.toString() + streamExtra != null -> streamExtra + textExtra != null -> textExtra + else -> null + } Logger.i(TAG, "Share Received - Final targetData: " + targetData); }