|
27 | 27 | using Flow.Launcher.Plugin.SharedCommands;
|
28 | 28 | using Flow.Launcher.ViewModel;
|
29 | 29 | using JetBrains.Annotations;
|
| 30 | +using Flow.Launcher.Core.Resource; |
30 | 31 |
|
31 | 32 | namespace Flow.Launcher
|
32 | 33 | {
|
33 | 34 | public class PublicAPIInstance : IPublicAPI
|
34 | 35 | {
|
35 | 36 | private readonly Settings _settings;
|
| 37 | + private readonly Internationalization _translater; |
36 | 38 | private readonly MainViewModel _mainVM;
|
37 | 39 |
|
38 | 40 | #region Constructor
|
39 | 41 |
|
40 |
| - public PublicAPIInstance(Settings settings, MainViewModel mainVM) |
| 42 | + public PublicAPIInstance(Settings settings, Internationalization translater, MainViewModel mainVM) |
41 | 43 | {
|
42 | 44 | _settings = settings;
|
| 45 | + _translater = translater; |
43 | 46 | _mainVM = mainVM;
|
44 | 47 | GlobalHotkey.hookedKeyboardCallback = KListener_hookedKeyboardCallback;
|
45 | 48 | WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
|
@@ -152,17 +155,17 @@ public void CopyToClipboard(string stringToCopy, bool directCopy = false, bool s
|
152 | 155 |
|
153 | 156 | public void StopLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Collapsed;
|
154 | 157 |
|
155 |
| - public string GetTranslation(string key) => App.API.GetTranslation(key); |
| 158 | + public string GetTranslation(string key) => _translater.GetTranslation(key); |
156 | 159 |
|
157 | 160 | public List<PluginPair> GetAllPlugins() => PluginManager.AllPlugins.ToList();
|
158 | 161 |
|
159 | 162 | public MatchResult FuzzySearch(string query, string stringToCompare) =>
|
160 | 163 | StringMatcher.FuzzySearch(query, stringToCompare);
|
161 | 164 |
|
162 |
| - public Task<string> HttpGetStringAsync(string url, CancellationToken token = default) => Http.GetAsync(url); |
| 165 | + public Task<string> HttpGetStringAsync(string url, CancellationToken token = default) => Http.GetAsync(url, token); |
163 | 166 |
|
164 | 167 | public Task<Stream> HttpGetStreamAsync(string url, CancellationToken token = default) =>
|
165 |
| - Http.GetStreamAsync(url); |
| 168 | + Http.GetStreamAsync(url, token); |
166 | 169 |
|
167 | 170 | public Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, Action<double> reportProgress = null,
|
168 | 171 | CancellationToken token = default) => Http.DownloadAsync(url, filePath, reportProgress, token);
|
|
0 commit comments