Skip to content

Commit 7e37e49

Browse files
committed
Bind checkbox
1 parent 60663e6 commit 7e37e49

4 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/service/github.oauth.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class GitHubOAuthService {
6060

6161
const gists: any[] = await this.getGists(token, user, host);
6262

63-
state.commons.webviewService.OpenGistSelectionpage(gists, cmd)
63+
state.commons.webviewService.OpenGistSelectionpage(gists, cmd);
6464
} catch (err) {
6565
const error = new Error(err);
6666
Commons.LogException(error, state.commons.ERROR_MESSAGE, true);

src/service/webview.service.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ export class WebviewService {
157157
{
158158
find: "@RELEASE_NOTES",
159159
replace: "releaseNotes"
160+
},
161+
{
162+
find: "@CHECKED",
163+
replace: "checked"
160164
}
161165
]
162166
},
@@ -310,14 +314,9 @@ export class WebviewService {
310314
}
311315

312316
public IsLandingPageEnabled(): boolean {
313-
const dontShowThisAgain = state.context.globalState.get<boolean>(
317+
return !state.context.globalState.get<boolean>(
314318
"landingPage.dontShowThisAgain"
315319
);
316-
if (dontShowThisAgain) {
317-
return false;
318-
} else {
319-
return true;
320-
}
321320
}
322321

323322
public OpenLandingPage(cmd?: string) {
@@ -326,7 +325,8 @@ export class WebviewService {
326325
const content: string = this.GenerateContent({
327326
content: webview.htmlContent,
328327
items: webview.replaceables,
329-
releaseNotes
328+
releaseNotes,
329+
checked: this.IsLandingPageEnabled()
330330
});
331331
if (webview.webview) {
332332
webview.webview.webview.html = content;
@@ -408,9 +408,10 @@ export class WebviewService {
408408
content: webview.htmlContent,
409409
items: webview.replaceables,
410410
gists,
411-
skip: cmd !== "extension.downloadSettings"
412-
? `<a href="#" onclick="vscode.postMessage({close: true});" title="Skip (new one will be created upon first upload)" class="btn btn-primary mt-4">Skip (new one will be created upon first upload)</a>`
413-
: ""
411+
skip:
412+
cmd !== "extension.downloadSettings"
413+
? `<a href="#" onclick="vscode.postMessage({close: true});" title="Skip (new one will be created upon first upload)" class="btn btn-primary mt-4">Skip (new one will be created upon first upload)</a>`
414+
: ""
414415
});
415416
if (webview.webview) {
416417
webview.webview.webview.html = content;

ui/landing-page/landing-page.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ <h3 class="mx-auto mb-3 text-white-50a">
134134
>Questions & Issues</a
135135
>
136136
<br />
137-
<a href="https://github.com/shanalikhan/code-settings-sync/blob/master/CONTRIBUTING.md"
137+
<a
138+
href="https://github.com/shanalikhan/code-settings-sync/blob/master/CONTRIBUTING.md"
138139
>Contribute</a
139140
>
140141
<br />
@@ -154,7 +155,6 @@ <h3 class="mb-3">Sponsors</h3>
154155
class="custom-control-input checkbox"
155156
type="checkbox"
156157
id="customCheck1"
157-
checked="true"
158158
onclick="sendCommand('dontShowThisAgain', !this.checked)"
159159
/>
160160
<label for="customCheck1" class="custom-control-label">
@@ -167,6 +167,7 @@ <h3 class="mb-3">Sponsors</h3>
167167
<font-injector></font-injector>
168168
<script defer>
169169
const releaseNotes = JSON.parse(`@RELEASE_NOTES`);
170+
const checked = "@CHECKED";
170171
</script>
171172
<script defer src="@PWD/ui/landing-page/landing-page.js"></script>
172173
</body>

ui/landing-page/landing-page.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ releaseNotes.changes.forEach(change => {
3636

3737
const currentVersionElement = document.querySelector("#current-version");
3838
currentVersionElement.innerHTML = releaseNotes.currentVersion;
39+
40+
document.querySelector("#customCheck1").checked = checked === "true";

0 commit comments

Comments
 (0)