2019-09-19 01:40:16 +00:00
|
|
|
import { NgModule, APP_INITIALIZER } from '@angular/core';
|
2019-09-18 06:02:21 +00:00
|
|
|
|
|
|
|
import { UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
|
|
|
import { ElectronNativeService } from '@ucap-webmessenger/native-electron';
|
|
|
|
|
2019-09-19 05:15:43 +00:00
|
|
|
import { RESOLVERS } from './resolvers';
|
2019-09-19 01:40:16 +00:00
|
|
|
import { SERVICES } from './services';
|
|
|
|
import { AppService } from './services/app.service';
|
|
|
|
|
|
|
|
export function initializeApp(appService: AppService) {
|
|
|
|
return (): Promise<any> => {
|
|
|
|
return appService.postInit();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-09-18 06:02:21 +00:00
|
|
|
@NgModule({
|
|
|
|
imports: [],
|
|
|
|
exports: [],
|
|
|
|
providers: [
|
|
|
|
...SERVICES,
|
2019-09-19 05:15:43 +00:00
|
|
|
...RESOLVERS,
|
2019-09-19 01:40:16 +00:00
|
|
|
{
|
|
|
|
provide: APP_INITIALIZER,
|
|
|
|
useFactory: initializeApp,
|
|
|
|
deps: [AppService],
|
|
|
|
multi: true
|
|
|
|
},
|
2019-09-18 06:02:21 +00:00
|
|
|
{ provide: UCAP_NATIVE_SERVICE, useClass: ElectronNativeService }
|
|
|
|
]
|
|
|
|
})
|
|
|
|
export class AppProviderModule {}
|