import { NgModule, APP_INITIALIZER, Type } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native'; import { RESOLVERS } from './resolvers'; import { SERVICES } from './services'; import { AppService } from './services/app.service'; import { environment } from '../environments/environment'; import { BrowserNativeService } from '@ucap-webmessenger/native-browser'; import { ElectronNativeService } from '@ucap-webmessenger/native-electron'; import { MatPaginatorIntl, MatPaginatorModule } from '@angular/material'; import { PaginatorIntlService } from '@ucap-webmessenger/ui'; import { TranslateService } from '@ngx-translate/core'; export function initializeApp( appService: AppService, nativeService: NativeService ) { return (): Promise => { return appService.postInit(); }; } @NgModule({ imports: [MatPaginatorModule], exports: [], providers: [ { provide: UCAP_NATIVE_SERVICE, // useFactory: nativeServiceFactory, useClass: 'browser' === environment.runtime ? BrowserNativeService : ElectronNativeService, deps: [HttpClient] }, { provide: MatPaginatorIntl, useClass: PaginatorIntlService }, ...SERVICES, ...RESOLVERS, { provide: APP_INITIALIZER, useFactory: initializeApp, deps: [AppService, UCAP_NATIVE_SERVICE], multi: true } ] }) export class AppProviderModule {}