File tree Expand file tree Collapse file tree 1 file changed +11
-22
lines changed Expand file tree Collapse file tree 1 file changed +11
-22
lines changed Original file line number Diff line number Diff line change 1
1
! ( ( ) => {
2
- const Bruh = Vencord . Util . lazyWebpack ( m => m . emitter ?. _events ?. SCROLLTO_PRESENT )
3
- const ModalEscapeHandler = Vencord . Util . lazyWebpack ( m => m . binds ?. [ 0 ] === "esc" && m . binds . length === 1 ) ;
4
- const EscapeHandler = Vencord . Util . lazyWebpack ( m => m . binds ?. [ 0 ] === "esc" && m . binds [ 1 ] === "shift+pagedown" ) ;
5
- window . VencordMobile = {
6
- onBackPress ( ) {
7
- // false implies modal closed
8
- if ( ModalEscapeHandler . action ( ) === false ) return ;
2
+ const { findLazy, Common } = Vencord . Webpack ;
3
+ const ModalEscapeHandler = findLazy ( m => m . binds ?. length === 1 && m . binds [ 0 ] === "esc" ) ;
9
4
10
- let hadEffect = true ;
11
- const onScroll = ( ) => hadEffect = false ;
12
- Bruh . subscribe ( "SCROLLTO_PRESENT" , onScroll ) ;
13
- // DISCORD IS BRAINDEAD AND ALWAYS RETURNS FALSE so we need to do the hack where we check if the
14
- // event was dispatched (aka end was reached)
15
- EscapeHandler . action ( { target :document . activeElement } ) ;
16
- setTimeout ( ( ) => {
17
- Bruh . unsubscribe ( "SCROLLTO_PRESENT" , onScroll ) ;
18
- if ( ! hadEffect ) {
19
- VencordMobileNative . goBack ( ) ;
20
- }
21
- } , 50 )
22
- }
23
- }
24
- } ) ( ) ;
5
+ window . VencordMobile = {
6
+ onBackPress ( ) {
7
+ // false implies modal closed
8
+ if ( ModalEscapeHandler . action ( ) === false ) return ;
9
+
10
+ Common . FluxDispatcher . dispatch ( { type : "MOBILE_WEB_SIDEBAR_OPEN" } ) ;
11
+ }
12
+ } ;
13
+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments