Skip to content

Commit 3188bd8

Browse files
committed
add OpenUri to interface and change OpenUrl method to OpenUri
1 parent f07db3d commit 3188bd8

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,10 @@ public interface IPublicAPI
231231
/// Opens the url. The browser and mode used is based on what's configured in Flow's default browser settings.
232232
/// </summary>
233233
public void OpenUrl(string url, bool? inPrivate = null);
234+
235+
/// <summary>
236+
/// Opens the application URI.
237+
/// </summary>
238+
public void OpenAppUri(string appUri);
234239
}
235240
}

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void OpenDirectory(string DirectoryPath, string FileName = null)
209209
explorer.Start();
210210
}
211211

212-
public void OpenUrl(string url, bool? inPrivate = null)
212+
public void OpenUri(string url, bool? inPrivate = null, bool isAppUri = false)
213213
{
214214
var uri = new Uri(url);
215215
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
@@ -229,10 +229,28 @@ public void OpenUrl(string url, bool? inPrivate = null)
229229
return;
230230
}
231231

232-
Process.Start(new ProcessStartInfo()
232+
if (isAppUri)
233233
{
234-
FileName = url, UseShellExecute = true
235-
})?.Dispose();
234+
Process.Start(new ProcessStartInfo()
235+
{
236+
FileName = url,
237+
UseShellExecute = true
238+
})?.Dispose();
239+
240+
return;
241+
}
242+
243+
throw new InvalidOperationException("URI scheme not specifiedor supported ");
244+
}
245+
246+
public void OpenUrl(string url, bool? inPrivate = null)
247+
{
248+
OpenUri(url, inPrivate);
249+
}
250+
251+
public void OpenAppUri(string appUri)
252+
{
253+
OpenUri(appUri, isAppUri: true);
236254
}
237255

238256
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;

0 commit comments

Comments
 (0)