Reply to thread

Interestingly, XF.KeepAlive.refresh() does not update the counters.


It does the cross tab communication stuff, which keeps the counters and other info in-sync across multiple browser tabs, but it doesn't update the counters.


Part of the reason for that is because we're using the native jQuery $.ajax() call rather than XF.ajax(). The latter of which fires some additional events.


That might be intentional.


So maybe we should leave that as it is.


But I'm not sure there's a valid reason we can't just:


[CODE="javascript"]if (data.visitor)

{

    XF.updateVisitorCounts(data.visitor, true);

}[/CODE]


Which does update the alert/inbox badges, and the app badge update.


So, then, could we just do:


[CODE="javascript"]document.addEventListener("visibilitychange", () => {

  if (document.visibilityState === "visible") {

    XF.keepAlive.refresh();

  }

});[/CODE]


The above probably only needs to happen specifically for the PWA (which we gate behind a display-mode: standalone check).


It seems pretty simple, unless I'm overlooking something.


The aforementioned CSRF issue I haven't actually experienced since my phone stopped being whacky. Doesn't XF.KeepAlive.refresh() handle an expired token already?


Back
Top Bottom