Bump esp-web-flasher to 2.0 + hide improv button when done provision is done (#14)

This commit is contained in:
Bram Kragten 2021-06-15 00:50:35 +02:00 committed by GitHub
parent 56a1dd7193
commit 7f03060e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 12 deletions

18
package-lock.json generated
View File

@ -1,16 +1,16 @@
{ {
"name": "esp-web-tools", "name": "esp-web-tools",
"version": "2.0.2", "version": "3.1.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "2.0.2", "version": "3.1.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@material/mwc-base": "^0.21.0", "@material/mwc-base": "^0.21.0",
"@material/mwc-linear-progress": "^0.21.0", "@material/mwc-linear-progress": "^0.21.0",
"esp-web-flasher": "^1.0.4", "esp-web-flasher": "^2.0.0",
"lit": "^2.0.0-rc.2", "lit": "^2.0.0-rc.2",
"tslib": "^2.2.0" "tslib": "^2.2.0"
}, },
@ -556,9 +556,9 @@
} }
}, },
"node_modules/esp-web-flasher": { "node_modules/esp-web-flasher": {
"version": "1.0.4", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/esp-web-flasher/-/esp-web-flasher-1.0.4.tgz", "resolved": "https://registry.npmjs.org/esp-web-flasher/-/esp-web-flasher-2.0.0.tgz",
"integrity": "sha512-n1LrBV6M5fu4k06zh7IW5FbpBnLTrPxTRO2YrpRu5ahqG0FO2dsxLkASdlOhVzSHtKNo29ZG4IS6nPtxlLiL5A==", "integrity": "sha512-vLAVJbWYL/wNIv5AQ8XwqO61ORnbtmbbAMFJJ1C0fMSUnu4J/rogWZYHZLNLZbtjp0XL5nbu8RWjXCE6DeSTjw==",
"dependencies": { "dependencies": {
"tslib": "^2.2.0" "tslib": "^2.2.0"
} }
@ -1925,9 +1925,9 @@
"dev": true "dev": true
}, },
"esp-web-flasher": { "esp-web-flasher": {
"version": "1.0.4", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/esp-web-flasher/-/esp-web-flasher-1.0.4.tgz", "resolved": "https://registry.npmjs.org/esp-web-flasher/-/esp-web-flasher-2.0.0.tgz",
"integrity": "sha512-n1LrBV6M5fu4k06zh7IW5FbpBnLTrPxTRO2YrpRu5ahqG0FO2dsxLkASdlOhVzSHtKNo29ZG4IS6nPtxlLiL5A==", "integrity": "sha512-vLAVJbWYL/wNIv5AQ8XwqO61ORnbtmbbAMFJJ1C0fMSUnu4J/rogWZYHZLNLZbtjp0XL5nbu8RWjXCE6DeSTjw==",
"requires": { "requires": {
"tslib": "^2.2.0" "tslib": "^2.2.0"
} }

View File

@ -23,7 +23,7 @@
"dependencies": { "dependencies": {
"@material/mwc-base": "^0.21.0", "@material/mwc-base": "^0.21.0",
"@material/mwc-linear-progress": "^0.21.0", "@material/mwc-linear-progress": "^0.21.0",
"esp-web-flasher": "^1.0.4", "esp-web-flasher": "^2.0.0",
"lit": "^2.0.0-rc.2", "lit": "^2.0.0-rc.2",
"tslib": "^2.2.0" "tslib": "^2.2.0"
} }

View File

@ -224,7 +224,7 @@ export const flash = async (
}); });
await sleep(100); await sleep(100);
await esploader.softReset(); await esploader.hardReset();
await esploader.disconnect(); await esploader.disconnect();
fireStateEvent({ fireStateEvent({

View File

@ -110,12 +110,24 @@ const startImprov = async (button: InstallButton) => {
// @ts-ignore // @ts-ignore
await import("https://www.improv-wifi.com/sdk-js/launch-button.js"); await import("https://www.improv-wifi.com/sdk-js/launch-button.js");
if (!customElements.get("improv-wifi-launch-button").isSupported) { const improvButtonConstructor = customElements.get(
"improv-wifi-launch-button"
);
if (
!improvButtonConstructor.isSupported ||
!improvButtonConstructor.isAllowed
) {
return; return;
} }
if (!improvEl) { if (!improvEl) {
improvEl = document.createElement("improv-wifi-launch-button"); improvEl = document.createElement("improv-wifi-launch-button");
improvEl.addEventListener("state-changed", (ev: any) => {
if (ev.detail.state === "PROVISIONED") {
improvEl!.classList.toggle("hidden", true);
}
});
const improvButton = document.createElement("button"); const improvButton = document.createElement("button");
improvButton.slot = "activate"; improvButton.slot = "activate";
improvButton.textContent = "CLICK HERE TO FINISH SETTING UP YOUR DEVICE"; improvButton.textContent = "CLICK HERE TO FINISH SETTING UP YOUR DEVICE";