Skip to content

Commit

Permalink
fix: Fixed "Checking phone is connected" without autoClose
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Oct 20, 2022
1 parent b523416 commit ad63fb5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api/layers/host.layer.ts
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit ad63fb5

Please sign in to comment.