Update UnifiedAboutActivity.kt - #23154
Conversation
Added check for possible invalid URLs or missing web browsers.
|
Thanks for taking the time to put this together, @OneBitSailor! Unfortunately I don’t think we can merge this one, and I wanted to explain why. The try/catch is already handled upstream. ActivityLauncher.openUrlExternal catches Since the exception never reaches the caller, the new catch block can’t be hit. Devices without a browser are already covered. The Dagger change isn’t in the diff. The description mentions moving injection before One thing for future PRs: user-facing strings need to come from Going to close this, but thanks again for the interest in the project! 🙇 |
Fixed lifecycle and possible injection issues in UnifiedAboutActivity along side with implementing safe check for possible invalid URLs or missing external web browsers.
Description
Safe Dependency Injection: Ensured Dagger injection occurs before
super.onCreateto prevent lifecycle race conditions where the framework might try to restore state or fragments using fields before they are injected.Safe URL Interaction: Encapsulated the external URL launcher in a explicit
try-catchblock capturingActivityNotFoundException. This guarantees the app will not crash on low-end or highly restricted devices lacking a default web browser or when processed an invalid deep-link structure.Testing instructions
Test Case 1: Standard navigation and external link launching
Test Case 2: Error handling on missing browser or invalid URL
openExternalBlogUrlwith an invalid link schema or restricted destination.Use numbered lists for action steps and checkboxes for verifications.
Organise by test case title when there are multiple scenarios.
Self-Testing Checklist
UnifiedAboutActivitycorrectly resolves config settings provided by theUnifiedAboutViewModelregardless of whether the active authenticated user profile belongs to a WordPress.com account or a self-hosted Jetpack site.