fix application URI logic when opening via WebSearch plugin

This commit is contained in:
Jeremy 2022-01-31 21:36:13 +11:00
parent af313ebb78
commit 96cf9fe36a
3 changed files with 15 additions and 18 deletions

View file

@ -228,12 +228,13 @@ namespace Flow.Launcher.Plugin
public void OpenDirectory(string DirectoryPath, string FileName = null);
/// <summary>
/// Opens the url. The browser and mode used is based on what's configured in Flow's default browser settings.
/// Opens the URL. The browser and mode used is based on what's configured in Flow's default browser settings.
/// Also supports application URIs e.g. obsidian://search-query-example
/// </summary>
public void OpenUrl(string url, bool? inPrivate = null);
/// <summary>
/// Opens the application URI.
/// Opens the application URI, e.g. obsidian://search-query-example
/// </summary>
public void OpenAppUri(string appUri);
}

View file

@ -209,7 +209,7 @@ namespace Flow.Launcher
explorer.Start();
}
public void OpenUri(string url, bool? inPrivate = null, bool isAppUri = false)
private void OpenUri(string url, bool? inPrivate = null)
{
var uri = new Uri(url);
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
@ -230,18 +230,7 @@ namespace Flow.Launcher
return;
}
if (isAppUri)
{
Process.Start(new ProcessStartInfo()
{
FileName = url,
UseShellExecute = true
})?.Dispose();
return;
}
throw new InvalidOperationException("URI scheme not specified or supported ");
OpenAppUri(url);
}
public void OpenUrl(string url, bool? inPrivate = null)
@ -251,7 +240,13 @@ namespace Flow.Launcher
public void OpenAppUri(string appUri)
{
OpenUri(appUri, isAppUri: true);
Process.Start(new ProcessStartInfo()
{
FileName = appUri,
UseShellExecute = true
})?.Dispose();
return;
}
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;

View file

@ -49,9 +49,10 @@ namespace Flow.Launcher.Plugin.WebSearch
var title = keyword;
string subtitle = _context.API.GetTranslation("flowlauncher_plugin_websearch_search") + " " + searchSource.Title;
//Action Keyword match apear on top
// Action Keyword match apear on top
var score = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? scoreStandard : scoreStandard + 1;
// This populates the associated action keyword search entry
if (string.IsNullOrEmpty(keyword))
{
var result = new Result
@ -61,6 +62,7 @@ namespace Flow.Launcher.Plugin.WebSearch
IcoPath = searchSource.IconPath,
Score = score
};
results.Add(result);
}
else
@ -93,7 +95,6 @@ namespace Flow.Launcher.Plugin.WebSearch
if (token.IsCancellationRequested)
return null;
}
return results;