Files
Dave Friedel 2a4e35cd39 Fix compilation: restore clean RC1 codebase
- Restore clean BindableProperty.Create syntax from RC1 commit
- Remove decompiler artifacts with mangled delegate types
- Add Svg.Skia package reference for icon support
- Fix duplicate type definitions
- Library now compiles successfully (0 errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 07:43:44 -05:00

67 lines
1.9 KiB
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using Microsoft.Maui.ApplicationModel;
namespace Microsoft.Maui.Platform.Linux.Services;
/// <summary>
/// Linux browser implementation using xdg-open.
/// </summary>
public class BrowserService : IBrowser
{
public async Task<bool> OpenAsync(string uri)
{
return await OpenAsync(new Uri(uri), BrowserLaunchMode.SystemPreferred);
}
public async Task<bool> OpenAsync(string uri, BrowserLaunchMode launchMode)
{
return await OpenAsync(new Uri(uri), launchMode);
}
public async Task<bool> OpenAsync(Uri uri)
{
return await OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
}
public async Task<bool> OpenAsync(Uri uri, BrowserLaunchMode launchMode)
{
return await OpenAsync(uri, new BrowserLaunchOptions { LaunchMode = launchMode });
}
public async Task<bool> OpenAsync(Uri uri, BrowserLaunchOptions options)
{
if (uri == null)
throw new ArgumentNullException(nameof(uri));
try
{
var uriString = uri.AbsoluteUri;
// Use xdg-open which respects user's default browser
var startInfo = new ProcessStartInfo
{
FileName = "xdg-open",
Arguments = $"\"{uriString}\"",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
};
using var process = Process.Start(startInfo);
if (process == null)
return false;
await process.WaitForExitAsync();
return process.ExitCode == 0;
}
catch
{
return false;
}
}
}