mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 01:26:29 +08:00
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
3e73c0a34d
commit
67e8fbc480
|
@ -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
Block a user