fix: compatibility with LegacyPhoneFeatures in latest WhatsApp Web version (#1930)
* fix removed features on latest wweb version * errors
This commit is contained in:
parent
8655badc0f
commit
23d5147a14
2 changed files with 9 additions and 1 deletions
|
|
@ -13,7 +13,6 @@ exports.ExposeStore = (moduleRaidStr) => {
|
||||||
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
|
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
|
||||||
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
|
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
|
||||||
window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
|
window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
|
||||||
window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures;
|
|
||||||
window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata;
|
window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata;
|
||||||
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
|
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
|
||||||
window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0];
|
window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0];
|
||||||
|
|
@ -87,6 +86,11 @@ exports.ExposeStore = (moduleRaidStr) => {
|
||||||
} else {
|
} else {
|
||||||
window.Store.MDBackend = true;
|
window.Store.MDBackend = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0];
|
||||||
|
if(_features) {
|
||||||
|
window.Store.Features = _features.LegacyPhoneFeatures;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.LoadUtils = () => {
|
exports.LoadUtils = () => {
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ class InterfaceController {
|
||||||
*/
|
*/
|
||||||
async getFeatures() {
|
async getFeatures() {
|
||||||
return await this.pupPage.evaluate(() => {
|
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;
|
return window.Store.Features.F;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -89,6 +90,7 @@ class InterfaceController {
|
||||||
*/
|
*/
|
||||||
async checkFeatureStatus(feature) {
|
async checkFeatureStatus(feature) {
|
||||||
return await this.pupPage.evaluate((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);
|
return window.Store.Features.supportsFeature(feature);
|
||||||
}, feature);
|
}, feature);
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +101,7 @@ class InterfaceController {
|
||||||
*/
|
*/
|
||||||
async enableFeatures(features) {
|
async enableFeatures(features) {
|
||||||
await this.pupPage.evaluate((features) => {
|
await this.pupPage.evaluate((features) => {
|
||||||
|
if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||||
for (const feature in features) {
|
for (const feature in features) {
|
||||||
window.Store.Features.setFeature(features[feature], true);
|
window.Store.Features.setFeature(features[feature], true);
|
||||||
}
|
}
|
||||||
|
|
@ -111,6 +114,7 @@ class InterfaceController {
|
||||||
*/
|
*/
|
||||||
async disableFeatures(features) {
|
async disableFeatures(features) {
|
||||||
await this.pupPage.evaluate((features) => {
|
await this.pupPage.evaluate((features) => {
|
||||||
|
if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||||
for (const feature in features) {
|
for (const feature in features) {
|
||||||
window.Store.Features.setFeature(features[feature], false);
|
window.Store.Features.setFeature(features[feature], false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue