Skip to content

Fix #6881: Add intent to Failed Upload notification to open Failed tab#6884

Open
Kishan8548 wants to merge 2 commits into
commons-app:mainfrom
Kishan8548:fix/failed-upload-notification-6881
Open

Fix #6881: Add intent to Failed Upload notification to open Failed tab#6884
Kishan8548 wants to merge 2 commits into
commons-app:mainfrom
Kishan8548:fix/failed-upload-notification-6881

Conversation

@Kishan8548
Copy link
Copy Markdown
Contributor

Description (required)

Fixes #6881

What changes did you make and why?

  • Added missing PendingIntent: The showErrorNotification method in UploadWorker.kt was missing a PendingIntent, which caused tapping on the "Failed to upload" error notification to do nothing. I added the intent to correctly launch UploadProgressActivity.
  • Direct routing to FAILED tab: When an upload fails, clicking the notification should ideally open the "FAILED" tab directly instead of defaulting to the "PENDING" tab.
    • I updated UploadWorker.getPendingIntent() to accept a targetTab argument, and added it to the intent extras.
    • Crucially, I set targetTab as the requestCode to ensure the Android OS treats it as a unique PendingIntent, preventing FLAG_IMMUTABLE from reusing a previous intent and ignoring our extras.
    • Finally, I updated UploadProgressActivity to check for this upload_target_tab extra and switch the ViewPager to the correct tab on launch.

Tests performed (required)

Tested ProdDebug on POCO F6 with API level 36.

  • Forced a network failure by starting an upload and immediately toggling off the internet connection.
  • Verified that tapping the "Failed to upload" notification successfully launches the app and opens the correct "FAILED" tab inside the Uploads activity.

Screenshots (for UI changes only)

Screenrecorder-2026-05-12-21-17-13-782.mp4

Copilot AI review requested due to automatic review settings May 12, 2026 15:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #6881 by making “Failed to upload” notifications actionable: tapping them now opens UploadProgressActivity and routes directly to the FAILED uploads tab.

Changes:

  • Added a PendingIntent to the failed/error upload notifications so taps launch UploadProgressActivity.
  • Extended UploadWorker.getPendingIntent() to accept a targetTab and pass it via intent extras (and as the requestCode).
  • Updated UploadProgressActivity to read the tab extra on launch and switch to the requested tab.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt Adds notification PendingIntents and passes a target-tab extra via getPendingIntent()
app/src/main/java/fr/free/nrw/commons/upload/UploadProgressActivity.kt Reads upload_target_tab extra and sets the initial ViewPager tab accordingly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Comment thread app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
@github-actions
Copy link
Copy Markdown

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tapping "Failed to upload" notification has no effect

2 participants