forked from EVOgeek/Vmeda.Online
		
	MOBILE-3833 ios: Fix handle iframe links in iOS
This commit is contained in:
		
							parent
							
								
									6dadd7b9a6
								
							
						
					
					
						commit
						9884ceb6b3
					
				| @ -17,10 +17,11 @@ import { CoreIframeUtils } from '@services/utils/iframe'; | |||||||
| import { Platform } from '@singletons'; | import { Platform } from '@singletons'; | ||||||
| 
 | 
 | ||||||
| export default async function(): Promise<void> { | export default async function(): Promise<void> { | ||||||
|  |     await Platform.ready(); | ||||||
|  | 
 | ||||||
|     if (!CoreApp.isIOS() || !('WKUserScript' in window)) { |     if (!CoreApp.isIOS() || !('WKUserScript' in window)) { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     await Platform.ready(); |  | ||||||
|     CoreIframeUtils.injectiOSScripts(window); |     CoreIframeUtils.injectiOSScripts(window); | ||||||
| } | } | ||||||
|  | |||||||
| @ -446,26 +446,13 @@ export class CoreIframeUtilsProvider { | |||||||
|             } else { |             } else { | ||||||
|                 element.setAttribute('src', url); |                 element.setAttribute('src', url); | ||||||
|             } |             } | ||||||
|         } else if (CoreUrlUtils.isLocalFileUrl(url)) { |         } else { | ||||||
|             // It's a local file.
 |  | ||||||
|             const filename = url.substring(url.lastIndexOf('/') + 1); |  | ||||||
| 
 |  | ||||||
|             if (!CoreFileHelper.isOpenableInApp({ filename })) { |  | ||||||
|                 try { |  | ||||||
|                     await CoreFileHelper.showConfirmOpenUnsupportedFile(); |  | ||||||
|                 } catch (error) { |  | ||||||
|                     return; // Cancelled, stop.
 |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             try { |             try { | ||||||
|                 await CoreUtils.openFile(url); |                 // It's an external link or a local file, check if it can be opened in the app.
 | ||||||
|  |                 await CoreWindow.open(url, name); | ||||||
|             } catch (error) { |             } catch (error) { | ||||||
|                 CoreDomUtils.showErrorModal(error); |                 CoreDomUtils.showErrorModal(error); | ||||||
|             } |             } | ||||||
|         } else { |  | ||||||
|             // It's an external link, check if it can be opened in the app.
 |  | ||||||
|             await CoreWindow.open(url, name); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user