fix: support Dia browser in Browser Rules #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Description
The "Browser Rules UI" currently hides browser toggles based on the return value of NSApplication.isBrowserInstalled. This helper function exclusively checks the LaunchServices registry for the "html/https handler" set.
For newly integrated browsers, such as Dia, if they are installed by the user before completing this specific LaunchServices registration step, isBrowserInstalled will incorrectly return false. Consequently, the configuration toggle for "Dia" remains hidden in the UI, preventing users from selecting it as their default browser, even though the application is successfully installed and functional. This limitation restricts user choice and hinders the adoption of new browsers on our platform.
Solution
This PR refines the detection logic within the isBrowserApp helper function by introducing a more robust fallback mechanism:
If both of these conditions are met, the browser is treated as installed.
This update preserves the original LaunchServices check as the primary detection method, ensuring backward compatibility with already registered browsers. The new fallback logic is only invoked when the primary check does not yield a match, thereby avoiding any impact on existing functionality and successfully unlocking the UI toggle for "Dia".