From 95c62a614c78923de2cfd96830961d34fdf78c94 Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Fri, 8 Dec 2023 11:38:19 +0100 Subject: [PATCH] support for oneplus N20 --- src/models/ReserveResultPojo.js | 6 ++++- src/workers/CommandorPage.js | 42 +++++++++++++++++---------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/models/ReserveResultPojo.js b/src/models/ReserveResultPojo.js index 855a81b..b3a2f58 100644 --- a/src/models/ReserveResultPojo.js +++ b/src/models/ReserveResultPojo.js @@ -1,4 +1,6 @@ const PublishType = require("./PublishType"); +const {hostname} = require("os"); +const hostName = hostname(); class ReserveResultPojo { @@ -13,6 +15,7 @@ class ReserveResultPojo { this.email = mail; this.type = type; this.source_from = "" + this.hostName = hostName this.created_at = new Date().toLocaleString() } @@ -27,7 +30,8 @@ class ReserveResultPojo { url: this.url, store_type: this.storeType, source_from: this.source_from, - created_at: this.created_at + created_at: this.created_at, + hostName: this.hostName } } diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 4f23b43..b8739f7 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -168,12 +168,8 @@ class CommandorPage { await this.enableDisableAirPlanMode(); // await delay(10 * 1000); await openUrlWithAdb(RDV_URL, this.device) - await delay(15000) + await delay(10 * 1000) await this.checkResultWithOcr() - // await this.clickOnlineAppointment(); - // } else { - // this.isTerminated = true; - // } let cancel const intervalTask = setInterval(async () => { @@ -953,6 +949,8 @@ class CommandorPage { await this.tapForDevice(this.device, 530, 1064) } else if (this.device.model() === "moto g51 5G") { await this.tapForDevice(this.device, 500, 1080) + } else if (this.device.model() === "CPH2469") { + await this.tapForDevice(this.device, 360, 820) } else if (this.device.model() === "M2006C3LG" || this.device.model() === "220233L2G") { await this.tapForDevice(this.device, 350, 777) } else if (this.device.model() === "KB2003" || this.device.model() === "DE2117") { @@ -984,6 +982,8 @@ class CommandorPage { await this.tapForDevice(this.device, 540, 1611) } else if (this.device.model() === "22041219PG") { await this.tapForDevice(this.device, 530, 1600) + } else if (this.device.model() === "CPH2469") { + await this.tapForDevice(this.device, 322, 1146) } else await this.tapForDevice(this.device, 500, 1680) // await this.device.shell("input tap " + 500 + " " + 1680) @@ -1096,6 +1096,8 @@ class CommandorPage { await this.tapForDevice(this.device, 360, 777) } else if (model === "ONEPLUS A6000") { await this.tapForDevice(this.device, 530, 1045) + } else if (model === "CPH2469") { + await this.tapForDevice(this.device, 360, 820) } else { logWithDevice("handleBraveSkipBtn", this.device) await this.tapForDevice(this.device, 470, 1160) @@ -1184,21 +1186,21 @@ class CommandorPage { async enableDisableAirPlanMode() { logWithDevice("will enable/disable airplane mode", this.device) - // try { - // // await this.device.shell("cmd connectivity airplane-mode enable") - // await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable") - // await delay(1000) - // await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable") - // // await this.device.shell("cmd connectivity airplane-mode disable") - // await delay(2000) - // } catch (e) { - // try { - // await this.device.shell("cmd connectivity airplane-mode disable") - // } catch (e) { - // console.log(e) - // } - // console.log(e) - // } + try { + // await this.device.shell("cmd connectivity airplane-mode enable") + await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable") + await delay(1000) + await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable") + // await this.device.shell("cmd connectivity airplane-mode disable") + await delay(2000) + } catch (e) { + try { + await this.device.shell("cmd connectivity airplane-mode disable") + } catch (e) { + console.log(e) + } + console.log(e) + } } async tapGoogleDisconnectBtn() {