Skip to content

Guard the external link launch in the reader view - #63

Open
jim-daf wants to merge 1 commit into
DesarrolloAntonio:masterfrom
jim-daf:fix-webview-link-crash
Open

Guard the external link launch in the reader view#63
jim-daf wants to merge 1 commit into
DesarrolloAntonio:masterfrom
jim-daf:fix-webview-link-crash

Conversation

@jim-daf

@jim-daf jim-daf commented Jun 4, 2026

Copy link
Copy Markdown

This wraps the external link launch in the reader view so the app no longer crashes when there is no app available to open the link.

Before, the link was passed to startActivity directly, which throws ActivityNotFoundException on a device with no handler. With this change the link still opens when a handler exists, and otherwise the exception is caught and a short message is shown.

Closes #62.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces error handling when opening external links from the WebView in ReadableContentScreen.kt by catching ActivityNotFoundException and displaying a Toast message. The review feedback correctly suggests externalizing the hardcoded Toast message string to strings.xml to support localization.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

try {
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(context, "No app found to open this link", Toast.LENGTH_SHORT).show()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The user-facing string "No app found to open this link" is hardcoded. To support internationalization (i18n) and localization, this string should be defined in the strings.xml resource file and retrieved using context.getString().

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.

External links in the reader view can crash with ActivityNotFoundException

1 participant