Skip to content

Conversation

@FikriMilano
Copy link
Member

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes #3779

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for bug fixes
  • I have added any strings visible on UI components to the strings.xml file
  • I have updated the CHANGELOG.md file for any notable changes to the codebase
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the project's style guide
  • I have built and run the FHIRCore app to verify my change fixes the issue and/or does not break the app
  • I have checked that this PR does NOT introduce breaking changes that require an update to Content and/or Configs? If it does add a sample here or a link to exactly what changes need to be made to the content.

Code Reviewer Checklist

  • I have verified Unit tests have been written for any new feature(s) and edge cases
  • I have verified any strings visible on UI components are in the strings.xml file
  • I have verifed the CHANGELOG.md file has any notable changes to the codebase
  • I have verified the solution has been implemented in a configurable and generic way for reuseable components
  • I have built and run the FHIRCore app to verify the change fixes the issue and/or does not break the app

@codecov
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.3%. Comparing base (b4b5028) to head (da45071).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...fhircore/quest/util/extensions/ConfigExtensions.kt 0.0% 8 Missing ⚠️
...gine/configuration/workflow/ApplicationWorkflow.kt 0.0% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.0%) is below the target coverage (60.0%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #3780     +/-   ##
=========================================
- Coverage     30.0%   25.3%   -4.8%     
+ Complexity     915     815    -100     
=========================================
  Files          287     297     +10     
  Lines        15409   16086    +677     
  Branches      2703    2812    +109     
=========================================
- Hits          4628    4071    -557     
- Misses       10215   11502   +1287     
+ Partials       566     513     -53     
Flag Coverage Δ
engine 60.7% <0.0%> (-0.1%) ⬇️
geowidget 18.7% <ø> (+0.7%) ⬆️
quest 5.0% <0.0%> (-6.4%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...gine/configuration/workflow/ApplicationWorkflow.kt 0.0% <0.0%> (ø)
...fhircore/quest/util/extensions/ConfigExtensions.kt 0.0% <0.0%> (-10.5%) ⬇️

... and 63 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to open URLs via navigation menu items by implementing a new OPEN_URL workflow. The implementation allows configurable navigation menu items to open external URLs in the system browser or appropriate applications.

  • Added OPEN_URL workflow type to ApplicationWorkflow enum
  • Implemented URL opening functionality in ConfigExtensions.kt using Android intents
  • Added a "Feedback" navigation menu item as an example usage

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ConfigExtensions.kt Implements the OPEN_URL workflow handler with intent-based URL opening
navigation_config.json Adds example feedback menu item using the new OPEN_URL workflow
ic_feedback.xml Adds feedback icon resource for the navigation menu item
ApplicationWorkflow.kt Defines the new OPEN_URL workflow enum value

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
ContextCompat.startActivity(navController.context, intent, null)
} catch (e: Exception) {
context?.showToast("Unable to open url ${e.message}", Toast.LENGTH_SHORT)
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

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

The error message exposes the raw exception message to users, which may contain technical details that are confusing. Consider using a more user-friendly message like 'Unable to open the URL. Please check the link and try again.'

Suggested change
context?.showToast("Unable to open url ${e.message}", Toast.LENGTH_SHORT)
context?.showToast("Unable to open the URL. Please check the link and try again.", Toast.LENGTH_SHORT)

Copilot uses AI. Check for mistakes.
Comment on lines +252 to +257
try {
val intent = Intent(Intent.ACTION_VIEW, url.toUri())
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
ContextCompat.startActivity(navController.context, intent, null)
} catch (e: Exception) {
context?.showToast("Unable to open url ${e.message}", Toast.LENGTH_SHORT)
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

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

The URL is not validated before being passed to the intent. This could allow malicious URLs to be opened. Consider validating the URL scheme (e.g., only allow http/https) or implementing a URL whitelist to prevent potential security issues.

Suggested change
try {
val intent = Intent(Intent.ACTION_VIEW, url.toUri())
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
ContextCompat.startActivity(navController.context, intent, null)
} catch (e: Exception) {
context?.showToast("Unable to open url ${e.message}", Toast.LENGTH_SHORT)
val uri = Uri.parse(url)
val scheme = uri.scheme?.lowercase()
if (scheme == "http" || scheme == "https") {
try {
val intent = Intent(Intent.ACTION_VIEW, uri)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
ContextCompat.startActivity(navController.context, intent, null)
} catch (e: Exception) {
context?.showToast("Unable to open url ${e.message}", Toast.LENGTH_SHORT)
}
} else {
context?.showToast("Invalid or unsupported URL scheme", Toast.LENGTH_SHORT)

Copilot uses AI. Check for mistakes.
FikriMilano added a commit that referenced this pull request Nov 11, 2025
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.

Open url via navigation menu

2 participants