Skip to content

fix: default browser setting#6929

Merged
diegolmello merged 10 commits intodevelopfrom
default-browser-fix
Jan 23, 2026
Merged

fix: default browser setting#6929
diegolmello merged 10 commits intodevelopfrom
default-browser-fix

Conversation

@Rohit3523
Copy link
Contributor

@Rohit3523 Rohit3523 commented Jan 19, 2026

Proposed changes

App does not follow the default browser behavior. Even when the setting is configured to open links inside the app, links are always opened in an external browser. Additionally, instead of showing the actual text, the app displays the i18n key.

Note for reviewer

I have tested this behavior on Android and can confirm it is working correctly now. Selecting “In App” opens the link in an in-app tab instead of the external browser.
I haven’t tested this on iOS yet.

Issue(s)

https://rocketchat.atlassian.net/browse/CORE-1732

How to test or reproduce

  1. Go to settings
  2. Click on "Default Browser"
  3. It shows i18n keys
  4. Select "In App"
  5. Go to any room and click on link
  6. It opens the link in external browser

Screenshots

Screenshot 2026-01-22 at 1 01 45 AM

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Corrected translation handling for the in-app and system-default browser options so their labels display appropriately.
    • Fixed browser option matching so the app reliably opens links using the intended in-app vs external path and the correct browser URL scheme.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Walkthrough

Update changes how default-browser titles are translated and how the selected browser key is compared/used in the UI, and aligns browser identifier casing and the in-app vs external launch branch in the link-opening helper, affecting which URL schemes and launch paths are chosen.

Changes

Cohort / File(s) Summary
Default browser UI
app/views/DefaultBrowserView/index.tsx
List.Radio.translateTitle now computes dynamically: it translates only when item.title is one of ['In_app','System_default']; selection comparison now uses item.value === browser (value vs title). No exported signatures changed.
Link opening behavior / browser keys
app/lib/methods/helpers/openLink.ts
Adjusted browser-name comparisons and schemes: uses capitalized browser keys ('Chrome', 'Firefox', 'Brave') instead of lowercase, and treats the in-app option as 'In_app' (capitalized) when deciding to use Expo WebBrowser vs external launching; URL-scheme generation updated accordingly.

Sequence Diagram(s)

mermaid
sequenceDiagram
rect rgba(200,220,255,0.5)
participant User
end
rect rgba(200,255,200,0.5)
participant DefaultBrowserView as UI
end
rect rgba(255,220,200,0.5)
participant Storage as KeyValueStore
end
rect rgba(255,200,220,0.5)
participant OpenLink as LinkHelper
end
rect rgba(220,255,255,0.5)
participant ExternalBrowser as SystemBrowser
end
User->>UI: select "In_app" or "System_default" (item.value)
UI->>Storage: persist DEFAULT_BROWSER_KEY = selected value
User->>OpenLink: taps a link
OpenLink->>Storage: read DEFAULT_BROWSER_KEY
alt value == "In_app"
OpenLink->>OpenLink: use Expo WebBrowser.openBrowserAsync(url)
else value == "Chrome"/"Firefox"/"Brave"
OpenLink->>ExternalBrowser: construct scheme (e.g., googlechrome://... or app-specific) and open
else
OpenLink->>ExternalBrowser: open default system URL
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • diegolmello
  • OtavioStasiak

Poem

🐰 I nibble keys and hop through code,
Titles now warm in proper mode.
In-app or system, choice now clear,
Links will open where they’re near.
A little hop — the changes cheer! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: default browser setting' directly addresses the main change: fixing the default browser setting to respect 'In App' selection and display translations correctly.
Linked Issues check ✅ Passed The changes align with CORE-1732 requirements: translateTitle now shows translations instead of i18n keys, and browser comparison logic updated to use correct case-sensitive identifiers for proper 'In App' browser selection.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the default browser setting and translation display issues as defined in CORE-1732; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch default-browser-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Rohit3523 Rohit3523 marked this pull request as ready for review January 19, 2026 20:27
@Rohit3523
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Note

Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Here are the copyable unit test edits:

Copyable Edits

@Rohit3523 Rohit3523 temporarily deployed to approve_e2e_testing January 20, 2026 16:47 — with GitHub Actions Inactive
@Rohit3523 Rohit3523 temporarily deployed to experimental_android_build January 20, 2026 16:50 — with GitHub Actions Inactive
@Rohit3523 Rohit3523 temporarily deployed to experimental_ios_build January 20, 2026 16:50 — with GitHub Actions Inactive
@Rohit3523 Rohit3523 had a problem deploying to official_android_build January 20, 2026 16:50 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to upload_experimental_android January 20, 2026 17:24 — with GitHub Actions Error
@github-actions
Copy link

Android Build Available

Rocket.Chat Experimental 4.69.0.108192

Internal App Sharing: https://play.google.com/apps/test/RQVpXLytHNc/ahAO29uNQnZNMDTWcExHhSchnMlxBl-vv4Co-A_RvysQjHBXCb5SbpNQVgoKcDLLF1x63rypMIm6DPiF68j7LBiqGA

@github-actions
Copy link

iOS Build Available

Rocket.Chat Experimental 4.69.0.108193

@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build January 21, 2026 20:41 — with GitHub Actions Error
@Rohit3523 Rohit3523 temporarily deployed to experimental_ios_build January 21, 2026 20:41 — with GitHub Actions Inactive
@Rohit3523 Rohit3523 had a problem deploying to official_android_build January 21, 2026 20:41 — with GitHub Actions Error
@github-actions
Copy link

iOS Build Available

Rocket.Chat Experimental 4.69.0.108198

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
app/lib/methods/helpers/openLink.ts (2)

52-66: In‑app branch must align with persisted value.

browser === 'In_app' won’t match if the preference is still stored as 'inApp', which would skip the in‑app flow and open externally. Please align the stored value or accept both.

✅ Minimal compatibility tweak
-		if (browser === 'In_app') {
+		if (browser === 'In_app' || browser === 'inApp') {
 			await WebBrowser.openBrowserAsync(url, {

20-36: Browser selection will not work—stored values don't match comparison checks.

The stored values ('googlechrome', 'firefox', 'brave' after stripping the colon) are all lowercase, but appSchemeURL compares against capitalized strings ('Chrome', 'Firefox', 'Brave'). None of the conditions will match, and the function will always return the URL unchanged. Additionally, line 55 checks for 'In_app' but the stored value is 'inApp'.

Fix by either normalizing the comparison or adjusting stored values. For example:

-	if (browser === 'Chrome') {
+	if (browser === 'googlechrome' || browser === 'chrome') {
 		if (!isSecure) {
 			schemeUrl = url.replace(protocol, scheme.chrome);
 		} else {
 			schemeUrl = url.replace(protocol, scheme.chromeSecure);
 		}
-	} else if (browser === 'Firefox') {
+	} else if (browser === 'firefox') {
 		schemeUrl = `${scheme.firefox}//open-url?url=${url}`;
-	} else if (browser === 'Brave') {
+	} else if (browser === 'brave') {
 		schemeUrl = `${scheme.brave}//open-url?url=${url}`;
 	}

Also fix the 'In_app' check on line 55 to match the stored 'inApp' value.

@Rohit3523 Rohit3523 requested a deployment to approve_e2e_testing January 23, 2026 17:15 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to experimental_ios_build January 23, 2026 17:18 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to experimental_android_build January 23, 2026 17:18 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to official_android_build January 23, 2026 17:18 — with GitHub Actions Waiting
Copy link
Contributor

@OtavioStasiak OtavioStasiak left a comment

Choose a reason for hiding this comment

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

Looks good to me!
Nice job!

@diegolmello diegolmello merged commit e1af190 into develop Jan 23, 2026
4 of 9 checks passed
@diegolmello diegolmello deleted the default-browser-fix branch January 23, 2026 20:55
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.

3 participants