From 4013855ae9dde972b8eec28c17a722c51def9deb Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 21 Feb 2023 12:27:07 +0100 Subject: [PATCH] MOBILE-2314 fileuploader: Lazy load modal --- .../audio-recorder.module.ts} | 15 +++++++-------- .../features/fileuploader/fileuploader.module.ts | 4 ---- .../fileuploader/services/fileuploader.ts | 4 +++- 3 files changed, 10 insertions(+), 13 deletions(-) rename src/core/features/fileuploader/components/{components.module.ts => audio-recorder/audio-recorder.module.ts} (76%) diff --git a/src/core/features/fileuploader/components/components.module.ts b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts similarity index 76% rename from src/core/features/fileuploader/components/components.module.ts rename to src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts index 118c8e573..3b50dd3b7 100644 --- a/src/core/features/fileuploader/components/components.module.ts +++ b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreFileUploaderAudioRecorderComponent } from './audio-recorder/audio-recorder.component'; -import { CoreFileUploaderAudioHistogramComponent } from './audio-histogram/audio-histogram'; +import { NgModule } from '@angular/core'; +import { CoreFileUploaderAudioHistogramComponent } from '@features/fileuploader/components/audio-histogram/audio-histogram'; + +import { CoreFileUploaderAudioRecorderComponent } from './audio-recorder.component'; + +export { CoreFileUploaderAudioRecorderComponent }; @NgModule({ imports: [ @@ -25,9 +28,5 @@ import { CoreFileUploaderAudioHistogramComponent } from './audio-histogram/audio CoreFileUploaderAudioRecorderComponent, CoreFileUploaderAudioHistogramComponent, ], - exports: [ - CoreFileUploaderAudioRecorderComponent, - CoreFileUploaderAudioHistogramComponent, - ], }) -export class CoreFileUploaderComponentsModule {} +export class CoreFileUploaderAudioRecorderComponentModule {} diff --git a/src/core/features/fileuploader/fileuploader.module.ts b/src/core/features/fileuploader/fileuploader.module.ts index 4b9f58e4f..c0774617d 100644 --- a/src/core/features/fileuploader/fileuploader.module.ts +++ b/src/core/features/fileuploader/fileuploader.module.ts @@ -13,7 +13,6 @@ // limitations under the License. import { APP_INITIALIZER, NgModule, Type } from '@angular/core'; -import { CoreFileUploaderComponentsModule } from '@features/fileuploader/components/components.module'; import { CoreFileUploaderProvider } from './services/fileuploader'; import { CoreFileUploaderDelegate, CoreFileUploaderDelegateService } from './services/fileuploader-delegate'; @@ -31,9 +30,6 @@ export const CORE_FILEUPLOADER_SERVICES: Type[] = [ ]; @NgModule({ - imports: [ - CoreFileUploaderComponentsModule, - ], providers: [ { provide: APP_INITIALIZER, diff --git a/src/core/features/fileuploader/services/fileuploader.ts b/src/core/features/fileuploader/services/fileuploader.ts index 1a10f6de6..9926844da 100644 --- a/src/core/features/fileuploader/services/fileuploader.ts +++ b/src/core/features/fileuploader/services/fileuploader.ts @@ -32,7 +32,6 @@ import { CoreSite } from '@classes/site'; import { CoreFileEntry, CoreFileHelper } from '@services/file-helper'; import { CorePath } from '@singletons/path'; import { CorePlatform } from '@services/platform'; -import { CoreFileUploaderAudioRecorderComponent } from '@features/fileuploader/components/audio-recorder/audio-recorder.component'; import { CoreModals } from '@services/modals'; /** @@ -159,6 +158,9 @@ export class CoreFileUploaderProvider { * @returns Promise resolved with the file. */ async captureAudioInApp(): Promise { + const { CoreFileUploaderAudioRecorderComponent } = + await import('@features/fileuploader/components/audio-recorder/audio-recorder.module'); + const recording = await CoreModals.openSheet(CoreFileUploaderAudioRecorderComponent); if (!recording) {