implement a safari hack for ime (#4186)
remove debug logs use a better hack implement a safari hack extract `isSafari` and `isFirefox` to a global variable
This commit is contained in:
		
							parent
							
								
									2c6c906934
								
							
						
					
					
						commit
						d051614342
					
				
					 5 changed files with 30 additions and 6 deletions
				
			
		
							
								
								
									
										2
									
								
								src/lib/browser.native.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/lib/browser.native.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
export const isSafari = false
 | 
			
		||||
export const isFirefox = false
 | 
			
		||||
							
								
								
									
										6
									
								
								src/lib/browser.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/lib/browser.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
// https://stackoverflow.com/questions/7944460/detect-safari-browser
 | 
			
		||||
export const isSafari = /^((?!chrome|android).)*safari/i.test(
 | 
			
		||||
  navigator.userAgent,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
export const isFirefox = /firefox|fxios/i.test(navigator.userAgent)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
import {Dimensions, Platform} from 'react-native'
 | 
			
		||||
 | 
			
		||||
import {isSafari} from 'lib/browser'
 | 
			
		||||
import {isWeb} from 'platform/detection'
 | 
			
		||||
const {height: SCREEN_HEIGHT} = Dimensions.get('window')
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -353,10 +354,6 @@ export function parseEmbedPlayerFromUrl(
 | 
			
		|||
 | 
			
		||||
    if (id && filename && dimensions && id.includes('AAAAC')) {
 | 
			
		||||
      if (Platform.OS === 'web') {
 | 
			
		||||
        const isSafari = /^((?!chrome|android).)*safari/i.test(
 | 
			
		||||
          navigator.userAgent,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        if (isSafari) {
 | 
			
		||||
          id = id.replace('AAAAC', 'AAAP1')
 | 
			
		||||
          filename = filename.replace('.gif', '.mp4')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue