Skip to content

Commit

Permalink
check if inline reply is supported & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzombiee2361 committed Apr 22, 2022
1 parent 47ae1e4 commit d71bf7d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Main/MainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,13 @@ module.exports = class MainWindow extends BrowserWindow {
(await this.whatsapp.getChatById(tag)).sendSeen();
});

notif.addInlineReply('Reply', async (reply) => {
console.log('replied', reply);
(await this.whatsapp.getChatById(tag)).sendMessage(reply);
});
const canReply = await Notify.supportsInlineReply();
if(canReply) {
notif.addInlineReply('Reply', async (reply) => {
console.log('replied', reply);
(await this.whatsapp.getChatById(tag)).sendMessage(reply);
});
}

notif.show();
}
Expand All @@ -286,14 +289,11 @@ module.exports = class MainWindow extends BrowserWindow {
this.whatsapp = new Client(pieBrowser, this);
this.whatsappReady = false;

this.whatsapp.on('ready', async () => {
this.whatsapp.on('ready', () => {
console.log('Whatsapp client ready');
this.whatsappReady = true;
this.webContents.send('ready', this._id);
this.emit('ready');

const chats = await this.whatsapp.getChats();
console.log(chats[0].id._serialized);
});

this.whatsapp.on("change_battery", (batteryInfo) => {
Expand Down

0 comments on commit d71bf7d

Please sign in to comment.