mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.02k stars 797 forks source link

window.Store is Undefined #1010

Closed deadpyxel closed 3 years ago

deadpyxel commented 3 years ago

May be related to #1009

the function isStoreMessageDefined and, by proxy is_store_msg_defined() ( a custom one to call the JS Function), seems to be failling, consequentelly, the software doesn't think that whatsapp has loaded properlly.

window.WAPI.isStoreMsgDefined = function (done) {
    let defined = false;
    try {
        defined =
            typeof window !== undefined &&
            typeof window.Store !== undefined &&  // this always is undefined
            typeof window.Store.Msg !== undefined;
    } catch (e) {
        defined = false;
    }
    done(defined);
    return defined; //this is always being false
};
def is_store_msg_defined(self):
    try:
        defined = self.wapi_functions.isStoreMsgDefined()
        return defined
    except JavascriptException:
        return False

Any ideas in a fix? I tried applying #1003 but to no results. It seems that for some reason window.Storage is not being defined in the initialization, did something change? This is the begining of wapi.jsin my case:

if (!window.Store) {
    (function () {
        function getStore(modules) {
            let foundCount = 0;
            let neededObjects = [
                {
                    id: "Store",
                    conditions: (module) =>
                        module.default &&
                        module.default.Chat &&
                        module.default.Msg
                            ? module.default
                            : null,
                },
                ...
deadpyxel commented 3 years ago

Closing since this seems unrelated and due to a custom code.