MOBILE-2314 fileuploader: Lazy load modal

main
Noel De Martin 2023-02-21 12:27:07 +01:00
parent d91f2ed51a
commit 4013855ae9
3 changed files with 10 additions and 13 deletions

View File

@ -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 {}

View File

@ -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<unknown>[] = [
];
@NgModule({
imports: [
CoreFileUploaderComponentsModule,
],
providers: [
{
provide: APP_INITIALIZER,

View File

@ -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<CoreFileUploaderAudioRecording> {
const { CoreFileUploaderAudioRecorderComponent } =
await import('@features/fileuploader/components/audio-recorder/audio-recorder.module');
const recording = await CoreModals.openSheet(CoreFileUploaderAudioRecorderComponent);
if (!recording) {