bind contact list with phone serial

This commit is contained in:
2024-10-01 22:58:32 +02:00
parent 9eb582a6e8
commit 842f87c784
3 changed files with 19 additions and 4 deletions
+14 -1
View File
@@ -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);
}
})