From 5e5d67f6cc291da583125651c60ebe26c60eaa12 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 2 Jul 2019 16:06:23 +0400 Subject: [PATCH 1/2] Add button to download public gist --- src/service/webview.service.ts | 24 ++++++++++++++++++++++++ ui/landing-page/landing-page.html | 8 ++++++++ 2 files changed, 32 insertions(+) diff --git a/src/service/webview.service.ts b/src/service/webview.service.ts index 3598aa68..f54c6e19 100644 --- a/src/service/webview.service.ts +++ b/src/service/webview.service.ts @@ -348,6 +348,30 @@ export class WebviewService { await state.commons.GetSettings() ); break; + case "downloadPublicGist": + const [extConfig, customConfig] = await Promise.all([ + state.commons.GetSettings(), + state.commons.GetCustomSettings() + ]); + const publicGist = await vscode.window.showInputBox({ + placeHolder: localize("common.placeholder.enterGistId"), + ignoreFocusOut: true + }); + if (!publicGist) { + break; + } + await state.commons.SetCustomSettings({ + ...customConfig, + downloadPublicGist: true + }); + await state.commons.SaveSettings({ + ...extConfig, + gist: publicGist + }); + vscode.window.showInformationMessage( + localize("cmd.otherOptions.warning.tokenNotRequire") + ); + break; } }); landingPanel.webview.html = content; diff --git a/ui/landing-page/landing-page.html b/ui/landing-page/landing-page.html index a4e309e5..eaac9ca9 100644 --- a/ui/landing-page/landing-page.html +++ b/ui/landing-page/landing-page.html @@ -71,6 +71,14 @@

+

From 6aeecef55e88d59068ac92e85093eccd3da6f384 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 2 Jul 2019 16:19:45 +0400 Subject: [PATCH 2/2] Download after getting public gist --- src/service/webview.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/service/webview.service.ts b/src/service/webview.service.ts index f54c6e19..eb605e48 100644 --- a/src/service/webview.service.ts +++ b/src/service/webview.service.ts @@ -371,6 +371,7 @@ export class WebviewService { vscode.window.showInformationMessage( localize("cmd.otherOptions.warning.tokenNotRequire") ); + vscode.commands.executeCommand("extension.downloadSettings"); break; } });