Store: remove all mentions of window.Store (#127077)
* Store: remove all mentions of window.Store * Apply suggestion from @BenyFilho Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com> --------- Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
This commit is contained in:
parent
9e42f1e0c3
commit
883d7e4eda
1 changed files with 522 additions and 754 deletions
|
|
@ -16,7 +16,7 @@ class InterfaceController {
|
|||
async openChatWindow(chatId) {
|
||||
return await this.pupPage.evaluate(async (chatId) => {
|
||||
const chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
return await window.Store.Cmd.openChatBottom({'chat':chat});
|
||||
return await (window.require('WAWebCmd').Cmd).openChatBottom({'chat':chat});
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class InterfaceController {
|
|||
async openChatDrawer(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
await window.Store.Cmd.openDrawerMid(chat);
|
||||
await (window.require('WAWebCmd').Cmd).openDrawerMid(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ class InterfaceController {
|
|||
async openChatSearch(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
await window.Store.Cmd.chatSearch(chat);
|
||||
await (window.require('WAWebCmd').Cmd).chatSearch(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
|
|
@ -48,10 +48,10 @@ class InterfaceController {
|
|||
*/
|
||||
async openChatWindowAt(msgId) {
|
||||
await this.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId) || (await window.Store.Msg.getMessagesById([msgId]))?.messages?.[0];
|
||||
const chat = window.Store.Chat.get(msg.id.remote) ?? await window.Store.Chat.find(msg.id.remote);
|
||||
const searchContext = await window.Store.SearchContext.getSearchContext(chat, msg.id);
|
||||
await window.Store.Cmd.openChatAt({ chat: chat, msgContext: searchContext });
|
||||
const msg = (window.require('WAWebCollections')).Msg.get(msgId) || (await (window.require('WAWebCollections')).Msg.getMessagesById([msgId]))?.messages?.[0];
|
||||
const chat = (window.require('WAWebCollections')).Chat.get(msg.id.remote) ?? await (window.require('WAWebCollections')).Chat.find(msg.id.remote);
|
||||
const searchContext = await (window.require('WAWebChatMessageSearch')).getSearchContext(chat, msg.id);
|
||||
await (window.require('WAWebCmd').Cmd).openChatAt({ chat: chat, msgContext: searchContext });
|
||||
}, msgId);
|
||||
}
|
||||
|
||||
|
|
@ -61,8 +61,8 @@ class InterfaceController {
|
|||
*/
|
||||
async openMessageDrawer(msgId) {
|
||||
await this.pupPage.evaluate(async msgId => {
|
||||
const msg = window.Store.Msg.get(msgId) || (await window.Store.Msg.getMessagesById([msgId]))?.messages?.[0];
|
||||
await window.Store.Cmd.msgInfoDrawer(msg);
|
||||
const msg = (window.require('WAWebCollections')).Msg.get(msgId) || (await (window.require('WAWebCollections')).Msg.getMessagesById([msgId]))?.messages?.[0];
|
||||
await (window.require('WAWebCmd').Cmd).msgInfoDrawer(msg);
|
||||
}, msgId);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ class InterfaceController {
|
|||
*/
|
||||
async closeRightDrawer() {
|
||||
await this.pupPage.evaluate(async () => {
|
||||
await window.Store.DrawerManager.closeDrawerRight();
|
||||
await window.require('WAWebDrawerManager').DrawerManager.closeDrawerRight();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -80,8 +80,8 @@ class InterfaceController {
|
|||
*/
|
||||
async getFeatures() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
return window.Store.Features.F;
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
return (window.require('WAWebCollections')).Features.F;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -91,8 +91,8 @@ class InterfaceController {
|
|||
*/
|
||||
async checkFeatureStatus(feature) {
|
||||
return await this.pupPage.evaluate((feature) => {
|
||||
if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
return window.Store.Features.supportsFeature(feature);
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
return (window.require('WAWebCollections')).Features.supportsFeature(feature);
|
||||
}, feature);
|
||||
}
|
||||
|
||||
|
|
@ -102,9 +102,9 @@ class InterfaceController {
|
|||
*/
|
||||
async enableFeatures(features) {
|
||||
await this.pupPage.evaluate((features) => {
|
||||
if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
for (const feature in features) {
|
||||
window.Store.Features.setFeature(features[feature], true);
|
||||
(window.require('WAWebCollections')).Features.setFeature(features[feature], true);
|
||||
}
|
||||
}, features);
|
||||
}
|
||||
|
|
@ -115,9 +115,9 @@ class InterfaceController {
|
|||
*/
|
||||
async disableFeatures(features) {
|
||||
await this.pupPage.evaluate((features) => {
|
||||
if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
for (const feature in features) {
|
||||
window.Store.Features.setFeature(features[feature], false);
|
||||
(window.require('WAWebCollections')).Features.setFeature(features[feature], false);
|
||||
}
|
||||
}, features);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue