Skip to content

Commit 3b0def8

Browse files
committed
Add new api OpenWebUrl
1 parent 367bf2c commit 3b0def8

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,19 @@ public interface IPublicAPI
305305
/// <param name="FileNameOrFilePath">Extra FileName Info</param>
306306
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null);
307307

308+
/// <summary>
309+
/// Opens the URL using the browser with the given Uri object, even if the URL is a local file.
310+
/// The browser and mode used is based on what's configured in Flow's default browser settings.
311+
/// </summary>
312+
public void OpenWebUrl(Uri url, bool? inPrivate = null, bool forceBrower = false);
313+
314+
/// <summary>
315+
/// Opens the URL using the browser with the given string, even if the URL is a local file.
316+
/// The browser and mode used is based on what's configured in Flow's default browser settings.
317+
/// Non-C# plugins should use this method.
318+
/// </summary>
319+
public void OpenWebUrl(string url, bool? inPrivate = null, bool forceBrower = false);
320+
308321
/// <summary>
309322
/// Opens the URL with the given Uri object.
310323
/// The browser and mode used is based on what's configured in Flow's default browser settings.

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,9 @@ public void OpenDirectory(string directoryPath, string fileNameOrFilePath = null
391391
}
392392

393393

394-
private void OpenUri(Uri uri, bool? inPrivate = null)
394+
private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrower = false)
395395
{
396-
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
396+
if (forceBrower || uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
397397
{
398398
var browserInfo = _settings.CustomBrowser;
399399

@@ -420,6 +420,16 @@ private void OpenUri(Uri uri, bool? inPrivate = null)
420420
}
421421
}
422422

423+
public void OpenUrl(string url, bool? inPrivate = null, bool forceBrower = false)
424+
{
425+
OpenUri(new Uri(url), inPrivate, forceBrower);
426+
}
427+
428+
public void OpenUrl(Uri url, bool? inPrivate = null, bool forceBrower = false)
429+
{
430+
OpenUri(url, inPrivate, forceBrower);
431+
}
432+
423433
public void OpenUrl(string url, bool? inPrivate = null)
424434
{
425435
OpenUri(new Uri(url), inPrivate);

0 commit comments

Comments
 (0)