Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 80 additions & 5 deletions Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;

namespace Flow.Launcher.Core.Plugin.JsonRPCV2Models
{
public class JsonRPCPublicAPI
public class JsonRPCPublicAPI : IPublicAPI
{
private IPublicAPI _api;
private readonly IPublicAPI _api;

public JsonRPCPublicAPI(IPublicAPI api)
{
Expand Down Expand Up @@ -55,6 +55,14 @@ public Task ReloadAllPluginDataAsync()
return _api.ReloadAllPluginData();
}

/// <summary>
/// The same as <see cref="ReloadAllPluginDataAsync"/>
/// </summary>
public Task ReloadAllPluginData()
{
return _api.ReloadAllPluginData();
}

public void CheckForNewUpdate()
{
_api.CheckForNewUpdate();
Expand All @@ -80,6 +88,12 @@ public bool IsMainWindowVisible()
return _api.IsMainWindowVisible();
}

public event VisibilityChangedEventHandler VisibilityChanged
{
add { _api.VisibilityChanged += value; }
remove { _api.VisibilityChanged -= value; }
}

public void ShowMsg(string title, string subTitle = "", string iconPath = "")
{
_api.ShowMsg(title, subTitle, iconPath);
Expand All @@ -105,6 +119,15 @@ public List<PluginPair> GetAllPlugins()
return _api.GetAllPlugins();
}

public void RegisterGlobalKeyboardCallback(Func<int, int, SpecialKeyState, bool> callback)
{
_api.RegisterGlobalKeyboardCallback(callback);
}

public void RemoveGlobalKeyboardCallback(Func<int, int, SpecialKeyState, bool> callback)
{
_api.RemoveGlobalKeyboardCallback(callback);
}

public MatchResult FuzzySearch(string query, string stringToCompare)
{
Expand All @@ -121,8 +144,7 @@ public Task<Stream> HttpGetStreamAsync(string url, CancellationToken token = def
return _api.HttpGetStreamAsync(url, token);
}

public Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath,
CancellationToken token = default)
public Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default)
{
return _api.HttpDownloadAsync(url, filePath, token);
}
Expand Down Expand Up @@ -157,21 +179,74 @@ public void LogWarn(string className, string message, [CallerMemberName] string
_api.LogWarn(className, message, methodName);
}

public void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "")
{
_api.LogException(className, message, e, methodName);
}

public T LoadSettingJsonStorage<T>() where T : new()
{
return _api.LoadSettingJsonStorage<T>();
}

public void SaveSettingJsonStorage<T>() where T : new()
{
_api.SaveSettingJsonStorage<T>();
}

public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
{
_api.OpenDirectory(DirectoryPath, FileNameOrFilePath);
}

public void OpenUrl(Uri url, bool? inPrivate = null)
{
_api.OpenUrl(url, inPrivate);
}

public void OpenUrl(string url, bool? inPrivate = null)
{
_api.OpenUrl(url, inPrivate);
}

public void OpenAppUri(Uri appUri)
{
_api.OpenAppUri(appUri);
}

public void OpenAppUri(string appUri)
{
_api.OpenAppUri(appUri);
}

public void ToggleGameMode()
{
_api.ToggleGameMode();
}

public void SetGameMode(bool value)
{
_api.SetGameMode(value);
}

public bool IsGameModeOn()
{
return _api.IsGameModeOn();
}

public void ReQuery(bool reselect = true)
{
_api.ReQuery(reselect);
}

public void BackToQueryResults()
{
_api.BackToQueryResults();
}

public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK)
{
return _api.ShowMsgBox(messageBoxText, caption, button, icon, defaultResult);
}
}
}
Loading