import { PermissionsService } from '@airgap/angular-core' ; import { RendererFactory2 , Injectable , Inject } from '@angular/core' ; import { Platform } from '@ionic/angular' ; import { IEntropyGenerator } from '../entropy/IEntropyGenerator' ; import { CameraBrowserService } from './camera.browser.service' ; import { CameraNativeService } from './camera.native.service' ; import { CAMERA_PREVIEW_PLUGIN } from 'src/app/capacitor-plugins/injection-tokens' ; import { CameraPreviewPlugin } from 'src/app/capacitor-plugins/definitions' ; @ Injectable ( ) export class CameraFactoryDepHolder { constructor ( readonly platform , readonly rendererFactory , readonly permissionsService , @ Inject ( CAMERA_PREVIEW_PLUGIN ) readonly cameraPreview ) { } } export function CameraFactory ( depHolder ) { if ( depHolder . platform . is ( 'hybrid' ) ) { return new CameraNativeService ( depHolder . platform , depHolder . rendererFactory , depHolder . permissionsService , depHolder . cameraPreview ) ; } else { return new CameraBrowserService ( ) ; } }