feat: vote_update event (#2596)
* Merge branch 'add-polls' into polls-ext * added listener to poll votes * added isUnvote property * added option for custom message secret * usage example updated * added logic for catching removed votes * usage example updated * fixed logic for poll vote events * temp usage example * No more `isCurrentState` * messageSecret converted to array Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> * docs updated * we already have messageSecret in vote.parentMessage * PollVote.selectedOptions changed to be similar to pollOptions * docs fixed * window.injectToFunction clarifications * minor clarifications * fix: typo * style: fix broken link in readme file --------- Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
This commit is contained in:
parent
8c810a8462
commit
01714fe599
2 changed files with 132 additions and 3 deletions
|
|
@ -65,7 +65,8 @@ exports.Events = {
|
|||
STATE_CHANGED: 'change_state',
|
||||
BATTERY_CHANGED: 'change_battery',
|
||||
INCOMING_CALL: 'call',
|
||||
REMOTE_SESSION_SAVED: 'remote_session_saved'
|
||||
REMOTE_SESSION_SAVED: 'remote_session_saved',
|
||||
VOTE_UPDATE: 'vote_update'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -556,6 +556,15 @@ exports.LoadUtils = () => {
|
|||
return msg;
|
||||
};
|
||||
|
||||
window.WWebJS.getPollVoteModel = (vote) => {
|
||||
const _vote = vote.serialize();
|
||||
if (vote.parentMsgKey) {
|
||||
const msg = window.Store.Msg.get(vote.parentMsgKey);
|
||||
msg && (_vote.parentMessage = window.WWebJS.getMessageModel(msg));
|
||||
return _vote;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
window.WWebJS.getChatModel = async chat => {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue