Make back gesture close modals and similar
This commit is contained in:
parent
924ba2b74b
commit
2f35908d0c
5 changed files with 58 additions and 9 deletions
12
app/src/main/res/raw/vencord_mobile.js
Normal file
12
app/src/main/res/raw/vencord_mobile.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
!(() => {
|
||||
const ModalEscapeHandler = Vencord.Util.lazyWebpack(m => m.binds?.[0] === "esc" && m.binds.length === 1);
|
||||
const EscapeHandler = Vencord.Util.lazyWebpack(m => m.binds?.[0] === "esc" && m.binds[1] === "shift+pagedown");
|
||||
window.VencordMobile = {
|
||||
onBackPress() {
|
||||
// false implies modal closed
|
||||
if (ModalEscapeHandler.action() === false) return;
|
||||
|
||||
EscapeHandler.action({target:document.activeElement});
|
||||
}
|
||||
}
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue