From 842f87c78442a3bde5bf89398a913db5718b764b Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Tue, 1 Oct 2024 22:58:32 +0200 Subject: [PATCH 1/4] bind contact list with phone serial --- src/appointment.js | 15 ++++++++++++++- src/excel/ExcelUtil.js | 5 +++-- src/models/ContactPojo.js | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/appointment.js b/src/appointment.js index 8a7165b..0b3061f 100644 --- a/src/appointment.js +++ b/src/appointment.js @@ -118,6 +118,16 @@ function shuffle(array) { return array; } +function getContactListForDevice(device, allContactList) { + let contactList = []; + allContactList.forEach((contact) => { + if (contact.serial === device.serial) { + contactList.push(contact) + } + }) + return contactList; +} + async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx', audioAnalyse = true, alertBeep = false) { console.log("startBookWithNumbers() called, with alertBeep:" + alertBeep) console.log("startBookWithNumbers() called, with audioAnalyse:" + audioAnalyse) @@ -191,7 +201,10 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT for (let i = 0; i < filteredDeviceList.length; i++) { let device = filteredDeviceList[i]; let port = startForwordingForDevice(device) - startWithList(listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)), device, sender, selectedStore, audioAnalyse, alertBeep, port); + // let _contactList = listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)) + let _contactList = getContactListForDevice(device, listWithoutBlackContact) + console.log("contactList: for device:" + device.serial + " has " + _contactList.length) + startWithList(_contactList, device, sender, selectedStore, audioAnalyse, alertBeep, port); } }) diff --git a/src/excel/ExcelUtil.js b/src/excel/ExcelUtil.js index f01ae93..cf38eb5 100644 --- a/src/excel/ExcelUtil.js +++ b/src/excel/ExcelUtil.js @@ -19,11 +19,12 @@ class ExcelUtil { if (store === undefined || store.length === 0) { store = "random" } - let ipCountry = info[5]; + let serial = info[5]; + let ipCountry = info[6]; if (ipCountry === undefined || ipCountry.length === 0) { ipCountry = "FR" } - let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry); + let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry, serial); contactList.push(newContact); } } diff --git a/src/models/ContactPojo.js b/src/models/ContactPojo.js index 6088605..66c4a5d 100644 --- a/src/models/ContactPojo.js +++ b/src/models/ContactPojo.js @@ -1,6 +1,6 @@ class ContactPojo { - constructor(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry) { + constructor(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry, serial) { this.phoneNumber = phoneNumber; this.passportNumber = passportNumber; this.lastName = lastName; @@ -8,6 +8,7 @@ class ContactPojo { this.mail = mail; this.store = store; this.ipCountry = ipCountry; + this.serial = serial; } } From a04ec8373dbffa58ed42c7c4f5b6b906d9a0eb8a Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Tue, 1 Oct 2024 23:28:09 +0200 Subject: [PATCH 2/4] support moto --- src/workers/CommandorPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index f2d5df5..11fe33b 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -1417,7 +1417,7 @@ class CommandorPage { this.device.shell("input tap " + 818 + " " + 2140) await delay(1000); } else if (model === "moto_g51_5G") { - await this.tapForDevice(this.device, 800, 2215) + await this.tapForDevice(this.device, 806, 2230) await delay(2000); this.device.shell("input tap " + 800 + " " + 2215) await delay(1000); From 9cfa650b3176ee0833dcd68263dced2df28fd01c Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Sat, 5 Oct 2024 08:35:18 +0200 Subject: [PATCH 3/4] correction for moto --- src/workers/CommandorPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index caea7d0..bcd5c6e 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -1417,7 +1417,7 @@ class CommandorPage { this.device.shell("input tap " + 818 + " " + 2140) await delay(1000); } else if (model === "moto_g51_5G") { - await this.tapForDevice(this.device, 806, 2230) + this.device.shell("input tap " + 806 + " " + 2230) await delay(2000); this.device.shell("input tap " + 800 + " " + 2215) await delay(1000); From 9d70bf7097346ad06704891cf0a6c783de4d648d Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Sat, 5 Oct 2024 16:48:25 +0200 Subject: [PATCH 4/4] do not need to bind contact list with mobiles --- src/appointment.js | 4 ++-- src/workers/CommandorPage.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/appointment.js b/src/appointment.js index 0b3061f..d13bcaf 100644 --- a/src/appointment.js +++ b/src/appointment.js @@ -201,8 +201,8 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT for (let i = 0; i < filteredDeviceList.length; i++) { let device = filteredDeviceList[i]; let port = startForwordingForDevice(device) - // let _contactList = listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)) - let _contactList = getContactListForDevice(device, listWithoutBlackContact) + let _contactList = listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)) + // let _contactList = getContactListForDevice(device, listWithoutBlackContact) console.log("contactList: for device:" + device.serial + " has " + _contactList.length) startWithList(_contactList, device, sender, selectedStore, audioAnalyse, alertBeep, port); } diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index bcd5c6e..5ebd079 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -1354,8 +1354,8 @@ class CommandorPage { this.device.shell("input tap " + 925 + " " + 1325) } else if (this.device.model === "22041219PG") { this.device.shell("input tap " + 925 + " " + 1430) - } else if (this.device.model === "moto g51 5G") { - await this.tapForDevice(this.device, 950, 1434) + } else if (this.device.model === "moto_g51_5G") { + this.device.shell("input tap " + 950 + " " + 1434) } else this.device.shell("input tap " + 933 + " " + 1538) await delay(2000); @@ -1417,7 +1417,7 @@ class CommandorPage { this.device.shell("input tap " + 818 + " " + 2140) await delay(1000); } else if (model === "moto_g51_5G") { - this.device.shell("input tap " + 806 + " " + 2230) + this.device.shell("input tap " + 806 + " " + 2230) await delay(2000); this.device.shell("input tap " + 800 + " " + 2215) await delay(1000);