-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CMM-972 authenticate media requests with wp.com credentials #22359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMM-972 authenticate media requests with wp.com credentials #22359
Conversation
Generated by 🚫 Danger |
WordPress/src/main/java/org/wordpress/android/support/he/ui/AttachmentFullscreenVideoPlayer.kt
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/ui/AttachmentFullscreenVideoPlayer.kt
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/ui/AttachmentFullscreenVideoPlayer.kt
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/util/TempAttachmentsUtil.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/util/TempAttachmentsUtil.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/ui/HESupportViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/ui/HESupportViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/ui/HESupportViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/support/he/ui/AttachmentFullscreenVideoPlayer.kt
Outdated
Show resolved
Hide resolved
|
| App Name | Jetpack | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22359-5f73fa6 | |
| Commit | 5f73fa6 | |
| Direct Download | jetpack-prototype-build-pr22359-5f73fa6.apk |
|
| App Name | WordPress | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22359-5f73fa6 | |
| Commit | 5f73fa6 | |
| Direct Download | wordpress-prototype-build-pr22359-5f73fa6.apk |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22359 +/- ##
=======================================
Coverage 39.05% 39.05%
=======================================
Files 2201 2201
Lines 106104 106169 +65
Branches 15040 15048 +8
=======================================
+ Hits 41434 41469 +35
- Misses 61182 61211 +29
- Partials 3488 3489 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Claude finished @adalpari's task —— View job Code Review CompleteI've performed a comprehensive review of this PR. Overall, the implementation is well-structured with good test coverage. Below are my findings organized by category: Summary✅ Strengths:
1. Code Quality IssuesCritical: Deprecated API UsageFile: The code uses deprecated ExoPlayer APIs ( Recommendation: Migrate to the non-deprecated APIs:
I understand from review comments that ExoPlayer upgrade is out of scope, but this should be tracked as technical debt. The codebase guidelines are clear about avoiding deprecated APIs in new features. Recomposition PerformanceFile: val authorizationHeader = remember { onGetAuthorizationHeaderArgument() }Good optimization! This prevents repeated function calls during recomposition. However, there's an issue in the same file at line 96: addHeader(AUTHORIZATION_TAG, onGetAuthorizationHeaderArgument.invoke())This lambda is invoked on every recomposition. Should be cached with Line Length ViolationsFile: Several lines exceed the 120-character limit specified in project guidelines: Line 45: "Error removing attachment temp files temp files: " + e.stackTraceToString()
Line 128: "Failed to download video. Deleted: ${deleted} - Response code: $responseCode"Recommendation: Break into multiple lines or use multiline strings. 2. Security Review✅ Good: Authorization Header HandlingFile: fun getAuthorizationHeader():String = "$BEARER_TAG ${accountStore.accessToken}"Proper Bearer token format. However:
|
I know Claude, I know. You have complained about it 10 times 😓
This is missing part of the story. The download is inside the ViewModel, called by a coroutine. I assume Claude got panicked because of the function name. |
|
jkmassel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this against some existing threads, and they worked fine – both images and videos.





Description
We made some changes at the server side, so now attachment files are hosted in the WP api, so an authentication is needed to browse them.
This PR is adding an authentication header to properly show the images and videos attached to HE tickets.
Important note: Images worked straightforwardly, but videos were not properly loaded by ExoPlayer, even using the same auth configuration we use for Media videos. Something seems to be working differently at the server side for the attachments since the media fullscreen is able to reproduce WP videos requiring authorization, but no the attached ones.
All in all, we are now downloading the videos before playing them. It can cause some delay when loading a heavy video, but the result feels way better.
Testing instructions
Before:

After:
