File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -145,11 +145,25 @@ function showMessage(message, duration) {
145145
146146// device and platform queries
147147
148- const isMobile = navigator . userAgent . match ( 'Mobile' ) ?? false ;
149- const isSafari = isMobile && navigator . userAgent . toLowerCase ( ) . indexOf ( 'safari' ) != - 1 ;
148+ let isMobile = false ;
150149
151- const isMac = navigator . platform . indexOf ( 'Mac' ) > - 1 ;
152- const isWindows = navigator . platform . indexOf ( 'Win' ) > - 1 ;
150+ if ( navigator . userAgentData
151+ && navigator . userAgentData . mobile ) isMobile = true ;
152+
153+ if ( navigator . userAgent
154+ && navigator . userAgent . includes ( 'Mobile' ) ) isMobile = true ;
155+
156+ let isSafari = false ;
157+
158+ if ( navigator . userAgentData
159+ && navigator . userAgentData . platform === 'iOS' ) isSafari = true ;
160+
161+ if ( navigator . userAgent
162+ && isMobile
163+ && navigator . userAgent . toLowerCase ( ) . includes ( 'safari' ) ) isSafari = true ;
164+
165+ const isMac = navigator . platform . includes ( 'Mac' ) ;
166+ const isWindows = navigator . platform . includes ( 'Win' ) ;
153167
154168let isLandscape = window . matchMedia ( '(orientation: landscape)' ) . matches ;
155169
You can’t perform that action at this time.
0 commit comments