Wire up settings URLs#11
Conversation
…ler` to open external URLs when users tap rows.\n- Implement open URL actions for Share Feedback, Get Help, Terms of Service, and Privacy Policy.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request implements functional links in the 'More Options' section of the Settings screen by utilizing LocalUriHandler to open external URLs for feedback, help, terms of service, and privacy policy. Feedback suggests centralizing the URI opening logic within a remembered helper function to provide robust error handling for cases where a browser might not be available. Additionally, it is recommended to move hardcoded URLs containing locale segments into string resources to better support internationalization.
| LaunchedEffect(lifecycleState) { | ||
| if (lifecycleState == Lifecycle.State.RESUMED) viewModel.refresh() | ||
| } | ||
| val uriHandler = LocalUriHandler.current |
There was a problem hiding this comment.
To improve robustness and reduce duplication, consider creating a remembered helper function to handle URI opening. This allows you to centralize error handling (e.g., catching exceptions if no browser is installed on the device) and makes the UI code cleaner.
| val uriHandler = LocalUriHandler.current | |
| val uriHandler = LocalUriHandler.current | |
| val openUrl = remember(uriHandler) { | |
| { url: String -> | |
| try { | |
| uriHandler.openUri(url) | |
| } catch (e: Exception) { | |
| // TODO: Handle error gracefully (e.g., show a snackbar or log the error) | |
| } | |
| } | |
| } |
| SettingsRow(title = stringResource(Res.string.settings_share_feedback), onClick = { uriHandler.openUri("https://github.com/mobile/feedback") }) | ||
| SettingsRow(title = stringResource(Res.string.settings_get_help), onClick = { uriHandler.openUri("https://support.github.com") }) | ||
| SettingsRow(title = stringResource(Res.string.settings_terms_of_service), onClick = { uriHandler.openUri("https://docs.github.com/en/site-policy/github-terms/github-terms-of-service") }) | ||
| SettingsRow(title = stringResource(Res.string.settings_privacy_policy), onClick = { uriHandler.openUri("https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement") }) |
There was a problem hiding this comment.
Use the openUrl helper function to handle URI opening with centralized error handling. Additionally, note that the documentation URLs for Terms of Service and Privacy Policy are hardcoded with the /en/ locale segment. To better support internationalization (i18n), consider moving these URLs to string resources (strings.xml) so that localized links can be provided for different languages.
| SettingsRow(title = stringResource(Res.string.settings_share_feedback), onClick = { uriHandler.openUri("https://github.com/mobile/feedback") }) | |
| SettingsRow(title = stringResource(Res.string.settings_get_help), onClick = { uriHandler.openUri("https://support.github.com") }) | |
| SettingsRow(title = stringResource(Res.string.settings_terms_of_service), onClick = { uriHandler.openUri("https://docs.github.com/en/site-policy/github-terms/github-terms-of-service") }) | |
| SettingsRow(title = stringResource(Res.string.settings_privacy_policy), onClick = { uriHandler.openUri("https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement") }) | |
| SettingsRow(title = stringResource(Res.string.settings_share_feedback), onClick = { openUrl("https://github.com/mobile/feedback") }) | |
| SettingsRow(title = stringResource(Res.string.settings_get_help), onClick = { openUrl("https://support.github.com") }) | |
| SettingsRow(title = stringResource(Res.string.settings_terms_of_service), onClick = { openUrl("https://docs.github.com/en/site-policy/github-terms/github-terms-of-service") }) | |
| SettingsRow(title = stringResource(Res.string.settings_privacy_policy), onClick = { openUrl("https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement") }) |
Wire up the Share Feedback, Get Help, Terms of Service, and Privacy Policy rows in Settings to open their respective URLs in the device browser using
LocalUriHandler.PR created automatically by Jules for task 11082377490145505425 started by @TheRealAshik