Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TopLevel.Launcher #14320

Merged
merged 4 commits into from
Feb 7, 2024
Merged

Implement TopLevel.Launcher #14320

merged 4 commits into from
Feb 7, 2024

Conversation

maxkatz6
Copy link
Member

@maxkatz6 maxkatz6 commented Jan 23, 2024

What does the pull request do?

Adds TopLevel.Launcher service to allow launching Uri and IStorageItem.

See https://github.com/AvaloniaUI/Avalonia/pull/14320/files#diff-dedbbea0fc7e00cbdde2962c6eb7ba6edc52d0af3894b74608e742000321963a for the public API changes.

How was the solution implemented (if it's not obvious)?

For desktop: simple Process shell execute.
For browser: window.open (only links).
For mobile: copy of essentials launcher with adjustments.

Both macOS and Windows platforms can be improved by using more specific APIs, like WinRT Launcher API on Windows. But I am going to leave it outside of this PR scope.

Checklist

Fixed issues

Contributes to #7640
Fixes #13640

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0043869-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0043873-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0043879-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@workgroupengineering
Copy link
Contributor

Great.
What do you think to add to "AppBuilder" the ability to override the behavior of ILauncher? May be useful in non-standard Linux distributions.

@maxkatz6
Copy link
Member Author

@workgroupengineering no, probably not now. If anything - we should support OpenURI and OpenFILE - https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.OpenURI.xml.

@workgroupengineering
Copy link
Contributor

@workgroupengineering no, probably not now. If anything - we should support OpenURI and OpenFILE - https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.OpenURI.xml.

Ok, thanks I had already seen it. My proposal is a simple way to give those who use custom Linux distributions with DRM or FrameBuffer support the possibility to customize the behavior.

I was thinking of something like this:

          return AppBuilder.Configure<App>()
                      .UsePlatformDetect()
                      .WithInterFont()
                      .WithLaunchUriAsync( async uri=>
                      {
                          ...
                          return await Task.FromResult(false);
                      })

@thevortexcloud
Copy link
Contributor

I can't say I am a fan of that. If it had to be done you would be better off somehow providing a custom implementation of ILauncher. But even that feels unnecessary.

@robloo
Copy link
Contributor

robloo commented Jan 23, 2024

This is great! I'll plan to resurrect the HyperlinkButton control and open a PR in a few weeks.

@robloo robloo mentioned this pull request Jan 27, 2024
8 tasks
@maxkatz6 maxkatz6 requested a review from a team January 31, 2024 23:22
@robloo robloo mentioned this pull request Feb 6, 2024
3 tasks
Copy link
Member

@jmacato jmacato left a comment

Choose a reason for hiding this comment

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

LGTM

@jmacato jmacato added this pull request to the merge queue Feb 7, 2024
Merged via the queue into master with commit df4189c Feb 7, 2024
7 checks passed
@jmacato jmacato deleted the launcher branch February 7, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants