forked from EVOgeek/Vmeda.Online
		
	MOBILE-3565 core: Fix some ESLint of CoreDomUtilsProvider
This commit is contained in:
		
							parent
							
								
									e7de01acf6
								
							
						
					
					
						commit
						1241be46ec
					
				
							
								
								
									
										55
									
								
								src/app/classes/ion-loading.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/app/classes/ion-loading.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | |||||||
|  | // (C) Copyright 2015 Moodle Pty Ltd.
 | ||||||
|  | //
 | ||||||
|  | // Licensed under the Apache License, Version 2.0 (the "License");
 | ||||||
|  | // you may not use this file except in compliance with the License.
 | ||||||
|  | // You may obtain a copy of the License at
 | ||||||
|  | //
 | ||||||
|  | //     http://www.apache.org/licenses/LICENSE-2.0
 | ||||||
|  | //
 | ||||||
|  | // Unless required by applicable law or agreed to in writing, software
 | ||||||
|  | // distributed under the License is distributed on an "AS IS" BASIS,
 | ||||||
|  | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | ||||||
|  | // See the License for the specific language governing permissions and
 | ||||||
|  | // limitations under the License.
 | ||||||
|  | 
 | ||||||
|  | import { CoreUtils } from '@services/utils/utils'; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Class to improve the behaviour of HTMLIonLoadingElement. | ||||||
|  |  * It's not a subclass of HTMLIonLoadingElement because we cannot override the dismiss function. | ||||||
|  |  */ | ||||||
|  | export class CoreIonLoadingElement { | ||||||
|  | 
 | ||||||
|  |     protected isPresented = false; | ||||||
|  |     protected isDismissed = false; | ||||||
|  | 
 | ||||||
|  |     constructor(public loading: HTMLIonLoadingElement) { } | ||||||
|  | 
 | ||||||
|  |     // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
 | ||||||
|  |     async dismiss(data?: any, role?: string): Promise<boolean> { | ||||||
|  |         if (!this.isPresented || this.isDismissed) { | ||||||
|  |             this.isDismissed = true; | ||||||
|  | 
 | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         this.isDismissed = true; | ||||||
|  | 
 | ||||||
|  |         return this.loading.dismiss(data, role); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Present the loading. | ||||||
|  |      */ | ||||||
|  |     async present(): Promise<void> { | ||||||
|  |         // Wait a bit before presenting the modal, to prevent it being displayed if dissmiss is called fast.
 | ||||||
|  |         await CoreUtils.instance.wait(40); | ||||||
|  | 
 | ||||||
|  |         if (!this.isDismissed) { | ||||||
|  |             this.isPresented = true; | ||||||
|  | 
 | ||||||
|  |             await this.loading.present(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -15,7 +15,13 @@ | |||||||
| import { Injector, NgZone as NgZoneService } from '@angular/core'; | import { Injector, NgZone as NgZoneService } from '@angular/core'; | ||||||
| import { HttpClient } from '@angular/common/http'; | import { HttpClient } from '@angular/common/http'; | ||||||
| 
 | 
 | ||||||
| import { Platform as PlatformService } from '@ionic/angular'; | import { | ||||||
|  |     Platform as PlatformService, | ||||||
|  |     AlertController as AlertControllerService, | ||||||
|  |     LoadingController as LoadingControllerService, | ||||||
|  |     ModalController as ModalControllerService, | ||||||
|  |     ToastController as ToastControllerService, | ||||||
|  | } from '@ionic/angular'; | ||||||
| 
 | 
 | ||||||
| import { Clipboard as ClipboardService } from '@ionic-native/clipboard/ngx'; | import { Clipboard as ClipboardService } from '@ionic-native/clipboard/ngx'; | ||||||
| import { Diagnostic as DiagnosticService } from '@ionic-native/diagnostic/ngx'; | import { Diagnostic as DiagnosticService } from '@ionic-native/diagnostic/ngx'; | ||||||
| @ -25,7 +31,9 @@ import { FileOpener as FileOpenerService } from '@ionic-native/file-opener/ngx'; | |||||||
| import { FileTransfer as FileTransferService } from '@ionic-native/file-transfer/ngx'; | import { FileTransfer as FileTransferService } from '@ionic-native/file-transfer/ngx'; | ||||||
| import { Geolocation as GeolocationService } from '@ionic-native/geolocation/ngx'; | import { Geolocation as GeolocationService } from '@ionic-native/geolocation/ngx'; | ||||||
| import { Globalization as GlobalizationService } from '@ionic-native/globalization/ngx'; | import { Globalization as GlobalizationService } from '@ionic-native/globalization/ngx'; | ||||||
|  | import { HTTP } from '@ionic-native/http/ngx'; | ||||||
| import { InAppBrowser as InAppBrowserService } from '@ionic-native/in-app-browser/ngx'; | import { InAppBrowser as InAppBrowserService } from '@ionic-native/in-app-browser/ngx'; | ||||||
|  | import { WebView as WebViewService } from '@ionic-native/ionic-webview/ngx'; | ||||||
| import { Keyboard as KeyboardService } from '@ionic-native/keyboard/ngx'; | import { Keyboard as KeyboardService } from '@ionic-native/keyboard/ngx'; | ||||||
| import { LocalNotifications as LocalNotificationsService } from '@ionic-native/local-notifications/ngx'; | import { LocalNotifications as LocalNotificationsService } from '@ionic-native/local-notifications/ngx'; | ||||||
| import { Network as NetworkService } from '@ionic-native/network/ngx'; | import { Network as NetworkService } from '@ionic-native/network/ngx'; | ||||||
| @ -74,6 +82,7 @@ export class Globalization extends makeSingleton(GlobalizationService) {} | |||||||
| export class InAppBrowser extends makeSingleton(InAppBrowserService) {} | export class InAppBrowser extends makeSingleton(InAppBrowserService) {} | ||||||
| export class Keyboard extends makeSingleton(KeyboardService) {} | export class Keyboard extends makeSingleton(KeyboardService) {} | ||||||
| export class LocalNotifications extends makeSingleton(LocalNotificationsService) {} | export class LocalNotifications extends makeSingleton(LocalNotificationsService) {} | ||||||
|  | export class NativeHttp extends makeSingleton(HTTP) {} | ||||||
| export class Network extends makeSingleton(NetworkService) {} | export class Network extends makeSingleton(NetworkService) {} | ||||||
| export class Push extends makeSingleton(PushService) {} | export class Push extends makeSingleton(PushService) {} | ||||||
| export class QRScanner extends makeSingleton(QRScannerService) {} | export class QRScanner extends makeSingleton(QRScannerService) {} | ||||||
| @ -81,12 +90,17 @@ export class StatusBar extends makeSingleton(StatusBarService) {} | |||||||
| export class SplashScreen extends makeSingleton(SplashScreenService) {} | export class SplashScreen extends makeSingleton(SplashScreenService) {} | ||||||
| export class SQLite extends makeSingleton(SQLiteService) {} | export class SQLite extends makeSingleton(SQLiteService) {} | ||||||
| export class WebIntent extends makeSingleton(WebIntentService) {} | export class WebIntent extends makeSingleton(WebIntentService) {} | ||||||
|  | export class WebView extends makeSingleton(WebViewService) {} | ||||||
| export class Zip extends makeSingleton(ZipService) {} | export class Zip extends makeSingleton(ZipService) {} | ||||||
| 
 | 
 | ||||||
| // Convert some Angular and Ionic injectables to singletons.
 | // Convert some Angular and Ionic injectables to singletons.
 | ||||||
| export class NgZone extends makeSingleton(NgZoneService) {} | export class NgZone extends makeSingleton(NgZoneService) {} | ||||||
| export class Http extends makeSingleton(HttpClient) {} | export class Http extends makeSingleton(HttpClient) {} | ||||||
| export class Platform extends makeSingleton(PlatformService) {} | export class Platform extends makeSingleton(PlatformService) {} | ||||||
|  | export class AlertController extends makeSingleton(AlertControllerService) {} | ||||||
|  | export class LoadingController extends makeSingleton(LoadingControllerService) {} | ||||||
|  | export class ModalController extends makeSingleton(ModalControllerService) {} | ||||||
|  | export class ToastController extends makeSingleton(ToastControllerService) {} | ||||||
| 
 | 
 | ||||||
| // Convert external libraries injectables.
 | // Convert external libraries injectables.
 | ||||||
| export class Translate extends makeSingleton(TranslateService) {} | export class Translate extends makeSingleton(TranslateService) {} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user