Skip to content

Commit

Permalink
fix: alterado ordem de inicialização
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Escher committed Aug 29, 2022
1 parent f794274 commit f782610
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/controllers/initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ import { tokenSession } from '../config/tokenSession.config';
import { checkFileJson } from '../api/helpers/check-token-file';
import { SocketState, SocketStream } from '../api/model/enum';
import { SessionTokenCkeck, saveToken, isBeta } from './auth';
import { initWhatsapp, initBrowser, injectApi } from './browser';
import {
initWhatsapp,
initBrowser,
injectApi,
getWhatsappPage
} from './browser';
import { welcomeScreen } from './welcome';
const path = require('path');
/**
Expand Down Expand Up @@ -249,6 +254,8 @@ export async function create(

statusFind && statusFind('initWhatsapp', this.session);
// Initialize whatsapp
const newPage: Page = await getWhatsappPage(browser);
const client = new Whatsapp(newPage, session, mergedOptions);
const page: false | Page = await initWhatsapp(
session,
mergedOptions,
Expand All @@ -274,8 +281,6 @@ export async function create(
session
});

const client = new Whatsapp(page, session, mergedOptions);

client.onStreamChange(async (stateStream) => {
if (stateStream === SocketStream.CONNECTED) {
statusFind && statusFind('chatsAvailable', session);
Expand Down

0 comments on commit f782610

Please sign in to comment.