From ad63fb56a2255a67bcb16227fa6a61210f8633d1 Mon Sep 17 00:00:00 2001 From: Edgard Date: Wed, 19 Oct 2022 22:33:20 -0300 Subject: [PATCH] fix: Fixed "Checking phone is connected" without autoClose --- src/api/layers/host.layer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/layers/host.layer.ts b/src/api/layers/host.layer.ts index 1de55ff4a..c16216eb1 100644 --- a/src/api/layers/host.layer.ts +++ b/src/api/layers/host.layer.ts @@ -290,8 +290,14 @@ export class HostLayer { public async waitForInChat() { let inChat = await isInsideChat(this.page); + const start = Date.now(); + while (inChat === false) { - await sleep(200); + if (Date.now() - start >= 60000) { + return false; + } + + await sleep(1000); inChat = await isInsideChat(this.page); } return inChat; @@ -350,9 +356,9 @@ export class HostLayer { if (authenticated === true) { // Reinicia o contador do autoclose this.cancelAutoClose(); - this.startAutoClose(); // Wait for interface update await sleep(200); + this.startAutoClose(); this.log('http', 'Checking phone is connected...'); const inChat = await this.waitForInChat();