MOBILE-3947 chore: Remove direct usage of is('cordova')

main
Pau Ferrer Ocaña 2024-03-07 10:49:49 +01:00
parent 3bdb936d58
commit ccd9c05855
2 changed files with 11 additions and 11 deletions

View File

@ -61,35 +61,35 @@ import { CoreDbProviderMock } from '@features/emulator/services/db';
providers: [ providers: [
{ {
provide: Camera, provide: Camera,
useFactory: (): Camera => CorePlatform.is('cordova') ? new Camera() : new CameraMock(), useFactory: (): Camera => CorePlatform.isMobile() ? new Camera() : new CameraMock(),
}, },
{ {
provide: Clipboard, provide: Clipboard,
useFactory: (): Clipboard => CorePlatform.is('cordova') ? new Clipboard() : new ClipboardMock(), useFactory: (): Clipboard => CorePlatform.isMobile() ? new Clipboard() : new ClipboardMock(),
}, },
{ {
provide: File, provide: File,
useFactory: (): File => CorePlatform.is('cordova') ? new File() : new FileMock(), useFactory: (): File => CorePlatform.isMobile() ? new File() : new FileMock(),
}, },
{ {
provide: FileOpener, provide: FileOpener,
useFactory: (): FileOpener => CorePlatform.is('cordova') ? new FileOpener() : new FileOpenerMock(), useFactory: (): FileOpener => CorePlatform.isMobile() ? new FileOpener() : new FileOpenerMock(),
}, },
{ {
provide: Geolocation, provide: Geolocation,
useFactory: (): Geolocation => CorePlatform.is('cordova') ? new Geolocation() : new GeolocationMock(), useFactory: (): Geolocation => CorePlatform.isMobile() ? new Geolocation() : new GeolocationMock(),
}, },
{ {
provide: InAppBrowser, provide: InAppBrowser,
useFactory: (): InAppBrowser => CorePlatform.is('cordova') ? new InAppBrowser() : new InAppBrowserMock(), useFactory: (): InAppBrowser => CorePlatform.isMobile() ? new InAppBrowser() : new InAppBrowserMock(),
}, },
{ {
provide: MediaCapture, provide: MediaCapture,
useFactory: (): MediaCapture => CorePlatform.is('cordova') ? new MediaCapture() : new MediaCaptureMock(), useFactory: (): MediaCapture => CorePlatform.isMobile() ? new MediaCapture() : new MediaCaptureMock(),
}, },
{ {
provide: Zip, provide: Zip,
useFactory: (): Zip => CorePlatform.is('cordova') ? new Zip() : new ZipMock(), useFactory: (): Zip => CorePlatform.isMobile() ? new Zip() : new ZipMock(),
}, },
{ {
provide: LocalNotifications, provide: LocalNotifications,
@ -99,12 +99,12 @@ import { CoreDbProviderMock } from '@features/emulator/services/db';
}, },
{ {
provide: CoreDbProvider, provide: CoreDbProvider,
useFactory: (): CoreDbProvider => CorePlatform.is('cordova') ? new CoreDbProvider() : new CoreDbProviderMock(), useFactory: (): CoreDbProvider => CorePlatform.isMobile() ? new CoreDbProvider() : new CoreDbProviderMock(),
}, },
{ {
provide: APP_INITIALIZER, provide: APP_INITIALIZER,
useValue: async () => { useValue: async () => {
if (CorePlatform.is('cordova')) { if (CorePlatform.isMobile()) {
return; return;
} }

View File

@ -445,7 +445,7 @@ export class CoreLocalNotificationsProvider {
* @returns Whether local notifications plugin is available. * @returns Whether local notifications plugin is available.
*/ */
isPluginAvailable(): boolean { isPluginAvailable(): boolean {
return !!this.getCordovaPlugin() && CorePlatform.is('cordova'); return !!this.getCordovaPlugin() && CorePlatform.isMobile();
} }
/** /**