FIX: change focus when application resumes in android
Per new lifecycle https://developers.google.com/web/updates/2018/07/page-lifecycle-api On Android and latest Chrome when an app transitions from "frozen" to active the new "resume" event fires with no accompanying "visibilitychange" event. This means that often background tabs may be stuck thinking that discourse has no focus when, indeed, it has. This leads to cases where no posts are marked read anymore.
This commit is contained in:
parent
5cfbe19eef
commit
499472b6a0
|
@ -24,12 +24,16 @@ export default Ember.Mixin.create({
|
|||
Discourse.set("hasFocus", true);
|
||||
|
||||
document.addEventListener("visibilitychange", onchange);
|
||||
document.addEventListener("resume", onchange);
|
||||
document.addEventListener("freeze", onchange);
|
||||
},
|
||||
|
||||
reset() {
|
||||
this._super(...arguments);
|
||||
|
||||
document.removeEventListener("visibilitychange", onchange);
|
||||
document.removeEventListener("resume", onchange);
|
||||
document.removeEventListener("freeze", onchange);
|
||||
|
||||
onchange = undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue