Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable manual download buttons during checksum test #2622

Merged
merged 1 commit into from
May 9, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/core/plugins/core/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const fs = require("fs-extra");
const path = require("path");
const { download, checkFile } = require("progressive-downloader");
const { unpack } = require("../../helpers/asarLibs.js");
const window = require("../../../lib/window.js");

/**
* core plugin
Expand Down Expand Up @@ -276,6 +277,7 @@ class CorePlugin extends Plugin {
)
)
.then(ok => {
window.send("user:manual_download:check", ok);
if (ok) {
return ok;
} else {
Expand Down
22 changes: 18 additions & 4 deletions src/ui/views/ManualDownload.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<script>
const { ipcRenderer } = require("electron");
import {
manualDownloadFileData,
manualDownloadGroup,
eventObject
} from "../../stores.mjs";

let downloadedFile;
let checkingFile = false;

function handleManualDownloadButton() {
checkingFile = true;
ipcRenderer.once("user:manual_download:check", (event, ok) => {
checkingFile = false;
});

$eventObject.sender.send(
"manual_download:completed",
downloadedFile[0].path
Expand Down Expand Up @@ -40,14 +47,21 @@
</p>
<div class="input-group" style="margin-bottom: 1em;">
<div class="custom-file">
<input type="file" bind:files={downloadedFile} />
<input type="file" bind:files={downloadedFile}
disabled={checkingFile}
/>
</div>
</div>
<button
id="manual-download-button"
class="btn btn-primary"
disabled={!downloadedFile}
on:click={() => handleManualDownloadButton()}>Continue</button
>
disabled={!downloadedFile || checkingFile}
on:click={() => handleManualDownloadButton()}>
{#if checkingFile}
Checking file...
{:else}
Continue
{/if}
</button>
</div>
</div>