mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use callback to check whether downloading manifest successfully.
This commit is contained in:
parent
2463582af0
commit
912cca6c5f
1 changed files with 12 additions and 9 deletions
|
|
@ -30,7 +30,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
return new PluginsManagerSettings(viewModel);
|
||||
}
|
||||
|
||||
public async Task InitAsync(PluginInitContext context)
|
||||
public Task InitAsync(PluginInitContext context)
|
||||
{
|
||||
Context = context;
|
||||
viewModel = new SettingsViewModel(context);
|
||||
|
|
@ -38,16 +38,19 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
contextMenu = new ContextMenu(Context);
|
||||
pluginManager = new PluginsManager(Context, Settings);
|
||||
var updateManifestTask = pluginManager.UpdateManifest();
|
||||
if (await Task.WhenAny(updateManifestTask, Task.Delay(1000)) == updateManifestTask)
|
||||
_ = updateManifestTask.ContinueWith(t =>
|
||||
{
|
||||
lastUpdateTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.API.ShowMsg("Plugin Manifest Download Fail.",
|
||||
"Please check if you can connect to github.com. "+
|
||||
if (t.IsCompletedSuccessfully)
|
||||
lastUpdateTime = DateTime.Now;
|
||||
else
|
||||
{
|
||||
context.API.ShowMsg("Plugin Manifest Download Fail.",
|
||||
"Please check if you can connect to github.com. " +
|
||||
"This error means you may not be able to Install and Update Plugin.", pluginManager.icoPath, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public List<Result> LoadContextMenus(Result selectedResult)
|
||||
|
|
|
|||
Loading…
Reference in a new issue