Skip to content

Conversation

@domonkosadam
Copy link
Contributor

refs: CLX-3342
affects: Student
release note: none

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Review Summary

This PR successfully simplifies the "Report a Bug" functionality by removing the complex WebView-based implementation and replacing it with a direct external URL link. This is a great improvement that reduces code complexity and maintenance burden.

Positive Changes ✅

  • Reduced complexity: Removed 147 lines of complex WebView code including JavaScript interface handling, file picker callbacks, and video client setup
  • Cleaner architecture: Eliminated unnecessary navigation route and dedicated screen for a simple external link
  • Better user experience: Opens the bug report URL directly in the user's browser instead of an embedded WebView
  • Improved maintainability: Simpler code with fewer moving parts and dependencies

Issues to Address

  • Hardcoded URL (libs/horizon/src/main/java/com/instructure/horizon/features/account/AccountViewModel.kt:122): The bug report URL is hardcoded in the ViewModel. Consider extracting it to a constant for better maintainability
  • Missing error handling (libs/horizon/src/main/java/com/instructure/horizon/features/account/AccountScreen.kt:171): The uriHandler.openUri() call should be wrapped in try-catch to handle cases where no browser is available

Code Quality

  • Architecture follows MVVM pattern correctly
  • Changes are focused and well-scoped
  • Removed unused code completely (no backwards-compatibility hacks)
  • Type changes are consistent across the codebase

Testing Recommendations

  • Verify the external URL opens correctly in the default browser
  • Test behavior when no browser app is installed on the device
  • Ensure the account screen still renders correctly with the simplified implementation

Overall, this is a solid refactoring that improves the codebase. The suggested improvements are minor and would further enhance robustness.

AccountItemState(
title = context.getString(R.string.accountReportABug),
type = AccountItemType.OpenExternal(AccountRoute.BugReportWebView)
type = AccountItemType.OpenExternal("https://community.canvaslms.com/t5/Canvas-Career/Report-an-issue/td-p/662564")
Copy link

Choose a reason for hiding this comment

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

Consider extracting this URL to a constant or configuration file instead of hardcoding it in the ViewModel. This would make it easier to update the URL in the future and improve testability.

companion object {
    private const val BUG_REPORT_URL = "https://community.canvaslms.com/t5/Canvas-Career/Report-an-issue/td-p/662564"
}


is AccountItemType.OpenExternal -> navController.navigate(item.type.route.route)
is AccountItemType.OpenExternal -> {
uriHandler.openUri(item.type.url)
Copy link

Choose a reason for hiding this comment

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

Good use of LocalUriHandler for opening external URLs! However, consider adding error handling in case the URI cannot be opened (e.g., no browser installed):

is AccountItemType.OpenExternal -> {
    try {
        uriHandler.openUri(item.type.url)
    } catch (e: Exception) {
        // Log error or show a toast to the user
    }
}

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

📊 Code Coverage Report

✅ Student

  • PR Coverage: 42.61%
  • Master Coverage: 42.61%
  • Delta: +0.00%

✅ Teacher

  • PR Coverage: 25.44%
  • Master Coverage: 25.44%
  • Delta: +0.00%

✅ Pandautils

  • PR Coverage: 22.59%
  • Master Coverage: 22.59%
  • Delta: +0.00%

📈 Overall Average

  • PR Coverage: 30.21%
  • Master Coverage: 30.21%
  • Delta: +0.00%

@github-actions
Copy link

Student Install Page

Copy link
Contributor

@andrasmaczak andrasmaczak left a comment

Choose a reason for hiding this comment

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

Don't merge it yet, the url might be changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants