forked from EVOgeek/Vmeda.Online
		
	Merge pull request #3095 from dpalou/MOBILE-3833
MOBILE-3833 core: Fix infinite requests if file download failed
This commit is contained in:
		
						commit
						46f82b58be
					
				| @ -25,7 +25,7 @@ import { | ||||
| } from '@angular/core'; | ||||
| import { CoreApp } from '@services/app'; | ||||
| import { CoreFile } from '@services/file'; | ||||
| import { CoreFilepool } from '@services/filepool'; | ||||
| import { CoreFilepool, CoreFilepoolFileActions, CoreFilepoolFileEventData } from '@services/filepool'; | ||||
| import { CoreSites } from '@services/sites'; | ||||
| import { CoreDomUtils } from '@services/utils/dom'; | ||||
| import { CoreUrlUtils } from '@services/utils/url'; | ||||
| @ -395,7 +395,12 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O | ||||
|         // Listen for download changes in the file.
 | ||||
|         const eventName = await CoreFilepool.getFileEventNameByUrl(site.getId(), url); | ||||
| 
 | ||||
|         this.fileEventObserver = CoreEvents.on(eventName, async () => { | ||||
|         this.fileEventObserver = CoreEvents.on(eventName, async (data: CoreFilepoolFileEventData) => { | ||||
|             if (data.action === CoreFilepoolFileActions.DOWNLOAD && !data.success) { | ||||
|                 // Error downloading the file. Don't try again.
 | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             const newState = await CoreFilepool.getFileStateByUrl(site.getId(), url); | ||||
|             if (newState === state) { | ||||
|                 return; | ||||
|  | ||||
| @ -1251,7 +1251,7 @@ export class CoreFilepoolProvider { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Get the name of the event used to notify download events (CoreEventsProvider). | ||||
|      * Get the name of the event used to notify download events. | ||||
|      * | ||||
|      * @param siteId The site ID. | ||||
|      * @param fileId The file ID. | ||||
| @ -1262,7 +1262,7 @@ export class CoreFilepoolProvider { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Get the name of the event used to notify download events (CoreEventsProvider). | ||||
|      * Get the name of the event used to notify download events. | ||||
|      * | ||||
|      * @param siteId The site ID. | ||||
|      * @param fileUrl The absolute URL to the file. | ||||
| @ -3008,7 +3008,7 @@ export class CoreFilepoolProvider { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Trigger mmCoreEventPackageStatusChanged with the right data. | ||||
|      * Trigger package status changed event with the right data. | ||||
|      * | ||||
|      * @param siteId Site ID. | ||||
|      * @param status New package status. | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user