summaryrefslogtreecommitdiffhomepage
path: root/main.mjs
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2025-07-12 20:24:55 +0800
committerLi Zhineng <[email protected]>2025-07-12 20:24:55 +0800
commit45f1d969484000c045eaca352092b9ba64af7521 (patch)
tree2ea8c3a946812c272a49720d26d6ee49681343e8 /main.mjs
parenta7c267c39bfd53d3b2e991fc531dc273ac725c2b (diff)
downloadsetup-45f1d969484000c045eaca352092b9ba64af7521.tar.gz
setup-45f1d969484000c045eaca352092b9ba64af7521.zip
reorder code
Diffstat (limited to 'main.mjs')
-rw-r--r--main.mjs12
1 files changed, 7 insertions, 5 deletions
diff --git a/main.mjs b/main.mjs
index 4bc1ce5..a607769 100644
--- a/main.mjs
+++ b/main.mjs
@@ -995,25 +995,25 @@ class Application {
return
}
- const handler = new BluetoothHandler(Device.airmxPro())
-
const successForm = new SuccessForm('form-result-success')
const failureForm = new FailureForm('form-result-failure')
+
+ const handler = new BluetoothHandler(Device.airmxPro())
const communicationForm = new CommunicationForm('form-communication', handler)
.succeedTo(successForm)
.failTo(failureForm)
.onPair((deviceId) => {
successForm.deviceIdUsing(deviceId)
})
+
const pairingActivationForm = new PairingActivationForm('form-pairing-activation')
.nextTo(communicationForm)
+
const wifiCredentialsForm = new WifiCredentialsForm('form-wifi-credentials')
.nextTo(pairingActivationForm)
.onSubmit((credentials) => {
communicationForm.wifiCredentialsUsing(credentials)
})
- const welcomeForm = new WelcomeForm('form-welcome')
- .nextTo(wifiCredentialsForm)
// If the pairing process fails, we will redirect the user to the Wi-Fi
// credentials form so that they can retry with different credentials.
@@ -1021,7 +1021,9 @@ class Application {
// Now that everything is set up, it's time to show the user
// the welcome screen.
- welcomeForm.display()
+ new WelcomeForm('form-welcome')
+ .nextTo(wifiCredentialsForm)
+ .display()
}
}