Skip to content

Update UnifiedAboutActivity.kt - #23154

Open
OneBitSailor wants to merge 2 commits into
wordpress-mobile:trunkfrom
OneBitSailor:check-about-activity
Open

Update UnifiedAboutActivity.kt#23154
OneBitSailor wants to merge 2 commits into
wordpress-mobile:trunkfrom
OneBitSailor:check-about-activity

Conversation

@OneBitSailor

Copy link
Copy Markdown

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.onCreate to 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-catch block capturing ActivityNotFoundException. 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

  1. Clicking upon blog button in about.
  2. The link will be redirected to URLs upon action.
  • Verify that the external web browser opens immediately to the correct URL.
  1. Rotate the device while the browser is open or right after returning to the app.
  • Verify that the app does not repeatedly attempt to launch the browser or crash due to configuration changes.

Test Case 2: Error handling on missing browser or invalid URL

  1. (Optional/Simulated) Use a device/emulator with no default web browser installed, or temporarily disable your system browser.
  2. Trigger the action that calls openExternalBlogUrl with an invalid link schema or restricted destination.
  • Verify that the app does not crash.
  • Verify that a Toast message appears displaying "Invalid URL or external activity!".
    Use numbered lists for action steps and checkboxes for verifications.
    Organise by test case title when there are multiple scenarios.

Self-Testing Checklist

  • Compatibility with WordPress.com sites and self-hosted Jetpack sites: Verified that the UnifiedAboutActivity correctly resolves config settings provided by the UnifiedAboutViewModel regardless of whether the active authenticated user profile belongs to a WordPress.com account or a self-hosted Jetpack site.

Added check for possible invalid URLs or missing web browsers.
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.

1 participant