mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 20:34:52 +00:00
FIX: only respond to menu open swipes on Andorid
This commit is contained in:
parent
12d061a45b
commit
c3cbff55be
@ -228,6 +228,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
const { isAndroid } = this.capabilities;
|
||||||
$(window).on("resize.discourse-menu-panel", () => this.afterRender());
|
$(window).on("resize.discourse-menu-panel", () => this.afterRender());
|
||||||
|
|
||||||
this.appEvents.on("header:show-topic", topic => this.setTopic(topic));
|
this.appEvents.on("header:show-topic", topic => this.setTopic(topic));
|
||||||
@ -244,11 +245,16 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addTouchListeners($("body"));
|
// Only add listeners for opening menus by swiping them in on Android devices
|
||||||
|
// iOS will respond to these events, but also does swiping for back/forward
|
||||||
|
if (isAndroid) {
|
||||||
|
this.addTouchListeners($("body"));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
const { isAndroid } = this.capabilities;
|
||||||
$("body").off("keydown.header");
|
$("body").off("keydown.header");
|
||||||
$(window).off("resize.discourse-menu-panel");
|
$(window).off("resize.discourse-menu-panel");
|
||||||
|
|
||||||
@ -256,7 +262,9 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
this.appEvents.off("header:hide-topic");
|
this.appEvents.off("header:hide-topic");
|
||||||
this.appEvents.off("dom:clean");
|
this.appEvents.off("dom:clean");
|
||||||
|
|
||||||
this.removeTouchListeners($("body"));
|
if (isAndroid) {
|
||||||
|
this.removeTouchListeners($("body"));
|
||||||
|
}
|
||||||
|
|
||||||
Ember.run.cancel(this._scheduledRemoveAnimate);
|
Ember.run.cancel(this._scheduledRemoveAnimate);
|
||||||
window.cancelAnimationFrame(this._scheduledMovingAnimation);
|
window.cancelAnimationFrame(this._scheduledMovingAnimation);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user