Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C
// Check if all required permissions are granted
val hasAllPermissions = hasPermission(this, PERMISSIONS_STORAGE)
val hasPartialAccess = hasPartialAccess(this)

// The share intent provides files via content uris with temporary read permissions,
// so we do not need to obtain storage permissions
val action = intent.action
if (Intent.ACTION_SEND == action || Intent.ACTION_SEND_MULTIPLE == action) {
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI visibility for binding.cvContainerTopCard is not set when handling share intents. In the normal flow (line 330), binding.cvContainerTopCard.visibility is set to View.VISIBLE after permissions are granted and receiveSharedItems() is called. The share intent path should also set this visibility to ensure consistent UI behavior. Consider adding binding.cvContainerTopCard.visibility = View.VISIBLE before calling receiveSharedItems().

Suggested change
if (Intent.ACTION_SEND == action || Intent.ACTION_SEND_MULTIPLE == action) {
if (Intent.ACTION_SEND == action || Intent.ACTION_SEND_MULTIPLE == action) {
binding.cvContainerTopCard.visibility = View.VISIBLE

Copilot uses AI. Check for mistakes.
receiveSharedItems()
return
}
Comment on lines 317 to 322
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check duplicates the logic already present in receiveSharedItems() (lines 485-486). The receiveSharedItems() method already checks for the same intent actions to call receiveExternalSharedItems(). Consider refactoring to avoid this duplication, perhaps by extracting an isShareIntent() helper method or restructuring the permission check flow.

Copilot uses AI. Check for mistakes.

if (hasAllPermissions || hasPartialAccess) {
// All required permissions are granted, so enable UI elements and perform actions
receiveSharedItems()
Expand Down