wppconnect-team / wa-js

WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web
https://wppconnect.io/wa-js/
Apache License 2.0
435 stars 139 forks source link

feat: Add a event for when the chatList filter changes #2511

Open henriquecm opened 5 days ago

henriquecm commented 5 days ago

Is your feature request related to a problem? Please describe. When using the WPP.chat.setChatList, I can try to keep track of what type of filter was applied, but if the user clear/change the Chat Filter using WhatsApp native filters I lose track of what filter is currently applied.

Describe the solution you'd like An event that returns the current filter being applied.

Describe alternatives you've considered Using a setInterval to check a __reactProps$ of an element that I found that has the current filter.

Additional context

dllsystem commented 4 days ago

for now try using this function

WPP.whatsapp.Cmd.on('set_active_filter', (a) => { console.log('event: set_active_filter', a) })

to see existing events

window.require("WAWebCmd").Cmd._events

icleitoncosta commented 4 days ago

for now try using this function

WPP.whatsapp.Cmd.on('set_active_filter', (a) => { console.log('event: set_active_filter', a) })

to see existing events

window.require("WAWebCmd").Cmd._events

Exact @dllsystem !

icleitoncosta commented 4 days ago

Is your feature request related to a problem? Please describe. When using the WPP.chat.setChatList, I can try to keep track of what type of filter was applied, but if the user clear/change the Chat Filter using WhatsApp native filters I lose track of what filter is currently applied.

Describe the solution you'd like An event that returns the current filter being applied.

Describe alternatives you've considered Using a setInterval to check a __reactProps$ of an element that I found that has the current filter.

Additional context

I will working in new way to create custom lists. Whatsapp is releasing a new function for do, and I use it

icleitoncosta commented 4 days ago

You can follow in https://github.com/wppconnect-team/wa-js/pull/2517

henriquecm commented 2 days ago

Thanks, I never used the WPP.whatsapp.Cmd before, I'll look into it, maybe I find new ways improve some others thing with it.