From 6f4d7fd6b9a145406664cc4a0534d9867d10d3f0 Mon Sep 17 00:00:00 2001 From: Trevor Date: Tue, 19 Aug 2025 11:54:29 -0500 Subject: [PATCH] Add comprehensive debugging for file sharing intent handling - Add logging for all intent details (action, data, type, extras) - Add detailed logging for ACTION_SEND intent processing - Add logging for targetData processing and handleUrlAll calls - Add logging for URI scheme detection - This will help identify where the file sharing process is failing The logs will show the complete flow from intent reception to processing. --- .../platformplayer/activities/MainActivity.kt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 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 b591d038..d3935558 100644 --- a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt +++ b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt @@ -705,15 +705,20 @@ class MainActivity : AppCompatActivity, IWithResultLauncher { if (intent == null) return; Logger.i(TAG, "handleIntent started by " + intent.action); - + Logger.i(TAG, "Intent data: " + intent.dataString); + Logger.i(TAG, "Intent type: " + intent.type); + Logger.i(TAG, "Intent extras: " + intent.extras?.keySet()?.joinToString(", ")); var targetData: String? = null; when (intent.action) { Intent.ACTION_SEND -> { - targetData = intent.getStringExtra(Intent.EXTRA_STREAM) - ?: intent.getStringExtra(Intent.EXTRA_TEXT); - Logger.i(TAG, "Share Received: " + targetData); + val streamExtra = intent.getStringExtra(Intent.EXTRA_STREAM); + val textExtra = intent.getStringExtra(Intent.EXTRA_TEXT); + Logger.i(TAG, "Share Received - EXTRA_STREAM: $streamExtra"); + Logger.i(TAG, "Share Received - EXTRA_TEXT: $textExtra"); + targetData = streamExtra ?: textExtra; + Logger.i(TAG, "Share Received - Final targetData: " + targetData); } Intent.ACTION_VIEW -> { @@ -765,22 +770,29 @@ class MainActivity : AppCompatActivity, IWithResultLauncher { } try { + Logger.i(TAG, "About to process targetData: $targetData") if (targetData != null) { lifecycleScope.launch(Dispatchers.Main) { try { + Logger.i(TAG, "Calling handleUrlAll with: $targetData") handleUrlAll(targetData) } catch (e: Throwable) { Logger.e(TAG, "Unhandled exception in handleUrlAll", e) } } + } else { + Logger.w(TAG, "targetData is null, nothing to process") } } catch (ex: Throwable) { + Logger.e(TAG, "Exception in handleIntent", ex) UIDialogs.showGeneralErrorDialog(this, getString(R.string.failed_to_handle_file), ex); } } suspend fun handleUrlAll(url: String) { + Logger.i(TAG, "handleUrlAll called with url: $url") val uri = Uri.parse(url) + Logger.i(TAG, "Parsed URI scheme: ${uri.scheme}") when (uri.scheme) { "grayjay" -> { if (url.startsWith("grayjay://license/")) {